Repository navigation
pk16_diff, vint_diff, sdwa_diff, wint_diff: --oracle hw,vk runs the translated programs on a Vulkan GPU - #6306
Conversation
…PU, wave32 or wave64 fmisc_diff judged the translator in spirv_mini_interp only. --oracle hw,vk also runs each program through llvm-mc, rdna2spirv.py and vk_compute_test as one wave of 32 or 64 identical lanes (tools/vk_fuzz_run.py, shared with other fuzzers) and judges lane 0's four words against the hardware's. The seeds are computed from the buffer fill at run time: the AMD Windows driver folds an ordered compare of a literal NaN to true in a wave32 pipeline. Seeds 11 to 13 (600 programs each): Radeon wave32 and wave64 and RTX 5080 wave32 show only the denormal gap and omod turning -0 into +0 (ItsNotRexed#1281), no mismatch. AI-assisted.
…ranslated programs on a Vulkan GPU The same check as fmisc_diff's (ItsNotRexed#5931) and f32_fuzz's (ItsNotRexed#5351), through the shared tools/vk_fuzz_run.py: llvm-mc, rdna2spirv.py and vk_compute_test run each program as one wave of 32 or 64 lanes and its words are judged against the hardware's from a kernel in the same wave size. wint_diff judges every lane of its per-lane programs. vk_fuzz_run.py gains rewrite/per_lane/uniform options, the s_mov_b32 vcc_lo data seed as a 64-bit mov, and judge() with an exact verdict; sdwa_diff adds a nan class for programs the reference declines for an f16 NaN. Fresh seeds, 400 to 500 programs each: no mismatch on the RTX 5080 and none in vint_diff anywhere. On the Radeon pk16_diff found v_med3_i16 with a constant operand (fixed separately) and sdwa_diff / wint_diff a few wave64-only differences, listed in docs/shader_validation.md. AI-assisted.
SirKingg
left a comment
There was a problem hiding this comment.
Requesting changes at 4ce6558 (stacked on #5931):
tools/pk16_diff.py:591-596and the corresponding exits in the other four fuzzers:--oracle hw,vkreturns 0 when every Vulkan case is skipped, as long as a hardware/reference comparison passes. With a synthetic hardware oracle returning the reference and the Vulkan runner returningtranslator: not translatedfor every program, pk16 reports one hardware pass, one Vulkan skip, and exits 0. Unsupported subgroup sizes or a translator failure can therefore produce a successful run without any requested Vulkan comparison. Treat a run with no Vulkan verdict as non-success, and surface systemic execution failures.tools/sdwa_diff.py:649-654: any reference NaN skip classifies every differing output asnan, including a corrupted independent register. A synthetic program whose f16 operation encounters NaN but which separately observes the unchanged source returnsnanwhen only that copied source word is corrupted (0x7e00 -> 0x7e01). This masks real translator or driver errors unrelated to the NaN operation; narrow the exemption to affected outputs or skip the case explicitly rather than presenting it as an explained difference.
Windows independent checks: RTX 4070 Ti, NVIDIA 610.88, MSVC 19.44. The six targeted Python test files passed (109 tests); synthetic negative controls detected corrupted final lanes for wave32 and wave64. MSVC-built vk_compute_test ran an independent synthetic wave32 Vulkan smoke test and returned all 128 expected words; the device reports subgroup range 32..32 and correctly rejects required wave64 with exit 77. These are not RDNA2-vs-Vulkan comparisons: the AMD hardware oracle and AMDGPU llvm-mc were unavailable, so the new end-to-end hw,vk path and real wave64 were not tested. No game files. Review assisted by AI; no approval or merge.
|
Tested
All the skips are the hardware side:
The
So the wave64 miscompile you saw on the gfx1036 iGPU with 26.10.1 does not happen on RDNA4 with 26.11.2. From one card I can't tell whether the newer driver fixed it or the bug is specific to the RDNA2 compile path. A run of the same program on gfx1036 with 26.11.2 would separate the two before it goes to AMD. Not run: Synthetic programs only, no game files. AI-assisted (Claude Code). |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
Adds a shared Vulkan-GPU oracle path to four differential fuzzers. New tools/vk_fuzz_run.py (197 lines: program_text, wave64_text, judge, exact_verdict) wraps llvm-mc → rdna2spirv.py → vk_compute_test. pk16_diff.py, vint_diff.py, wint_diff.py, fmisc_diff.py extend hw_kernel(..., wave), run_suite(..., wave, build, work, vk_constants) and add VK verdicts; sdwa_diff.py adds vk_verdict() with an f16 nan class. tests/test_vk_fuzz_run.py is new; docs/shader_validation.md documents the mode.
Why merge
Judges translated programs against real hardware words on Radeon and RTX, exposing translator/driver bugs the mini-interpreter cannot see, with wave32/64 control and fresh-seed measurements.
Verdict: Approve
SummaryAdds a shared Vulkan-GPU oracle path to four differential fuzzers. New Why mergeJudges translated programs against real hardware words on Radeon and RTX, exposing translator/driver bugs the mini-interpreter cannot see, with wave32/64 control and fresh-seed measurements. Verdict: Approve |
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-VK-MORE, #5032 (comment)
Depends on: #5931 (this branch is stacked on it: the first commit is #5931's;
tools/vk_fuzz_run.pyis its shared runner)What and why
pk16_diff,vint_diff,wint_diffandsdwa_diffjudge the translator only inspirv_mini_interp. The same check inf32_fuzz --oracle hw,vk(#5351) andfmisc_diff(#5931) found real translator bugs and several driver problems the interpreter fuzzers cannot see, so this adds--oracle hw,vk(--wave 32|64,--build,--work,--vk-constants) to the four others through the sametools/vk_fuzz_run.py.wint_diffjudges every lane of its per-lane programs in the wave size they were generated for; the others run identical lanes and judge lane 0.vk_fuzz_run.pygains therewrite/per_lane/uniformoptions,s_mov_b32 vcc_lo, Kas a 64-bit mov in wave64, and ajudge()helper with an exact verdict;sdwa_diffadds ananclass (the reference declines an f16 NaN; the hardware kernels run with IEEE on).Tested
Fresh seeds (pk16 201-203, vint 201-203, sdwa 211-213, wint 221-222), 400 to 500 programs each, AMD Radeon iGPU gfx1036 (driver 26.10.1) wave32 and wave64, NVIDIA RTX 5080 (616.92) wave32:
pk16_diff: Radeon 8 mismatches in wave32 (fivev_med3_i16) and 8 in wave64 (sevenv_med3_i16), the median of a constant operand coming out as a bound (fixed in the separate PR forcs_med3_i16; the rest arev_pk_*orv_min_i16), 0 on the RTX 5080.vint_diff: 0 mismatches on all three.sdwa_diffint: Radeon wave64 2 (v_not_b32_sdwa ... dst_unused:UNUSED_PADgives 0xffffff00 for 0x0000ff00, also when the field extracts are written as shifts and a mask: a driver bug, posted as a finding), 0 elsewhere; f16: Radeon wave64 2 (v_cvt_f32_f16_sdwa dst_sel:WORD_1of an f16 denormal), the restnan.wint_diff: Radeon 2 of 400 (one wave32 lane, one wave64 lane), RTX 5080 0 of 400.v_add3_u32made to emitOpISubfails 79 of 80 programs on the Radeon.tests/test_vk_fuzz_run.py(program text, wave64 spelling, opaque seeds,judge, the--oracle vkguard of each of the four tools); the four tools' existing tests andtest_fmisc_diffpass;test_docs_*andcompileallOK.docs/shader_validation.mddocuments the mode and the table above.AI-assisted: yes.
Checklist
docs/design.mdrow.