Skip to content

GPU: a WARP host keeps its pipeline library in a file of its own (#2637) - #2646

Open
Creaa wants to merge 3 commits into
Marvisak:mainfrom
Creaa:gpu/pipeline-library-per-host
Open

Creaa wants to merge 3 commits into
Marvisak:mainfrom
Creaa:gpu/pipeline-library-per-host

Conversation

@Creaa

@Creaa Creaa commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

The host pipeline library was one file, host-pipelines.bin, for every host. A run with VICTORY_D3D12_WARP=1 rejected the hardware library, started an empty one and saved it over the file; the next hardware run rejected that one and made every pipeline during play. A WARP host now keeps its library in host-pipelines-warp.bin; hardware keeps host-pipelines.bin, so existing caches stay valid. Fixes #2637.

What is in it

  • crates/victory-gpu/src/host.rs: Host::software, set when the device is made on the software adapter (the existing VICTORY_D3D12_WARP diagnostics switch).

  • crates/victory-gpu/src/pipeline/library.rs: library_file(software) / host_library_file(); the library is read from and saved to the file of this run's host. Test warp_and_hardware_hosts_keep_their_own_library.

  • Same file: the pre-build's list (prebuilt-pipelines.txt, tagged with its library's bytes) also has a WARP file, prebuilt-pipelines-warp.txt (raised by @DrDarkDK in review). Test each_host_reads_back_its_own_prebuilt_list: two tagged lists in one folder, each read back for its own library.

  • crates/victory-gpu/src/pipeline/library.rs (test only, by @andrewpozdnakov7-jpg, 940d410): warp_cache_save_and_reload_preserve_hardware_files (diagnostics builds) saves and reloads the WARP library in fresh processes over marker bytes at the hardware file names and checks both stay byte for byte; it passes here (hardware blob 40 -> 40 bytes, index 35 -> 35).

Tested

Not tested

  • The run sequence of the issue end to end (a cached hardware library, a WARP run, then a hardware run) with the title: covered by the file name, not by a title run.
  • Two different hardware adapters in one machine sharing the folder: they still share host-pipelines.bin, as before.

AI use

  • Claude Code (Claude Opus 5.5) wrote the change and the test, ran them, and drafted this description; I checked it.

🤖 Generated with Claude Code

@DrDarkDK

Copy link
Copy Markdown

The library blobs are now separate, while both adapters still use prebuilt-pipelines.txt. That list carries a tag derived from its library blob. If a hardware prebuild is followed by a WARP prebuild in the same cache directory, WARP can replace the list with its own tag. The next hardware prebuild then rejects the list and prepares those pipelines again, even though the hardware blob is intact.

Could the adapter selection also choose the prebuilt-list filename, keeping prebuilt-pipelines.txt for hardware? A focused test could write two tagged lists in one cache directory and verify that each adapter reloads its own entries.

Static review only.

AI-assisted with Codex.

@kotekompotek

Copy link
Copy Markdown

Reviewed: correct and minimal — WARP and hardware libraries are mutually incompatible, so a shared file got emptied on every switch. Recording software on Host at creation and splitting the filename closes #2637. CI green.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

I ran the production WARP save and reload path in separate processes. The synthetic cache directory starts with a 40-byte marker at host-pipelines.bin.

  • Main 13f91ca replaced the marker with an 872-byte WARP library. The separate WARP file was absent in all three runs.
  • Exact PR head 63def7e preserved all 40 hardware-path bytes and wrote the 872-byte library to host-pipelines-warp.bin. A fresh WARP process reloaded the saved library and its tagged entry in all three runs.
  • The author head with this test passed all 10 library tests, strict victory-gpu Clippy, and the staged policy. The run used app-local D3D12 WARP with a synthetic hardware-path marker.

The test-only commit a855fd7 is directly on your exact head. It checks the library files and reload path. The shared prebuilt index review covers the cross-adapter index separately.

AI-assisted (Codex 2). Please retain the Git author on cherry-pick or rebase. If folding the test into another commit, please retain Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com.

@Creaa

Creaa commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@DrDarkDK thanks, right: the list is tagged with its library's bytes, so it needs a file per host too. Done in 39b921e: a WARP host keeps prebuilt-pipelines-warp.txt, hardware keeps prebuilt-pipelines.txt, and each_host_reads_back_its_own_prebuilt_list writes two tagged lists in one folder and checks each reads back for its own library. cargo test -p victory-gpu --lib library: 10 passed; clippy (also with diagnostics) clean.

AI use: Claude Code (Claude Opus 5.5) made the change and drafted this reply.

@oni-swr

oni-swr commented Nov 25, 2026

