Skip to content

GPU diagnostics: skip host pipeline creation by shader hash - #1320

Open
gurvancampion wants to merge 1 commit into
Marvisak:mainfrom
gurvancampion:topic/skip-pipeline-compile
Open

gurvancampion wants to merge 1 commit into
Marvisak:mainfrom
gurvancampion:topic/skip-pipeline-compile

Conversation

@gurvancampion

Copy link
Copy Markdown

Summary

VICTORY_SKIP_PIPELINES filters commands during recording, after an early cache hit or a host lookup can already send the matching pipeline to a worker. Pending::new now records the matching hash and marks the host result complete and absent. early and ready leave it off the queue. Draw and dispatch diagnostics keep reporting skipped shader {hash}.

  Matching title pipeline
-   early / ready → queue → Pending::make → HostPipeline::new
+   Pending::new → completed without a host pipeline
+   early / ready → return without queueing
  Recording drops matching work before the indirect argument clamp

This extends the diagnostic used to isolate pipeline compilation crashes. Issue #144

Evidence

  • pipeline::make::tests::skipped_pipeline_stays_off_the_queue failed on base with both queue flags set (0 passed, 1 failed). It passed on head (1 passed, 0 failed) and checked that both pipelines were complete and the synthetic shader was untranslated. Run with cargo xwin test -p victory-gpu --features diagnostics --locked --target x86_64-pc-windows-msvc pipeline::make::tests::skipped_pipeline_stays_off_the_queue.
  • cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings passed on both revisions.
  • cargo xwin clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings passed on both revisions.
  • cargo xwin test -p victory-gpu --features diagnostics --locked --target x86_64-pc-windows-msvc passed under GE-Proton with Vulkan disabled. Base had 53 passes. Head had 54 passes. Both had one ignored test.
  • cargo xwin test --workspace --locked --target x86_64-pc-windows-msvc --no-fail-fast recorded 322 passes on each revision. With --all-features, base recorded 326 passes and head recorded 327. Both modes had the same 20 failures on base and head under no-GPU Wine, plus six ignored tests. The runs passed with those 20 cases filtered. The cases require a shader-model-6.6 device or Wine support for windows, a networking export, a nested Cargo build, or Git.
  • cargo test -p xtask --locked repository_passes_policy passed natively on both revisions. cargo xtask policy --staged passed for all three changed files.
  • cargo fmt --all -- --check reported existing formatting differences on both revisions. Changed Rust lines pass against rustfmt.toml. git diff --check origin/main HEAD passed.

Not verified

Native Windows, live D3D12 and the retail title were outside this no-GPU run. Existing platform errors prevent full native Linux workspace tests and Clippy.

Merge Danger

Door Blast radius
Two-way Module

A revert restores record-time filtering for matching Windows diagnostics pipelines. The pipeline cache format stays compatible.

AI disclosure

OpenAI Codex (gpt-6.2-sol) assisted with the implementation, synthetic tests, verification, and PR draft. Antigravity (Gemini 4 Neon) coordinated and reviewed the diff. The author reviewed the diff and description before opening the PR.

@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 (D3D12/windows_sys) — nothing compiles or runs on macOS; this is source review plus the PR's own Windows tests.

VICTORY_SKIP_PIPELINES now skips host pipeline creation, not just draws: Pending::new computes skipped_shader once, pre-publishes made=None so ready() answers immediately, and early()/queueing are bypassed (made.get().is_none() guard). Draw/dispatch accounting (is_skipped, note_drop) reads the stored hash instead of recomputing. parse_skip_hashes moved to cfg(all(feature=diagnostics, any(windows, test))) so the parsing test runs anywhere the crate does. The new skipped_pipeline_stays_off_the_queue test verifies neither cold nor warm pipelines queue workers. Sound; diagnostics-only feature.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. This now merges cleanly into main, and CI (check) passes.

With VICTORY_SKIP_PIPELINES set, a matching pipeline is now never created on the host. Pending::new (crates/victory-gpu/src/pipeline/make.rs) checks the hash list once and stores made = Some(None) for a match. ready and early then never queue it, and is_skipped / note_drop read the stored hash instead of searching on every draw. On main, skipped_shader only filtered at recording time, so the pipeline was still translated and made.

