vk_fuzz_run: read a wave32 one-word dump from vk_compute_test's larger buffer #388
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!388
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/388/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Sangonapou on GitHub · 2026-11-24 04:23 UTC · original
Sangonapou:fix-vk-fuzz-run-short-request→main· +45 −4 · 2 files · 3 commits · merged 2026-11-24 16:24 UTCClaimed in the coordination issue as: claim in #14. This carries on my PR 7756 from the original repository, which was not among the 251
old-pr/*branches; same commit, rebased onmainece4ba5b.What and why
tools/vk_fuzz_run.run_programsaccepted aVKC_DUMPonly when it was exactly4 * words * wavebytes.vk_compute_test's output buffer is at least one 64-thread group of words (VKC_OUT_WORDSonly raises it), andVKC_DUMPwrites the whole buffer. So a request under 64 words (wave32 withwords=1: 128 bytes asked, 256 written) failed the check, and every program came back asvk_compute_test exit 0even though it had run and stored the right words. The docstring allowswords1, 2, 4 and 8; 2, 4 and 8 were never affected, and no current caller passes 1.read_dump(path, words, wave)returns the firstwords * wavewords of a dump at least that long, orNonewhen it is missing or short.vk_compute_test: no dump of N bytes or moreinstead ofvk_compute_test exit 0.Tested
NVIDIA GeForce RTX 3080 Ti Laptop (subgroup 32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300); runtime built from this branch with
scripts\build_runtime.ps1(MSVC 19.51);llvm-mc23.1.6 (conda-forge).Two real programs (
v_add_nc_u32of 5 and 3;v_not_b32of0x12345678) throughrun_programsat wave32:wordsmainece4ba5bvk_compute_test exit 0(both)[8],[0xedcba987]maintests/test_vk_fuzz_run.py: 15 OK (newtest_read_dump_takes_the_first_wave_of_a_larger_buffer: a 64-word dump for wave32words=1, an exact-size dump, a short and a missing one).tests/test_fmisc_diff.py(avk_fuzz_runcaller): 34 OK.python -m compileall,scripts/check_no_game_data.pyon both files: clean.On the original repo, PR 7756 had four independent checks (two CPU-side parser sweeps over all eight shapes, a mocked
run_programsprobe and a revert check), all passing.AI-assisted: yes (Claude Code)
Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator change.)🤖 Generated with Claude Code
@Oliwettoo on GitHub · 2026-11-24 10:34 UTC · original
Looks good.
read_dumpaccepts a dump at least4 * words * wavebytes long and reads only that prefix, which matches vk_compute_test writing its whole (≥ 64-word) buffer; a non-zero exit is still reported before the dump is read.tests/test_vk_fuzz_run.pypasses with the PR on currentmain. Ship. AI-assisted review.@EvgHaze on GitHub · 2026-11-24 13:29 UTC · original
Read-only review (I could not build this head: the clone timed out from this machine, so nothing below is a test result).
The fix looks right, and it is worth landing specifically because of 32-wide devices:
vk_compute_test's buffer is at least 64 words, sowave=32, words=1asks for 128 bytes and gets 256. The oldgetsize(dump) != 4 * words * wavetherefore rejected a perfectly good run. On a 64-wide AMD host the naturalwave=64, words=1case needs 256 bytes and matches exactly, which is presumably how this stayed invisible: the broken shape is the 32-wide default, i.e. Apple (MoltenVK reports 4..32 and defaults to 32; KosmicKrisp is 32..32) and every NVIDIA/Intel fixture run.read_dumpreading exactlyneedbytes and slicing intowavelanes ofwordsmatches the layout the old code assumed, and thereturncodecheck moved ahead of it, so a crashed run is still reported as an exit code rather than "no dump". The three new cases (larger buffer, exact size, short/missing) cover the branches.One suggestion on the test, not the code: the tail in
test_read_dump_takes_the_first_wave_of_a_larger_bufferis filled withR.FILL, which is also what the harness writes past the program's stores. So the test would still pass ifread_dumpaccidentally read the whole buffer and sliced it — the values would be identical. A distinct sentinel in the tail (e.g.0xdeadbeefinstead ofR.FILL) would make the test prove the tail is not read. Cheap to add while the fixture is being touched.On the Apple side I can supply the hardware check once the tree is reachable:
valu_fuzz --family f16 --programs 200 --seed 1 --wave bothon an M3 with MoltenVK 1.4.2 and KosmicKrisp 26.3.1 is already set up here and runs thewave=32path by default.AI-assisted.
@Sangonapou on GitHub · 2026-11-24 13:31 UTC · original
@EvgHaze thanks, good catch. Done in
2bf664f2: the larger-buffer case now gives each lane its own value (0x100 + lane) and fills the tail with0xDEADBEEF(asserted to differ fromR.FILL), so the test fails ifread_dumptook the tail, the wrong words or the wrong order. I also checked it the other way round: aread_dumpthat turns the whole 64-word buffer into lanes now fails it.tests/test_vk_fuzz_run.py: 15 OK. Code unchanged. An Apple run of thewave=32path would be very welcome.@EvgHaze on GitHub · 2026-11-24 14:26 UTC · original
Checked
2bf664f2. I could not run the test file itself (it importshw_oracle.runner, and the clone still will not complete from this machine), so I ranread_dumpdirectly fromtools/vk_fuzz_run.pyat that commit against the same fixtures, plus one you do not have yet:The per-lane values are the right call: with a single repeated word the test could not tell a wrong order from a right one, and
0xDEADBEEFin the tail is exactly the case that would have caught a whole-buffer read.The last row is the only thing I would consider adding: a
wave=64, words=1case over a two-group dump, because that is the shape a 64-wide AMD/NVIDIA host produces — the same bug in the other direction, where the buffer is now longer than the request rather than equal to it. Not a blocker.AI-assisted.
@Sangonapou on GitHub · 2026-11-24 14:35 UTC · original
@EvgHaze thanks for running it. Added your last row in
8dcc3964:wave=64, words=1from a two-group (128-word) dump, per-lane0x200 + lanewith the sentinel in the second group, expecting lanes 0..63 only.tests/test_vk_fuzz_run.py: 15 OK. Code unchanged.@QemmHD on GitHub · 2026-11-24 16:24 UTC · original
Merging.
Why merged: vk_fuzz_run reads the first wave of vk_compute_test's larger (64-word or more) dump, so a wave32 run with words=1 no longer drops every result. Oliwettoo said "Ship". The current head adds EvgHaze's suggested case (wave64, words=1, from a two-group dump); tools/vk_fuzz_run.py is unchanged since that review.
Why it's good: tests/test_vk_fuzz_run.py: 15 passed.
Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Alone on main, its tests passed both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #388, #418, #421, #434, #470, #484, #485, #486 and #488 merged onto main
1504c1af6(a225e593e). There the repo-consistency set gives 566 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 306/308. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same skip set. git merge-tree against current main98a977b4b: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.AI-assisted (Claude Code, Claude Opus 5.5).
@EvgHaze on GitHub · 2026-11-25 12:23 UTC · original
Apple run of the wave=32 path, as asked.
Unit test file, on macOS:
python3 -I tests/test_vk_fuzz_run.py→ 15 tests, OK. Same count as the merge comment.The exact shape that used to be dropped, end to end on the GPU —
run_programs(words=1, wave=32), where the dump is 64 words and the request is 32:So all 32 lanes come back, in order, and the uniform check still rejects a program whose lanes differ — both halves of the read path behave on a 32-wide host.
What I could not run here: the differential fuzzers in their hardware-compare mode.
vint_diff.py --oracle hw,vk(the mode that exercises this wrapper) exits withhardware oracle unavailable: the launcher targets the Windows AMD driver (amdhip64_7.dll), so there is nohw,vkrun from a Mac. The Apple result above is the wrapper plusvk_compute_teston a 32-wide host, not a hardware comparison.AI-assisted. No game data: one hand-written program, and the numbers above are its output.