Skip to content

Report driver feedback for application pipeline-cache hits - #912

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
nschlaepfer:codex/pipeline-cache-feedback
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
nschlaepfer:codex/pipeline-cache-feedback

Conversation

@nschlaepfer

@nschlaepfer nschlaepfer commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

The checker reports that it read the seed file, but that alone cannot tell whether the graphics driver found a particular pipeline in the application cache. #367 used a private diagnostic to answer this for a runtime pipeline.

Add an opt-in --cache-feedback summary, grouped by translated stage. For successful creations it counts valid application-cache hits, valid replies without the hit flag, and unavailable feedback. The three counts sum to the number of successful pipelines. A driver may also use an internal cache. A hit can reflect work earlier in the same run. Skips and failures stay separate.

Verification. Ran the committed checker on five synthetic pipelines with three compute, one vertex and one pixel shader. On native Windows 11, the RTX 5090 (621.14) reported zero application-cache hits for a fresh application cache and five after the saved cache was reopened. The same counts held with three workers and with compiler statistics enabled on both runs. On Mesa llvmpipe, all five pipelines succeeded in both runs and the driver reported zero hits each time. The default invocation produced no feedback lines. Limits that skipped every module contributed no hits.

AI-assisted. This extends the offline corpus checker. Coordination claim

RTX 5090 package sample. On native Windows 11 with driver 621.14, I selected six compute, six vertex and six pixel shaders before translation, spaced by container size within each stage among distinct programs in containers of at most 8,192 bytes. All 18 translated, passed SPIR-V validation and produced pipelines on both runs. The fresh application cache reported 0 of 18 hits. After reopening the saved cache, the driver reported 18 of 18 hits. Both runs had zero failures and zero capability skips. Graphics pipelines used the checker’s synthetic partner stages. This measures pipeline creation and cache feedback for these 18 small shaders. Draws, gameplay and larger shaders were outside the test.

@poststructural

Copy link
Copy Markdown

Checked pr912 on Linux: NVIDIA GeForce RTX 2080 (Turing, proprietary driver, Vulkan 1.4.341) and Mesa llvmpipe (LLVM 21.1.8), LEONIDA_VK_VALIDATION=1, GCC. AI-assisted.

Input: 12 synthetic compute modules, i.e. 4 byte-identical copies each of the three vk_descriptor_bench --dump-spv modules, with a hand-written index.json; no game data. --jobs 4 --cache-feedback:

run cs cache feedback
RTX 2080, fresh cache file 7 hits, 5 no hit reported, 0 unavailable (only 3 distinct modules, so later copies hit what earlier ones just compiled: the in-run case your description mentions)
RTX 2080, saved cache reopened 12 hits, 0, 0
llvmpipe 0 hits, 12 no hit reported, 0 unavailable

Each row adds up to the 12 ok pipelines. There were no validation messages, and without the flag nothing extra is printed. Code read: cpi.pNext was null before, so chaining fci there drops nothing, and on the graphics side fci keeps rend behind it.

Not covered: the graphics path (I had no partner stubs for this synthetic set) and a pre-1.3 device going through the extension path.

@quackottu quackottu 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.

Tested 53d2c61 on NVIDIA GeForce RTX 5070, driver 621.24, Windows 11 Pro (26300), VS 2022 Build Tools, Vulkan SDK 1.4.363.0, with LEONIDA_VK_VALIDATION=1 and LEONIDA_D3D12=vulkan: pass

  • ctest -C RelWithDebInfo: 100% tests passed, 0 tests failed out of 32
  • 33 test programs in the build pass with 0 validation errors
  • d3d12_clear_test fails (R8G8B8A8_UNORM/SNORM 0.5 ties and a D16 clear byte differ from WARP) exactly as on main 4a36bb1 here, so not from this PR; #521 addresses it

Implicit Vulkan layers (overlays) were off through an empty VK_IMPLICIT_LAYER_PATH.

@tylerstraub

Copy link
Copy Markdown
Contributor

Tested 53d2c6126bc789c99e4b7a443440348b4e7cb0d5 on NVIDIA GeForce RTX 5090, 595.99.02 (Linux).

Checked graphics pipeline-cache feedback on Linux RTX 5090 (595.99.02) at 53d2c6126bc789c99e4b7a443440348b4e7cb0d5. I built this head's vk_pipeline_check and used the repository's synthetic vertex and pixel stub generators for both indexed shaders and partners. Eight index entries reuse two vertex/pixel pairs, one with no varying and one with location 0. All modules passed SPIR-V validation.

With one worker, the driver reported the following application-cache feedback. Each row accounts for all eight successful graphics pipeline creations.