What I checked:

  • The rebase includes the three Pending::new calls in draws_go_ahead_of_early_starts that main added since.
  • The cfg changes to parse_skip_hashes, OnceLock and the test still match what is built on non-Windows.
  • The new test checks that a skipped shader is never translated.
  • Everything is behind the diagnostics feature, and there are no dependency changes.

The README row is a one-line wording update.

Not changed by this PR: the report in the comment above that a skipped direct dispatch may not log a drop reason on main. That is worth a separate issue if it reproduces.


Generated by Claude Code

@BaggyALPHA

Copy link
Copy Markdown
Contributor

Rebased this onto main 940d32f locally and tested it: the behaviour it claims is real and I measured it, but the rebase needs one change beyond the two conflicting files — main has since added three call sites of Pending::new that the new signature does not compile against.

Triage asked for a rebase, so I did one to see what it would take. Setup: RTX 3080 (driver 621.24), Ryzen 7 5800X, 32 GB, Windows 11 26300, pinned main 940d32f, separate CARGO_TARGET_DIR per tree.

What the rebase runs into

  1. README.md — trivial: keep your new VICTORY_SKIP_PIPELINES wording, keep main's newer VICTORY_GPU_TIMING row (it gained "a device removal names the list it happened in...") and its new VICTORY_TRACE_SHADERS row.
  2. pipeline/make.rs — main moved the key into a key() helper, added a log("created", &key, ...) call, added the now / taken fields, and early() now starts with super::library::note_created(&p.key). Your three pieces layer on top cleanly: the skip_hashes parameter, skipped_shader plus the pre-set made, and the p.made.get().is_none() guard in early() (keeping note_created before it).
  3. Not a conflict, but it breaks the build: main added draws_go_ahead_of_early_starts, which calls Pending::new(Vec::new(), None) three times. Those need the third argument (#[cfg(feature = "diagnostics")] &[]). Worth writing them in the same multi-line shape you used in first_use_is_made_by_a_worker — on one line they cost six rustfmt diffs; multi-line, the tree's rustfmt --check output is identical to main's.

Checks on the rebased tree

check rebased #1320 main 940d32f control
cargo test -p victory-gpu --features diagnostics --locked 145 passed, 2 failed 144 passed, the same 2 failed
same without diagnostics 141 passed, same 2 failed –
clippy --all-targets -- -D warnings, with and without the feature clean –
rustfmt --check diff count per file identical to control (main is not rustfmt-clean)
cargo xtask policy 182 files ok –

The two failures are descriptor::host::tests::dynamic_slots_are_held_until_released and memory::tests::lists_share_a_table_and_copies_keep_their_views — the capped-view-heap pair (FIND-9), failing identically on the control, so nothing here. Net effect is one extra passing test. Your skipped_pipeline_stays_off_the_queue and skip_hashes_accepts_full_hashes_only both pass, and the former is a good test: asserting the shader is never even translated is the part that matters.

The claim itself, measured. Three short boot-only runs with the local title, one compute program created early in boot used as the probe (same warm cache, same scripted input):

run probe's shader translated host pipeline made for it
rebased #1320, nothing skipped yes yes
rebased #1320, probe skipped no no
main 940d32f, same probe skipped yes yes

So on main a skipped pipeline is still translated and still made and only its commands are dropped, and with this PR it is never created at all. That is exactly the difference the description claims, and it is the capability #1972 needs for the 61 pipelines that crash AMD's shader compiler on creation — worth linking them.

One half I could not verify. "Draw and dispatch diagnostics keep reporting skipped shader {hash}" — I saw no drop reason for the probe in these runs, because a boot-only run on this card ends at the format-115 device removal (#1781/#1753) before that program is dispatched, so nothing exercised the record path for it. Separately, on main I could not get a skipped direct dispatch to report a reason at all in a longer world run, while a skipped indirect one reported 20-30 times (notes on #1968). Since this PR keeps that reporting path, it may be worth a look — a switch whose effect cannot be confirmed from the log is easy to draw a wrong conclusion from, which I did before catching it.

I have not pushed anything; the rebase is local and the resolution is described above so it stays your commit. Nothing from the game here: test counts, log line kinds and timings. Inputs were the local title for the three runs and synthetic for everything else.

AI-assisted (Claude Code); results are from the runs and builds described.

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.

4 participants