Stage the full in-flight report before replacing its destination, using the existing checked checkpoint writer. Preserve the last complete snapshot if staging or replacement fails.
ps_sdwa_f16_const read mrt0 lane y as 0x0000 instead of 0x1c00 on NVIDIA: the
_sdwa src0_sel:BYTE_1 selects the f16 denormal 0x0040 (2^-18), and the driver
flushed it on the way into f32 because the module declared no 16-bit denormal
mode. The translator models f16 arithmetic in f32 with integer narrowing, so no
f32 denormal is involved and that conversion is what the 16-bit mode governs.
Every module now also emits OpExecutionMode %main DenormPreserve 16 with the
matching capability (core since SPIR-V 1.4, so no extension), and the index
lists shaderDenormPreserveFloat16, which vk_pipeline_check requires and
--no-float-controls still drops along with the 32-bit mode.
Tested on an RTX 4070 SUPER (driver 610.88, validation layers on): the GPU test
goes from 4096/4096 mismatches to 4096/4096 pixels exact, and the full GPU suite
from 142/189 to 143/189 passed with 0 failures and the same 46 skips.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
vk_pipeline_check previously created one VkPipelineLayout with a hardcoded 144-byte push-constant range and set 0 only (without checking vkCreatePipelineLayout's result). On a 128-byte push-constant device (AMD Windows RDNA2 iGPUs, some Intel Arc drivers) that violates VUID-VkPushConstantRange-size-00298, and every --pc-tail-ubo shader declaring set 1 fails pipeline creation with VK_ERROR_UNKNOWN / VUID-VkComputePipelineCreateInfo-layout-07988.
Parse push_constant_bytes and pc_tail.bytes from index.json (with strict from_chars validation, tested in check_vk_pipeline_cli.cmake), skip shaders whose required push-constant size exceeds props.limits.maxPushConstantsSize, add set 1 (UNIFORM_BUFFER_DYNAMIC at binding 0), and create one pipeline layout per distinct (push_bytes, has_pc_tail) needed by the selected shaders within the device limit.
Claimed in #2300.
Co-Authored-By: Gemini 4 Neon <noreply@google.com>
Review of #2111 (@matheuskshn): an explicit empty argument followed by a filename was accepted, because an empty
cache_path stood for both "not given" and "given as ''". A flag now records that the cache path was given, so a
second positional argument is always a usage error (exit 2), and the message quotes both values.
Tested: `vk_pipeline_check <dir> "" b.bin` and `<dir> a.bin b.bin` exit 2 with the message; one cache path still runs
(62/62 real compute modules, RTX 5070 Ti / 621.24) and writes the cache. No new warnings. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #2111 (@Pipodi): the in-flight table got its entry only just before vkCreateComputePipelines /
vkCreateGraphicsPipelines, so a thread busy in vkCreateShaderModule (or a large module there, alone behind
compile_gate) was invisible: the watchdog never named it, and --inflight-file couldn't name a module that died there.
- The entry is made once the worker holds compile_gate, before vkCreateShaderModule, with phase "module"; it becomes
"pipeline" when the pipeline is created, and is removed on every path out of the loop (a pipeline, a skip, a failed
module). A module over --large-module-bytes writes the file when it enters the driver, not only at its pipeline.
- --inflight-file lines are "name<TAB>phase"; make_game.py reads the name.
- The watchdog says "still creating the shader module of X" or "still compiling X".
Waiting on compile_gate is not in the table: that thread isn't in the driver.
Tested on Windows 11 Pro 25H2, MSVC 14.51 + Ninja, RTX 5070 Ti / 621.24: the crash end-to-end through
make_game.pipelines on 62 real compute modules (skipped, the other 61 checked); the in-flight file at a simulated
crash reads "<module>\tpipeline" and is empty after a clean pass (62/62). tests/test_make_game_pipelines.py writes the
tab format; all 14 test_make_game*.py files pass. No new warnings. No game data. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #2111 (@matheuskshn): a vk_pipeline_check built before this PR takes any argument it doesn't know as the
cache path. Run with --inflight-file F, it would write the Vulkan pipeline cache into F and exit 0; make_game.py would
then delete F and report success, with no pipeline_cache.bin. That happens with a reused runtime build or a supplied
Windows build (#2194).
- make_game.py asks the checker first: run without arguments it prints its usage before touching Vulkan, and only a
build that lists --inflight-file and --skip-file gets them and the crash retry. An older build runs exactly as before
(one call, a crash stops the stage), with a log line saying to rebuild the runtime stage for crash recovery.
- vk_pipeline_check: an unknown --option or a second positional argument is now a usage error (exit 2) instead of
silently becoming the cache path, so the next new option can't be swallowed the same way.
Tested on Windows 11 Pro 25H2, MSVC 14.51 + Ninja, RTX 5070 Ti / 621.24:
- checker_supports: True for this build, False for a 6a6704df build (before this PR).
- the new checker: --no-such-option and a second cache path exit 2 with a message.
- make_game.pipelines on 62 real compute modules: with this build and a simulated crash, the module is skipped and
the other 61 checked, as before; with the 6a6704df build, one call without the new flags, exit 0, and the cache in
pipeline_cache.bin (6.7 MB), nothing written to pipeline_inflight.txt.
- tests/test_make_game_pipelines.py: 11 tests, 2 new (an older checker gets the old invocation and isn't retried;
support is read from the usage line). All 14 test_make_game*.py files pass.
No game data. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #1847: (1) read_index returned on the closing brace without checking
that only whitespace follows, so {}garbage was accepted: now it is malformed.
(2) Malformed and empty input keep 'malformed JSON in ...' (open PR #1735's CLI
test asserts it); only a file that cannot be opened or read says 'cannot read'.
(3) The file is read with read() and its gcount checked, since
istreambuf_iterator bypasses the stream state. (4) The test's find_binary also
checks runtime/build/vk_pipeline_check.exe (single-config Windows Ninja).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Since dcd8ecf the two #881/#884 giants pass spirv-val and are back in the corpus. On NVIDIA the larger one runs the
driver's compiler out of memory (LLVM ERROR: out of memory, exit 0x80000003), vk_pipeline_check dies with it, and the
pipelines stage stops: on @VeTkN's RTX 5070 (#884, c603b8f) about 5,750 pipelines after it were never checked or
cached, and make_game.py exited 1.
vk_pipeline_check:
- --inflight-file F keeps the names of the modules being compiled in F. It is rewritten when a module over
--large-module-bytes starts or finishes (those compile alone, #903, so F then names exactly that module), by the 5 s
watchdog for the others, and emptied at the end of the pass.
- --skip-file F: modules named in F are not compiled; each is reported as `MODULE CRASH <name> (<stage>, killed the
driver in an earlier run; not retried)` and counted as a failed pipeline, as --isolate does on POSIX. --isolate
passes it on to its children. A missing F is a usage error (exit 2).
make_game.py, pipelines stage:
- runs the checker with --inflight-file. When it exits other than 0, 1 or 2 (a crash, not Ctrl+C), the modules in
the in-flight file are added to pipeline_crashes.txt and the checker runs again with --skip-file; what was already
compiled comes back from pipeline_cache.bin (checkpointed every 10 minutes). If several modules were compiling, each
is tried alone (--start/--count in the checker's name-sorted index) and only those that crash alone are skipped.
- a crash no module can be named for is not retried, nor is Ctrl+C, and there are at most 5 restarts.
- the stage still fails when anything failed, now after checking everything else, and names the modules that took
the driver down. pipeline_crashes.txt is cleared at the start of each pipelines stage, so a module gets a fresh
chance after a translator change.
- run() takes check=False and returns the exit code.
The --isolate child-process mode stays POSIX-only; with a multi-GB pipeline cache per child it is too heavy for the
default path. A memory cap for the checker on Windows, so the OOM doesn't take other programs down, is a follow-up.
Tested on Windows 11 Pro 25H2, MSVC 14.51 + Ninja, RTX 5070 Ti / 621.24:
- tests/test_make_game_pipelines.py: 6 new cases (a named crasher is skipped and the rest checked; several in flight
are tried alone and only the crasher is skipped; no suspect or Ctrl+C is not retried; the retry limit; a clean run is
one call and an old skip list is dropped). All 14 test_make_game*.py files pass.
- end to end on 62 real compute modules from my own copy's work folder (2 over 4 MiB), through make_game.pipelines:
with VK_PIPELINE_CHECK_SIMULATE_CRASH on one large module, the first run died (exit 3), the in-flight file named
that module, the second run checked the other 61 (all ok) and saved the cache, and the stage failed naming it.
Without the hook: one call, 62/62, exit 0. The in-flight file is empty after a clean pass.
No game data. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RDNA2 float ops return NaN, +-inf and -0 as computed. Without float controls,
Vulkan lets the driver assume none of them occur, and AMD's compiler does. On
an RX 9070 XT (26.11.2), x != x NaN checks fold to false and -0 products come
back +0. With integer f16 narrowing (#575), NaN results are never stored.
- rdna2spirv.py: every module declares the SignedZeroInfNanPreserve capability
and OpExecutionMode SignedZeroInfNanPreserve 32. The index entry lists the
property it needs (float_controls). --no-float-controls leaves both out.
- vk_pipeline_check: reads float_controls and skips a shader on a device
without shaderSignedZeroInfNanPreserveFloat32.
- GPU test cs_signed_zero_nan (check.py, run_gpu_tests.py): without the mode,
out[4..7] are 0 on AMD; with it, all eight words match.
- tests/test_translate.py: covers the mode, the index entry and the opt-out.
- docs/design.md: a "Float controls" contract row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- vk_pipeline_check.cpp: #1826's --isolate-batch parsed with the val() helper #1735 replaced, so the checker
didn't build; it now uses number() like the other options.
- check_vk_pipeline_cli.cmake (#1735) matched "malformed JSON"; #1847's index parser names the file and position
("index.json: expected '{' at byte 0"), which the check now matches.
- test_tbuffer_store: BUF_FMT_8_UINT stopped being an unsupported example once #1871 added the 8/16-bit UINT/SINT
formats; it uses BUF_FMT_8_USCALED.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
read_index did not check that the stream opened and returned an empty index,
with no error, for an empty input, so a wrong directory exited 0 after checking
nothing. Both now set the error (exit 2, before Vulkan is loaded); a valid {}
stays an intentionally empty index. tests/test_vk_pipeline_check_index.py covers
missing, empty, whitespace-only, malformed and {} (no GPU needed).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
--isolate (POSIX only; an error on Windows) runs the check in child processes
over --isolate-batch modules at a time. A child killed by a signal has its
batch bisected to the module, which is reported as MODULE CRASH, counted as a
failed pipeline and makes the exit status 1; the rest is checked as usual.
Children share cache.bin one after another (atomic saves). The test hook
VK_PIPELINE_CHECK_SIMULATE_CRASH=<name substring>[:SIGNAL] raises a signal
before a matching pipeline is created, so tests/test_vk_pipeline_check_isolate.py
checks this with five hand-assembled compute shaders and no crashing driver.
Normal (non-isolated) output is unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Corpus (scripts/vs_input_survey.py, all 2,236 VS): no exp prim, no s_sendmsg, no v_mbcnt, every
VS exports pos0/param, so the console runs them as legacy hardware VS. Their input VGPRs are
Mesa's GFX10 legacy layout (radv_shader_args.c, declare_vs_input_vgprs, not is_ngg): v0 vertex
id, v1 unused, v2 primitive id, v3 instance id; no VS reads v1/v2 on entry, 788 start with the
fetch call and read attributes from v4.
Those ids are zero-based on the hardware (ac_nir_lower_intrinsics_to_args.c: vertex_id is
load_vertex_id_zero_base, instance_id is load_instance_id; the bases come in SGPRs), while
Vulkan's VertexIndex/InstanceIndex include firstVertex|vertexOffset/firstInstance. The
translator now seeds v0 = VertexIndex - BaseVertex and v3 = InstanceIndex - BaseInstance
(DrawParameters; feature shaderDrawParameters in every VS's metadata).
GPU test vs_base_ids.asm, drawn with VKH_DRAW=16,7 (new vk_harness option): 0x101 on every
pixel, where before it was 0x7111. Run by check.py and run_gpu_tests.py. vk_harness,
vk_pipeline_check, vk_bindless_test, vk_texture_test and the runtime's Vulkan device enable
shaderDrawParameters. design.md's "Inputs and outputs" row replaces the "unverified" note.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GLSL.std.450 Fma may be split into two roundings by a driver (Vulkan
environment: inherited from OpFMul followed by OpFAdd); RDNA2 v_fma_* round
once. --fma khr (default stays glsl) emits OpFmaKHR with capability FMAKHR and
SPV_KHR_fma and lists shaderFmaFloat32 in the index. Runtime device creation
and the vk_* test programs enable VK_KHR_shader_fma when present; cs_fma_fused
tests single rounding; the mini interpreter learns OpFmaKHR.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The GPU tools picked a device with the shared ranker but never applied the
name filter the D3D12 tests have used since #861. Filter candidates through
vulkan_device_wanted in vk_device_pick.h, report a filter that matches nothing
instead of dereferencing a null device, and cover the filter cases in the
picker test. docs/testing.md no longer says the tools ignore it.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
With the Compatibility Pack installed, Windows enumerates Mesa's D3D12
translation layer next to the real GPU, and Dozen reports DISCRETE_GPU. Every
harness used "the last discrete device wins", so it selected the wrapper and
the resulting failures looked like translator bugs (#915). One shared rank now
treats Microsoft's vendor as a translation layer, then prefers discrete over
integrated over virtual over CPU, keeping the first device on a tie. A CPU-only
test covers the reported enumeration without needing the Compatibility Pack.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
vk_pipeline_check <spirv dir> --stats FILE enables VK_KHR_pipeline_executable_properties, creates the
pipelines with CAPTURE_STATISTICS and writes, for the executable that runs each translated shader (not
the partner stub's), every statistic the driver reports as CSV rows name,stage,statistic,value. On RADV:
instructions, VGPRs, SGPRs, spills, scratch size, waves per SIMD, and more.
scripts/shader_stats.py <stats.csv> <disasm dir> [--details] compares them with the original RDNA
listings: code growth, VGPRs against the highest VGPR the original uses, and which shaders use scratch or
spill (a register file that went to memory, e.g. through v_movrels with an unbounded index). Over the
corpus it says how many shaders compile badly.
RX 5700 XT (RADV), the repository's test shaders: 47 pipelines, no scratch or spills in any.
New tests/test_shader_stats.py (standard library only).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>