Skip to content

vk_fuzz_run: read a wave32 one-word dump from vk_compute_test's larger buffer - #7756

Open
Sangonapou wants to merge 1 commit into
ItsNotRexed:mainfrom
Sangonapou:fix-vk-fuzz-run-short-request
Open

Sangonapou wants to merge 1 commit into
ItsNotRexed:mainfrom
Sangonapou:fix-vk-fuzz-run-short-request

Conversation

@Sangonapou

Copy link
Copy Markdown

Claimed in the coordination issue as: claim in #7694

What and why

tools/vk_fuzz_run.run_programs accepted a VKC_DUMP only when it was exactly 4 * words * wave bytes. vk_compute_test's output buffer is at least one 64-thread group of words (its header: VKC_OUT_WORDS only raises it), and VKC_DUMP writes the whole buffer. So a request under 64 words (wave32 with words=1: 128 bytes asked, 256 written) failed the check, and every program came back as vk_compute_test exit 0 even though it had run and stored the right words. The docstring allows words 1, 2, 4 and 8; 2, 4 and 8 were never affected, and no current caller passes 1, so nothing in the repo hit it. I ran into it while GPU-testing #7293 (v_dot4_i32_i8 readback with one word per program).

  • read_dump(path, words, wave) returns the first words * wave words of a dump at least that long, or None when it is missing or short.
  • A missing or short dump now reports vk_compute_test: no dump of N bytes or more instead of vk_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 4078faaa with scripts\build_runtime.ps1 (MSVC 19.51); llvm-mc 23.1.6 (conda-forge).

Two real programs (v_add_nc_u32 of 5 and 3; v_not_b32 of 0x12345678) through run_programs at wave32:

words main this branch
1 vk_compute_test exit 0 (both) [8], [0xedcba987]
2, 4, 8 correct identical to main
  • tests/test_vk_fuzz_run.py: 12 OK (new test_read_dump_takes_the_first_wave_of_a_larger_buffer: a 64-word dump for wave32 words=1, an exact-size dump, a short and a missing one).
  • tests/test_fmisc_diff.py (a vk_fuzz_run caller): 25 OK.
  • python -m compileall, scripts/check_no_game_data.py on both files: clean.

Doesn't overlap #4426, which changes other lines of the same file.

AI-assisted: yes (Claude Code)

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: no translator change.)

🤖 Generated with Claude Code

…r buffer

run_programs required a VKC_DUMP of exactly 4 * words * wave bytes. vk_compute_test's
output buffer is at least one 64-thread group of words (VKC_OUT_WORDS only raises it),
and VKC_DUMP writes the whole buffer, so wave32 with words=1 (128 bytes asked) got a
256-byte file and every program came back as "vk_compute_test exit 0". words=2, 4
and 8 were not affected.

read_dump() now takes the first words * wave words of a dump at least that long, and a
missing or short dump says so instead of reporting exit 0. Unit test in
tests/test_vk_fuzz_run.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CourtyardGames

Copy link
Copy Markdown

Checked read_dump at c7d84c2 on Windows with Python 3.12.13 and 3.14. Exercised all eight supported shapes (32/64 lanes × 1/2/4/8 words), encoding the lane and word index into every value. For each shape I checked an exact payload, one trailing byte, 513 trailing bytes, and a payload one byte short. All 32 checks passed on each interpreter: lane and word order stayed intact, trailing bytes were ignored, and the one-byte truncation returned None. CPU-side parser check with synthetic files, AI-assisted.

@hcampbell98

Copy link
Copy Markdown

Tested c7d84c2d2 merged with main dde82f27e on Linux (WSL2, CPU-only, Python 3.14.4 & 3.12.13): Pass

  • Diff & repo hygiene: git diff --check dde82f27e...HEAD clean; python3 -I scripts/check_no_game_data.py tools/vk_fuzz_run.py tests/test_vk_fuzz_run.py clean; python3 -m compileall -q tools tests OK.
  • tests/test_vk_fuzz_run.py: 12/12 OK on Python 3.14.4 (-I) and 12/12 OK on Python 3.12.13 (-I); pytest on tests/test_vk_fuzz_run.py and sibling tests/test_fmisc_diff.py ran 37 passed, 58 subtests passed.
  • Negative control: reverting tools/vk_fuzz_run.py to dde82f27e errored 1/12 (AttributeError: module 'vk_fuzz_run' has no attribute 'read_dump').
  • Probes: read_dump returned 32 1-word lanes ([[100], [101], [102]] ... [131]) from a 256-byte wave32 dump and None from a 124-byte dump; run_programs(..., words=1, wave=32) with llvm-mc/rdna2spirv/vk_compute_test mocked returned [[200]] (uniform=False), vk_compute_test: no dump of 128 bytes or more on 124-byte dumps, and vk_compute_test exit 7 on non-zero exit.
  • Limits: CPU-only (llvm-mc, vk_compute_test, and GPU were not run).

AI-assisted.

@azterixx

Copy link
Copy Markdown

checked: #7756 | with: python -I -m unittest discover -s tests -p test_vk_fuzz_run.py | on: Debian 13, Intel i7-8700, CPython 3.13.5, head c7d84c2, CPU only | result: pass (12 tests; main@dde82f27e has 11)

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.

4 participants