Repository navigation
Tools: image_load differential fuzzer and its GPU harness - #863
Conversation
|
Two review notes:
|
|
Tested 8f5d428 on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51, ctest 32/32, llvm-mc 23.1.6):
The harness requires more than the fuzzed shaders use. The translator only declares Suggestion:
Then Intel iGPUs, and other devices without the feature, can still fuzz the float path. The split into two messages ( |
|
@kapitche thank you — the RTX 4080 SUPER numbers are the first Windows/Ada confirmation (50/50), and the Intel run is the more useful one. On the skip: it is real, and it comes from the translator rather than from the harness asking for more than the case needs. What I did change, from your review:
The portability issue itself (translated |
quackottu
left a comment
There was a problem hiding this comment.
Tested 7da4428 on NVIDIA GeForce RTX 5070, driver 621.24, Windows 11 Pro (26300), VS 2022 Build Tools, Vulkan SDK 1.4.363.0, with LEONIDA_VK_VALIDATION=1 and LEONIDA_D3D12=vulkan: pass
ctest -C RelWithDebInfo: 100% tests passed, 0 tests failed out of 32- 33 test programs in the build pass with 0 validation errors
d3d12_clear_testfails (R8G8B8A8_UNORM/SNORM 0.5 ties and a D16 clear byte differ from WARP) exactly as onmain4a36bb1 here, so not from this PR; #521 addresses it
Implicit Vulkan layers (overlays) were off through an empty VK_IMPLICIT_LAYER_PATH.
|
@quackottu thank you — this is the first run on the final head ( Noted on For the record, the branch as pushed also passes the full GitHub CI on this head (check, semantic both OS, translator, viewer, windows, linux-gpu-tools, wine, change-scope, no-game-data). Thanks for turning off the implicit overlay layers too — that is the same trap that made @rafaelpssz's first run on #696 look red. |
|
Tested PR head
The run covered the four formats supported by the fuzzer. Implicit Vulkan layers were disabled. No game files or game-derived data were used. |
|
Tested 7da4428 on AMD's proprietary Windows driver (the earlier AMD run was RADV): pass. Windows 11. AMD Radeon Graphics (Ryzen 7 7800X3D iGPU, RDNA2), driver 26.3.1 (32.0.21043.5001). RTX 4070 Ti SUPER, driver 610.88.
No validation layer is installed here, so these runs are without (AI-assisted run, counts only.) |
AI-assisted. docs/shader_validation.md said "Not covered yet: images", and FUZZ-1..13 touch VALU, memory, LDS, crosslane and control flow but not a single image instruction. This is the first slice of that gap: - runtime/test/vk_image_fuzz.cpp: headless harness that binds one 2D sampled image from a key=value spec (format, size, texels, T# key) through the bindless set and the descriptor table, draws a 64x64 full-screen triangle with a caller-supplied VS/PS, and dumps RGBA32F. It enables the without-format storage-image reads/writes and fragment atomics the translated image path declares, and fails on validation errors with LEONIDA_VK_VALIDATION=1. - tools/image_fuzz.py: assembles a pixel shader that reads one texel with image_load (dmask 0xf, T# in s[8:15]), translates it with rdna2spirv.py, runs the harness, and compares every pixel with an independent CPU oracle for the T# format. A fetch is a memory read, so the oracle is exact. - tests/test_image_fuzz.py: the oracle, the texel mapping, the T# word and the generated shader, without a GPU. Covered: R8G8B8A8_UNORM, R16G16B16A16_SFLOAT, R32G32B32A32_SFLOAT and R32_SFLOAT, at 8/16/32/64 square sizes that divide the draw; a fifth of the values are NaN, +-inf, +-0 or denormals. Not covered yet: dmask variants, UINT/SINT formats (they read through the storage views), mips, 1D/2D-array/3D/cube, image_sample/gather with filters and borders, and texel offsets with VK_KHR_maintenance8. Verified on an NVIDIA RTX 2060 SUPER (Linux, 620.73.04, Vulkan 1.4.357): 40/40 programs match under LEONIDA_VK_VALIDATION=1; ctest 11/11; the GPU suite is unchanged with a clean build. Synthetic fixtures only, no game data.
The skip message said 'lacks ... or the without-format reads/writes', which cost kapitche a vulkaninfo round trip on an Intel UHD 770. It now prints the exact features that are missing, plus the reason when the without-format ones are involved: the translated image_load declares those capabilities for every shader, because its uint/sint path is chosen from the T# FORMAT at run time.
7da4428 to
6169f9b
Compare
|
Two more GPUs and both AMD drivers on the same PR — thank you both.
Both match the oracle with zero mismatches, which is the outcome the fuzzer is built to produce for these four formats. Heads-up: |
|
The float oracle accepts a wrong binding when the only difference is the sign of zero. I reproduced this on head
There is also a case with the normal varying coordinates and the PR's generated input. With In |
Vonsek reproduced a blind spot: +0.0 == -0.0 in Python, so a wrong binding that returns +0 where the texture holds -0 passed silently (4096/4096 raw words differ, compare() reported none; 192/4096 on a generated float case). same_component() now compares the packed f32 words and keeps the any-NaN policy (payloads are not modelled). Two CPU regressions: one flips a single output channel from -0 to +0 and expects exactly that pixel; the other feeds a different NaN payload and expects no mismatch. 40/40 programs still match on the RTX 2060 SUPER with validation, so the GPU preserves signed zeros for these formats.
|
@Vonsek caught and fixed — thank you, that was a real blind spot in the comparator, and the raw-word counts made it unambiguous (4096/4096 differing words with 0 reported, and the 192 on a generated case). The fix is in
Both fail on the old comparator. Re-ran 40/40 on the RTX 2060 SUPER with New head: the rebased |
|
Retested |
|
@Vonsek confirmed on our side too: |
New FUZZ item (claimed in #634);
docs/shader_validation.mdstill said "Not covered yet: images", and FUZZ-1..13 cover VALU, memory, LDS, crosslane and control flow but not one image instruction.What this is
runtime/test/vk_image_fuzz.cpp— headless harness. It reads akey=valuespec (width, height, format, texels path, the 8 T# words), creates one DEVICE_LOCAL 2D sampled image, uploads the texels through staging, registers the T# → bindless index in the descriptor table throughBindlessSet, and draws a 64×64 full-screen triangle with the VS/PS it is given, dumping RGBA32F. It enablesfragmentStoresAndAtomicsand the without-format storage-image reads/writes the translated image path declares;LEONIDA_VK_VALIDATION=1turns any validation error into a failure.tools/image_fuzz.py— assembles a pixel shader that reads one texel withimage_load(dmask:0xf, T# ins[8:15], coordinates from the interpolated UV), translates it withrdna2spirv.py, runs the harness and compares every pixel with an independent CPU oracle for the T# format. A texel fetch is a memory read, so the oracle is exact (UNORM divide in f32, binary16 → float, missing components (0,0,1)).tests/test_image_fuzz.py— the oracle, the texel mapping, the T# word and the generated shader, no GPU.Covered:
R8G8B8A8_UNORM,R16G16B16A16_SFLOAT,R32G32B32A32_SFLOAT,R32_SFLOAT; 8/16/32/64 square sizes that divide the draw, every texel read; a fifth of the values are NaN, ±inf, ±0 or denormals.Not covered yet (follow-ups):
dmaskvariants, UINT/SINT formats (they read through the storage views), mips, 1D/2D-array/3D/cube,image_sample/gatherwith filters and borders, and texel offsets withVK_KHR_maintenance8.Verified on an NVIDIA RTX 2060 SUPER (Linux, 620.73.04, Vulkan 1.4.357): 40/40 programs match under
LEONIDA_VK_VALIDATION=1;ctest11/11; the GPU suite is unchanged with a clean build (73/100 + 27 64-wide skips, 0 failures);pytest tests/test_image_fuzz.py11/11.No game data; synthetic fixtures only. AI-assisted.
Depends on: nothing. Touches
runtime/test/andtools/only.