Repository navigation
compute: copy descriptor words through VCC as a scalar temporary, wave64 SMEM loads and lane spills - #3329
Conversation
72860b3 to
17595bd
Compare
A direct compute program may park descriptor words in VCC with s_mov and move them back. The move into s106/s107 used to refuse eagerly with "descriptor used as mask". The words are now copied with their symbols, and every consumer that reads VCC as a mask or as numeric data (carry-in, cndmask, branches, SALU, DPP, readlane selectors, SMEM offsets) requires numeric VCC words, so a real descriptor-as-mask use still refuses.
…oads and lane spills A wave64 table or heap-offset descriptor load may end at s106/s107, and the program then spills the descriptor with v_writelane_b32 (vcc_lo/vcc_hi included) and reloads it with v_readlane_b32. Both refused before: "symbolic scalar memory destination overlaps wave64 VCC" for the load, then "unbound numeric SGPR s106" for the spill. With the scalar-temporary VCC model of the previous commit, the load writes the descriptor symbols into s106/s107, the spill and reload carry them like other SGPRs, and a reload into M0, EXEC or above is still refused. A later read of VCC as a mask still refuses with the existing reason.
17595bd to
9541455
Compare
|
Rebased on |
tedin7
left a comment
There was a problem hiding this comment.
Reviewed head 9541455.
Code read (gfx1013_direct_compute.inl, gfx1013_compute_native.cpp): s_mov_b32/s_mov_b64 now copy each word per identity into or out of s106/s107 in compute; every VCC consumer found in the diff (operand reader, carry-in and v_cndmask, scalar bypass matches, DPP with preserved destination, s_cbranch_vccz/vccnz, lane read/write) first requires the VCC words to be numeric and refuses otherwise. EXEC and M0 stay refused. The wave64 SMEM overlap refusal is removed only for table and heap-offset loads, with the new SMEM range and mask refusal tests behind it. No issue found.
Verification (Win2025, dev and release, this head):
x2w_pipe.py win2025 3329 --regex 'native_vcc_descriptor_copy|native_direct_container|native_heap_offset_add': 10/10 passed on dev and 10/10 on release, includingnative_vcc_descriptor_copy_warpand_hardware.- Required CI on the head is green; 1 commit behind main; no change requests.
AI-assisted; commands listed were executed locally.
Part of #3224 (claimed there). Target branch
main.Some direct compute programs park descriptor words in VCC and move them back, for example
s_mov_b64 vcc, s[18:19]while s[18:19] hold the upper words of a buffer descriptor. The move into s106/s107 refused at once with "descriptor used as mask", although VCC is only a scalar temporary there.Change 1 (
src/gfx1013_direct_compute.inl, first commit):s_mov_b32and aligneds_mov_b64copy each word into or out of s106/s107 with its symbol, as for other SGPRs.transfer()insrc/gfx1013_compute_native.cppalready copies both symbols, and VOPC and carry writes already make VCC numeric again (s106 only in wave32).v_cndmask;main);s_cbranch_vccz/vccnz, on s106 in wave32 and on both words in wave64.Change 2 (
src/gfx1013_direct_compute.inl,src/gfx1013_compute_native.cpp, second commit):s_load_dwordx4/x8) may end at s106/s107; the "symbolic scalar memory destination overlaps wave64 VCC" refusal is removed and the load writes the descriptor symbols there (shown for table loads; a heap-offset load into s[104:107] now reaches the heap contract check).v_writelane_b32andv_readlane_b32spill and reload s106/s107 like other SGPRs (bound raised from s105 to s107 in both files); a symbolic reload into anything above s107 is still refused.Tests for change 1. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on
main32dc3d7cplus the first commit.native_vcc_descriptor_copy_controls:s_cbranch_vccz, byv_cndmask_b32with VCC, or bys_mov_b64 exec, vccis refused.main'scompile_dxilthe round trip is refused at the park with "descriptor used as mask", so the test fails there.native_vcc_descriptor_copy_hardwarepasses on the RTX 5080: 320 output and guard words for each of the four round trips.native_vcc_descriptor_copy_warpreports a capability skip (77).ctest -R "native_|startup_compute|compile_dxil|salu": 528 of 529 pass, plus one transient failure.native_scalar_lds_hardwarefails as onmain.cpu_native_exe_terminationfailed once during the parallel run and passes when run alone.compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests(counts only):main3f780716, and 251 with this commit (the commits from3f780716to32dc3d7conly touchtools/probe_root_devices.pyand its tests);v_dot4_i32_i8withop_sel_hi:[1,0,1]. That stays refused: as I wrote on direct compute: untranslated compute shaders of a start-up run ranked by dispatches, with first refusals on main #3224, its semantics for an inline constant are not established.Tests for change 2. Same setup, on
main8ecd30feplus both commits.native_vcc_descriptor_copy_{smem_store,smem_mask,smem_range,spill_image,spill_mask}: a wave64 x4 load into s[104:107] stored through directly; the same load followed bys_cbranch_vccnz(refused); an x8 load into s[104:111] (refused as a range); an x8 image descriptor in s[100:107] spilled to a VGPR withv_writelane_b32(s100..s105,vcc_lo,vcc_hi), cleared, reloaded and used byimage_store; the same spill followed bys_cbranch_vccnz(refused).native_direct_containerandnative_heap_offset_addnow expect the accepted load or the heap contract instead of the overlap refusal.ctest -R "^(native_vcc_descriptor_copy_.*|native_direct_container|native_heap_offset_add|native_lane_access.*)$": 10 pass,native_vcc_descriptor_copy_warpskips (77).ctest -R "native_|compile_dxil|salu"after a full build: all pass exceptnative_fixed_mesh57_waterfall_fine_hardwareandnative_scalar_lds_hardware, which fail onmaintoo.v_writelane_b32source bound back to<= 105ingfx1013_direct_compute.inlmakesspill_imageandspill_maskfail; restoring the SMEM overlap refusal makessmem_store,smem_mask,native_direct_containerandnative_heap_offset_addfail.compile_dxil --jobs 4 gfx1013-direct-cs@0 --requests), four programs stopped at the SMEM overlap and then at thevcc_lo/vcc_hispill; they now pass both. Three then stop atdirect descriptor address outside bound table(native: bind a single directly indexed heap flag as a descriptor table #3221) and one atunbound numeric SGPR s61, so none compiles with this alone.