gpu: VICTORY_TRACE_PIPELINES logs pipelines made and put off, by frame #353

Closed
github-bot wants to merge 1 commit from github-bot/gh-350 into main AGit
Owner

@⁠ShadyUnderLight on GitHub · 2026-11-27 13:43 UTC · original
ShadyUnderLight:diag/pipeline-counts → main · +34 −1 · 3 files · 1 commits · closed without merging

What and why

The frame log's native draws so far line comes every 64 presents and carries no pipeline counters, so "how many pipelines did this frame make, and how many did it put off" cannot be read from a log. That is exactly the question a crash storm raises: a compile that crashes Metal's compiler spends the rest of its frame's pipeline budget, so that frame's other new pipelines are put off. Do they ever get made?

What it does

VICTORY_TRACE_PIPELINES=1 logs native pipelines so far at every present whose counters moved: frame, made (ShaderStats::pipelines), put_off (ShaderStats::put_off) and cached (ShaderStats::cached), each cumulative. A frame whose counters did not move writes nothing, so a cold first world frame and each later frame that binds new pipelines get a line while quiet frames do not.

Off (the default) it costs one read of the switch per present; the title lock is taken only when it is on. Documented under "Bring-up diagnostics", with a pointer from "Reading the log" beside VICTORY_TRACE_SHADER_CACHE.

Checks

  • cargo test -p victory-gpu -p victory-metal -p victory-shader (native arm64): 357 / 36 / 12 / 16 / 370 / 5 passed, 0 failed.
  • cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings: clean.
  • cargo xtask policy: 384 files ok.
  • Used on a 400 s world run (macOS 27.2.1, M5 Max, series-x): 107 lines, so the resolution is there for the frames that do pipeline work.

No behaviour change: nothing reads these counters.

**@⁠ShadyUnderLight** on GitHub · 2026-11-27 13:43 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/350) `ShadyUnderLight:diag/pipeline-counts` → `main` · +34 −1 · 3 files · 1 commits · closed without merging ## What and why The frame log's `native draws so far` line comes every 64 presents and carries no pipeline counters, so "how many pipelines did this frame make, and how many did it put off" cannot be read from a log. That is exactly the question a crash storm raises: a compile that crashes Metal's compiler spends the rest of its frame's pipeline budget, so that frame's other new pipelines are put off. Do they ever get made? ## What it does `VICTORY_TRACE_PIPELINES=1` logs `native pipelines so far` at every present whose counters moved: `frame`, `made` (`ShaderStats::pipelines`), `put_off` (`ShaderStats::put_off`) and `cached` (`ShaderStats::cached`), each cumulative. A frame whose counters did not move writes nothing, so a cold first world frame and each later frame that binds new pipelines get a line while quiet frames do not. Off (the default) it costs one read of the switch per present; the title lock is taken only when it is on. Documented under "Bring-up diagnostics", with a pointer from "Reading the log" beside `VICTORY_TRACE_SHADER_CACHE`. ## Checks - `cargo test -p victory-gpu -p victory-metal -p victory-shader` (native arm64): 357 / 36 / 12 / 16 / 370 / 5 passed, 0 failed. - `cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings`: clean. - `cargo xtask policy`: 384 files ok. - Used on a 400 s world run (macOS 27.2.1, M5 Max, series-x): 107 lines, so the resolution is there for the frames that do pipeline work. No behaviour change: nothing reads these counters.
The frame log's `native draws so far` line comes every 64 presents and has no
pipeline counters, and a compile that crashes Metal's compiler puts a frame's
pipelines off one frame at a time. Counting whether the pipelines a frame put
off ever get made therefore needs a per-frame number that nothing logged.

`VICTORY_TRACE_PIPELINES=1` adds `native pipelines so far` at every present
whose `made`, `put_off` or `cached` counters moved, each cumulative, read
under the title lock. Off, the cost is one read of the switch per present; a
frame whose counters did not move writes nothing.

Used on a 400 s world run (macOS 27.2.1, M5 Max, series-x): 107 lines, so the
resolution is there for the frames that do pipeline work.

No behaviour change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 13:54:34 +00:00
github-bot closed this pull request 2026-11-27 14:08:11 +00:00
Author
Owner

@⁠ShadyUnderLight on GitHub · 2026-11-27 14:02 UTC · original

This is the instrument I used to answer the put-off/made numbers on #181 and #318, not a fix, and nobody asked for the line itself. Keeping it out of the review queue; the branch diag/pipeline-counts stays on my fork if you ever want it.

**@⁠ShadyUnderLight** on GitHub · 2026-11-27 14:02 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/350#issuecomment-7220264558) This is the instrument I used to answer the put-off/made numbers on #181 and #318, not a fix, and nobody asked for the line itself. Keeping it out of the review queue; the branch `diag/pipeline-counts` stays on my fork if you ever want it.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.