Skip to content

VICTORY_SHADER_DIAG: structured per-pipeline classification logging - #376

Open
ZaneIceMaster11 wants to merge 1 commit into
fxceless:mainfrom
ZaneIceMaster11:feature/shader-diag
Open

ZaneIceMaster11 wants to merge 1 commit into
fxceless:mainfrom
ZaneIceMaster11:feature/shader-diag

Conversation

@ZaneIceMaster11

Copy link
Copy Markdown

Why

Every shader/pipeline failure path already had its own ad hoc tracing::warn!/info! (shader translation, root signature, mesh/graphics/compute pipeline creation, the depth-bounds-test and rectangle-geometry-stage shortcuts, the two unimplemented device methods at vtable slots 0x1c8/0x218). Fine for watching a live log, but there was no single, structured, greppable place to answer "why doesn't this draw look right" across a whole run - needed to chase reports of low-poly models and shaders not rendering.

What

VICTORY_SHADER_DIAG=<dir> (new, crates/victory-gpu/src/shader_diag.rs, diagnostics-feature-gated like capture.rs/copystat.rs) appends one JSONL record per classification to <dir>/shader-diag.jsonl: a classification (ok / missing-shader / root-signature-refused / mesh-pipeline-refused / pipeline-refused / rect-gs-fallback / depth-bounds-unsupported / state-not-kept / device-method-unimplemented), the shaders involved (stage + content hash - the same hash VICTORY_SHADER_SAVE and crash reports use), and whatever detail was already on hand at that call site - the graphics state's existing describe() (input layout, RT/depth formats, blend, rasterizer) on success, the host's rejection error on failure. Every hook sits next to an existing tracing call and reuses its data. Off by default, zero cost when unset.

Verification

  • cargo build --release --workspace and --profile diag --features diagnostics both clean.
  • cargo clippy --workspace --all-targets --release, with and without the diagnostics feature, both clean, 0 warnings.
  • cargo test --workspace: green except two already-documented flaky tests, both confirmed at their established rates.
  • Found and ruled out a false lead while verifying: cargo test -p victory-gpu --features diagnostics occasionally crashes (STATUS_ACCESS_VIOLATION) under parallel execution. Reproduced on unmodified main too (1/5 runs) and on this change (1/6 runs) - statistically the same pre-existing rate, not caused by this change. Same root-cause class as victory-shader's already-documented GPU-test concurrency flakiness.

Co-authored with Claude Code (Claude Sonnet 5).

…ation

Every existing shader/pipeline failure path already had its own ad hoc
tracing::warn!/info! (shader translation, root signature, mesh/graphics/
compute pipeline creation, the depth-bounds-test and rectangle-geometry-stage
shortcuts, the two unimplemented device methods at vtable slots 0x1c8/0x218).
That's fine for watching a live log, but there was no single, structured,
greppable place to answer "why doesn't this draw look right" across a whole
run - which is exactly what's needed to chase reports of low-poly models and
shaders not rendering: is a given pipeline hitting missing-shader, a refused
root signature or PSO, a dropped partial-support shortcut, or the device-
method gap, and how often.

VICTORY_SHADER_DIAG=<dir> (new, crates/victory-gpu/src/shader_diag.rs,
diagnostics-feature-gated like capture.rs/copystat.rs) appends one JSONL
record per classification to <dir>/shader-diag.jsonl: a classification
(ok/missing-shader/root-signature-refused/mesh-pipeline-refused/
pipeline-refused/rect-gs-fallback/depth-bounds-unsupported/state-not-kept/
device-method-unimplemented), the shaders involved (stage + content hash,
same hash VICTORY_SHADER_SAVE and crash reports use), and whatever detail
was already on hand at that call site - the graphics state's existing
describe() (input layout, render target/depth formats, blend, rasterizer)
on success, the host's rejection error on failure. Every hook sits next to
an existing tracing call and reuses its data; nothing new is computed only
for this. Off by default, zero cost when unset (the env var is read once
via OnceLock and short-circuits).

Also documents VICTORY_KEYBOARD_PAD in the README (added on another branch,
not yet merged) and fixes a crash::tests::unwinds_like_the_system_walk-class
regression gate issue: cherry-picked the .gitignore fix from that same
branch since this branch needed it too for the policy test to pass.

Verified: cargo build --release --workspace and --profile diag --features
diagnostics both clean. cargo clippy --workspace --all-targets --release,
with and without the diagnostics feature, both clean, 0 warnings.
cargo test --workspace: green except the two already-documented flaky tests
(state/findings/flaky-tests.md), both confirmed still at their established
rates, neither new.

Found and ruled out as a false lead while verifying: cargo test -p
victory-gpu --features diagnostics occasionally crashes
(STATUS_ACCESS_VIOLATION) under parallel test execution. Reproduced on the
unmodified code too (1/5 runs) and on this change (1/6 runs across two
batches) - statistically the same pre-existing rate, not caused by this
change. Documented as a third known-flaky pattern, same root cause class as
victory-shader's already-documented "two GPU tests at once on WARP can end
the test process with an access violation".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@BTekV4

BTekV4 commented Nov 25, 2026

Copy link
Copy Markdown

Built this locally (release, --features diagnostics) and ran it on a full prologue pass. It works as advertised and it is exactly the tool that was missing for this kind of report — thanks.

Run: Windows 11 x64, RTX 5070 Ti, 2119b0e + the open PRs merged (#340 #341 #343 #344 #345 #346 #347 #348 #349 #353 #354 #357 #358 #359 #376 #377), VICTORY_SHADER_DIAG=<dir>, ~2.5 minutes through the prologue.

34,192 records: device-method-unimplemented 28,139 · ok 5,774 · depth-bounds-unsupported 224 · missing-shader 44 · pipeline-refused 10 · mesh-pipeline-refused 1.

Two things that stood out:

  1. The unimplemented device methods dominate the file: slot 0x1c8 is hit 25,450 times and 0x218 2,689 times in one run, i.e. ~82% of all records. If either is on a per-draw or per-copy path, that is worth a look on its own (they are also invisible in the plain log, which only warns once per call site).
  2. missing-shader splits cleanly by translation error, and the hashes line up with the raw shader does not translate lines: 15 a lane mask exchanged where not every lane runs, 15 a whole-wave section step the simulation does not follow, 7 a descriptor read only as data (pixel), 3 v_cvt_f32_f64, 2 the first half of an interpolation (pixel), 1 a descriptor's address or format read as data, 1 a first-lane read where not every lane runs. Per-hash lists in RTX 5070 Ti, Windows 11: 44 shaders do not translate (1456/5173 draws dropped) - VICTORY_SHADER_DIAG report; VICTORY_WAVE_WIDE=1 removes the device #394.

Small suggestion, from actually grepping the output: when detail carries a slot number, adding the resolved method name (even just the D3D12 interface the vtable belongs to, e.g. ID3D12Device12) would make that class actionable without a debugger. A monotonically increasing calls= counter is already there and helps; a per-slot total at exit would help more.

Repro details and the full comparison (dropped draws, GPU idle, switch effects) are in #394.

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.

2 participants