Skip to content

GPU: VICTORY_SKIP_WAVE64 diagnostics switch for wave64 programs - #579

Open
wbkepler wants to merge 1 commit into
Marvisak:mainfrom
wbkepler:gpu/skip-wave64-diagnostic
Open

wbkepler wants to merge 1 commit into
Marvisak:mainfrom
wbkepler:gpu/skip-wave64-diagnostic

Conversation

@wbkepler

Copy link
Copy Markdown

What

A diagnostics-only switch, VICTORY_SKIP_WAVE64=<stage>,... (mesh, compute, vertex, pixel). It omits draws and dispatches whose pipeline has a program of a listed stage written for 64-lane console waves. It counts and logs them like VICTORY_SKIP_PIPELINES, with the shader named. Unknown stage names are warned about and ignored. There is a new row under Debugging in the README.

Why

On NVIDIA (32-lane waves) the world hangs the GPU at dispatches of wave64 mesh and compute programs. There are hundreds of such programs, which is too many to list as hashes in VICTORY_SKIP_PIPELINES. With VICTORY_SKIP_WAVE64=mesh,compute, an RTX 5090 stayed in the world for almost 7 minutes without a device removal, where it otherwise failed within 25 to 95 s. Testers can use the switch to check whether a hang is in this class, or narrow it to one stage, on any build.

The program's wave size is read from its native program once per container and cached.

Tests

  • New unit test skip_stages_names_known_stages_only (parsing).
  • cargo clippy --workspace --all-targets, cargo clippy -p victory --features diagnostics --all-targets, cargo test --workspace, cargo xtask policy: pass. The remaining clippy warnings are already on main.

Overlaps with #578 (both add a cached Shader::wave64()). Whichever lands second needs a trivial rebase.

🤖 Generated with Claude Code

A diagnostics switch for 32-lane hosts: VICTORY_SKIP_WAVE64=mesh,compute
drops draws and dispatches whose pipeline has a program of a listed stage
written for 64-lane waves, so testers can tell whether those programs
cause a GPU hang without listing shader hashes one by one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Len1k Len1k mentioned this pull request Nov 24, 2026
r4tedx added a commit to r4tedx/VIctory that referenced this pull request Nov 24, 2026
…tch)

wbkepler's Marvisak#579: in diagnostics builds, VICTORY_SKIP_WAVE64=<stage>,...
(mesh, compute, vertex, pixel) omits draws and dispatches whose pipeline
has a program of a listed stage written for 64-lane console waves, and
counts them as VICTORY_SKIP_PIPELINES does.

