Repository navigation
Conversation
dcastell1
left a comment
There was a problem hiding this comment.
Verified locally (CPU): python -I tests/test_shader_checks.py → 40 tests OK; full semantic suite → 1195 tests OK (1 skip). Worth noting the fixture was updated with the PR (tests/semantic/fixtures/disasm/cs_mubuf_fmt0.s + regen_fixtures.py), which is exactly what #1394 is missing.
Reading the change: gating inside check_end() (and the %false shortcut for a literal V# with FORMAT=0) keeps one predicate path, so a suppressed multi-dword load or store cannot partially write. Scoping it to parts=True leaves the typed/fixed_fmt loads alone, which is right — their format is the instruction's, not the V#.
The description is honest about which cases are measured on gfx1036 and which the rule extends to (mode 0 per-dword, stores); I have no AMD hardware to add to that. No GPU rerun here: the 5090 is compiling one of the two giant ScreenProbes modules.
|
@opit80, I measured the atomic/GLC question you left open in the PR description on native gfx1036 (Windows). Both wave32 and wave64 gave the same results in 24 source-built kernels. I kept base, byte range and source constant; the only descriptor change was FORMAT=0 versus 32_UINT. Memory started at 11, and the input VGPR held 7. With INVALID, neither ADD nor CMPSWAP changed memory. GLC returned 0 in the first data VGPR; without GLC, that VGPR stayed 7. CMPSWAP preserved its compare VGPR for both matching (11) and mismatching (12) comparands. With the bound control, ADD wrote 18, matching CMPSWAP wrote 7, and mismatching CMPSWAP kept 11. All three returned the old memory value 11 with GLC. A separate global load and host readback agreed on memory in all cases. These measurements cover ADD and CMPSWAP on this chip. Can you use them for the atomic follow-up you described? AI-assisted. |
|
Tested f13857c (118 behind main) on Windows 11 Home 10.0.26300, with the GPU suite on two GPUs. Python 3.14.7, llvm-mc 21.1.8, Vulkan SDK 1.4.363.0,
Both GPUs read AI-assisted (Claude Code). No game files. |
f13857c to
6df06e2
Compare
|
Rebased onto main AI-assisted. |
64f6b03 to
2d6b072
Compare
|
Re-ran on the rebased head so the FORMAT=0 suppression now has a measured GPU result on NVIDIA as well as the AMD numbers in the description. The 8 skips are the M1/M2/M3 shaders the D3D12 tests run. My earlier "no GPU rerun" note is superseded. |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Tested 2d6b072 on NVIDIA GeForce GTX 1660 (Turing, TU116, subgroup 32..32), driver 620.73.04 (proprietary, Vulkan 1.4.357), Arch Linux (kernel 6.18): pass, no regression. Native build of runtime/ from this head (Ninja, RelWithDebInfo, clang 23.1.5), llvm-mc 23.1.5, SPIRV-Tools v2026.4.
AI-assisted run (Claude). Synthetic programs only, no game files involved. |
|
Tested
The new AI-assisted (Claude Code). 🤖 Generated with Claude Code |
2d6b072 to
1ec7d92
Compare
|
Tested All five harnesses ( AMD Radeon 780M (subgroups 32..64)
NVIDIA GeForce RTX 5060 Laptop GPU (subgroup 32..32)
Unit & Semantic Verification
No game data or proprietary assets used. |
1ec7d92 to
6f42872
Compare
|
Tested 6f42872 (a re-test at the new head) on AMD Radeon RX 9070 XT (RADV GFX1201, wave32/64) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
|
Tested
No game files. AI-assisted (Claude Code). |
The raw buffer_load_dword in test_slist_as_vsharp_and_tsharp ran with V# word3 0x30000000: OOB_SELECT 3 with FORMAT=0 (INVALID). A raw MUBUF access is suppressed for an INVALID format, measured on gfx1035 in OOB_SELECT modes 0, 1 and 3 (ItsNotRexed#1218), so the load reads zero there. Give the descriptor FORMAT=32_FLOAT (22), the valid control of the same measurement, so the test keeps exercising the VCCTuple-as-V# plumbing it was written for.
The reference-oracle suite (61bd71e) built its raw and structured V#s with word3 0x30000000 or 0: OOB_SELECT modes 0 and 3 with FORMAT=0 (INVALID). A raw MUBUF access is suppressed for an INVALID format, measured on a Radeon 680M (gfx1035) in modes 0, 1 and 3 (ItsNotRexed#1218), so those loads read 0 and the stores never wrote. Give those descriptors FORMAT=32_FLOAT (22), the valid control of the same measurement; the address, bounds, masking and multi-dword subjects stay unchanged. test_wave64_emulate_opt's monotone dirty-transfer scan looked for the blk3 buffer OpLoad within 15 lines of the preceding OpConvertUToPtr; the run-time V# format check adds three instructions between them, so widen that one window to 18.
TEST-722 (d7d9a8e) runs the ps_w64_* pixel fixtures on the wave interpreter with the V# that w64_graphics.py passes in VKH_SGPRS. ps_w64_b_ballot_atomic's word3 was 0x30000000: OOB_SELECT 3 with FORMAT=0 (INVALID). A raw MUBUF access is suppressed for an INVALID format, measured on gfx1035 in OOB_SELECT modes 0, 1 and 3 (ItsNotRexed#1218), so the fixture's buffer_atomic_add and its slot stores did nothing and the test failed with an empty heap. Give the descriptor FORMAT=32_FLOAT (22), the valid control of the same measurement; the compaction idiom the fixture tests is unchanged, and main, which has no suppression rule, translates both descriptors alike.
6f42872 to
c8fa560
Compare
|
@AlxcBTW @markankamaransheogarat-sys: a heads-up from the SHADER-221 rebase onto AI-assisted. |
The second descriptor group derived word3 with s_xor_b32 from two literals, which the translator folds into sgpr_imm: the FORMAT=0 gate became a constant and the run-time path was never exercised. Building word3 with s_or_b32 keeps the same descriptor values but leaves them run-time, so the interpreter and the GPU both execute the format gate.
Hiiva
left a comment
There was a problem hiding this comment.
Independently checked current head d220806df20ca55aaabf7703b2e7c69b8c5ed953 on Windows 11 with MSVC 19.44.35228, AMDGPU LLVM 21.1.8, and Vulkan SDK 1.4.363.0. Synthetic inputs only. No actionable finding in this bounded review.
At d220806, after confirming the two-file fixture delta from c8fa560:
- Reran
RawBufferInvalidFormat.test_loads_and_stores: pass. Substituting unchanged main's translator makes the same test fail on the INVALID load/store words. - Built the revised
cs_mubuf_fmt0through the repository's normal assembly, header, translation, and validation pipeline: 1/1 translated andspirv-val-valid. Its emitted runtime FORMAT gates remain present after the news_or_b32construction. - RTX 4080, driver 610.62 / 32.0.16.1062, and AMD Radeon(TM) Graphics, driver 32.0.21043.5001: both runs return exactly
[0, 0xeeeeeeee, 0xeeeeeeee, 0x12345678]twice. Forced Khronos standard and synchronization validation logging captures no VUIDs or validation errors. - The revised fixture built with main's translator also validates and executes, but returns
[0xeeeeeeee, 0xeeeeeeee, 0x12345678, 0x12345678]twice on RTX. This is the expected negative control.
Evidence carried from the separately tested c8fa560 revision: the four affected semantic modules passed 124 tests; both GPUs passed the repository's ps_w64_b_ballot_atomic pixel/heap oracle (4,096 pixel records, counter 1,024, every intended pixel number once). Restoring only its old FORMAT=0 descriptor keeps the counter at 1,024 but fails the slot oracle on both GPUs. RTX confirmed required fragment subgroup size 32; Radeon coverage used the default fragment subgroup size because that harness could not confirm a forced size. The graphics fixture, graphics checker, translator, and both Vulkan harness sources are unchanged by d220806, so I did not repeat that matrix. A known-invalid interface pairing and corrected control had also confirmed this harness's validation logging at c8fa560.
The worktree remains clean at the verified current head. This checks translated behavior, not native ISA FORMAT semantics. AI-assisted.
|
Measured the raw-MUBUF FORMAT rule on native RDNA2 across every FORMAT code. The "by extension, not measured directly" cases in the new row hold. Two gaps remain against Setup. gfx1036 (Ryzen 9 9950X3D iGPU), AMD driver 32.0.21030.2001, raw
Result: two classes, the same in all four modes and both wave sizes.
Gap 1: codes 78–127. The hardware treats every reserved code like 0. The PR gates only The Out-of-bounds typed buffer loads row already groups INVALID ( Gap 2: sub-dword raw loads. For atomics, @Vonsek's gfx1036 measurement above (ADD and CMPSWAP) matches mine (ADD with and without Translated at
I ran that fixture only through the translator. The native column comes from the sweep, which covers the same instructions and descriptor modes. Gap 1 is the one I'd fold into this PR, since it changes the condition the PR adds. Gap 2 and the atomics could share the follow-up. Windows 11, Vulkan SDK 1.4.363, llvm-mc AMD LLVM 23.0.0git. Synthetic descriptors and data only, no game files. The probe scripts are local. AI-assisted (Claude Code). |
Claimed in the coordination issue as: SHADER-221 (claim, listed in #1380)
What and why
@ezwinxdlmao found the bug and measured it on gfx1035 (Radeon 680M, driver 22.40.84.06): a V# with FORMAT=0 (INVALID) suppresses raw
buffer_load_dword[xN]/buffer_store_dword[xN]accesses even when they fit the buffer bounds; at FORMAT=0 the loads return zero and the stores write nothing for OOB_SELECT 0, 1 and 3, while FORMAT=22 returns data and writes. gfx1035 measurements @Vonsek verified on gfx1036 that descriptor-selected constants can survive a formatted MUBUF read that returns no memory data (0, 1, 0, 1for FORMAT=0), which is why the zeroing rule is attached only to the raw path. gfx1036 measurements Before this change the translator applied only the existing OOB_SELECT / NUM_RECORDS / lane-mask / dword-bound logic to raw dword accesses, so a FORMAT=0 V# still read and wrote memory. NowFORMAT = (word3 >> 12) & 0x7fis folded for literalword3and added as an extra predicate beside the bounds predicate for run-timeword3: active load lanes get zero without a read, and stores issue no write. The memory differential fuzzer's two synthetic descriptor sites now carry a valid FORMAT for their in-bounds controls. AMD RDNA 2 ISA §8.1.4, Table 31Scope
Out of scope and tracked separately: MTBUF loads → @Vonsek (SHADER-215, the follow-up to the merged #1302; MTBUF load measurements); MTBUF stores → @ezwinxdlmao (#1371 / SHADER-217);
buffer_atomic_*→ not measured on hardware and not touched by this PR. The claim text also listedbuffer_atomic_*under the zero-on-read / no-write rule, but that part was dropped because AMD ISA §8.1.4 does not separate the atomic memory effect from the GLC return value for a partially filled FORMAT=0 V#, and the local fuzzer only exercised atomics with valid descriptors.Where #1367, #580 and #1116 touch the same shared test/design tables: whoever merges first, the other rebases.
The
buffer_load_dwordx2/x3/x4andbuffer_store_dwordx2/x3/x4forms and the other raw formats were not measured directly; they follow from the x1 measurements by the same per-dword rule. Descriptor-selected constants on the formatted path (FORMAT=0 with DST_SEL) are out of scope for this PR.Tested
main3faac55 (headc8fa560d):docs/design.mdandscripts/run_gpu_tests.pyconflicted (both sides kept); one more upstream fixture needed a valid FORMAT (item 4 above). Windows 11, RTX 5070 Ti, MSVC 19.44 RelWithDebInfo: fulltests/semantic6246 tests with 3 failures + 2 errors, the same list asmain3faac55 on its own (6245 tests,test_loop_ballot_barrier);scripts/run_gpu_tests.py171/218 passed, 47 skipped, 0 failed (main: 170/217, the difference iscs_mubuf_fmt0, PASS);regen_fixtures.py --checkclean (independently re-run).cs_mubuf_fmt0run-time group now really run-time (d220806d): its second descriptor pair used to derive word3 withs_xor_b32of two literals, which the translator folds to a constant, so the run-time FORMAT check was never emitted for those four accesses and the GPU only ran the literal path. Word3 is now built withs_or_b32(the patterntests/semantic/test_buffer_oob_select.pyalready uses for run-time descriptors); the descriptor values (0x11000fac,0x11016fac) and the expected words are unchanged. The translated module now has 10 run-time format checks instead of 6.run_gpu_tests.py --filter cs_mubuf_fmt0passes natively and withLEONIDA_W64_EMULATE=1(same words); the full GPU run is still 0 failed. If the translator ever foldss_or_b32of literals too, this case would silently become literal again.GPU: NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 Pro 25H2. Synthetic shaders and buffers only.
Re-run after rebasing onto current
main(baseaa2988cc, branch head6f428728):python -m unittest discover -s tests/semantic— 7457 tests, 0 PR-specific failures/errors after the descriptor adjustments; the remaining 7 failures + 2 errors are identical (same 9 test names) on cleanmainat 7456 tests (loop_ballot_barrier5,cmp_class_f642,mutations2; the extra test is the PR'scs_mubuf_fmt0CPU fixture).python tests/semantic/regen_fixtures.py --checkexits 0 on both the PR and cleanmain.python -I scripts/run_gpu_tests.py: PR 165/211 passed, 46 skipped, 0 failures; withLEONIDA_W64_EMULATE=1196/211 passed, 15 skipped, 0 failures;cs_mubuf_fmt0passes in both modes. Cleanmainwith the same runtime: 164/210 passed, 46 skipped, 0 failures normal and 195/210 passed, 15 skipped, 0 failures emulated — the only delta is this PR's one new GPU test. The detailed list below is from the original branch point.Upstream tests adjusted after the rebase. While rebasing onto current
main, upstream test additions turned out to build their V# descriptors with an INVALID format (FORMAT=0), which this PR makes suppress rawbuffer_load/store_dword[xN]— measured on a Radeon 680M (gfx1035) in OOB_SELECT modes 0, 1 and 3, with 32_FLOAT (FORMAT=22) as the working control (the #1218 measurements linked above; thecs_mubuf_fmt0GPU fixture checks the same rule for literal and run-time descriptors). The tests are adapted so they still test what they were written for, with valid-format descriptors:tests/semantic/test_fspx_rules.py::VccTupleSmemTests::test_slist_as_vsharp_and_tsharp— upstream commitbda17759by SweatierKey. It loaded a V# into[s104,s105,vcc_lo,vcc_hi]and fed the same descriptor tos_buffer_loadand a rawbuffer_load_dword, with word30x30000000(mode 3, FORMAT=0). Our commit86a06d77("tests: give the VCCTuple V# a valid FORMAT") changes only V# word3 to0x30016000(FORMAT=32_FLOAT) and adds an explanatory comment; the VCCTuple-as-V# and 8-dword T# subject, the load/store sequence and the expected data are unchanged, so the raw load reads the stored words again.tests/semantic/test_vector_mem_mubuf.py(TestSpirvTranslationLoads/TestSpirvTranslationStores) — upstream commit61bd71ef("test(semantic): add reference oracle for untyped MUBUF buffer loads and stores") by slopgobblercobbler. Its raw V# words were built with word30x30000000(mode 3, 10 places) or0(mode 0, 9 places), both FORMAT=0, expecting data through the raw opcodes. Our commit6f428728("tests: valid formats in the untyped MUBUF oracle descriptors") changes only those 19 descriptor words to0x30016000/0x16000(FORMAT=32_FLOAT); every test's address, bounds, masking, offsets and multi-dword subject is unchanged.tests/semantic/test_wave64_emulate_opt.py::StructuredEmulationTests::test_monotone_dirty_transfer_no_phantom_clear_after_x_round— not a FORMAT case: its structure scan looked for the blk3 bufferOpLoadwithin 15 lines of the precedingOpConvertUToPtr, and the run-time V# format check this PR emits adds three instructions between them. The same commit6f428728widens that single scan window to 18; the emulated words it checks are unchanged.runtime/test/shaders/ps_w64_b_ballot_atomic.asm+ itsw64_graphics.pypixel-shader environment (fixture from ce305ec, SHADER-10; run as a pixel shader by TEST-722, d7d9a8e): the PS environment's V# carried FORMAT=0, so on this branch the fixture's raw buffer accesses were suppressed and TEST-722'sps_w64_b_ballot_atomiccase failed. The descriptor now carries FORMAT=32_FLOAT; the fixture's ballot/atomic subject and expected words are unchanged. (Commit "tests: give the ballot-atomic fixture V# a valid FORMAT".)If a reviewer has hardware evidence that raw MUBUF accesses ignore FORMAT, that contradicts the #1218 measurements and we'd like to hear it — the rule this PR implements is backed by the gfx1035/gfx1036 runs linked above.
spirv-valsucceeded but four output words were wrong). After the fix the CPU fixture passed (1 passed, expected eight dwords and read addresses matched) and all eight output words matched in both GPU modes.python -m compileall -q make_game.py tools tests— exit 0.python -m unittest discover -s tests/semantic— 1179 passed (the new test was checked as a filtered negative control before the fix).python -I tests/test_*.pyon the selected standalone files — 30 files passed,mem_diff13/13 (applying the translator fix alone had made four subcases fail).tools/mem_diff.py --programs 200 --seed 20261122 --max-ops 12— 200/200 before and after, 0 mismatch.python -I scripts/run_gpu_tests.py --work <scratch>/gpu— 106/134 passed, 28 wave64 skipped, 0 failures; 138/138 shaders translated and passedspirv-val.LEONIDA_W64_EMULATE=1(<scratch>/gpu-emulate) — 134/134 passed; 138/138 shaders translated and passedspirv-val.python -I make_game.py --helpandpython tests/semantic/regen_fixtures.py --check— both exit 0.AI-assisted. The measurements above were run on this machine.
Checklist
docs/design.md, with how it was confirmed.