metal: VICTORY_PASS_TIMING — per-pass GPU timing at each encoder boundary (#460 step 1) #598
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!598
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-594"
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?
@AnastasisKon on GitHub · 2026-11-28 11:04 UTC · original
AnastasisKon:vibe/pass-timing-55a8d1→main· +463 −17 · 6 files · 1 commits · openWhat this changes
Refs #464 (step 1 only; step 2 record/replay stays open). Adds
VICTORY_PASS_TIMING=1(or=<n>): per-pass GPU time on the native Metal path. AnMTLCounterSampleBufferof the timestamp counter set is sampled at each pass encoder's start and end, resolved when the command buffer completes, and at each present the frame'snmost expensive passes (10 for=1) are logged most-expensive-first by pipeline (shader hash) and work (draws / thread groups / blit ops), then the frame total (pass time frame=<f> ...lines).Implementation notes:
crates/victory-metal/src/pass_timing.rs; sampling hooks ingfx.rs's submit path (one sample buffer per command buffer, one per piece of a split submission) and in both completion handlers; the frame boundary is each present inpresent.rs.AtDispatchBoundary/AtDrawBoundary/AtBlitBoundary): Metal asserts (SIGABRT) onsampleCountersInBufferfor an unsupported kind, and support differs per GPU family — an AGXG15X (this Mac) samples dispatch and draw boundaries but not blit. Passes of an unsampled kind get no label, keeping sample indices aligned with labels.VICTORY_TRACE_GPU_FAILSso the log can name passes by shader hash.docs/native-host.mdunder "Bring-up diagnostics".How it was tested
cargo test -p victory-hle -p victory -p victory-gpu -p xtask(host arm64, run with-- --test-threads=1per #552): 708 passed, 0 failedcargo test -p victory-metal -- --test-threads=1: 85 passed, 0 failed, including the newpass_timing::tests::each_pass_of_a_command_buffer_is_sampled_and_a_frame_reports_them— a synthetic two-pass command buffer (blit fills, or a zero-draw render pass when the device samples no blit boundary, as here) yields one resolved sample per pass, with sane durationscargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings: cleancargo xtask policy: cleanChecklist
docs/native-host.md(G15X: no blit boundary)VICTORY_PASS_TIMING, off by default, and documented indocs/native-host.mdView 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.