No conflict. Marvisak#578 (the same author's refusal of such programs on hosts
without 64-lane waves) is not merged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
r4tedx added a commit to r4tedx/VIctory that referenced this pull request Nov 24, 2026
Seven more upstream PRs are in (Marvisak#493, Marvisak#483, Marvisak#206, Marvisak#469, Marvisak#459, Marvisak#454,
Marvisak#579) and the wave64 stack is at Marvisak#439's head 965ce30. Records how each
was combined with what the tree had, that a capped view heap keeps
2^18 dynamic slots and why, Marvisak#189 and Marvisak#578 as left out, and a new
section with testers' reports from the title: the set without the
world-entry hang on three NVIDIA cards and how this tree differs from
it, VICTORY_SKIP_WAVE64 as the switch to try, and Marvisak#136 bisected as
making every frame black.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@mercuryVM mercuryVM 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 1658c84 on Windows 11, RTX 5070, MSVC: the workspace passes (195 outside victory-shader; victory-shader --lib single-threaded: 69), and cargo test -p victory-gpu --features diagnostics --lib skip_stages passes.

  • Everything is behind cfg(all(windows, feature = "diagnostics")), including the new wave64 field, so release builds are unchanged.
  • Wave64 is read once per container from native_programs and cached in a OnceLock, so the per-draw check is a vector contains plus a cached bool. It reuses VICTORY_SKIP_PIPELINES's path, so skipped draws are counted and logged the same way.
  • Warning on unknown stage names, instead of silently matching nothing, is a good touch for a tester-facing switch.

No issues found. I can't reproduce the NVIDIA world hang here (no game package).

AI-assisted (Claude Code).

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
…switch for wave64 programs

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

Copy link
Copy Markdown

3090 / 24 GB confirmation on current main 8e79c80 + this PR's diff only (my one extra change is a local adapter picker, because D3D12CreateDevice(None) takes the display adapter, a 2070 SUPER on this box). Diag build, VICTORY_D3D12_DRED=1, no debug layer.

Same title and box as my #468 post: 1.0.2.1, blake3 b99f876b74d4a77f03af5f878223b27bd647b5c35a79d5decd9f716504239e93, Win11 26200, Ryzen 7 5800X3D, 64 GB, RTX 3090, driver 32.0.16.1088 (610.88).

With VICTORY_SKIP_WAVE64=mesh,compute, ten minutes in the world:

  • No device removal, no DRED breadcrumb, and no slow host submission at all. Without the switch the same run is removed at 188 s with 0x887A0006, right after an 11,225 ms single-list submission.
  • 0 host pipeline refused, against 117 compute refusals (all 0x80070057) without it. 218 distinct shaders skipped, 3,033 skip lines.
  • Menus are unchanged: 30.0 fps, 33.3 ms/frame, 0 dropped.
  • World: ~2 fps, ~420 draws/frame, ~3,660 dropped/frame without a host pipeline (vs ~3,000 without the switch), 474 shaders still do not translate - the same families as before (untracked mask, lane mask read as data, descriptor read only as data, unknown stride).
  • I couldn't watch the window during this run, so I can't say what the scene looked like beyond the black-frame log (58 frames flagged black after a non-black frame).

So on a 32-lane Ampere card this does what it says: the hang goes away, and what goes away with it is most of the world's draws.

Two follow-ups if useful, each about an hour on this box: mesh only and compute only, to see which of the two carries the hang; and the same build plus #89's formats 86/115, which still log no host texture here.

@R0D4X

R0D4X commented Nov 24, 2026

Copy link
Copy Markdown

Follow-up A/B test on RTX 5080 (Wave32, Windows 11) with PRs #334 + #579 + #669

(Follow-up to my initial main + #334/#578/#669 crash report in #71 (comment))

Setup: main (8e79c80) + #334 + #579 + #669, diagnostics build (--profile diag --features diagnostics), title build 1.0.2.1 (b99f876b74d4a77f), automated menu entry (VICTORY_KEYS=18:Enter,24:Enter,30:Enter,36:Enter,42:Enter).

Run Environment Result
Run A VICTORY_D3D12_DRED=1, VICTORY_SKIP_WAVE64=mesh,compute No device removal over the full 210 s run (~2 min 42 s continuously in the world until clean stop). Steady 3.2–5.1 fps (~60 ms GPU/frame, ~400–438 draws/frame). The previously hanging compute shader eeed82b877b44b5f was bound at frame 1644 and cleanly skipped; the world ran for another ~88 s afterward with zero crashes.log entries.
Run B VICTORY_D3D12_DRED=1, VICTORY_SHADER_LOOP_LIMIT=4096 (no VICTORY_SKIP_WAVE64) DXGI_ERROR_DEVICE_HUNG (0x887A0006) at 91.7 s (shortly after entering the world), no page fault. DRED (matched via #669) stops at list 7 of 28, command 125 of 149 (op 5), isolated between barriers 124..126: indirect kind 10 max 1 at 0x42ced4b4 [mesh f9c79a2d484bd75a, pixel a144abbc586fa5b2].

Takeaway:

This was referenced Nov 24, 2026

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: README.md, crates/victory-gpu/src/pipeline.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

geiyiliyabumo pushed a commit to geiyiliyabumo/VIctory that referenced this pull request Nov 25, 2026
GPU: Upload the resident levels of placed 2D texture views
@imrealynailong

Copy link
Copy Markdown

Rebased onto main 940d32f — patch below, plus a run on an RTX 4060 Laptop

The triage marker on this PR is needs-rebase (README.md, crates/victory-gpu/src/pipeline.rs against ac2525d/current main). I resolved both against 940d32f and the result builds and tests clean; the patch is at the end.

What the two conflicts were, and how I resolved them

crates/victory-gpu/src/pipeline.rs — the branch built Shader { … } inline in shader(); main now routes through Shader::new(stage, bytes). I kept main's call and put the new wave64: OnceLock::new() inside Shader::new instead, so the struct has one constructor again:

fn new(stage: &'static str, bytes: &[u8]) -> Shader {
    Shader {
        stage,
        hash: blake3::hash(bytes).to_hex()[..16].to_owned(),
        container: bytes.to_vec(),
        #[cfg(windows)]
        translated: OnceLock::new(),
        #[cfg(all(windows, feature = "diagnostics"))]
        wave64: OnceLock::new(),
    }
}

README.md — both sides added rows to the Debugging table, so I kept both sets: VICTORY_GPU_TIMING and VICTORY_TRACE_SHADERS from main, and VICTORY_SKIP_WAVE64 from this branch.

Net diff against 940d32f: 2 files, +68/−4.

Checks

result
cargo build --profile diag -p victory --features diagnostics ok, 18.8 s
cargo build --release -p victory ok, 32.2 s
cargo test --release -p victory-gpu --features diagnostics --lib 144 passed, 3 failed
same command on main 940d32f alone 143 passed, 3 failed

The three failures are the same on both trees — descriptor::host::tests::dynamic_slots_are_held_until_released, draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view, memory::tests::lists_share_a_table_and_copies_keep_their_views — so they are pre-existing here and not caused by the rebase. The rebase adds one passing test.

A run with the switch on, RTX 4060 Laptop (Ada), driver 32.0.15.6607

Not a clean measurement of this PR on its own: I had #2121 (view-heap paging) and #1763 (typed-UAV refusal) merged underneath, because without them the run dies at the boot-time UAV removal before the world is reached. Diagnostics build, title 1.0.2.1.

With #2121 + #1763 and no switch, the run ends at 0xC0000005 in title code (+0x23cf683, write 0x0) at frame 1,924. That is the signature in #1118.

switch highest frame= run end
none 1,924 142 s 0xC0000005 at +0x23cf683 (title code)
VICTORY_SKIP_WAVE64=mesh 2,254 111 s stopped in a compute-heavy stretch; no device removed, no exception in the log
VICTORY_SKIP_WAVE64=mesh,compute 2,792 158 s 0x887A0007 after a submission, GPU not responding

So on this card mesh alone gets past the +0x23cf683 stop, and mesh,compute gets further again before a different GPU-level failure. That is consistent with @Jitheswar's RTX 3050 Laptop result in #1118 (mesh skip: 0 of 5 runs reached that stop) and with @MD5Visual's and @R0D4X's runs here — three different NVIDIA generations now agree that the stop moves when these stages are skipped.

Caveat on the mesh-only row: the run ended while binding six compute pipelines at frame 2,254 and logged no device removed / no exception, so I cannot say from that log alone whether it hung or was cut off. I have not repeated it.

Not claimed

No frame capture was taken in these runs, so I cannot say whether the picture was the world or a flat colour. pages in use reported 2049 of 3906 (inside the 2,880 pages available to title slots, no exhaustion line) in the runs where #2121 was in play — that number looks deterministic across cards, so it adds little.

Patch

git format-patch 940d32f..HEAD
From 7044040e14425e3312bbe952ad2c155f455d43f1 Mon Sep 17 00:00:00 2001
From: imrealynailong <2275815336@qq.com>
Date: Wed, 25 Nov 2026 16:57:45 +0800
Subject: [PATCH] GPU: VICTORY_SKIP_WAVE64 omits draws of wave64 programs of
 listed stages

Rebased onto main 940d32f. The two conflicts were resolved by keeping
main's Shader::new constructor (the wave64 OnceLock is initialised there
instead of inline) and by keeping both sets of Debugging rows in the
README (VICTORY_GPU_TIMING, VICTORY_TRACE_SHADERS from main, and
VICTORY_SKIP_WAVE64 from the original branch).

Original commit: 1658c84 by the author of #579.
---
 README.md                          |  4 +-
 crates/victory-gpu/src/pipeline.rs | 68 +++++++++++++++++++++++++++++-
 2 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 4010879..0efc3ec 100644
--- a/README.md
+++ b/README.md
@@ -183,9 +183,9 @@ The on/off switches below (`...=1`) are off when unset or set to `0`.
 | `VICTORY_D3D12_GBV=1` | with the above, GPU-based validation (bad descriptor use reported, not faulted; slow) |
 | `VICTORY_D3D12_DRED=1` | on a GPU failure, the allocation hit and the commands in flight |
 | `VICTORY_SKIP_PIPELINES=<hash>,...` | omit draws and dispatches, including indirect ones, whose pipeline contains a listed 16-digit shader hash |
+| `VICTORY_SKIP_WAVE64=mesh,compute` | omit draws and dispatches whose pipeline has a program of a listed stage written for 64-lane waves (on hosts with 32-lane waves, such as NVIDIA's, these can hang the GPU) |
 | `VICTORY_GPU_TIMING=1` | with the above, each list of a submission run and timed on its own; slow lists logged with their slowest commands; a device removal names the list it happened in and lists all its commands |
-| `VICTORY_TRACE_SHADERS=<hash>,...` | with `VICTORY_D3D12_DRED`, every draw and dispatch of a listed shader logged with what it binds (user data, heap slots, root views and their first dwords; the first 500) |
-| `VICTORY_D3D12_WARP=1` | host device on the software adapter (slow; cannot reset the driver) |
+| `VICTORY_TRACE_SHADERS=<hash>,...` | with `VICTORY_D3D12_DRED`, every draw and dispatch of a listed shader logged with what it binds (user data, heap slots, root views and their first dwords; the first 500) || `VICTORY_D3D12_WARP=1` | host device on the software adapter (slow; cannot reset the driver) |
 | `VICTORY_PIPELINE_LOG=<file>` | a line per title pipeline created (key, shaders, state), first used, and made or loaded (library name); `translate --cache --pipelines` writes the last kind too |
 | `VICTORY_PREBUILD_KEYS=<file>` | `translate --cache --pipelines` makes nothing and lists each pack record's key, shaders and state (or why it is skipped) |
 | `VICTORY_SHADER_LOOP_LIMIT=<n>` | translated shader loops stop after `n` iterations per lane instead of 2^20 (own shader cache entries); if a lower `n` makes world frames much faster, loops hitting the limit are what makes them slow |
diff --git a/crates/victory-gpu/src/pipeline.rs b/crates/victory-gpu/src/pipeline.rs
index bd69afe..aa6fa8b 100644
--- a/crates/victory-gpu/src/pipeline.rs
+++ b/crates/victory-gpu/src/pipeline.rs
@@ -63,6 +63,10 @@ pub(crate) struct Shader {
     container: Vec<u8>,
     #[cfg(windows)]
     translated: OnceLock<Option<Translated>>,
+    /// Whether its native program runs in 64-lane console waves
+    /// (diagnostics: `VICTORY_SKIP_WAVE64`).
+    #[cfg(all(windows, feature = "diagnostics"))]
+    wave64: OnceLock<bool>,
 }
 
 impl std::fmt::Debug for Shader {
@@ -93,6 +97,8 @@ impl Shader {
             container: bytes.to_vec(),
             #[cfg(windows)]
             translated: OnceLock::new(),
+            #[cfg(all(windows, feature = "diagnostics"))]
+            wave64: OnceLock::new(),
         }
     }
 }
@@ -279,19 +285,66 @@ fn parse_skip_hashes(value: &str) -> Vec<String> {
         .collect()
 }
 
+/// The stages `VICTORY_SKIP_WAVE64` names (`mesh`, `compute`, `vertex`,
+/// `pixel`).
+#[cfg(all(windows, feature = "diagnostics"))]
+fn parse_skip_stages(value: &str) -> Vec<&'static str> {
+    value
+        .split(',')
+        .map(str::trim)
+        .filter(|s| !s.is_empty())
+        .filter_map(|s| {
+            let stage = ["mesh", "compute", "vertex", "pixel"]
+                .into_iter()
+                .find(|&k| k.eq_ignore_ascii_case(s));
+            if stage.is_none() {
+                tracing::warn!(
+                    stage = s,
+                    "VICTORY_SKIP_WAVE64 expects mesh, compute, vertex or pixel"
+                );
+            }
+            stage
+        })
+        .collect()
+}
+
+#[cfg(all(windows, feature = "diagnostics"))]
+impl Shader {
+    /// Whether the container's native program runs in 64-lane console waves.
+    fn wave64(&self) -> bool {
+        *self.wave64.get_or_init(|| {
+            victory_shader::Container::parse(&self.container)
+                .ok()
+                .and_then(|c| {
+                    c.part(victory_shader::FourCC::DXIL)
+                        .map(|p| p.data.to_vec())
+                })
+                .and_then(|d| victory_shader::native::native_programs(&d).ok())
+                .is_some_and(|ps| ps.iter().any(|p| p.wave64))
+        })
+    }
+}
+
 #[cfg(all(windows, feature = "diagnostics"))]
 fn skipped_shader(p: &Pipeline) -> Option<&str> {
     static HASHES: OnceLock<Vec<String>> = OnceLock::new();
+    static WAVE64: OnceLock<Vec<&'static str>> = OnceLock::new();
     let hashes = HASHES.get_or_init(|| {
         let value = std::env::var("VICTORY_SKIP_PIPELINES").unwrap_or_default();
         parse_skip_hashes(&value)
     });
-    if hashes.is_empty() {
+    let wave64 = WAVE64.get_or_init(|| {
+        let value = std::env::var("VICTORY_SKIP_WAVE64").unwrap_or_default();
+        parse_skip_stages(&value)
+    });
+    if hashes.is_empty() && wave64.is_empty() {
         return None;
     }
     p.shaders
         .iter()
-        .find(|shader| hashes.contains(&shader.hash))
+        .find(|shader| {
+            hashes.contains(&shader.hash) || (wave64.contains(&shader.stage) && shader.wave64())
+        })
         .map(|shader| shader.hash.as_str())
 }
 
@@ -684,6 +737,17 @@ pub fn wanted_early(key: &str) -> bool {
 
 #[cfg(test)]
 mod tests {
+    #[cfg(all(windows, feature = "diagnostics"))]
+    #[test]
+    fn skip_stages_names_known_stages_only() {
+        assert_eq!(
+            super::parse_skip_stages(" mesh,Compute ,,"),
+            ["mesh", "compute"]
+        );
+        assert_eq!(super::parse_skip_stages("hull,pixel"), ["pixel"]);
+        assert!(super::parse_skip_stages("").is_empty());
+    }
+
     #[cfg(all(windows, feature = "diagnostics"))]
     #[test]
     fn skip_hashes_accepts_full_hashes_only() {
-- 
2.45.2.windows.1

I am not the author of this branch and cannot push to it; the patch is offered so it can be applied as-is. If you would rather have it as a fork branch I can put one up.

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.

6 participants