Copy link
Copy Markdown

Independent verification of head 63def7ea91feaa960abff96b489ec865c3b9032f merged onto origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca.

  • Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1 (48a229cea 2026-09-01), -j 4, WARP only (VICTORY_WARP=1, VICTORY_D3D12_WARP=1; d3d10warp 10.0.26100.9818), DXC/DXIL 1.8.2502.11 (Windows SDK 10.0.26100.0 x64 dxil.dll on PATH). No physical GPU device was created by the test runs.
  • Diff: host.rs (Host.software) and pipeline/library.rs (host-pipelines-warp.bin for WARP; host-pipelines.bin unchanged for hardware); addresses GPU: one host pipeline library for every adapter, so a WARP run discards the hardware one #2637. Merges cleanly.
  • clippy (-p victory-gpu --features diagnostics --all-targets): no warnings.
  • cargo test --locked -p victory-gpu --features diagnostics: 199 passed, 0 failed, 1 ignored (origin/main under WARP: 198/0/1).
  • Negative control: kept the test, made library_file return LIBRARY_FILE for both: warp_and_hardware_hosts_keep_their_own_library fails.
  • Extra end-to-end check (temporary test, not committed): under VICTORY_D3D12_WARP=1, host().software is true and host_library_file() is host-pipelines-warp.bin, so the selection is wired through, not only the pure helper.
  • Found: no bugs. Notes: the PR's test covers the pure library_file mapping only (the wiring check above was mine). It does not cover two different hardware adapters sharing host-pipelines.bin, which GPU: one host pipeline library for every adapter, so a WARP run discards the hardware one #2637 mentions as an option and this PR does not claim.

Independent verification by Claude Code (Claude Sonnet 5.5), an AI. No game files, dumps or shader names were used. Each PR head was merged (no conflicts) onto origin/main and run with --locked; clippy used --all-targets.

@fuzeofficlal

Copy link
Copy Markdown
Contributor

Tested 39b921ee merged cleanly onto main (13f91ca) on Windows 11 with NVIDIA GeForce RTX 5090 (32.0.16.1656) and D3D12 WARP (--features diagnostics):

  • RTX 5090 (VICTORY_D3D12_WARP=0, --features diagnostics) pipeline::library::tests: 10 passed, 0 failed
  • WARP (VICTORY_D3D12_WARP=1, --features diagnostics) pipeline::library::tests: 10 passed, 0 failed
  • WARP (VICTORY_D3D12_WARP=1, --features diagnostics) full victory-gpu --lib: 200 passed, 0 failed, 1 ignored
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default and --features diagnostics): clean (0 warnings)

Splitting both host-pipelines-warp.bin and prebuilt-pipelines-warp.txt while keeping adapter-independent early-pipelines.txt shared looks clean and avoids prebuilt tag invalidation across adapter switches.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

I ran the same production-path test with both a library marker and an index marker at the hardware filenames.

  • Earlier head 63def7e leaves the 40-byte library marker intact, but WARP saves its index over the 35-byte hardware index.
  • Updated head 39b921e preserves both markers byte for byte, writes both WARP-specific files, and reloads the tagged entry in a fresh WARP process. Three paired runs gave the same result.
  • The updated head with the fixture passed all 11 library tests, strict victory-gpu Clippy, and the staged policy.

Test-only commit f3e5b2c is directly on 39b921e and covers both paths in one fixture. The hardware paths use synthetic marker bytes. WARP uses the real D3D12 library save and reopen.

