tools: cargo xtask refusals <log> says what a run lost, and why #2890
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2892"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by HoLa-Lee on 2026-11-25T23:15:35Z.
What this adds
cargo xtask refusals <log>— one command that says what a run lost and why, grouped, most frequent first. A run names four kinds of loss, each on its own line, thousands of frame lines apart:host pipeline refused error=… shaders=[…](and themesh,graphics,root signatureforms)D3D12: … id=… severity=…VICTORY_D3D12_DEBUG=1shader does not translate; … stage=… hash=… error=…dropped …/frame without a host pipeline: …On a real run, from this machine
240 s of the intro with the debug layer on (RTX 4080 SUPER):
Over a run without the debug layer it prints the same shape and says plainly that
VICTORY_D3D12_DEBUG=1is what supplies the reasons, rather than leaving a reader to wonder whether nothing was wrong.Shape
parse(&str) -> Reportis a pure function of the log's text:BTreeMaps of refusals (kind, shaders, error), debug messages (text, id, severity), untranslated shaders (stage, hash, error), and drop reasons with the highest rate seen. Nothing touches the filesystem or a GPU.stage="compute"quoting and the "name the switch" path are all pinned.cargo test -p xtask: 8 passed (6 policy, 2 new).cargo clippy -p xtask --all-targets -- -D warnings: clean.Why not a script
The same parsing is what a reviewer wants over a pasted log, it has to survive ten thousand lines and group by keys, and
xtaskis where this repository keeps its maintenance subcommands (policy). No workspace behaviour changes: this only reads a file.Found while chasing the card's refused pipelines (four separate costs: wave64 shaders, an
R8_UINTblend, the 1,000,000-view heap cap, and the deliberately-off ray-tracing builder). The tool exists so the next session does not have to find them again by hand.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:32:29Z.
Review: COMMENTED
Verified head
dc7d1995cleanly on top oforigin/main(842b0cb7) on Windows 11 x64.Findings
read_untranslatedwon't aggregate identical untranslated shaders on real logs (xtask/src/refusals.rs:123-126):crates/victory-gpu/src/pipeline.rs:130-139emits trailing fields aftererror=%e(cached=... ms=... user_ms=... kernel_ms=...). Becauseread_untranslatedslices fromrest.split_once("error=")to the end of the line, any difference inms=/user_ms=produces a distinctUntranslated.errorkey and prevents grouping identical shaders (the unit test fixture truncates right aftererror=..., so it doesn't catch this). Trimming atcached=(or parsing structured trailing fields) fixes aggregation on real runs.debugorunparsedentries exist (xtask/src/refusals.rs:171): Whenrefusals,untranslated, anddropsare all empty butdebugis non-empty orunparsed > 0, the report still prints"nothing refused, dropped, or untranslated in this log"immediately before printing the D3D12 debug layer or unparsed sections.pipeline/host.rs:657logs"host pipeline refused"(not"host graphics pipeline refused"), so graphics and compute pipelines both fall underkind = "pipeline"(distinguishable viashaders).read_debugformats missingid=/severity=asu64::MAX(18446744073709551615).Local Verification
cargo test --locked -p xtask: 8/8 passed (including the 2 new tests andrepository_passes_policy).cargo clippy --locked -p xtask --tests -- -D warnings,cargo xtask policy, andcargo xtask refusals --help: clean.refusals.rsuses onlystd+anyhow(no platform-specific dependencies).Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T23:36:39Z.
Review: COMMENTED
Useful triage tooling — the four refusal classes it groups (device-refused pipelines, debug-layer reasons, untranslatable shaders, per-frame drops) are exactly what gets lost in a frame-line flood. Additive, no runtime surface. LGTM.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:30:02Z.
Automated triage for the maintainers.
Needs work. Thanks for the follow-up; most of the earlier points are addressed in
b040e48: the nonexistenthost graphics pipeline refusedshape is gone,renderreturns aStringand both hint tests now assert the text. A few things remain:drive_card.ps1is still named in theRefusalsdoc comment inxtask/src/main.rs(/// ... e.g. a drive_card.ps1 tag's .err.log); please drop it there too.Report::unparsedis never incremented anywhere inrefusals.rs, so the "could not be read whole" line can never print. Either count lines that match a refusal prefix but fail to parse, or remove the field and that branch.shader does not translate(victory-gpu/src/pipeline.rs) logscached,ms,user_ms,kernel_msaftererror, soread_untranslatedtakeserror=to end of line and folds those timings into the key; the same shader with different timings is counted as different kinds. The fixture line is cut aftererror=, which hides this. Please stop the error atcached=and use a fixture shaped like the real line. Likewise the fixture'smessages=Noneis not a field main logs.host root signature refusedinpipeline/host.rsdoes log?shaders, so in practice it carries ashaders=[...]list; fine to keep the fallback, but the comment saying it "names no shaders at all" is not accurate.Whether a log-analysis command belongs in
xtaskis still the maintainer's call.CI: not run on this head.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by HoLa-Lee on 2026-11-26T04:48:21Z.
All five points are in,
b040e48(rebased onto63bcca4, still two files:xtask/src/main.rs+11,xtask/src/refusals.rs+302).host graphics pipeline refusedremoved - you are right, nothing in main logs it. The three shapes left arehost pipeline refused,host mesh pipeline refused,host root signature refused.shaders=[is now read, not counted as unparsed:push_refusaltreats a missing shader list as an empty one, and the report names such a refusal by its kind. The fixture line you asked for is inLOGand the test asserts both the entry and that the rendering says[root signature].drive_card.ps1is gone from the doc comments (it lives in our fork, not here - my mistake to mention it).printisrender(&Report) -> String(printis one line that prints it), anda_log_without_reasons_says_what_to_turn_onasserts the string containsVICTORY_D3D12_DEBUG=1. A new test pins the empty-log sentence.One thing worth flagging on myself: while making these changes I amended on the old base and force-pushed, which briefly made the PR show your
63bcca4work as deletions (64 files, -9,562). It is rebased and pushed again (b040e48, two files,mergeable=True); nothing of yours was touched, but a list-only review of this PR between those two pushes would have been misleading.On your last question - whether a log-analysis tool belongs in
xtask: that is yours to decide and I will not push for it. If the answer is no, the same file works as a standalone example in the issue thread, and I will close the PR rather than argue.cargo test -p xtask: 9 passed.cargo clippy -p xtask --all-targets -- -D warnings: clean.Imported from Marvisak/VIctory. Originally posted by HoLa-Lee on 2026-11-26T12:15:58Z.
All four are in,
783e136(two files, +323/-0, rebased on63bcca4).drive_card.ps1is gone from theRefusalsdoc comment; the parameter now says what it is ("the diagnostics output of one run, e.g. the file a launcher keeps of its stderr").Report::unparsedis removed, with the render branch that could never fire -push_refusalalways produces a refusal now, so there was nothing for the field to count.cached=, and the fixture is shaped like the real line:stage="compute" hash=… error=… cached=false ms=12 user_ms=11 kernel_ms=1, twice with different timings, and the test asserts that the two are one kind and thatcached=never reaches the key.messages=Noneis gone from the fixture too.?shaders, so the fixture now carries a shader list and the test reads it; the no-list path stays as a fallback and says so.One more thing the fixture was hiding, now covered: the drop line.
LOGhasdropped 227.7/frame without a host pipeline: …and the test asserts the rate is read off the line rather than left at 0.0, which is whatread_dropexists for.On whether it belongs in
xtask: still yours to decide, and if the answer is no I will close it rather than argue - the parsing is one file and travels well.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.