Repository navigation
compute: let direct wave64 scalar loads use VCC as scalar data - #3265
Conversation
tedin7
left a comment
There was a problem hiding this comment.
Review of head a71822e0. The change looks right to me, but the branch now conflicts with main and gh pr update-branch refuses, so it cannot be merged as is.
Conflict. #3253 (merged) added the low.type == Symbol::Type::heap_offset block in src/gfx1013_direct_compute.inl at the same spot as this PR's new wave64 VCC check, right after const bool root = ... in the SMEM branch. They do not interact (one tests Symbol::Type::table, the other heap_offset), so keeping both works. I tested this order:
const bool root = low.type == Symbol::Type::root_address;
// Table descriptor lowering tracks identities and slot indices instead of loading payload bits.
if (wave64 && !graphics_input && i.op < 8 && low.type == Symbol::Type::table &&
i.dst + memory_count(i) > 106)
refuse(i.pc, "symbolic scalar memory destination overlaps wave64 VCC");
if (low.type == Symbol::Type::heap_offset) {
... (the #3253 block, unchanged)
}src/gfx1013_compute_native.cpp and tests/native_direct_container_check.py merge on their own.
What I checked on the change itself:
smem_sgpr_limitnow takesdirect && !graphicsin the decoder and intransfer. For the non-direct path the bound was already 106 in the decoder, so thetransferchange does not widen it.- The direct lowering uses the same bound, and wave64 table loads that would write symbolic slot words into s106/s107 are refused with the new text.
native_smem_vcc_wave64_check.pycompares every output word, guards included, with a CPU reference: s[104:107] and s[100:107] loads, VCC_LO/VCC_HI as SGPR offsets, and a loaded 64-bit VCC that drivesv_cndmask_b32under a patterned EXEC.
Commands run, on this head plus the keep-both merge of main above (applied as a patch):
- Linux:
python3 tests/docs_links_check.pyok,python3 tests/bidi_controls_check.pyok,git diff --checkclean,python3 -m py_compileon both touched test files ok. - Windows Server 2025, D3D12 WARP 1.0.22,
-R '^native_(smem_vcc_wave64_controls|smem_vcc_wave64_hardware|direct_container|heap_offset_add|global_srv_heap_replay_warp|wave64_exec_salu_hardware|wrexec64_hardware|s_not_b64_exec_controls|s_not_b64_exec_hardware|compute_clear)$': dev 10/10 passed, release 10/10 passed.native_smem_vcc_wave64_hardwareran on WARP and did not skip. - Mutation 1 (decoder bound back to wave32 only):
native_smem_vcc_wave64_controls,_hardwareandnative_direct_containerfail. - Mutation 2 (direct lowering bound back to wave32 only):
native_smem_vcc_wave64_controlsand_hardwarefail (unsupported root descriptor load range).
Question, not blocking: with this PR a wave64 load may end at s107, and the #3253 heap_offset path writes the slot index into all four destination words without the new overlap refusal. In wave64, s_load_dwordx4 s[104:107] from an added heap address would therefore put the index into VCC. That index is a real uniform value, not a symbolic one, so it may be fine. If you want the two paths to match, the new check could also cover low.type == Symbol::Type::heap_offset.
Once the conflict is resolved on the branch, I can rerun the Windows check on the new head.
AI-assisted; commands listed were executed locally.
Direct wave64 compute now gives scalar loads the same SGPR bound as wave32 since R0Y00#3180: destination ranges may end at s107 (VCC_HI), and VCC_LO/VCC_HI may be the SGPR offset. In the direct wave64 model VCC is two scalar words that both host wave32 halves hold identically (ballot writers publish both words through the exchange), so a uniform numeric load into s106/s107 is read back the same way by s_mov, v_cndmask and the VCC branches. Table descriptor loads and resource-heap loads at an added byte offset (R0Y00#3253), which track descriptor identity or a slot index instead of payload bits, still refuse when their destination overlaps VCC in wave64. Graphics and ranges past s107 keep their refusals. New test native_smem_vcc_wave64 (controls, hardware): x4 and x8 loads ending at s107, VCC_LO and VCC_HI offsets, and a 64-bit mask loaded into VCC driving v_cndmask in both host halves under a patterned EXEC. native_direct_container replaces the wave64 VCC refusals it had with a symbolic-destination refusal. native_heap_offset_add gains a wave64 control: an added-offset heap address loaded into s[104:107] refuses with the overlap message.
a71822e to
0c54f12
Compare
|
Thanks for the review and for testing the keep-both merge. Rebased onto main
A rerun of your Windows check on the new head would be welcome. AI-assisted. |
R0Y00
left a comment
There was a problem hiding this comment.
The current head 0c54f128 covers both symbolic routes. Ordinary and added-offset heap descriptor loads still refuse destinations overlapping VCC in wave64, and the new wave64_vcc_dst control exercises the added-offset path. The numeric loads and register-offset cases passed the two-host-half readback.
On f41806a9 plus this head (tree fd5c77bc), Debug and Release /O2 each passed 7/7. This included the new controls and hardware readback, heap offset, direct containers, VCC/EXEC NOT and wave64 EXEC. On main fbef6381 plus this head (tree b2c0640a), Release /O2 passed all six focused cases, including the adjacent raw-load and raw-store cache hints:
ctest --test-dir <build> --no-tests=error --output-on-failure -j 1 -R '^native_(smem_vcc_wave64_(controls|hardware)|heap_offset_add|raw_(load|store)_cache_bits_(controls|hardware))$'No skips. Windows 11 26200.9974, RTX 4060 Laptop driver 32.0.16.1656, SDK/DXC 10.0.26100.0. The fixtures are source-built.
Part of #2935 and #3224. Target branch
main. Extends #3180 to direct wave64 compute.Change. The direct wave64 compute path now gives scalar loads the SGPR bound that wave32 has had since #3180.
src/gfx1013_compute_native.cpp,smem_sgpr_limitand its two callers: destination ranges may end at s107 (VCC_HI), and VCC_LO/VCC_HI may be the SGPR offset.s_mov,v_cndmaskand the VCC branches. The branches OR the two words.src/gfx1013_direct_compute.inl: the direct compute lowering's ownsmem_sgpr_limitcall takes the same bound. Table descriptor loads track descriptor identity rather than payload bits. In wave64 they now refuse when their destination overlaps VCC, with "symbolic scalar memory destination overlaps wave64 VCC".docs/experiments.md: the SMEM note now says wave64 as well.Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on
mainf9286e7dplus this commit.native_smem_vcc_wave64_controlsand_hardwarecover, in 64-thread wave64 groups:s_buffer_load_dwordx4into s[104:107] ands_load_dwordx8into s[100:107];v_cndmask_b32in both host halves, under a patterned EXEC.native_direct_containerused to check three wave64 decoder refusals: two VCC offsets and a destination at s107. Those decoder refusals no longer apply, and the s107 destination is accepted. It checks the symbolic-destination refusal instead.main'scompile_dxil, the controls stop at "unsupported scalar memory destination range".native_direct_container.ctest -R "native_|startup_compute|compile_dxil|salu|smem"passes 435 of 436.native_scalar_lds_hardwarefails as onmain.Measured with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests, base and change both onmainf9286e7d.s_ff1_i32_b64and the global-load refusal.AI-assisted.