VICTORY_SHADER_DIAG: structured per-pipeline classification logging #376

Open
ZaneIceMaster11 wants to merge 1 commit from upstream-pr/376 into main
ZaneIceMaster11 commented 2026-11-25 00:09:10 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by ZaneIceMaster11 on 2026-11-25T00:09:10Z.


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).

<!-- greyfinch-sync:fxceless/victory-fork:issue:6594060663 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/376). Originally posted by [ZaneIceMaster11](https://github.com/ZaneIceMaster11) on 2026-11-25T00:09:10Z. --- ## 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).
BTekV4 commented 2026-11-25 01:11:58 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by BTekV4 on 2026-11-25T00:20:07Z.


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 #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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7148400706 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/376#issuecomment-7148400706). Originally posted by [BTekV4](https://github.com/BTekV4) on 2026-11-25T00:20:07Z. --- 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 #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.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/376:upstream-pr/376'
git switch 'upstream-pr/376'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/376'
git switch 'upstream-pr/376'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/376'
git switch 'upstream-pr/376'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/376'
git switch 'main'
git merge --squash 'upstream-pr/376'
git switch 'main'
git merge --ff-only 'upstream-pr/376'
git switch 'main'
git merge 'upstream-pr/376'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!376
No description provided.