AI-assisted (Codex 2). Please retain the Git author on cherry-pick or rebase. If folding the test into another commit, please retain Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. Now merges cleanly with main. create in crates/victory-gpu/src/host.rs records whether the device is on WARP (Host::software), and pipeline/library.rs picks host-pipelines-warp.bin / prebuilt-pipelines-warp.txt for that host while hardware keeps the existing names, so switching adapters no longer empties the other's library (#2637); early-pipelines.txt stays shared, which is right since it lists title pipelines, not driver bytes. Both load (library) and save go through the same helpers, so they can't disagree. The two new tests are thin (one checks file-name constants, the other reads back files it just wrote); the cross-process WARP save/reload check offered in this thread (andrewpozdnakov7-jpg's f3e5b2c) would be a stronger test to fold in. Nit: a stray blank line in the Host { .. } initialiser.

CI: passing. Recommending a look, not approving.


Generated by Claude Code

Creaa and others added 2 commits November 26, 2026 05:35
…visak#2637)

`host-pipelines.bin` was one file for every host. A run with
VICTORY_D3D12_WARP=1 rejected the hardware library (the blob is for another
adapter), started an empty one and saved it over the file; the next hardware
run rejected that in turn and made every pipeline during play. The host now
records whether it is on the software adapter, and a WARP host reads and
writes `host-pipelines-warp.bin`; hardware keeps `host-pipelines.bin`, so
existing caches stay valid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`prebuilt-pipelines.txt` is tagged with its library's bytes, so with one
file for both hosts a WARP pre-build replaced the hardware list and the next
hardware run refused it and prepared those pipelines again, though its
library was intact. A WARP host now keeps `prebuilt-pipelines-warp.txt`;
hardware keeps `prebuilt-pipelines.txt`. Raised by DrDarkDK in review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

@Creaa I moved the cross-process test from f3e5b2c to your current b605e29. 688b388 is a single test-only commit directly on that head.

With app-local Agility 1.620.2 and WARP 1.0.22, three fresh save/reload pairs left the synthetic 40-byte hardware library and 35-byte hardware index byte-for-byte intact. Each save wrote both WARP-specific files, and a new process found the tagged entry in the WARP prebuilt index. All 14 pipeline-library tests and strict all-feature GPU Clippy passed.

If you take the test, please retain its Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com> when folding it into another commit. AI-assisted with Codex.

@Creaa

Creaa commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@andrewpozdnakov7-jpg thanks, taken as is with you as its author: 940d410, on top of b605e29. Here (diagnostics build, WARP) it passes: hardware blob 40 -> 40 bytes, hardware index 35 -> 35, the tagged entry reloaded. victory-gpu library tests, clippy (default and --all-features) and policy pass.

AI use: Claude Code (Claude Opus 5.5).

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

Reviewed and verified head 940d41009e785b7f455ca897289f2f22f0e43cfe (clean merge with origin/main 63bcca43) on Windows 11 x64 with NVIDIA GeForce RTX 5090 and D3D12 WARP (VICTORY_D3D12_WARP=1, VICTORY_D3D12_DEBUG=1, Rust 1.98.1).

Code review

  • crates/victory-gpu/src/host.rs (L46, L190, L257): recording Host::software directly from the existing VICTORY_D3D12_WARP diagnostics switch is minimal and compiles cleanly both with and without --features diagnostics (and stays inside the Windows-only host module). Minor cosmetic nit: stray blank line at L256 in the Host initializer.
  • crates/victory-gpu/src/pipeline/library.rs (L133-158, L168-172, L374-377): both library() and save() route through host_library_file() (host-pipelines-warp.bin vs host-pipelines.bin) and prebuilt_file(host_software()) (prebuilt-pipelines-warp.txt vs prebuilt-pipelines.txt), respecting whatever cache directory use_pipeline_cache configures while keeping adapter-independent early-pipelines.txt shared.
  • Folding in warp_cache_save_and_reload_preserve_hardware_files (L555) gives genuine cross-process coverage of the WARP save/reload path.

Verification

  • cargo xtask policy: 191 files ok
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features): 0 warnings
  • pipeline::library::tests:
    • RTX 5090 (default): 13 passed, 0 failed
    • RTX 5090 (--features diagnostics, VICTORY_D3D12_DEBUG=1): 14 passed, 0 failed
    • WARP (VICTORY_D3D12_WARP=1, --features diagnostics, VICTORY_D3D12_DEBUG=1): 14 passed, 0 failed (WARP save: hardware blob 40 -> 40 bytes, hardware index 35 -> 35 bytes)
  • Additional 4-process cross-adapter check sharing one temporary cache directory (VICTORY_D3D12_DEBUG=1): saved a real compute PSO + prebuilt entry on RTX 5090 (host-pipelines.bin 2,250 B, prebuilt-pipelines.txt 71 B), then saved on WARP (host-pipelines-warp.bin 1,846 B, prebuilt-pipelines-warp.txt 73 B) and verified both hardware files remained SHA-256 identical; fresh RTX 5090 and fresh WARP processes each reloaded only their own prebuilt key and loaded their cached PSO from disk without recompiling, with 0 D3D12 Debug Layer messages.

Clean fix for #2637; approving.

@Dukestar69 Dukestar69 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM — verified on RTX 5090 (Windows / D3D12) against origin/main (63bcca4).

  • Tracking Host::software and isolating the WARP pipeline library file prevents WARP diagnostic runs from clobbering or rejecting the hardware GPU's pipeline cache.
  • cargo test -p victory-gpu --lib pipeline::library:: -- --test-threads=1: 13 passed, 0 failed (including warp_and_hardware_hosts_keep_their_own_library and each_host_reads_back_its_own_prebuilt_list).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPU: one host pipeline library for every adapter, so a WARP run discards the hardware one

8 participants