Application cache Pixel entries (hit / no hit reported) Vertex entries (hit / no hit reported) Unavailable
Fresh file 2 / 2 4 / 0 0
Reopened in a new process 4 / 0 4 / 0 0

The first process saved 25,774 bytes and the second loaded that size. Repeated pairs allow in-run hits even with a fresh file. A third run without --cache-feedback created all eight pipelines and printed no feedback rows. This exercises graphics pipeline creation and accounting on the core Vulkan path. Draw output, compile-time speedup, and the pre-1.3 extension path were outside this check. Synthetic inputs only. AI-assisted.

AI-assisted verification.

@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 53d2c61 on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass (no regression against main).

  • Clean RelWithDebInfo Ninja build of runtime/ (Vulkan SDK 1.4.363.0), then ctest with validation on: 32/32 pass.
  • GPU tests with LEONIDA_VK_VALIDATION=1 and the Khronos validation layer: d3d12_com_test, d3d12_descriptor_test, d3d12_gcl8_test, d3d12_method_variants_test, d3d12_resource_desc_test, d3d12_sampler2_test, d3d12_state_map_test, d3d12_typeless_rtv_test, d3d12_uav_clear_test, d3d12_vulkan_device_test, vk_command_replay_test pass, with 0 validation messages (no VUIDs).
  • d3d12_clear_test fails, the same as on plain main dcd8ecf on this GPU (NVIDIA rounds the 0.5 clear on 8-bit UNORM/SNORM down, Vulkan 7f, WARP 80, plus one depth-format-55 case). This is not caused by this PR.

The vk_* harness tests that need translated SPIR-V weren't run. No game files used. AI-assisted run (Claude Code).

@UlteriorMotive00

Copy link
Copy Markdown
Contributor

Tested 53d2c61 on AMD RDNA2 iGPU and RTX 5070: pass, and the feedback behaves as docs/pipeline_check.md describes on both drivers.

Windows 11 Home 10.0.26300, MSVC 14.44.35207, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, Ninja RelWithDebInfo (scripts\build_runtime.ps1), VK_LOADER_LAYERS_DISABLE=~implicit~. One PC, two GPUs, picked with VK_LOADER_DRIVERS_SELECT: AMD Radeon iGPU of a Ryzen 7 9800X3D (RDNA2, AMD 2026.04.17) and NVIDIA GeForce RTX 5070 (Blackwell, 617.42).

vk_pipeline_check <spirv> <new>.cache --cache-feedback twice per GPU, with a fresh cache file each time, on the 95 translated test shaders from runtime/test/shaders/build.py:

run 1 (empty cache) run 2 (seeded)
AMD iGPU, ps (45) 0 hits, 45 no hit reported, 0 unavailable 45 hits, 0 no hit reported, 0 unavailable
AMD iGPU, vs (4) 0 hits, 4 no hit reported, 0 unavailable 4 hits, 0 no hit reported, 0 unavailable
RTX 5070, ps (45) 0 hits, 45 no hit reported, 0 unavailable 45 hits, 0 no hit reported, 0 unavailable
RTX 5070, vs (4) 0 hits, 4 no hit reported, 0 unavailable 4 hits, 0 no hit reported, 0 unavailable

All pipelines succeeded in all four runs (exit 0), so the AMD proprietary driver gives valid feedback too, not only NVIDIA's. ctest with LEONIDA_VK_VALIDATION=1: RTX 5070 32/32; AMD iGPU 31/32. The AMD failure is the base's OPTIONS19.SupportedSampleCountsWithNoOutputs mismatch (since fixed on main), not this PR.

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

@tylerstraub

Copy link
Copy Markdown
Contributor

Tested f53fc3fa48578496b867dd4a76ec9bc1053332ff on NVIDIA GeForce RTX 5090, 595.99.02 (Linux).

Repeated the graphics cache check from 53d2c61 with the checker rebuilt at f53fc3fa48578496b867dd4a76ec9bc1053332ff. On Linux RTX 5090 (595.99.02), all eight synthetic pipeline entries succeeded in each of three processes.

  • Fresh application cache: pixel entries reported 2/4 hits, vertex entries 4/4. The entries reuse two shader pairs, allowing hits within the run.
  • Reopened 25,774-byte cache: pixel and vertex entries each reported 4/4 hits, with zero unavailable responses.
  • Feedback disabled: all eight entries succeeded and the checker printed no feedback rows.

The counts match the earlier head. This check covered graphics pipeline creation and cache accounting on the core Vulkan path. It did not measure draw output or compile-time speedup. AI-assisted.

AI-assisted verification.

@ItsNotRexed
ItsNotRexed merged commit 2d93239 into ItsNotRexed:main Nov 22, 2026
10 of 11 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.

7 participants