compute: accept vcc_lo and vcc_hi as wave32 SMEM offsets and destinations #3180
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3180"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-27T20:31:00Z.
Fixes #3171. Part of #2935. Target branch
main.Change (
src/gfx1013_compute_native.cpp,src/gfx1013_direct_compute.inl): in direct wave32 compute, scalar loads acceptvcc_lo(s106) andvcc_hi(s107):Details:
smem_sgpr_limit()gives 108 for wave32 compute and 106 otherwise. The decoder,transfer()and the emitter's offset reads use it.wave64parameter todecode()as #3157. Whichever lands second gets a small textual conflict that keeps both.Tests. The setup was Windows 11 build 26300.9974 with an NVIDIA GeForce RTX 5080 (driver 32.0.16.2101) and DXC from the Windows SDK 10.0.26100, on
main0f3e8248plus this commit.native_smem_vcc_hardware(new) runs a wave32 request. It reads backs_buffer_load_dwordwith avcc_looffset,s_buffer_load_dwordx2ands_load_dwordx8with avcc_hioffset, and a load intovcc_hi, against the expected source words, with intact guards.native_direct_containerchecks these refusals:vccoffset on a wave64 container stage;vcc_hidestination on wave64;native_scalar_lds_hardwarefails with "native compute PSO creation failed", as it does onmainwithout this change. The other selected tests pass.native_smem_vcc_hardwareandnative_direct_container.Measured on a local capture (counts and instruction shape only) with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requestsonmain6057071b. Since then only #3147 (3a550d0a) touchesgfx1013_direct_compute.inl, outside the SMEM path.v_cmp_class_f32mask written tovcc_hi, which #3157 handles.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-27T21:00:21Z.
LGTM! The Wave32 SMEM VCC support is correctly implemented:
Key changes:
smem_sgpr_limit()now returns 108 for wave32 compute (vs 106 for wave64), allowing s[106] and s[107] as valid offsets/destinationsnative_smem_vcc_check.pyverifies reads from vcc_lo/s[106] and vcc_hi/s[107] with proper readbackImplementation notes:
wave64parameter to distinguish between wave32/wave64 modesThis enables games using VCC registers for scalar memory addressing in Wave32 compute, which is essential for RDNA 3+ compatibility.
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-27T21:17:25Z.
The title says "accept vcc_lo and vcc_hi as wave32 SMEM offsets", but this PR removes VCC handling from scalar memory operations and drops the
wave64parameter fromdecode().Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-27T21:22:44Z.
Thanks for the look. I think that reading may come from a comparison with the pre-rebase branch, which predated #3157. The branch is rebased on
108f554e(#3157), head578ae9b2, and its diff against that base only adds the wave32 SMEMvcc_lo/vcc_hihandling.decode()keeps thewave64parameter that #3157 introduced.native_smem_vcc_hardware,native_sdwa_vcc_hi_hardwareandnative_direct_containerpass on the rebased tree.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T21:53:35Z.
Review: APPROVED
Independently reviewed
578ae9b2integrated overmain2dde49a8(tree2c7529a3). The merge is clean andgit diff --cached --checkis clean.What I traced.
smem_sgpr_limit()is 108 only for direct, non-graphics wave32 compute (decodepassesdirect && !graphics && !wave64). Graphics, wave64 and non-direct decodes keep the oldsoffset > 105rule. The new limit reaches all five SMEM checks: the decode offset check, the new decode destination-range refusal, thetransfer()index, the root-descriptori.dst + nrange, and the twooperand32(i, so, limit)offset reads. The numeric check then covers s106/s107. Their entry state isunknown(numeric), becauseinitialmarks only s0..s105unbound. A VOPC mask invcc_loislane_mask, so using it as an SMEM offset stays refused. That errs on the safe side. KelboLive's second comment (that the PR removes VCC handling and thewave64parameter) doesn't match the diff against108f554e.What I ran. I built
compile_dxil native_store_replay native_wave_request_gpuindevandrelease, then ran5/5 pass in Debug and in Release
/O2, with no skips.native_smem_vcc_hardwarematched 24 result words and all guards.native_scalar_lds_hardwarepasses here onmainand on the merge, so the PSO failure in the description doesn't reproduce on this machine.Negative control and mutants. Each mutant was rebuilt in
dev, then run againstnative_direct_containerandnative_smem_vcc_hardware:mainnative_smem_vcc_hardwarefails,native_direct_containerfails at "unsupported root descriptor load range"108→106native_direct_container)> limit→> 106native_smem_vcc_hardware)operand32(i, so, limit)→operand32(i, so)native_direct_container)operand32(i, so, limit)→operand32(i, so)transfer()index< smem_sgpr_limit(...)→<= 105Restored and rebuilt afterwards;
git diff --quietis clean.Non-blocking.
s_load_dwordx4(the indexed path), nots_buffer_load_dword. This case, added after the existingwave32-smem-symbolic-offset-*loop, passes on this head and kills the surviving mutant:transfer()the offset symbol becomes theindex_maskof anindexed_descriptor.resource()sizes the binding as1 + index_mask / 32. With the mutant, ans_load_dwordx4indexed by a maskedvcc_lowould get~0uinstead of the mask. No fixture loads a descriptor through a VCC index, so this branch is still unexercised. That is my reading of the code; I haven't run it.Verdict: approve on
578ae9b2.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.26100, DXC 1.9.2602.17; Python 3.12.10; wave32. Debug-layer status was not checked.
CI:
Build and test on Windowspasses on578ae9b2(theprpreset doesn't include these tests).This reply was AI-assisted.