Skip to content

GPU: read VICTORY_SKIP_PIPELINES in release builds too - #91

Open
omeuniercombet wants to merge 1 commit into
fxceless:mainfrom
omeuniercombet:pr/skip-pipelines-release
Open

omeuniercombet wants to merge 1 commit into
fxceless:mainfrom
omeuniercombet:pr/skip-pipelines-release

Conversation

@omeuniercombet

Copy link
Copy Markdown

What

VICTORY_SKIP_PIPELINES was compiled only with the diagnostics feature, so a player whose card's shader compiler crashes or stalls on one program had to run the diagnostics build just to skip it. This reads the list in release builds too.

  • The three is_skipped checks in draw.rs and the list parsing in pipeline.rs lose their diagnostics gate. The list is read once (OnceLock); with the variable unset the check returns at once.
  • The per-reason drop counts (note_drop) stay diagnostics-only.
  • README: the table row says it is also read by a release build.
  • skip_hashes_accepts_full_hashes_only now runs without the feature.

Why

Issue #3 (RX 9070 XT) needs three kinds of skips on AMD, and I hit the same on an RX 6600 XT: one 71 KB compute program kept AMD's compiler busy for 164 s and its private commit grew by about 10 GB, until Windows ran out of commit and the device was removed at the end of the opening cutscene. Skipping that program let the run reach the prologue checkpoint.

Checked

  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features: clean.
  • cargo test --workspace --locked: passes (the asset-policy test only complains about an untracked local launcher script in my working copy, nothing in the commit).
  • In game (release build, Series X profile, RX 6600 XT 8 GB, 16 GB RAM): the title reaches and plays the prologue with a skip list set. I did not measure any frame-rate difference, and this change is not meant to give one.

Not done

Early-pipeline prewarming still queues a skipped program's pipeline if its key is in early-pipelines.txt; I worked around that locally by removing the key. Making prewarm honour the skip list would be a separate change.

AI-assisted (Claude): written and checked on my machine with my own copy of the game. Hashes and counts only; no game data.

@ericomeehan

Copy link
Copy Markdown

Before merging: this branch is based on 4e17478 ("The game is no longer named in the tree"), but its commit puts the full name back in place of "the title" on six comment lines. Four are in crates/victory-gpu/src/draw.rs: the stride note, the scissor/target note, the "draws what it sees" note and the indirect-rectangles note. Two are in crates/victory-gpu/src/pipeline.rs: the module doc and the stream-layout test doc. On the PR head, git grep -c finds the name 4 times in draw.rs and 2 times in pipeline.rs; main and #106 have none. It looks like those files were copied from before 4e17478. With those six lines reverted, the PR is just the cfg changes and the README row.

#106 makes the same VICTORY_SKIP_PIPELINES change and goes a little further. The four cfg changes in pipeline.rs are identical. In draw.rs, #106 gates the same three places with #[cfg(windows)] where this PR removes the gate, and it also counts skipped dispatches in DROPPED in release builds. The two PRs conflict on the same lines, so only one can be merged. #106 doesn't have the naming problem and also adds the separate texture-queue settings.

I only read the diffs; I didn't build or run either branch.

Written with an AI assistant (Claude).

A card's shader compiler that crashes or stalls on one program (AMD, issue fxceless#3 and similar) needed a diagnostics build just to skip it. The skip list is read once, and the check is a lookup that costs nothing when the list is empty. Drop counts per reason stay diagnostics-only.
@omeuniercombet
omeuniercombet force-pushed the pr/skip-pipelines-release branch from a141049 to c7ece02 Compare November 24, 2026 22:25
@omeuniercombet

Copy link
Copy Markdown
Author

Thanks for catching that! Rebased onto latest \main\ and cleaned up the six pre-\4e17478\ comment lines, gated the three \draw.rs\ checks with #[cfg(windows)], and kept \DROPPED\ counting on skipped dispatches in release builds. (Also happy if the maintainer prefers merging #106 instead if they want the texture-queue settings bundled with it.)

@JFIREonFIRE

Copy link
Copy Markdown

