CLI: compare runtime shader failures with offline coverage #1624

Open
srijann07 wants to merge 3 commits from upstream-pr/1625 into main
srijann07 commented 2026-11-24 19:55:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by srijann07 on 2026-11-24T19:55:20Z.


Summary

Related to #1579.

Adds a shader-coverage CLI command to compare runtime shader translation failures against offline emission results.

Changes

  • Deduplicates runtime shader failures by hash.
  • Identifies offline emitted, failed and unmatched shaders.
  • Groups runtime translation failures by reason.
  • Adds four synthetic regression tests and README documentation.
  • No new dependencies or runtime rendering changes.

Usage

victory shader-coverage <runtime.log> [paths...]

Verification

  • Workspace tests: 346 passed, 0 failed, 6 ignored.
  • All four new regression tests passed.
  • Standard and diagnostics Clippy checks passed.
  • Asset policy passed.

Windows CI results:
https://github.com/srijann07/VIctory/actions/runs/45473262548

Limitations

Unmatched hashes do not prove shader absence. Offline emission does not guarantee DXIL validation or successful GPU execution.

No actual title run was performed. Zero game assets included.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6590190036 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1625). Originally posted by [srijann07](https://github.com/srijann07) on 2026-11-24T19:55:20Z. --- ## Summary Related to #1579. Adds a `shader-coverage` CLI command to compare runtime shader translation failures against offline emission results. ## Changes - Deduplicates runtime shader failures by hash. - Identifies offline emitted, failed and unmatched shaders. - Groups runtime translation failures by reason. - Adds four synthetic regression tests and README documentation. - No new dependencies or runtime rendering changes. ## Usage `victory shader-coverage <runtime.log> [paths...]` ## Verification - Workspace tests: 346 passed, 0 failed, 6 ignored. - All four new regression tests passed. - Standard and diagnostics Clippy checks passed. - Asset policy passed. Windows CI results: https://github.com/srijann07/VIctory/actions/runs/45473262548 ## Limitations Unmatched hashes do not prove shader absence. Offline emission does not guarantee DXIL validation or successful GPU execution. No actual title run was performed. Zero game assets included. AI-assisted.
catminou4 commented 2026-11-24 20:06:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:06:17Z.

Review: COMMENTED


Static review only: victory-gpu/victory-hle/apps are Windows-only (D3D12/windows_sys), so nothing here compiles or runs on macOS — please rely on the Windows CI leg.

shader-coverage compares runtime translation failures from a log against an offline scan: dedups 16-hex hashes, groups reasons by unsupported operation (stripping the GFX10 code at 0x… prefix), replays only matching byte extents through emit, and reports emitted/failed/unmatched counts. Privacy-conscious like list-diff (hashes and reasons only, no shader bytes; README documents keeping logs outside the repo). The CSI-stripping and hash validation are careful. Pure logic but the crate is Windows-only, so untested here — consider #[cfg(test)] unit tests for plain/reason/failures parsing edge cases (they're platform-independent).

<!-- greyfinch-sync:Marvisak/VIctory:review:6046506730 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1625#pullrequestreview-6046506730). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T20:06:17Z. **Review:** COMMENTED --- Static review only: victory-gpu/victory-hle/apps are Windows-only (D3D12/windows_sys), so nothing here compiles or runs on macOS — please rely on the Windows CI leg. `shader-coverage` compares runtime translation failures from a log against an offline scan: dedups 16-hex hashes, groups reasons by unsupported operation (stripping the `GFX10 code at 0x…` prefix), replays only matching byte extents through `emit`, and reports emitted/failed/unmatched counts. Privacy-conscious like `list-diff` (hashes and reasons only, no shader bytes; README documents keeping logs outside the repo). The CSI-stripping and hash validation are careful. Pure logic but the crate is Windows-only, so untested here — consider `#[cfg(test)]` unit tests for `plain`/`reason`/`failures` parsing edge cases (they're platform-independent).
srijann07 commented 2026-11-24 21:03:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by srijann07 on 2026-11-24T20:18:57Z.


Thanks for the review, @catminou4!

I've added four dedicated unit tests for "plain", "reason", and "failures" in commit 1460a85, covering the parsing edge cases you suggested.

All four new tests passed, along with the full workspace test suite (350 passed, 0 failed) and both Clippy checks.

Windows CI: https://github.com/srijann07/VIctory/actions/runs/45478941041

I'd appreciate another look when you have time. Thanks!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7143353840 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1625#issuecomment-7143353840). Originally posted by [srijann07](https://github.com/srijann07) on 2026-11-24T20:18:57Z. --- Thanks for the review, @catminou4! I've added four dedicated unit tests for "plain", "reason", and "failures" in commit 1460a85, covering the parsing edge cases you suggested. All four new tests passed, along with the full workspace test suite (350 passed, 0 failed) and both Clippy checks. Windows CI: https://github.com/srijann07/VIctory/actions/runs/45478941041 I'd appreciate another look when you have time. Thanks!
Marvisak commented 2026-11-25 02:06:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:32:32Z.


Automated triage for the maintainers.

Merge candidate (as before the conflict). Thanks for the rebase onto 63bcca4. The main.rs change now only registers ShaderCoverage and dispatches it to coverage::run.

What I checked in apps/victory/src/coverage.rs: failures matches the exact warning victory_gpu::pipeline logs in Shader::translated, which is shader does not translate; its pipelines' draws are dropped, with fields hash= and error= followed by cached=/ms=. It strips the cached= suffix. The hash is the same blake3(..)[..16] that pipeline.rs uses. Only containers whose hash was asked for are translated, and nothing is written. It reuses shader::sources/MAX_FILE, adds no dependencies, and the README addition is one line. The tests cover the parsing edge cases and an actual translator failure.

CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149665434 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1625#issuecomment-7149665434). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:32:32Z. --- <!-- victory-triage v1 head=50b237a60b00cb8f925bcdd2baec98f6bd85da36 verdict=merge-candidate at=2026-11-26T07:21:29Z --> Automated triage for the maintainers. **Merge candidate** (as before the conflict). Thanks for the rebase onto `63bcca4`. The `main.rs` change now only registers `ShaderCoverage` and dispatches it to `coverage::run`. What I checked in `apps/victory/src/coverage.rs`: `failures` matches the exact warning `victory_gpu::pipeline` logs in `Shader::translated`, which is `shader does not translate; its pipelines' draws are dropped`, with fields `hash=` and `error=` followed by `cached=`/`ms=`. It strips the `cached=` suffix. The hash is the same `blake3(..)[..16]` that `pipeline.rs` uses. Only containers whose hash was asked for are translated, and nothing is written. It reuses `shader::sources`/`MAX_FILE`, adds no dependencies, and the README addition is one line. The tests cover the parsing edge cases and an actual translator failure. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
srijann07 commented 2026-11-25 07:03:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by srijann07 on 2026-11-25T06:09:47Z.


Rebased onto upstream main (940d32f), resolved the README conflict and preserved the additional parsing tests. Fresh Windows CI and both Clippy configurations passed.

CI: https://github.com/srijann07/VIctory/actions/runs/45557227927

Ready for re-review. Thanks!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154506070 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1625#issuecomment-7154506070). Originally posted by [srijann07](https://github.com/srijann07) on 2026-11-25T06:09:47Z. --- Rebased onto upstream main (940d32f), resolved the README conflict and preserved the additional parsing tests. Fresh Windows CI and both Clippy configurations passed. CI: https://github.com/srijann07/VIctory/actions/runs/45557227927 Ready for re-review. Thanks!
srijann07 commented 2026-11-25 08:06:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by srijann07 on 2026-11-25T07:12:19Z.


Thanks for identifying the parsing issue!

  • Fixed error extraction to exclude trailing cache and timing metadata.
  • Added regression tests using realistic runtime log fields, including quoted stage names and varying timings.
  • Verified that identical failure reasons remain grouped correctly.
  • Shortened the README documentation.

Fresh Windows CI, regression tests and both Clippy configurations passed.

https://github.com/srijann07/VIctory/actions/runs/45565441242

Ready for re-review. Thanks!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7155602574 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1625#issuecomment-7155602574). Originally posted by [srijann07](https://github.com/srijann07) on 2026-11-25T07:12:19Z. --- Thanks for identifying the parsing issue! - Fixed error extraction to exclude trailing cache and timing metadata. - Added regression tests using realistic runtime log fields, including quoted stage names and varying timings. - Verified that identical failure reasons remain grouped correctly. - Shortened the README documentation. Fresh Windows CI, regression tests and both Clippy configurations passed. https://github.com/srijann07/VIctory/actions/runs/45565441242 Ready for re-review. Thanks!
srijann07 commented 2026-11-26 07:01:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by srijann07 on 2026-11-26T06:27:56Z.


Rebased onto latest upstream main (63bcca4) and resolved the conflict in main.rs. All existing regression tests are preserved, and fresh Windows CI passed.

CI: https://github.com/srijann07/VIctory/actions/runs/45767881219

Ready for re-review. Thanks!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7184455480 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1625#issuecomment-7184455480). Originally posted by [srijann07](https://github.com/srijann07) on 2026-11-26T06:27:56Z. --- Rebased onto latest upstream main (`63bcca4`) and resolved the conflict in `main.rs`. All existing regression tests are preserved, and fresh Windows CI passed. CI: https://github.com/srijann07/VIctory/actions/runs/45767881219 Ready for re-review. Thanks!
fuzeofficlal commented 2026-11-26 18:02:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T18:02:19Z.

Review: APPROVED


Looks good. Verified merged onto main (63bcca43) on Windows 11:

  • cargo xtask policy (192 files ok), cargo clippy --locked -p victory --all-targets -- -D warnings (default and --all-features), and all 27 tests in victory (including all 9 new coverage::tests::* cases) pass.
  • Verified end-to-end against real ANSI-colored UTF-8 stderr output produced by victory_core::logging::init using the exact tracing::warn! call from crates/victory-gpu/src/pipeline.rs:139-148: victory shader-coverage stripped the CSI sequences, parsed the hash and GFX10 code at 0x... reason cleanly (1 record, 1 unique hash, 0 malformed rows).
  • Also verified UTF-8 BOM + CRLF logs, duplicate hash deduplication across offsets, raw standalone / padded standalone / offset-embedded synthetic DXBC containers, missing scan paths, empty logs, non-UTF-8 logs (exits 1 with the UTF-8 guidance), and missing log files.

(Non-blocking note: runtime crates/victory-gpu/src/shader_cache.rs:87-88 and apps/victory/src/translate.rs:571-572 both translate with emit::Options { view_marks: true }, whereas apps/victory/src/coverage.rs:198 calls emit::translate(b) (view_marks: false). View-mark lowering is currently infallible so pass/fail results match, though switching to emit::translate_with(b, emit::Options { view_marks: true }) would keep offline comparison strictly matched to runtime settings going forward.)

<!-- greyfinch-sync:Marvisak/VIctory:review:6078732938 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1625#pullrequestreview-6078732938). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T18:02:19Z. **Review:** APPROVED --- Looks good. Verified merged onto `main` (`63bcca43`) on Windows 11: - `cargo xtask policy` (`192 files ok`), `cargo clippy --locked -p victory --all-targets -- -D warnings` (default and `--all-features`), and all 27 tests in `victory` (including all 9 new `coverage::tests::*` cases) pass. - Verified end-to-end against real ANSI-colored UTF-8 stderr output produced by `victory_core::logging::init` using the exact `tracing::warn!` call from `crates/victory-gpu/src/pipeline.rs:139-148`: `victory shader-coverage` stripped the CSI sequences, parsed the hash and `GFX10 code at 0x...` reason cleanly (`1` record, `1` unique hash, `0` malformed rows). - Also verified UTF-8 BOM + CRLF logs, duplicate hash deduplication across offsets, raw standalone / padded standalone / offset-embedded synthetic DXBC containers, missing scan paths, empty logs, non-UTF-8 logs (exits 1 with the UTF-8 guidance), and missing log files. (Non-blocking note: runtime `crates/victory-gpu/src/shader_cache.rs:87-88` and `apps/victory/src/translate.rs:571-572` both translate with `emit::Options { view_marks: true }`, whereas `apps/victory/src/coverage.rs:198` calls `emit::translate(b)` (`view_marks: false`). View-mark lowering is currently infallible so pass/fail results match, though switching to `emit::translate_with(b, emit::Options { view_marks: true })` would keep offline comparison strictly matched to runtime settings going forward.)
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/1625:upstream-pr/1625'
git switch 'upstream-pr/1625'

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/1625'
git switch 'upstream-pr/1625'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1625'
git switch 'upstream-pr/1625'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1625'
git switch 'main'
git merge --squash 'upstream-pr/1625'
git switch 'main'
git merge --ff-only 'upstream-pr/1625'
git switch 'main'
git merge 'upstream-pr/1625'
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
Marvisak/VIctory!1624
No description provided.