perf(gpu/memory): targeted frame-boundary sync for BVH compacted-size queries (#339) #343

Manually merged
github merged 2 commits from github-bot/gh-343 into gh-pr/343/base 2026-12-02 22:37:43 +00:00 AGit
Owner

@⁠Androtim on GitHub · 2026-12-02 14:36 UTC · original
Androtim:feat/hw-rt-phase1-bvh-sync → main · +436 −37 · 9 files · 2 commits · merged 2026-12-02 22:33 UTC

Phase 1c of #339 — Eliminates the ~20 ms/frame full-pipeline stall of legacy \VICTORY_BVH_SIZES_WAIT=1\ while synchronizing dynamic BVH compacted-size readback queries without starving subsequent draw submissions:

Changes

  • Targeted SIZES flight landing (host/sizes.rs, host.rs):
    • Host::send_late records sent.number for submissions carrying BVH size queries (sks_size) without calling full-line Host::settle.
    • Added sizes::settle_until and sizes::settle_for_present: when
      elay() is enabled, waits only until FINISHED >= target_flight (keeping later draw submissions and late_free_present() in flight rather than draining line.line).
    • Upgraded opt-in VICTORY_BVH_SIZES_WAIT=1 to use settle_until instead of draining later flights.
  • Frame-boundary synchronization (queue.rs, queue/behind.rs):
    • Present drains any queued SIZES submissions in ehind::LANE (only when SIZES work was actually queued) and calls host::settle_sizes_for_present() before advancing to the next frame.
    • Zero runtime cost when BVH builder size queries are inactive (PENDING_FLIGHT == 0, SIZES_SEEN == false).
  • Compacted-size query detection & quiet wake (memory.rs, shadow.rs, quiet.rs):
    • Added VICTORY_BVH_SIZES_SYNC (deferred frame-boundary mode on by default for sks_size dispatches; =0 disables; VICTORY_BVH_SIZES_WAIT=1 keeps eager mode).
    • Checked all root UAV slots in sks_size and woke Quiet on queried small buffers (shadow::wake_quiet) so copybacks are never muted across idle frames.

Audit Note: \lobomfz/VIctory-xmem\ (\VICTORY_BVH_HARDWARE)

  • Audited \xmem's \OP_BVH64_INTERSECT_RAY\ (\
**@⁠Androtim** on GitHub · 2026-12-02 14:36 UTC · [original](https://github.com/Androtim/MiniVI/pull/343) `Androtim:feat/hw-rt-phase1-bvh-sync` → `main` · +436 −37 · 9 files · 2 commits · merged 2026-12-02 22:33 UTC Phase 1c of #339 — Eliminates the ~20 ms/frame full-pipeline stall of legacy \VICTORY_BVH_SIZES_WAIT=1\ while synchronizing dynamic BVH compacted-size readback queries without starving subsequent draw submissions: ### Changes - **Targeted SIZES flight landing ([host/sizes.rs](crates/victory-gpu/src/host/sizes.rs), [host.rs](crates/victory-gpu/src/host.rs)):** - Host::send_late records sent.number for submissions carrying BVH size queries (sks_size) without calling full-line Host::settle. - Added sizes::settle_until and sizes::settle_for_present: when elay() is enabled, waits only until FINISHED >= target_flight (keeping later draw submissions and late_free_present() in flight rather than draining line.line). - Upgraded opt-in VICTORY_BVH_SIZES_WAIT=1 to use settle_until instead of draining later flights. - **Frame-boundary synchronization ([queue.rs](crates/victory-gpu/src/queue.rs), [queue/behind.rs](crates/victory-gpu/src/queue/behind.rs)):** - Present drains any queued SIZES submissions in ehind::LANE (only when SIZES work was actually queued) and calls host::settle_sizes_for_present() before advancing to the next frame. - Zero runtime cost when BVH builder size queries are inactive (PENDING_FLIGHT == 0, SIZES_SEEN == false). - **Compacted-size query detection & quiet wake ([memory.rs](crates/victory-gpu/src/memory.rs), [shadow.rs](crates/victory-gpu/src/shadow.rs), [quiet.rs](crates/victory-gpu/src/quiet.rs)):** - Added VICTORY_BVH_SIZES_SYNC (deferred frame-boundary mode on by default for sks_size dispatches; =0 disables; VICTORY_BVH_SIZES_WAIT=1 keeps eager mode). - Checked all root UAV slots in sks_size and woke Quiet on queried small buffers (shadow::wake_quiet) so copybacks are never muted across idle frames. ### Audit Note: \lobomfz/VIctory-xmem\ (\VICTORY_BVH_HARDWARE\) - Audited \xmem\'s \OP_BVH64_INTERSECT_RAY\ (\
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 14:39:28 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-12-02 15:04 UTC · original

Holding merge (triage: needs work) per deep static audit routing (#282 comment 7349410307, P0/P1 findings #13, #14, #16, #17 routed to #339). Please resolve the flagged findings, re-verify CI, and run a paired plain---release RT-off A/B + --features diagnostics PNG check before merge.

**@⁠Androtim** on GitHub · 2026-12-02 15:04 UTC · [original](https://github.com/Androtim/MiniVI/pull/343#issuecomment-7349658300) Holding merge (`triage: needs work`) per deep static audit routing (`#282` comment `7349410307`, P0/P1 findings #13, #14, #16, #17 routed to `#339`). Please resolve the flagged findings, re-verify CI, and run a paired plain-`--release` RT-off A/B + `--features diagnostics` PNG check before merge.
Author
Owner

@⁠Androtim on GitHub · 2026-12-02 15:05 UTC · original · edited 2026-12-02 17:05 UTC

Automated triage for the maintainers (not an approval).

Verdict: needs-rebase · CI (check): passing

This PR no longer merges cleanly into main.

To change the verdict: Rebase onto current main and resolve conflicts; CI and triage will run again automatically.


Generated with Antigravity CLI (agy).

**@⁠Androtim** on GitHub · 2026-12-02 15:05 UTC · [original](https://github.com/Androtim/MiniVI/pull/343#issuecomment-7349696390) · edited 2026-12-02 17:05 UTC <!-- minivi-triage v1 head=6b9c8435ed0e1d17ca6d9c8c24ed26447955d183 verdict=needs-rebase ci=passing at=2026-12-02T17:06:15Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-rebase` · **CI (`check`):** `passing` This PR no longer merges cleanly into `main`. **To change the verdict:** Rebase onto current `main` and resolve conflicts; CI and triage will run again automatically. --- _Generated with Antigravity CLI (`agy`)._
Author
Owner

@⁠Androtim on GitHub · 2026-12-02 16:29 UTC · original

Rebased onto \main\ (\80d3ff4) and resolved #282\ P1 finding #17 (plus the \ehind.rs\ and \memory.rs\ triage notes):

  • Eliminated per-frame drains & load-order race (\pipeline.rs, \list/thin.rs, \queue/behind.rs, \memory.rs): Removed \SIZES_SEEN, \THIN_QUEUED, and \THIN_DONE. Added \Recording::has_sizes\ via \pipeline::maybe_size_query\ on thin \DISPATCH/\DISPATCH_X/\EXECUTE_INDIRECT\ calls and carried \had_sizes\ on \Job::Lists. \Job::unfold\ now calls
    ote_queued_sizes(&jobs)\ (publishing \SIZES_QUEUED) before incrementing \THIN_SIZES_DONE, and \has_pending_sizes()\ loads \THIN_SIZES_DONE\ before \SIZES_QUEUED.
  • Fixed \Quiet::wake\ near-threshold bypass (\quiet.rs): Always acquires \self.state\ and resets \streak = 0; audit = 0; range = None\ alongside \self.ready, even when \self.ready\ was still \ alse. Also filtered \wake_quiet\ in \memory.rs\ to small buffers matching \in_buffer(at, 1).is_some_and(|b| b.1 <= BACK).

Verified (\VICTORY_D3D12_WARP=1): \list::thin::tests\ (\13 passed; 0 failed), \queue::behind::tests\ (\9 passed; 0 failed), \quiet::tests\ (\8 passed; 0 failed), \host::sizes::tests\ (\2 passed; 0 failed), \memory::tests\ (\10 passed; 0 failed), workspace \clippy --all-targets\ (normal & --all-features), and \xtask policy --staged\ (\5 files ok). Ready for CI and maintainer GPU check.

**@⁠Androtim** on GitHub · 2026-12-02 16:29 UTC · [original](https://github.com/Androtim/MiniVI/pull/343#issuecomment-7352012171) Rebased onto \main\ (\80d3ff4\) and resolved \#282\ P1 finding #17 (plus the \ehind.rs\ and \memory.rs\ triage notes): - **Eliminated per-frame drains & load-order race (\pipeline.rs\, \list/thin.rs\, \queue/behind.rs\, \memory.rs\):** Removed \SIZES_SEEN\, \THIN_QUEUED\, and \THIN_DONE\. Added \Recording::has_sizes\ via \pipeline::maybe_size_query\ on thin \DISPATCH\/\DISPATCH_X\/\EXECUTE_INDIRECT\ calls and carried \had_sizes\ on \Job::Lists\. \Job::unfold\ now calls \ ote_queued_sizes(&jobs)\ (publishing \SIZES_QUEUED\) *before* incrementing \THIN_SIZES_DONE\, and \has_pending_sizes()\ loads \THIN_SIZES_DONE\ *before* \SIZES_QUEUED\. - **Fixed \Quiet::wake\ near-threshold bypass (\quiet.rs\):** Always acquires \self.state\ and resets \streak = 0; audit = 0; range = None\ alongside \self.ready\, even when \self.ready\ was still \ alse\. Also filtered \wake_quiet\ in \memory.rs\ to small buffers matching \in_buffer(at, 1).is_some_and(|b| b.1 <= BACK)\. Verified (\VICTORY_D3D12_WARP=1\): \list::thin::tests\ (\13 passed; 0 failed\), \queue::behind::tests\ (\9 passed; 0 failed\), \quiet::tests\ (\8 passed; 0 failed\), \host::sizes::tests\ (\2 passed; 0 failed\), \memory::tests\ (\10 passed; 0 failed\), workspace \clippy --all-targets\ (normal & \--all-features\), and \xtask policy --staged\ (\5 files ok\). Ready for CI and maintainer GPU check.
github-bot force-pushed github-bot/gh-343 from de84a1e1fd to 6b9c8435ed 2026-12-02 17:09:59 +00:00 Compare
Author
Owner

@⁠Androtim on GitHub · 2026-12-02 19:37 UTC · original

Deep Static Logic Audit Pass #3 (#282 comment 7355749301) signed off 6b9c8435 as VERIFIED CLEAN (Green Light) — Pass #1 Finding #17 is cleanly resolved. Rebase onto current main to resolve merge conflicts and pass CI, and this is ready to merge immediately.

**@⁠Androtim** on GitHub · 2026-12-02 19:37 UTC · [original](https://github.com/Androtim/MiniVI/pull/343#issuecomment-7356464635) Deep Static Logic Audit Pass #3 (`#282` comment `7355749301`) signed off `6b9c8435` as **VERIFIED CLEAN (Green Light)** — Pass #1 Finding `#17` is cleanly resolved. Rebase onto current `main` to resolve merge conflicts and pass CI, and this is ready to merge immediately.
github-bot force-pushed github-bot/gh-343 from 6b9c8435ed to a0ba51f8c1 2026-12-02 22:05:44 +00:00 Compare
github-bot changed target branch from main to gh-pr/343/base 2026-12-02 22:37:40 +00:00
github manually merged commit a0ba51f8c1 into gh-pr/343/base 2026-12-02 22:37:43 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-12-02 22:33 UTC · original

Rebased cleanly onto main (a0ba51f8), Deep Static Audit Pass #3 & Pass #4 verified clean (Pass #1 #17 resolved), CI GREEN. Merging #339 Phase 1c targeted frame-boundary sync for BVH compacted-size queries to main.

**@⁠Androtim** on GitHub · 2026-12-02 22:33 UTC · [original](https://github.com/Androtim/MiniVI/pull/343#issuecomment-7360847504) Rebased cleanly onto `main` (`a0ba51f8`), Deep Static Audit Pass #3 & Pass #4 verified clean (Pass #1 `#17` resolved), CI **GREEN**. Merging `#339` Phase 1c targeted frame-boundary sync for BVH compacted-size queries to `main`.
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/Androtim--MiniVI!343
No description provided.