perf(rt): opt-in VICTORY_RT_STAMPS dispatch timestamp profiler #299

Open
github-bot wants to merge 1 commit from github-bot/gh-299 into main AGit
Owner

@⁠Vladimir-Human on GitHub · 2026-11-27 14:40 UTC · original
Vladimir-Human:perf/opt-in-port-rt-and-stamps → main · +336 −0 · 3 files · 1 commits · open

Summary

Narrowed per @TaynanGT's review to only the opt-in GPU compute dispatch timestamp profiler (VICTORY_RT_STAMPS=1, diagnostics builds), with all forward-fill / VICTORY_PORT_RT changes removed now that #344 (VICTORY_PLACED_FILL_REDIRECT=1) covers the forward-fill path cleanly:

  • crates/victory-gpu/src/host/rtstamps.rs: Allocates the D3D12 timestamp query heap + readback ring lazily only when VICTORY_RT_STAMPS=1, bracketing direct and indirect compute dispatches (Kind::Builder, Kind::Walks, Kind::Other) and reporting per-frame / top-pipeline timings in late_line. When VICTORY_RT_STAMPS is off or unset, before() returns None immediately so zero EndQuery / ResolveQueryData calls or heap allocations enter submissions.
  • crates/victory-gpu/src/host.rs & crates/victory-gpu/src/draw.rs: Minimal #[cfg(feature = "diagnostics")] hooks around direct Dispatch and indirect ExecuteIndirect(..., DISPATCH, ...) calls plus late_line reporting.

Verification

  • cargo xtask policy: asset policy: 323 files ok
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (both default & --features diagnostics): 0 warnings
  • cargo test -p victory-gpu --lib --no-run: builds cleanly without diagnostics
  • cargo test -p victory-gpu --features diagnostics --lib rtstamps -- --test-threads=1 on both hardware D3D12 (VICTORY_D3D12_DEBUG=1) and VICTORY_D3D12_WARP=1: 2 passed, 0 failed (parse_on_defaults_off_and_accepts_one, disabled_profiler_leaves_ring_and_sums_unallocated)
**@⁠Vladimir-Human** on GitHub · 2026-11-27 14:40 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/299) `Vladimir-Human:perf/opt-in-port-rt-and-stamps` → `main` · +336 −0 · 3 files · 1 commits · open ## Summary Narrowed per `@TaynanGT`'s review to **only** the opt-in GPU compute dispatch timestamp profiler (`VICTORY_RT_STAMPS=1`, `diagnostics` builds), with all forward-fill / `VICTORY_PORT_RT` changes removed now that `#344` (`VICTORY_PLACED_FILL_REDIRECT=1`) covers the forward-fill path cleanly: - **`crates/victory-gpu/src/host/rtstamps.rs`**: Allocates the D3D12 timestamp query heap + readback ring lazily only when `VICTORY_RT_STAMPS=1`, bracketing direct and indirect compute dispatches (`Kind::Builder`, `Kind::Walks`, `Kind::Other`) and reporting per-frame / top-pipeline timings in `late_line`. When `VICTORY_RT_STAMPS` is off or unset, `before()` returns `None` immediately so zero `EndQuery` / `ResolveQueryData` calls or heap allocations enter submissions. - **`crates/victory-gpu/src/host.rs` & `crates/victory-gpu/src/draw.rs`**: Minimal `#[cfg(feature = "diagnostics")]` hooks around direct `Dispatch` and indirect `ExecuteIndirect(..., DISPATCH, ...)` calls plus `late_line` reporting. ## Verification - `cargo xtask policy`: `asset policy: 323 files ok` - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (both default & `--features diagnostics`): 0 warnings - `cargo test -p victory-gpu --lib --no-run`: builds cleanly without `diagnostics` - `cargo test -p victory-gpu --features diagnostics --lib rtstamps -- --test-threads=1` on both hardware D3D12 (`VICTORY_D3D12_DEBUG=1`) and `VICTORY_D3D12_WARP=1`: **2 passed, 0 failed** (`parse_on_defaults_off_and_accepts_one`, `disabled_profiler_leaves_ring_and_sums_unallocated`)
Ports `avatarmanz`'s opt-in `VICTORY_PORT_RT=1` submission-stall fix (off by
default; A/B-able in `diagnostics` builds) and diagnostics-gated
`VICTORY_RT_STAMPS=1` compute-dispatch profiler onto a clean standalone PR
separate from the VRAM arena budget/spill work:

1. Opt-in `VICTORY_PORT_RT=1` (`port_rt.rs`, `host/card_steps.rs`,
   `host/place.rs`, `host.rs`, `lib.rs`):
   - Enables placed-copy ordering (`placed_order`) and tracks `cut_for` split
     counters when `VICTORY_PORT_RT=1`, eliminating submission stalls caused by
     fills behind unrelated placed copies.
   - Carries `from_upload: bool` on `Does::Placed` (populated from
     `Placed::uses_upload()`) so an earlier card-taken copy writing `src` of an
     upload-backed placed copy is still safely refused (`BEHIND_PLACED`).
   - Adds `HostList::forward_fill` (for `defer_fill`, `defer_constants`, and
     `defer_fill_buffer`) forwarding same-list fills covered by an upload-backed
     placed copy directly to the copy's source across exact `Copy`, `GpuWrite`,
     and `RawCopy` ranges.
2. Diagnostics `VICTORY_RT_STAMPS=1` (`host/rtstamps.rs`, `draw.rs`, `host.rs`):
   - Brackets direct and indirect compute dispatches with GPU timestamp queries
     grouped by structure builder, structure walkers, and other dispatches,
     with a zero-frequency guard in `make_rt_ring`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 14:42:53 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 14:49 UTC · original

@⁠Vladimir-Human The forward-fill experiment has a useful control now. I’m looking at lists with more than one prior copy, including a second copy that overlaps part of the first. With the switch enabled, the fill should use the latest bytes over the overlap and preserve the first copy’s non-overlapping range. The stamps option gives us a way to measure the wait in the same route.

**@⁠TaynanGT** on GitHub · 2026-11-27 14:49 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/299#issuecomment-7221268044) @⁠Vladimir-Human The forward-fill experiment has a useful control now. I’m looking at lists with more than one prior copy, including a second copy that overlaps part of the first. With the switch enabled, the fill should use the latest bytes over the overlap and preserve the first copy’s non-overlapping range. The stamps option gives us a way to measure the wait in the same route.
Author
Owner

@⁠Vladimir-Human on GitHub · 2026-11-27 19:51 UTC · original

@⁠TaynanGT Thanks for reviewing #299. Since merged #344 (df01b38, VICTORY_PLACED_FILL_REDIRECT=1) now handles redirecting Step::Fill reads behind card-sourced placed copies with overlap/intervening-write checks in host/card_steps.rs (superseding #299's VICTORY_PORT_RT=1 forward-fill path), would you prefer that I close #299 or rebase & narrow #299 strictly to the standalone opt-in VICTORY_RT_STAMPS=1 (host/rtstamps.rs) dispatch timestamp profiler?

**@⁠Vladimir-Human** on GitHub · 2026-11-27 19:51 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/299#issuecomment-7226935501) @⁠TaynanGT Thanks for reviewing `#299`. Since merged `#344` (`df01b38`, `VICTORY_PLACED_FILL_REDIRECT=1`) now handles redirecting `Step::Fill` reads behind card-sourced placed copies with overlap/intervening-write checks in `host/card_steps.rs` (superseding `#299`'s `VICTORY_PORT_RT=1` forward-fill path), would you prefer that I close `#299` or rebase & narrow `#299` strictly to the standalone opt-in `VICTORY_RT_STAMPS=1` (`host/rtstamps.rs`) dispatch timestamp profiler?
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 19:59 UTC · original

@⁠Vladimir-Human Please keep #299 open and narrow it to the dispatch profiler under VICTORY_RT_STAMPS=1. #344 covers the forward-fill part. Keep timestamp queries and resolves out of submissions when the profiler is off.

**@⁠TaynanGT** on GitHub · 2026-11-27 19:59 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/299#issuecomment-7227061613) @⁠Vladimir-Human Please keep #299 open and narrow it to the dispatch profiler under `VICTORY_RT_STAMPS=1`. #344 covers the forward-fill part. Keep timestamp queries and resolves out of submissions when the profiler is off.
github-bot changed title from perf(rt): opt-in VICTORY_PORT_RT forward-fill submission path and VICTORY_RT_STAMPS diagnostics to perf(rt): opt-in VICTORY_RT_STAMPS dispatch timestamp profiler 2026-11-27 20:41:47 +00:00
github-bot force-pushed github-bot/gh-299 from b031d15ebc to 581a861b0e 2026-11-27 20:41:48 +00:00 Compare
Author
Owner

@⁠Vladimir-Human on GitHub · 2026-11-27 20:41 UTC · original

@⁠TaynanGT Done — rebased onto main (2a577f8) and narrowed #299 strictly to the VICTORY_RT_STAMPS=1 (diagnostics) compute dispatch timestamp profiler:

  • Dropped port_rt.rs, forward_fill, and all host/card_steps.rs / host/place.rs / lib.rs changes (leaving #344 as the sole forward-fill path).
  • Verified before() returns None before touching ring() when VICTORY_RT_STAMPS is off or unset, so no query heap/readback ring is created and zero EndQuery / ResolveQueryData calls enter command lists.
  • Added unit tests host::rtstamps::tests::{parse_on_defaults_off_and_accepts_one, disabled_profiler_leaves_ring_and_sums_unallocated}, verified xtask policy (323 files ok), clippy (default + diagnostics, 0 warnings), and rtstamps 2/2 passing on both VICTORY_D3D12_DEBUG=1 (RTX 4070 SUPER) and VICTORY_D3D12_WARP=1.
**@⁠Vladimir-Human** on GitHub · 2026-11-27 20:41 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/299#issuecomment-7227742300) @⁠TaynanGT Done — rebased onto `main` (`2a577f8`) and narrowed `#299` strictly to the `VICTORY_RT_STAMPS=1` (`diagnostics`) compute dispatch timestamp profiler: - Dropped `port_rt.rs`, `forward_fill`, and all `host/card_steps.rs` / `host/place.rs` / `lib.rs` changes (leaving `#344` as the sole forward-fill path). - Verified `before()` returns `None` before touching `ring()` when `VICTORY_RT_STAMPS` is off or unset, so no query heap/readback ring is created and zero `EndQuery` / `ResolveQueryData` calls enter command lists. - Added unit tests `host::rtstamps::tests::{parse_on_defaults_off_and_accepts_one, disabled_profiler_leaves_ring_and_sums_unallocated}`, verified `xtask policy` (`323 files ok`), `clippy` (default + `diagnostics`, 0 warnings), and `rtstamps` 2/2 passing on both `VICTORY_D3D12_DEBUG=1` (RTX 4070 SUPER) and `VICTORY_D3D12_WARP=1`.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/299/head:github-bot/gh-299'
git switch 'github-bot/gh-299'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-299'
git switch 'github-bot/gh-299'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-299'
git switch 'github-bot/gh-299'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-299'
git switch 'main'
git merge --squash 'github-bot/gh-299'
git switch 'main'
git merge --ff-only 'github-bot/gh-299'
git switch 'main'
git merge 'github-bot/gh-299'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.