feat(kfdtest): Cu mask enablement PR AILIKFD-28 - #9738
Open
asierrag-amd wants to merge 5 commits into
Open
Conversation
asierrag-amd
commented
Aug 5, 2026
BasicCuMaskingLinear assumes mask bit i selects the i-th CU on the engine that runs the dispatch, which breaks on a multi-XCC node (e.g. gfx12.1.0 in SPX mode) in two ways. The driver spreads the linear mask across XCCs (bit i -> XCC i % NumXcc), but the PM4 queue runs on a single XCC, so most enabled bits never grow the executing XCC's CU count. Stride the mask by NumXcc and cap the sweep at ActiveCU / NumXcc so every enabled CU lands on XCC0. Within that XCC the mask fills round-robin across shader engines, so parallelism grows only in steps of SEsPerXcc. Compare against this SE-balanced effective CU count instead of the raw count. For single-XCC parts (NumXcc == 1) this reduces to the original contiguous mask, so behavior is unchanged.
On gfx12.1 the CU mask ABI is one bit per WGP, interleaved across XCCs (unit u of XCC x is at x + u*numXcc), and a PM4 dispatch runs on a single XCC. The old flat-SE, two-bit-per-WGP flow mis-maps every mask on such parts (e.g. gfx1250), marking all CUs outside XCC0 inactive. Add a per-XCC path (gated on NumXcc > 1 within FAMILY_GFX12): - Let a PM4 queue select its target XCC via BaseQueue::Create; existing callers are unchanged. - Extend mask_config_t with numXcc/targetXcc; numXcc <= 1 keeps the legacy encoding so pre-gfx12.1 parts are unaffected. - Make setCUMask/adjustMask honour the one-bit-per-WGP interleaved encoding and drive/validate each XCC's WGPs in isolation. - Treat KFD topology as WGP-granular (drop the CU<->WGP factor of two) so the per-XCC WGP count and mask size are not halved. Also fix SE readback on gfx12.5+, where HW_ID1 no longer carries SE: the shader reads it from MSG_RTN_GET_SE_AID_ID. Rewrite adjustMaskXcc to mirror KFD's interleaved enumeration and compaction of inactive WGPs, handling asymmetric WGP-per-SA layouts (e.g. SA0=9, SA1=8 on gfx1250). Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Run the CU masking tests on gfx1250 now that they are multi-XCC aware and expected to pass on this ASIC: - Drop KFDQMTest.ExtendedCuMasking from the gfx1250 exclude profile. - Split the CU masking tests (BasicCuMaskingLinear, BasicCuMaskingEven) out of PERMANENT_BLACKLIST_ALL_ASICS into CU_MASKING_BLACKLIST, and add a BLACKLIST_ALL_ASICS_NO_CU_MASK base that omits them. gfx1250 builds on this base so the tests are executed, while all other profiles keep excluding them via BLACKLIST_ALL_ASICS (unchanged behavior).
asierrag-amd
requested review from
kentrussell and
xiaogang-chen-amd
as code owners
August 5, 2026 21:07
❌ PR Check — Action Required
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
Contributor
|
In the future please use this format for the PR descriptions: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.