Skip to content

GPU: list only pipelines retained by the host library as prebuilt - #2336

Open
andrewpozdnakov7-jpg wants to merge 4 commits into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex2/prebuilt-requires-library-entry
Open

andrewpozdnakov7-jpg wants to merge 4 commits into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex2/prebuilt-requires-library-entry

Conversation

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

Prebuild::make used to record every successfully created host PSO in prebuilt-pipelines.txt, even when D3D12 refused StorePipeline. A later prebuild would skip that key although the library could not load the PSO. StorePipeline can refuse an existing name or fail to allocate storage. D3D12 API

The library now reports whether it loaded or stored the PSO. Prebuild adds the title key only in those cases. A PSO that was successfully created remains usable after a refused store.

The same synthetic Windows/WARP test on 940d32f and this patch seeded a conflicting library name. The incoming compute PSO was created and StorePipeline returned E_INVALIDARG. On 940d32f, prebuild listed that key. With the change, the refused key stayed pending and the successfully stored control was the only key in the saved list. The focused pipeline suite passed 17 tests. The full GPU suite on app-local WARP passed 147 project tests with 2 ignored. Strict GPU Clippy with and without diagnostics and the staged asset policy passed.

Coordination claim

Please retain the Git author when reapplying this change. If you fold it into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com>.

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

Static review only: victory-gpu is Windows-only; not compiled or tested on this macOS arm64 host. Only pipelines actually retained by the host library are listed as prebuilt (in_library threaded through HostPipeline) — fixes prebuilt listings for pipelines the library refused to store. Looks correct.

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

Tested against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.
  • Test failure on both RTX 5090 and WARP: pipeline::host::tests::a_host_pipeline_refused_by_the_library_is_not_listed_as_prebuilt fails at crates/victory-gpu/src/pipeline/host.rs:843:13 — the spawned child test process (VICTORY_TEST_PIPELINE_STORE_REFUSAL=1) exits abnormally right after printing running 1 test on both hardware (RTX 5090) and VICTORY_WARP=1 (15/16 passed in pipeline::).

AI-assisted (Gemini 4 Neon).

Match the compute bytecode used by production prebuilds and include the child process exit status and stage in failures.
@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

@DenRakEiw thanks for the failure report. bc52643 switches the fixture from FXC cs_5_1 to the same synthetic SM 6.6 DXIL emission path prebuild uses. The child now reports its last phase and Windows exit status if it stops early.

The original ac424bf ran on local app-local WARP. Inbox WARP on this machine skipped at the directly indexed root signature. The updated fixture reaches the real duplicate-name StorePipeline refusal on 940d32f, where it fails because the refused key is marked prebuilt. On bc52643 the same fixture persists only the successfully stored key. The full app-local WARP suite passed 147 project tests (0 failures, 2 ignored). Strict Clippy passed with and without diagnostics, and the asset policy passed.

Could you rerun this test on the RTX 5090 at the new head? If it still stops early, the phase and exit status will narrow it down. For a forced software run, victory-gpu reads VICTORY_D3D12_WARP=1 when built with --features diagnostics.

AI-assisted with Codex. Synthetic shaders only.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. library::pipeline (crates/victory-gpu/src/pipeline/library.rs) now returns a PipelineState that says whether the PSO was loaded from the library or stored in it, and Prebuild::make (pipeline.rs) lists a key as prebuilt only in that case. A PSO whose StorePipeline was refused stays pending and is still used. The merge with the depth-bounds stream builders in pipeline/host.rs passes the result through stream_pipeline and every HostPipeline constructor.

On your reply: the conflict resolution looks right. The new test re-runs its own test binary as a child process for the device's process-wide cache, which is the same pattern existing tests on main use. CI: passing.


Generated by Claude Code

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

The #158 depth-bounds merge conflicted with the pipeline-library result in pipeline/host.rs. I resolved it in daa944a on 842b0cb. The new vertex and mesh stream builders still choose the depth-stencil state based on host support and now carry through the library result.

On app-local WARP, the existing cache fixture confirmed that the stored key was persisted and the refused PSO remained pending. Both upstream depth-bounds tests passed in the same GPU suite, which finished with 247 passed and one ignored. Strict GPU Clippy in both configurations and the staged asset policy passed.

@fuzeofficlal

Copy link
Copy Markdown
Contributor

Code review and RTX 5090 + WARP verification at head daa944a7b659 merged cleanly onto main (63bcca43c6a0):

  • Code review (library.rs:258-300, pipeline/host.rs, pipeline.rs:672-674):
    • PipelineState { pso, in_library } accurately threads library retention across all three pipeline paths (compute, mesh, graphics): false when no library exists, true on load hit, and StorePipeline(...).is_ok() on fresh compile (without incrementing l.added on failure such as E_INVALIDARG).
    • Prebuild::make() calls library::note_prebuilt(key) only when pipeline.in_library is true, keeping prebuilt-pipelines.txt consistent with the saved ID3D12PipelineLibrary1 blob across cold and incremental warm runs so refused pipelines are not falsely skipped later.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory-gpu --tests -- -D warnings (default + --features diagnostics): 0 warnings
    • pipeline::: 24/24 passed default on RTX 5090; 27/27 passed (--features diagnostics) on both RTX 5090 and WARP
    • Confirmed a_host_pipeline_refused_by_the_library_is_not_listed_as_prebuilt executed end-to-end (unskipped) on both RTX 5090 and WARP through SM 6.6 DXIL compilation, StorePipeline E_INVALIDARG refusal, save, and prebuilt-pipelines.txt check.

LGTM.

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.

5 participants