Repository navigation
runtime/test: check.py's test programs write stdout unbuffered, so a run that ends without the final flush keeps its result lines - #7428
Conversation
…run that ends without the final flush keeps its result lines iTzAlvar measured vk_compute_test exiting 0 with an empty stdout in 5 of 450 piped runs (RTX 5080, NVIDIA 621.24, Windows 11), while stderr still had the device line: piped, stdout is fully buffered and the process ended without the C runtime's final flush, so check.py saw only "exit 0: device: ...". vk_compute_test, vk_store_test, vk_harness, vk_texture_test, vk_bindless_test and vk_sampler_test now start with setvbuf(stdout, nullptr, _IONBF, 0), as allocator_proxy_test, bvh_builder_test and others already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N2Zsqu4iNRbxKbY4BF95Tr
|
Tested 7d36550 on Intel Iris Xe Graphics (TGL GT2, Xe-LP, subgroup 8..32), Mesa ANV 26.3.1, Vulkan 1.4.363, Linux 6.12 (Arch container on Debian 13), GCC, llvm-mc 23.1.5, SPIRV-Tools v2026.4: pass. Branch and its merge-base b2801e2 built and run side by side.
Synthetic fixtures only, no game files. AI-assisted (Claude Code). |
CaravelaLabs
left a comment
There was a problem hiding this comment.
Reviewed 7d3655073 on Ubuntu 24.04.
- Read the six
mains. Each already includes<cstdio>and none uses iostream.std::setvbuf(stdout, nullptr, _IONBF, 0)is the same call asallocator_proxy_testandbvh_builder_test. These are exactly the programscheck.pyruns. - Sandbox
cmake --buildof those six targets: all linked. - No-args usage on
vk_harness,vk_bindless_test,vk_sampler_test,vk_store_test: exit 2, usage on stderr.vk_texture_test --self-test-cube-alpha: exit 0. - Did not rerun the GPU suite (the hourly tester is using the GPU) and did not reproduce the original piped empty-stdout flake.
#7484 fflush's vk_compute_test only and tags empty stdout in check.py. Unbuffered stdout here covers all six programs; fflush-at-return would miss an _exit during teardown.
Found nothing.
AI-assisted.
|
Tested 7d36550 on NVIDIA GeForce RTX 4080 SUPER, driver 621.01, Windows (MSVC 14.51 / Visual Studio Community 2026, RelWithDebInfo): pass (build + code review +
AI-assisted. |
|
Tested AMD Radeon RX 6700 XT (gfx1031, RDNA2), RADV Mesa 26.3.1, CachyOS, Linux 7.3.5, Python 3.14.
AI-assisted (Claude Code). |
|
Tested 7d36550 and its merge-base This adds the piped loop on NVIDIA under Windows, next to the ANV loop above (no reproduction) and the MSVC build check on the 4080 SUPER (no loop). Loop:
Caveat: both builds are the standalone tools built with llvm-mingw 20261117 (clang 23.1.6, UCRT, libc++), No game files. AI-assisted (Claude Code). |
|
Tested
A data point for the flake itself: on this Ampere card / 621.01 I did not reproduce the empty piped stdout in 5 × 175 piped |
|
Tested Built the six Suite: Stress check of the reported symptom: 300 piped runs of
The flush loss did not reproduce on this Turing card, so this confirms the change causes no regression here, not that it fixes the RTX 5080 case. AI-assisted. |
lucastayaralvarenga-ui
left a comment
There was a problem hiding this comment.
GPU validation — PR #7428
Reviewed head: 7d36550731c8ede9e285da4f75da8535b2838c10
Base tested: main 6664b0dbb270a7d71912f79e3a8d9e7aa5a87029
Setup: NVIDIA GeForce RTX 4060 (8 GB), driver 621.24, Windows 11 Pro build 26300, MSVC 19.44, RelWithDebInfo, Vulkan SDK 1.4.363.0, LLVM 23.1.6.
Code review and build
Applied this commit locally with git cherry-pick --no-commit onto the base above; it applied cleanly at that revision. All six changed programs built successfully. Each setvbuf call is before the program's stdout use. No blocking code findings in this narrow stdout-preservation change.
GPU and captured-output results
| Check | main | main + this PR |
|---|---|---|
python -I scripts/run_gpu_tests.py --require-pass |
191 pass, 48 skip, 1 fail | 191 pass, 48 skip, 1 fail |
| SPIR-V translation / validation | 246/246 translated, 246/246 valid | 246/246 translated, 246/246 valid |
450 sequential vk_compute_test cs_cvt_f32_sat.spv 1 dump launches, using Python subprocess.run(capture_output=True) |
450 exit 0, complete stdout | 450 exit 0, complete stdout |
All 240 per-test result lines match exactly between the suite runs. The one failure in both is ms_wave_info_s3: the frame remains (-1,-1,-1,-1). This is already covered by the separate mesh-allocation work (e.g. #7136); it is not introduced by this PR. Both full-suite commands therefore exit 1.
The captured output in all 900 compute launches is identical (112 bytes on Windows). I did not reproduce the spontaneous empty-stdout symptom on this RTX 4060, so these batches cannot establish that the original intermittent failure is fixed.
Controlled no-flush check
To isolate the stdout safeguard, I built two local copies of the actual compute test source with its original main renamed, then called it from a wrapper that uses TerminateProcess(GetCurrentProcess(), result) immediately after it returns. This deliberately bypasses the CRT's normal exit/stdio flush, after the GPU work and the test's cleanup have run:
- Without this PR: exit 0, 0 stdout bytes, 51 stderr bytes.
- With this PR: exit 0, 112 stdout bytes including the result, 51 stderr bytes.
This is an injected termination control, not a reproduction or diagnosis of the real NVIDIA failure. It confirms that unbuffering preserves the already-written result under that condition.
Recommendation
The stdout safeguard behaves as intended in the controlled check, with no result changes in the GPU suite. Keep the root cause of the original intermittent termination open; this test does not explain it.
Synthetic repository fixtures only; no game files used. AI-assisted review and test execution (Codex).
|
The empty-stdout symptom did not reproduce on a desktop RTX 5070, NVIDIA 616.92, Windows 11 Pro build 26200 (Vulkan 1.4.351). I built the PR head and its direct parent with MSVC 19.44.35223, x64
Each invocation ran This gives a native MSVC/Blackwell data point with identical output across builds. Since the parent also passed all 450 runs, the effect on the original RTX 5080 failure remains unconfirmed here. |
|
@username634 the MSVC data point you asked for, on NVIDIA under Windows: your exact loop (
So no reproduction with the MSVC CRT either, on Ampere / 621.01 (plus the 5 × 175 |
|
Tested 7d36550 on RX 5700 XT (RDNA1, gfx1010, RADV NAVI10), Mesa 26.3.1, Linux 6.18: pass
LLVM AI-assisted (Claude Code). |
|
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.
Test programs rebuilt from the merged tree. Every PASS/FAIL/SKIP row and its words are identical to main; no result line missing. AI-assisted. |
iTzAlvar's finding in the coordination issue:
vk_compute_testsometimes exits 0 with an empty stdout when piped (5 of 450 runs on an RTX 5080, NVIDIA 621.24, Windows 11), andcheck.pythen shows onlyexit 0: device: .... Stderr, which is unbuffered, keeps thedevice:line; piped stdout is fully buffered and is lost, so the process ends without the C runtime's final flush.The six programs
check.pyruns (vk_compute_test,vk_store_test,vk_harness,vk_texture_test,vk_bindless_test,vk_sampler_test) now start withsetvbuf(stdout, nullptr, _IONBF, 0), asallocator_proxy_test,bvh_builder_testand others already do.Tested (Linux, Mesa llvmpipe, test shaders built with LLVM 20.1.2):
check.pygives the same result before and after: 110 of 211 pass, 99 skipped, and the same 2 llvmpipe failures as onmain._exit(0), so the process ends duringexit()before stdio's flush: onmain,vk_compute_test cs_cvt_f32_sat.spv 1 dump | catexits 0 with 0 bytes on stdout and only thedevice:line on stderr (the reported symptom); with this change, the same run prints its 109 bytes.AI-assisted (Claude); I reviewed the change and the runs.
🤖 Generated with Claude Code
https://claude.ai/code/session_01N2Zsqu4iNRbxKbY4BF95Tr