Repository navigation
Conversation
… dword Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…out SHADER-309 checking Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…u16-crossing Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> # Conflicts: # docs/design.md
…allocation (measured on gfx1036) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…anch (SHADER-715) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Kam471
left a comment
There was a problem hiding this comment.
Ran the LDS suite at 23f6f465 on Windows 11:
- All 12 modified/new semantic modules together: 391 passed, 324 subtests passed, 0 failures.
- Includes the new
test_lds_dynamic_out_of_range.py(8),test_lds_basic_alloc.py(21), all the atomic variants andtest_u16_cross_dword.py(4). git diff --checkclean.
The new cases distinguish a VGPR-held address past the RSRC2 allocation from the old power-of-two wrap: reads return 0, writes/atomics are dropped, and the in-range controls still work. The code is the claimed last commit on top of #3817; the branch should merge after #3817. No blocker from this check.
|
Tested 23f6f46 on Steam Deck LCD (Jupiter), AMD Custom GPU 0405 "Van Gogh", RADV Mesa 26.2.0-devel (git-5c65d4fc31), Vulkan 1.4.350, SteamOS 3.9.5 (holo), kernel 7.2.7-valve2-2-neptune-72-g31504582a073: pass. Tested PR head as submitted (includes #3817 commits per PR). Commands:
The 14 skips were the expected suite skips; no failures. No runtime C++ changes; GPU suite run from the PR worktree against the existing main runtime build. AI-assisted (OpenCode). |
|
Note for reviewers: #3941 (465d6a0eac, docs-only) rewrites the same SHADER-309 row in |
|
Independent RTX 5080 check of |
|
@FIocker Thanks for the RTX 5080 run. On the sink question: yes, when several lanes' out-of-range writes select the sink dword, their plain This race is not new to the PR either. On main, lanes whose AI-assisted. |
|
Rebase status against current main ( Precise integration notes for whoever reworks it:
Main still has no |
|
Update on my earlier handoff note (AI-assisted, current main Result: the PR's own new regression test So the remaining work is a systematic expectation update across |
|
One more precise finding from the function-level port (AI-assisted, main
So porting this PR requires a maintainer decision: either (a) the sink counts against the device limit and the translator must drop it when the allocation is exactly 32 KiB (falling back to branch checks), or (b) the test's 32 KiB assertion is updated to allow the extra dword. I cannot pick one safely. My targeted tests pass (new out-of-range test 8/8, |
|
Watcher caught the Runtime CI failure on this branch (run 45078401353). Diagnosis: the |
|
Correction to my CI diagnosis in #3932 (comment): I wrote "which is why only Linux fails". That was wrong — both jobs failed in run Both failures are still unrelated to this PR's diff:
I verified |
Item: SHADER-715 (claim, finding).
Rebased status: #3817 was merged into
main, so no dependency remains; this branch's own change is its last commit (23f6f465). The PR is still dirty against currentmainand blocked on the SHADER-715 decision (sink at exactly 32 KiB vs. updating the test assertion — see the coordination board and my comment in #4683). I have not pushed a speculative rewrite of the 53 LDS expectations.What was wrong
RDNA2 LDS does not wrap. An access outside the workgroup's RSRC2 allocation reads 0 and its write is dropped (RDNA2 ISA 3.6.1, 3.6.6; measured on gfx1036 in #3817). SHADER-309 checked this only when a constant
offset:reached past the allocation. An address held in a VGPR past the allocation still went through the power-of-two mask, so it read or clobbered dword 0. Onmain, with 512 B allocated and the address in a VGPR at byte 512,ds_read_b32returns dword 0, andds_write_b16changes dword 0 (@Flyander's repro on #3817). This applies to every width and to the atomics.What it does now
The coordinator left the design open: always check, or only behind a flag or a corpus count. This PR checks always, for compute shaders, without a branch:
%ldsarray is the RSRC2 allocation plus one sink dword. It is no longer rounded up to a power of two, so it is smaller whenever LDS_SIZE is not a power of two.Gen.lds_ptr_oksends an out-of-range dword index to the sink:OpULessThan+OpSelectbefore theOpAccessChain. Stores and atomics there change nothing the program reads.Gen.lds_in_rangeselects what the access returned to 0, so reads and atomic old values give 0.lds_access(all read/write widths, read2/write2, the sub-dword accesses and rdna2spirv: LDS 16-bit reads and writes at byte 3 cross into the next dword #3817's crossing halfwords, the native atomics,cmpst,mskor,wrxchg*). It also covers the paths that tooklds_ptrdirectly and had no check even under SHADER-309:ds_read/write_addtid_b32and the compare-exchange loops (ds_add_f32,ds_inc/ds_dec/ds_rsub_u32,ds_min/ds_max_f32).MAX_SHARED_BYTES(a 64 KiB allocation natively, or%x_bufleaves no room),fit_shared_memorydrops it and uses SHADER-309's branch check (lds_bound). The compare-exchange loops and addtid are still unchecked there, as onmain.Cost
Per LDS dword access: one
OpULessThan, oneOpSelecton the index, and one more on a returned value. There are no extra blocks. The Workgroup array grows by 4 B compared with the allocation, and shrinks compared with today's power of two whenever LDS_SIZE is not one. I have no game files. Could someone with a work folder post before/after translated andspirv-val-valid counts for the CS slice? towade's count in #1882 says 485 CS use LDS.Tested (CPU only, no GPU)
tests/semantic/test_lds_dynamic_out_of_range.py(8 tests). Setup: 512 B allocated, a sentinel in dword 0, the address in a VGPR at byte 512.test_cs_shared_memory_limit.pyis updated for the new array size (+4 B), the branch-free check (sink_checks), and the fallback at the exact limit and at 64 KiB natively. The 9 test files with aMockGengetlds_sink = None.tests/semanticfiles: the only failures are 10 thatmainalso fails,test_loop_ballot_barrier(already reported in Coordinating who works on what (19) (moved to #3918) #3796) and spirv-val version failures on this VM. None of them is an LDS test.spirv-as/spirv-val --target-env vulkan1.2passes on representative modules: dynamic out-of-range accesses natively, the emulated 51,200 B array, and the 64 KiB fallback.python -m compileall -q make_game.py tools testsandpython -I make_game.py --helppass.No game files, shaders or logs were used; all fixtures are hand-written. AI-assisted (Devin).