compute: use vcc_hi as a wave32 lane mask in direct compute #3336
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3336
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3334"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Leyukaka on GitHub · 2026-11-28 10:29 UTC · original
Leyukaka:compute-wave32-carry-vcc-hi→main· +198 −4 · 4 files · 2 commits · merged 2026-11-28 11:11 UTCPart of #3226.
In a guest wave32 direct compute program, s107 (
vcc_hi) is an ordinary numeric scalar register. Some programs use it as a lane mask:v_cmp_*_e64 vcc_hi,v_add_co_ci_u32_e64 vD, vcc_hi, ...,s_and_b32 vcc_hi, ...,v_cndmask_b32_e64 ..., vcc_hi, andvcc_hias a carry-in.transfer()(src/gfx1013_compute_native.cpp) accepts 107 as a carry-out destination in the wave32 model of direct compute.src/gfx1013_direct_compute.inlaccepts 107 as thev_cndmask_b32mask source and as the carry-in source. Graphics stages keep both refusals.translate_programrefuses all three uses when the guest is wave64. A wave64 request of at most 32 threads runs on the wave32 model, and there 107 would be an odd pair.Tests (Windows 11, RTX 5080, SDK 10.0.26100 DXC, Release,
main3926a289plus this commit):native_carry_vcc_hi_controlschecks the DXIL for this chain: a carry into s105, thenv_add_co_ci_u32_e64 v16, vcc_hi, 0, v16, s105,v_cndmask_b32_e64 v20, 0, 1, vcc_hi, andv_add_co_ci_u32_e64 v20, s104, 0, v20, vcc_hi. It checks thatvcc_higets the carry ballot, thatvcc_lokeeps its seed, and that the finalv20and its carry depend onvcc_hi. Four requests stay refused: wave64 with 64 threads, wave64 with 32 threads, and sdstm0orttmp0.mainthe positive program is refused withunsupported carry mask destination.native_carry_vcc_hi_hardwarepasses on 32 lanes:vcc_hi=0xAAAAAAAA,vcc_lounchanged, and the last add gives 2 on odd lanes.native_carry_vcc_hi_warpreports a capability skip (77).ctest -R "native_|startup_compute|compile_dxil|salu": 530 of 531 before the last test-only change.native_scalar_lds_hardwarefails as onmain.compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests: 250 to 252. The added programs weigh 12,846 dispatches in that run. None is lost, and the existing output is byte-identical.Not covered: no source mutations were run. The wave64 refusals of the
v_cndmask_b32and carry-in sources andv_mad_u64_u32with sdstvcc_hihave no test.@tedin7 on GitHub · 2026-11-28 11:11 UTC · original · reviewed
Review of head
c9036f5f(the PR's own change is unchanged; the new head only merges currentmain).What I checked:
src/gfx1013_compute_native.cpp: s107 is accepted as a carry-out destination only for direct compute, non-graphics, non-wave64.translate_programrefuses all three uses (carry-out,v_cndmask_b32mask source,_ci_carry-in) when the guest is wave64, including the narrow wave64 model, so the odd-pair case stays refused.src/gfx1013_direct_compute.inl: the carry-in limit moves from 106 to 107 andv_cndmask_b32keeps its refusal for graphics stages. Graphics refusals are unchanged.native_carry_vcc_hi_controls(DXIL chain plus four refusals) andnative_carry_vcc_hi_warp(real D3D12 readback of the lane mask and the dependent adds against a CPU reference; it ran and did not skip).main.Commands run:
git diff --check origin/main...HEADclean,python3 -m py_compile tests/native_carry_vcc_hi_check.pyok.-R '^native_(carry_vcc_hi_(controls|warp)|direct_container|salu64_controls)$': dev 4/4 passed, release 4/4 passed.native_carry_vcc_hi_controlsfails at thenarrow wave64case.native_carry_vcc_hi_controlsandnative_carry_vcc_hi_warpfail withunsupported carry mask destination.No blocking findings. The receipt follows in a separate comment.
AI-assisted; commands listed were executed locally.
@tedin7 on GitHub · 2026-11-28 11:11 UTC · original
Win2025 WARP receipt for head
c9036f5fafter updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
c9036f5fe9c5649e1d800b0d45f4da8f4adfe2f5:--preset dev):cmake --build --preset dev --target compile_dxil offscreen_check native_store_replay -- -j 3):18.16s(configure6.00s)ctest --preset dev -R '^native_(carry_vcc_hi_(controls|warp)|direct_container|salu64_controls)$' --parallel 4 --no-tests=error --output-on-failure): 4/4 passed (12.80s:native_salu64_controls0.20s,native_carry_vcc_hi_warp0.84s,native_carry_vcc_hi_controls0.92s,native_direct_container12.32s)/O2(--preset release):cmake --build --preset release --target compile_dxil offscreen_check native_store_replay -- -j 3):43.72s(configure2.30s)ctest --preset release -R '^native_(carry_vcc_hi_(controls|warp)|direct_container|salu64_controls)$' --parallel 4 --no-tests=error --output-on-failure): 4/4 passed (11.57s:native_salu64_controls0.16s,native_carry_vcc_hi_warp0.64s,native_carry_vcc_hi_controls0.69s,native_direct_container11.21s)sccache: 257/271 hits; wall64.1sAI-assisted; commands listed were executed locally.