Skip to content

vk_compute_test: flush stdout before exit and note empty stdout in check.py - #7484

Open
bitzin-dev wants to merge 1 commit into
ItsNotRexed:mainfrom
bitzin-dev:fix/vk-compute-test-fflush
Open

bitzin-dev wants to merge 1 commit into
ItsNotRexed:mainfrom
bitzin-dev:fix/vk-compute-test-fflush

Conversation

@bitzin-dev

Copy link
Copy Markdown

Addresses the finding reported by @iTzAlvar in #7333:

When vk_compute_test is invoked via a pipe (such as in check.py or subprocess.run(capture_output=True)), standard C runtime full-buffering can cause the test results on stdout to be dropped if the process exits before the CRT buffer is flushed, leaving only the unbuffered stderr device: line.

This PR:

  1. Adds std::fflush(stdout); in runtime/test/vk_compute_test.cpp:main() right after OptInValidation::exit_status(run(argc, argv)) to guarantee all output reaches the pipe buffer before exit.
  2. In runtime/test/shaders/check.py:run(), detects when a child exited with code 0 but left stdout empty with stderr content, appending \n(empty stdout) so diagnostic failures immediately clarify that the test stdout was lost rather than displaying an ambiguous error.
  3. Adds regression coverage in tests/test_run_gpu_tests.py:test_check_py_run_flags_empty_stdout.

Validation:

  • Ran python -I tests/test_run_gpu_tests.py: 63 tests OK.

@morodirule

Copy link
Copy Markdown

Tested 43df6c6 on Arch Linux, Python 3.14.10, CPU only (no GPU run; the fflush half is C++): pass — tests/test_run_gpu_tests.py 63/63 OK including the new empty-stdout test. Negative control: check.py + vk_compute_test.cpp swapped to merge-base → exactly 1 failure (the new test, '(empty stdout)' missing); restored, green again. Overlap note: complements #7439 (transport-layer marker vs result-parsing note; verified they compose — the marker can't suppress the note), land both or either independently. No game files. AI-assisted.

@HungLe17

Copy link
Copy Markdown

Tested 43df6c60 on Windows 11 build 26200, RTX 3060 12 GB, NVIDIA 610.88, MSVC 19.51 Release: pass.

  • python -I tests/test_run_gpu_tests.py: 63 passed, including test_check_py_run_flags_empty_stdout.
  • run_gpu_tests.py --filter cs_buf_tail --disasm-dir tests/semantic/fixtures/disasm --assembler python --require-pass: 1/1 passed. The runner used the Python assembler and skipped spirv-val because it was unavailable.
  • Ten direct vk_compute_test.exe runs with subprocess.run(capture_output=True) each exited 0, printed all eight expected words to stdout, and identified the RTX 3060 on stderr. The parent 51e7c9d also passed 10/10, so the original intermittent empty stdout did not reproduce on this setup.

Synthetic inputs only. AI-assisted.

@airp1ane

Copy link
Copy Markdown
Contributor

Tested 43df6c6 on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass.

Ran the test files this PR adds or changes, from a clean checkout of the PR head: test_run_gpu_tests.py - all exit 0.

AI-assisted (Claude Code).

@phudyka

phudyka commented Nov 23, 2026

Copy link
Copy Markdown

Tested on NVIDIA GeForce GTX 1080 (Pascal, subgroup 32..32, no mesh shaders or fragment barycentrics), Linux (Ubuntu 26.04.1), driver 580.178.04, llvm-mc 21. No game files.
This PR (head 43df6c6) merged on main 0d31cdd (clean merge), test programs rebuilt from that tree; compared with main 0d31cdd alone, full run_gpu_tests.py:

  • LEONIDA_W64_EMULATE=1: 213/241 passed, 28 skipped, 0 failed
    • LEONIDA_MESH_COMPUTE=1 LEONIDA_BARY_FALLBACK=1 LEONIDA_TEXOFF_FALLBACK=1: 222/241 passed, 18 skipped, 1 failed

Test programs rebuilt from the merged tree. Every PASS/FAIL/SKIP row and its words are identical to main; no result line missing.
The one failure in the fallback run is ms_wave_info_s3, which fails on main too (SHADER-766, fixed by #5741).

AI-assisted.

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.

5 participants