Skip to content

TEST-837: Require fresh GPU test readbacks - #3786

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
DanielDeGiorgio:codex/gpu-suite-fresh-readbacks
Nov 23, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
DanielDeGiorgio:codex/gpu-suite-fresh-readbacks

Conversation

@DanielDeGiorgio

Copy link
Copy Markdown
Contributor

Claimed as TEST-837 in coordination #3574.

What and why

With a reused --work directory, an exit-0 harness that did not write a frame could pass by comparing the previous run's pixels. In a fresh directory the same exit could instead raise FileNotFoundError and stop the suite. I reproduced both with the actual ps_ops runner path and a synthetic 4,096-pixel frame.

Use one fresh-readback check for the runner's direct framebuffer-producing calls and the shared mesh workgroup test. Remove the previous output before starting the harness, then require the output file on exit 0. Preserve unsupported-device skips and launch failures. A missing frame is now a failed case with its own message, so the remaining cases can run.

Tested

  • Negative controls reproduced the stale-frame pass and the missing-file exception on the parent revision.
  • Windows: python -I tests/test_run_gpu_tests.py (39 passed), python -I tests/test_shader_checks.py (72 passed), Python compilation and git diff --check passed.
  • Ubuntu 24.04 container, Mesa llvmpipe (software Vulkan), LLVM 18 and SPIRV-Tools: built vk_harness, vk_compute_test, and vk_store_test, then ran python3 -I scripts/run_gpu_tests.py --llvm-mc /usr/lib/llvm-18/bin/llvm-mc --build /tmp/leonida-gpu --work /tmp/reused --filter ps_ops.asm --require-pass twice in the same work directory. Both runs passed with all 4,096 pixels exact.

The change covers sequential reuse of the runner's work directory. Native GPU execution and the full unfiltered suite were outside this run. No game files used. AI-assisted (Codex).

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at 99fb9e37 on Windows 11:

  • python -I tests/test_run_gpu_tests.py -> 39 tests, OK.
  • python -I tests/test_shader_checks.py -> 72 tests, OK.
  • compileall and git diff --check clean.

The fix closes both halves of the bug: the output is removed before the harness starts (so a fresh --work cannot raise FileNotFoundError on an exit-0 no-write), and exit 0 now requires the output to exist (so a reused --work cannot compare the previous frame). One helper used by both the runner and the mesh workgroup test keeps the two paths consistent.

Heads-up: #3785 also edits scripts/run_gpu_tests.py and tests/test_run_gpu_tests.py (its verdict_line change). The hunks look separate, but whichever of #3785/#3786 lands first, the other should rebase and rerun this pair. No test failure here.

@chpeu

chpeu commented Nov 22, 2026

Copy link
Copy Markdown

Tested 99fb9e37 (main f847748c is an ancestor, no rebase needed) on two NVIDIA cards, Linux, no game files.
Your change touches both scripts/run_gpu_tests.py and runtime/test/shaders/check.py, so both paths were run.

GPU suite, identical to the main baseline on this machine:

  • LEONIDA_W64_EMULATE=1 python -I scripts/run_gpu_tests.py --build runtime/build/linux --llvm-mc /usr/lib/llvm-20/bin/llvm-mc
    → RTX 3080 184/199 passed, 15 skipped, 0 failed; RTX 5080 (LEONIDA_VK_DEVICE="RTX 5080") the same.
  • Without the variable: 153/199 passed, 46 skipped on both cards.

The check.py path you changed (runtime/test/shaders/build.py then check.py <spirv> runtime/build/linux):

  • build.py: 224 shaders translated, 224 pass spirv-val.
  • check.py: 139 of 174 pass, 35 skipped, 0 failed; with LEONIDA_W64_EMULATE=1: 139 of 174 pass,
    33 skipped, 0 failed
    . Same numbers as main here, so the fresh-readback requirement does not break any
    existing check on NVIDIA hardware.

Tests you changed: tests/test_run_gpu_tests.py 39 tests OK, tests/test_shader_checks.py 72 tests OK
(python -I <file>). Translator side, the 28 pytest-marked files as CI runs them: 1486 passed, 38 skipped,
94 subtests passed
— same as main. python -m compileall -q make_game.py tools tests: clean.

Limit to state: this run was green everywhere, so the new stale-readback detection never triggered in the output
here — its own tests cover it, and they pass.

Machine: Linux Mint 22 (Ubuntu 24.04 base), NVIDIA driver 615.71.09, Vulkan 1.4.351, llvm-mc 20.1.2,
SPIRV-Tools 2025.1~rc1 (Ubuntu packages), GCC 13.3, Python 3.12.3 with pytest 9.2.0 and numpy 2.5.5, built with
cmake -S runtime -B runtime/build/linux -DLEONIDA_VULKAN_HEADERS_FETCH=ON. AI-assisted testing, counts read
through by hand.

@tupacfan04

Copy link
Copy Markdown
Contributor

Verified at the head on Windows 11 / Python 3.13.0: MERGEABLE, clean merge-tree, and no working output is lost - the deletion is pre-launch and confined to work/raw, and a failing test keeps its raw output (scripts/run_gpu_tests.py:1082-1320). "Fresh" is file-level, and the tools already read after vkQueueWaitIdle (runtime/test/vk_harness.cpp:764-776, vk_texture_test.cpp:517-521), so there is no stale GPU buffer.

Tests: branch 39 + 72 pass, merged 41 + 77, other test_gpu* 75 pass, compileall clean. Negative control reproduces both original bugs (a stale frame passing, and the FileNotFoundError).

Approve. AI-assisted review, no game files, no GPU.

@crastinator

Copy link
Copy Markdown
Contributor

Tested 99fb9e3 merged into main f847748c (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: 185/199 native, 185/199 with LEONIDA_W64_EMULATE=1 (skips: the D3D12-only fixtures and ps_w64x_readlane, as on main). ctest 41/41.
  • tests/test_run_gpu_tests.py, tests/test_shader_checks.py: 115 passed, 269 subtests passed.

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

@ItsNotRexed
ItsNotRexed merged commit 5816b24 into ItsNotRexed:main Nov 23, 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.

6 participants