gpu(watch): spin-backoff before yielding in fault-ask open wait #2814

Manually merged
github merged 1 commit from github-bot/gh-2814 into gh-pr/2814/base 2026-11-29 22:59:18 +00:00 AGit
Owner

@⁠Nosheboo on GitHub · 2026-11-29 17:37 UTC · original
Nosheboo:perf/fault-ask-spin-backoff → main · +131 −30 · 1 files · 1 commits · merged 2026-11-29 22:54 UTC

Motivation

On upstream 55d06914, baseline profiling shows the submitter spending 3.4–3.7 ms/frame in write watch. In wait_open_done, the open-wait loop immediately called std::thread::yield_now() on contention and unconditionally evaluated Instant::now() even when fault_asks() diagnostics were off.

Changes

  • crates/victory-gpu/src/watch.rs:
    • Extracts OpenWait, wait_open_done, and testable wait_open_done_with.
    • Performs a bounded 8 x 64 std::hint::spin_loop() fast-spin phase (OPEN_FAST_SPINS = 8) before falling back to std::thread::yield_now() up to OPEN_LONGEST_US = 2_000.
    • Moves Instant::now() reads inside the fault_asks() diagnostics branch so the non-diagnostic hot path avoids extra clock syscalls.
    • Adds wait_open_done_covers_immediate_fast_spin_yield_cleared_and_timeout covering all six wait outcomes.

Verification

  • cargo test -p victory-gpu --lib --locked watch:: -- --test-threads=1 -> 63 passed; 0 failed; 0 ignored
  • cargo clippy -p victory-gpu --no-deps --lib --tests --locked -- -W clippy::undocumented_unsafe_blocks reported 0 warnings in watch.rs
  • git diff --cached --check clean; cargo xtask policy --staged passed (1 files ok)

Council review

Rounds: 3

Delegate Round 1 Round 2 Round 3
Concurrency & Safety Auditor (gpt-6-luna, xhigh) 9/10 9/10 9/10
Performance & Modernization Architect (gpt-6-luna, xhigh) 8/10 8/10 9/10
Upstream PR Hygiene & Test Critic (gpt-6-luna, xhigh) 9/10 8/10 8/10

Created in T3 Code (reviewed by Council: 3× gpt-6-luna on xhigh).

**@⁠Nosheboo** on GitHub · 2026-11-29 17:37 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2814) `Nosheboo:perf/fault-ask-spin-backoff` → `main` · +131 −30 · 1 files · 1 commits · merged 2026-11-29 22:54 UTC ## Motivation On upstream `55d06914`, baseline profiling shows the submitter spending `3.4–3.7 ms/frame` in `write watch`. In `wait_open_done`, the open-wait loop immediately called `std::thread::yield_now()` on contention and unconditionally evaluated `Instant::now()` even when `fault_asks()` diagnostics were off. ## Changes - `crates/victory-gpu/src/watch.rs`: - Extracts `OpenWait`, `wait_open_done`, and testable `wait_open_done_with`. - Performs a bounded 8 x 64 `std::hint::spin_loop()` fast-spin phase (`OPEN_FAST_SPINS = 8`) before falling back to `std::thread::yield_now()` up to `OPEN_LONGEST_US = 2_000`. - Moves `Instant::now()` reads inside the `fault_asks()` diagnostics branch so the non-diagnostic hot path avoids extra clock syscalls. - Adds `wait_open_done_covers_immediate_fast_spin_yield_cleared_and_timeout` covering all six wait outcomes. ## Verification - `cargo test -p victory-gpu --lib --locked watch:: -- --test-threads=1` -> `63 passed; 0 failed; 0 ignored` - `cargo clippy -p victory-gpu --no-deps --lib --tests --locked -- -W clippy::undocumented_unsafe_blocks` reported 0 warnings in `watch.rs` - `git diff --cached --check` clean; `cargo xtask policy --staged` passed (`1 files ok`) ## Council review Rounds: 3 | Delegate | Round 1 | Round 2 | Round 3 | | --- | --- | --- | --- | | Concurrency & Safety Auditor (`gpt-6-luna`, `xhigh`) | 9/10 | 9/10 | 9/10 | | Performance & Modernization Architect (`gpt-6-luna`, `xhigh`) | 8/10 | 8/10 | 9/10 | | Upstream PR Hygiene & Test Critic (`gpt-6-luna`, `xhigh`) | 9/10 | 8/10 | 8/10 | Created in T3 Code (reviewed by Council: 3× gpt-6-luna on xhigh).
Extracts wait_open_done/wait_open_done_with so the !fault_asks() wait avoids Instant::now() calls across a bounded 8x64-pause spin phase before yielding up to 2,000 us, eliminating the cross-CCD contention regression reported on #1908 while preserving OPEN_DONE/OPENING/again semantics and diagnostics timing.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 17:39:15 +00:00
github-bot changed target branch from main to gh-pr/2814/base 2026-11-29 22:58:06 +00:00
github manually merged commit 789d1ed03e into gh-pr/2814/base 2026-11-29 22:58:07 +00:00
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!2814
No description provided.