Repository navigation
Shader: fix the differential oracle for merged MTBUF load behavior - #1396
Conversation
|
Independent CPU verification, at head
The unbound-MTBUF suppression looks correct from the CPU side. |
dcastell1
left a comment
There was a problem hiding this comment.
Verified locally (CPU): the full semantic suite on this branch → 1195 tests OK (1 skip); tests/semantic/test_buffer_load_format.py → 26 tests OK, including the new test_invalid_descriptor_suppresses_fixed_format_load with its 32_UINT control.
The rule reads correctly against the ISA: FORMAT is V# bits 12..18, so a 7-bit extract against 0 is the exact test, and folding it into the same in_b predicate as the bounds check keeps the single suppressed-load path (odd D16 half preserved) rather than adding a second one. Scoping it to MTBUF is right; MUBUF keeps its own descriptor rules.
No GPU rerun from me: the 5090 is compiling one of the two giant ScreenProbes modules, and I am not claiming words I did not measure. The gfx1036 measurements in the description are the evidence. No game files; no concerns.
|
Tested on Linux (WSL2 Ubuntu), Python 3.12, CPU only: pass. |
|
Windows Runtime on 2dfd8d4 failed only d3d12_present at line 139, d.create(true), the identical failure on base c2967a5e. #908 covers the missing no-device skip. AI-assisted. |
Use a bound descriptor to exercise the generated instruction format. Keep INVALID as an explicit reference control and model MTBUF's identity lanes independently of MUBUF selectors.
|
Fixed the failing differential check in f67aec2. Seed 20261122 generated INVALID V# word 3 for every MTBUF format case. At the first failing load, native gfx1036 returned 0 with word 3 = 0x30000fac and 0x3f2aaaab with only the descriptor format changed to 32_UINT, on both wave32 and wave64. The address, memory word (0xaededaaa), and instruction format stayed the same. The original 60-case seed now exercises bound formats and passed with zero skips or mismatches (previously 32 mismatches). Explicit reference controls retain INVALID, fixed channel order and zero-fill coverage. Two more seeds passed 128/128 each; 15 memory-fuzzer tests and 26 formatted-load tests passed locally. AI-assisted. |
|
Tested 2dfd8d4 on AMD Radeon RX 7900 XTX (RDNA3), AMD proprietary 26.10.1, Windows 11, MSVC 19.44: no regression.
This is a regression check only: the PR's own test ( AI-assisted (Claude wrote the test script and read the logs); the runs are from my machine. |
|
Independent CPU check of 95da3ff (Linux, Python 3.13, no GPU): |
The differential fuzzer guide still described MTBUF selector behavior as unmeasured. Record the native bound, unbound and missing-channel behavior exercised by the reference tests.
|
Tested The PR touches only
The two GPU failures are the same on main and are not from this PR:
The skips are the known Mac ones: no geometry or mesh shaders in MoltenVK, no Setup: Xcode 27.2, Homebrew LLVM 23.1.6 ( AI-assisted (Claude Code). |
|
Independent CPU verification of the oracle half at head
Why it matters beyond this PR: |
|
Update after the batch merge: main at 99f9989 contains the MTBUF generator and reference correction from f67aec2. I ran python -I tests/test_mem_diff.py on both 99f9989 and GitHub's merge candidate fd68b70 (main plus 9582e45). Both passed 15/15, with the mismatch canary detected as expected. The resulting merge diff against main is now only docs/shader_validation.md. The main Actions run is still queued. AI-assisted. |
The production shader change landed on main via b1b30d8 during the CI follow-up. The remaining diff at 95da3ff corrects the differential generator and reference model in two files. I reproduced 32/60 mismatches with the stock test from bb2e184; its unchanged randomized assertions pass 60/60 here. The original hardware measurements below explain why the generator needs bound resource descriptors.
Claimed in the coordination issue as SHADER-215. Coordination with the broader MUBUF/MTBUF finding.
What and why
An MTBUF load takes its format from the instruction when its resource is bound. An INVALID V# format marks the resource unbound even if its address and byte extent look valid. Previously the translator fetched from that address anyway. Gate the existing bounded read on the seven V# format bits, retaining the packed writer's normal handling of the destination registers.
This covers ordinary and D16 MTBUF loads. The descriptor-controlled MUBUF path has distinct constant-selector behavior, measured here.
Tested
Native RDNA2 gfx1036: 32 cases covering ordinary/packed loads, x/xy/xyz/xyzw, wave32/64, and a bound 32_UINT or INVALID descriptor at the same address. The valid four-channel instruction read 44/33/22/11 from 11223344. INVALID returned zero components, retaining untouched halves and adjacent registers.
On c2967a5 and this change, all 16 synthetic compute shaders translated and passed spirv-val. Per GPU (RTX 5080, Windows 616.92; integrated Radeon, 32.0.21045.16010), INVALID had 1,024 of 2,048 readback words wrong on the base and zero here. The bound control matched all 2,048 both times.
A separate source-built D3D12 guest ran on the #291 integration candidate at 70178d3. The vertex shader loaded the position, then cleared only the format bits for its color fetch. On each GPU the base translator produced 2,544 incorrect pixels out of 4,096 for INVALID. Here the CPU image matched all 4,096 for both INVALID and the original bound descriptor. No Vulkan validation VUIDs.
The two new semantic subcases failed on the old unbound values. The updated 26 formatted-load tests passed. The full translator suite passed 400 tests with two skips.
CI's format differential seed 20261122 previously generated INVALID descriptors for every MTBUF case. Native gfx1036 wave32/64 read 0 for the seed's original descriptor and 0x3f2aaaab for the same address with a bound V#. The fuzzer now generates bound cases and tests INVALID separately. All 60 original cases passed, as did 256 additional seed cases.
Checklist
AI-assisted.