A follow-up for the "not done" part. With this PR the skip list is read in release builds, but a skipped pipeline is still started at the title's creation call. hand_out calls make::early whenever the pipeline library lists the pipeline as used early, and that path never asks the skip list. So a program skipped because it crashes the host's shader compiler (#145, #120) still reaches that compiler while loading. The draw-time checks in draw.rs are fine; only this early start bypasses them.

The patch below goes on top of this PR's head a141049. It splits the lookup into skip_hashes() / first_skipped(), so hand_out can leave skipped pipelines out of the early start, and adds a test of the lookup.

Checked on an RTX 3090 (Windows 11):

  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features: clean.
  • cargo test --workspace --locked: passes. victory-gpu gives 112 passed, 1 ignored.
  • Not run on an AMD card, where the compiler crash happens.

Take it into this PR if you like; that's simpler than a separate PR.

patch (git apply)
 crates/victory-gpu/src/pipeline.rs | 48 ++++++++++++++++++++++++------
 1 file changed, 39 insertions(+), 9 deletions(-)

diff --git a/crates/victory-gpu/src/pipeline.rs b/crates/victory-gpu/src/pipeline.rs
index a1a4f12..62fe5d4 100644
--- a/crates/victory-gpu/src/pipeline.rs
+++ b/crates/victory-gpu/src/pipeline.rs
@@ -426,20 +426,33 @@ fn parse_skip_hashes(value: &str) -> Vec<String> {
         .collect()
 }
 
+/// The hashes `VICTORY_SKIP_PIPELINES` names, read once.
 #[cfg(windows)]
-fn skipped_shader(p: &Pipeline) -> Option<&str> {
+fn skip_hashes() -> &'static [String] {
     static HASHES: OnceLock<Vec<String>> = OnceLock::new();
-    let hashes = HASHES.get_or_init(|| {
+    HASHES.get_or_init(|| {
         let value = std::env::var("VICTORY_SKIP_PIPELINES").unwrap_or_default();
         parse_skip_hashes(&value)
-    });
-    if hashes.is_empty() {
+    })
+}
+
+/// The first of `hashes` that `skip` names.
+#[cfg(windows)]
+fn first_skipped<'a>(
+    hashes: impl IntoIterator<Item = &'a str>,
+    skip: &[String],
+) -> Option<&'a str> {
+    if skip.is_empty() {
         return None;
     }
-    p.shaders
-        .iter()
-        .find(|shader| hashes.contains(&shader.hash))
-        .map(|shader| shader.hash.as_str())
+    hashes
+        .into_iter()
+        .find(|hash| skip.iter().any(|s| s == hash))
+}
+
+#[cfg(windows)]
+fn skipped_shader(p: &Pipeline) -> Option<&str> {
+    first_skipped(p.shaders.iter().map(|s| s.hash.as_str()), skip_hashes())
 }
 
 #[cfg(windows)]
@@ -503,8 +516,15 @@ fn hand_out(
     tracing::trace!(?shaders, "pipeline state");
     #[cfg(windows)]
     let host = Arc::new(make::Pending::new(shaders.clone(), graphics));
+    // A skipped pipeline is never drawn with, so it is not made early
+    // either: a program that crashes or stalls the host's shader compiler
+    // is skipped to keep that compiler away from it.
     #[cfg(windows)]
-    make::early(&host);
+    if let Some(hash) = first_skipped(shaders.iter().map(|s| s.hash.as_str()), skip_hashes()) {
+        tracing::debug!(hash, "VICTORY_SKIP_PIPELINES: not made early");
+    } else {
+        make::early(&host);
+    }
     #[cfg(windows)]
     let builder = of_builder(&shaders);
     #[cfg(windows)]
@@ -724,6 +744,16 @@ pub fn save_pipeline_cache() {
 
 #[cfg(test)]
 mod tests {
+    #[cfg(windows)]
+    #[test]
+    fn skipped_pipelines_are_found_by_any_of_their_shaders() {
+        let skip = super::parse_skip_hashes("0011223344556677");
+        let vs_ps = ["8899aabbccddeeff", "0011223344556677"];
+        assert_eq!(super::first_skipped(vs_ps, &skip), Some("0011223344556677"));
+        assert_eq!(super::first_skipped(["8899aabbccddeeff"], &skip), None);
+        assert_eq!(super::first_skipped(vs_ps, &[]), None);
+    }
+
     #[cfg(windows)]
     #[test]
     fn skip_hashes_accepts_full_hashes_only() {

AI-assisted (Claude Code).

@MamaLeVrai

Copy link
Copy Markdown

Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head c7ece02 into main f85101b in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings fails with exactly the errors main itself has on this machine (placed_filler_twins, depth_written, a sort; PR #841 fixes them); with --all-features it fails with the same number of errors as main (4). This PR adds none and removes none. cargo test --workspace --locked: run 1: 556 passed, 0 failed, 11 ignored (main alone: 555 passed). Run 2: one failure. The failure is indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields, which fails on main itself most runs here (PR #849 fixes its assertion; see issue #850). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

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.

4 participants