Skip to content

SHADER-595: add a reusable lighting multiply GPU readback - #3182

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
kacper-serewis:test/synthetic-gpu-regression
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
kacper-serewis:test/synthetic-gpu-regression

Conversation

@kacper-serewis

@kacper-serewis kacper-serewis commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Depends on: #3116

SHADER-595 adds a GPU regression for the SHADER-578 translator rule. Coordination claim

The driver supplies 120 SGPR triples to the hand-written fixture and checks all 16 pixels per draw against an integer round-to-nearest-even oracle. It covers source modifiers, gates, exceptional operands, signed underflow, and exact halfway products in both rounding directions. Alpha exposes the raw product bits through a finite XOR witness when the float attachment may change a NaN payload.

Verification at 1f24d86e. The test build applies #3116 at 4c965b35 for its fixture and translator rule. On Windows, both shaders assembled, translated and passed spirv-val. The committed driver matched 120/120 draws and 1,920/1,920 pixels on NVIDIA GeForce RTX 5070, driver 616.56. Independent exact rational arithmetic confirmed the two midpoint products round up to 0x3fc00002 and down to 0x3fc00004. Reproduction commands are in docs/testing.md.

Earlier coverage. The RTX 4070 report (driver 621.01) covers the original 120 draws at 40f57cd0, before two seeded cases were replaced with the midpoint inputs. The earlier CPU replay also rejected truncated frames, corrupted last-pixel sentinels and altered finite NaN witnesses.

AI-assisted with Codex. All inputs are synthetic.

@KiryaAfimin

Copy link
Copy Markdown

Ran the committed mullit_readback.py on Windows 11 with an RTX 4070 (driver 621.01), using 40f57cd0 together with #3116 at 4c965b35. Both shaders passed spirv-val. All 120 operand triples went through vk_harness, and all 1,920 pixels matched.

As a negative control, I flipped one bit of the alpha output only when the lighting product was NaN. The script exited 1 on inputs (0x7fa12345, 0x7f800000, 0x3f800000) and reported pixel 0 A: got 0x3fa12344, expected 0x3fa12345.

AI-assisted

@kacper-serewis kacper-serewis changed the title SHADER-578: add a reusable lighting multiply GPU readback SHADER-595: add a reusable lighting multiply GPU readback Nov 22, 2026
@umnitus

umnitus commented Nov 22, 2026

Copy link
Copy Markdown

Independent Windows GPU check at 1f24d86 on an RTX 3060 12 GB, NVIDIA driver 621.14.

I built vk_harness from the PR head and used the translator and unmodified ps_mullit fixture from #3116 at 4c965b3. I copied the fixture from tests/semantic/fixtures into runtime/test/shaders so build.py could find it.

python -B -I runtime/test/shaders/build.py vs_ids ps_mullit: 2/2 shaders translated and passed spirv-val.
python -B -I runtime/test/shaders/mullit_readback.py : 120/120 operand triples and 1,920/1,920 pixels matched. Exit 0.

AI-assisted testing and write-up.

@kacper-serewis

Copy link
Copy Markdown
Contributor Author

AI-assisted CPU integration review passed against #3116 at f9d6d3e. Clean combined tree15f494f57ce49705ed71b399fe3fd5f45bfe7fc0 builds documented vs_ids/ps_mullit without copying the fixture; both pass Vulkan1.2 spirv-val. Fixture bytes are unchanged from4c965b35. All120 triples match translated CPU-interpreted RGBA versus independent readback oracle, including both exact ties;480 injected channel corruptions are detected at the correct final pixel/channel. NoGPU run in this review: historical1920pixel RTX5070/616.56 evidence remains scoped to dependency4c965b35. The3060 tester's manualcopy step cannot be attributed conclusively from the reported checkout details. No blocker found; dependency remains open.

@crastinator

Copy link
Copy Markdown
Contributor

Tested 1f24d86 merged into main 16282101 (clean merge) on AMD Radeon RX 6700 XT (Navi 22, gfx1031, subgroup 32..64), RADV Mesa 26.3.1, CachyOS, Linux 7.3.5, GCC 16.2.1, llvm-mc 23.1.5: pass.

  • Whole run_gpu_tests.py: 175/189 native, 175/189 with LEONIDA_W64_EMULATE=1 (the skips are the D3D12-only fixtures and ps_w64x_readlane, as on main). ctest 37/37.

No game files. AI-assisted (Claude Code).

@kacper-serewis

Copy link
Copy Markdown
Contributor Author

Thanks for the RX 6700 XT integration result. One coverage clarification: this PR's lighting regression runs through the standalone mullit_readback.py command documented in docs/testing.md; the default GPU suite does not currently invoke its 120 draws. Did you also run that standalone driver with #3116 applied? If so, please record the dependency head and its draw/pixel result. The reported suite/CTest results are useful integration evidence, but I will keep them separate from lighting-regression execution until confirmed.

@kacper-serewis

Copy link
Copy Markdown
Contributor Author

AI-assisted updated-dependency validation on Windows, RTX 5070 driver 616.56: #3182 at 1f24d86 plus #3116 at f9d6d3e, combined commit 4314e938c46641ea252fc4d29fc671027b2910f1 (tree 15f494f57ce49705ed71b399fe3fd5f45bfe7fc0). In a fresh checkout, the documented build used the committed fixtures directly: 2 shaders translated and separately passed spirv-val --target-env vulkan1.2. A newly built Release vk_harness ran mullit_readback.py: 120/120 draws, 1,920/1,920 pixels matched, including both exact ties. No fixture copying or retail inputs. GPU lease released.

@ItsNotRexed
ItsNotRexed merged commit 3c7618a into ItsNotRexed:main Nov 22, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants