perf(gpu): sift refresh batches with the scoped worker pool #3705

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

@⁠victorportelada on GitHub · 2026-11-30 04:22 UTC · original
victorportelada:pr/refresh-sift → main · +121 −54 · 4 files · 1 commits · closed without merging

What it changes

The refresh sifting paths allocated fresh Arc<Vec<AtomicBool>> marks and an Arc<Vec<...>> of items for every large flush, then cloned them once per worker. On a 6-core host this was measurable overhead in the submitting thread's critical path.

This patch:

  • Adds one reusable Vec<AtomicBool> to Batch and a generic retain_scoped helper that checks items on the existing scoped worker pool, reuses the marks allocation, and retains entries in order.
  • Uses that helper for both the front spans (VICTORY_FRONT_SIFT) and the batch refreshes (VICTORY_FLUSH_SIFT), replacing the two duplicate Arc-based sift functions.
  • Removes two unused write-watch snapshot calls.
  • Adds a test that checks ordering, counts, and allocation reuse.

Measurement

On an RTX 5060 8 GB / Ryzen 5 5600 with a gated headless replay driver (same tape, settings and 3,000-draw gate): median frame 68.3 ms → 58.9 ms (14.6 → 17.0 fps), p95 80.3 → 78.6 ms. This was the only structural patch in a long A/B series that produced a clear fps gain. The 1-second report's refresh cost fell from ~21.8 ms to ~16.3 ms per frame.

Verification

  • Release build succeeds on current upstream main after resolving one conflict with the newer ahead_snapshot_into path (the snapshot was unused and removed).
  • cargo test -p victory-gpu --lib sampled: passes.
  • cargo xtask policy: the only reported violation (heap_sites/frame_users.rs, 2022 hex digits) is pre-existing on upstream main, not in this patch.
  • cargo clippy -D warnings currently fails on clean upstream main with pre-existing lints; this patch adds none.

Docs/analysis from the investigation are included in docs/cpu-submission-critical-path.md.

**@⁠victorportelada** on GitHub · 2026-11-30 04:22 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3705) `victorportelada:pr/refresh-sift` → `main` · +121 −54 · 4 files · 1 commits · closed without merging ## What it changes The refresh sifting paths allocated fresh `Arc<Vec<AtomicBool>>` marks and an `Arc<Vec<...>>` of items for every large flush, then cloned them once per worker. On a 6-core host this was measurable overhead in the submitting thread's critical path. This patch: - Adds one reusable `Vec<AtomicBool>` to `Batch` and a generic `retain_scoped` helper that checks items on the existing scoped worker pool, reuses the marks allocation, and retains entries in order. - Uses that helper for both the front spans (`VICTORY_FRONT_SIFT`) and the batch refreshes (`VICTORY_FLUSH_SIFT`), replacing the two duplicate `Arc`-based sift functions. - Removes two unused write-watch snapshot calls. - Adds a test that checks ordering, counts, and allocation reuse. ## Measurement On an RTX 5060 8 GB / Ryzen 5 5600 with a gated headless replay driver (same tape, settings and 3,000-draw gate): median frame 68.3 ms → 58.9 ms (14.6 → 17.0 fps), p95 80.3 → 78.6 ms. This was the only structural patch in a long A/B series that produced a clear fps gain. The 1-second report's refresh cost fell from ~21.8 ms to ~16.3 ms per frame. ## Verification - Release build succeeds on current upstream `main` after resolving one conflict with the newer `ahead_snapshot_into` path (the snapshot was unused and removed). - `cargo test -p victory-gpu --lib sampled`: passes. - `cargo xtask policy`: the only reported violation (`heap_sites/frame_users.rs`, 2022 hex digits) is pre-existing on upstream `main`, not in this patch. - `cargo clippy -D warnings` currently fails on clean upstream `main` with pre-existing lints; this patch adds none. Docs/analysis from the investigation are included in `docs/cpu-submission-critical-path.md`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 04:28:09 +00:00
github-bot closed this pull request 2026-12-01 18:51:30 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:49 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:49 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3705#issuecomment-7321620993) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!3705
No description provided.