fix(gpu/uav_pool): read QUEUED before STARTED in retire_uavs and strengthen QUEUED ordering (#316) #335

Merged
RUIZ-Enrique-25002136 merged 1 commit from upstream-pr/335 into main 2026-12-02 13:34:22 +00:00
RUIZ-Enrique-25002136 commented 2026-12-02 13:15:09 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by RUIZ-Enrique-25002136 on 2026-12-02T13:15:09Z.


Summary

Fixes the reversed STARTED / QUEUED load order in uav_pool::retire_uavs and strengthens QUEUED synchronization in queue::behind so still-in-flight scratch UAV buffers cannot be under-counted and prematurely recycled into UAV_SPARE.

Fixes #316

Changes

  1. crates/victory-gpu/src/host/uav_pool.rs
    • Added current_started_with(queued, started) that evaluates queued() strictly before started(), matching host::retire and host::retire_resource.
    • Updated retire_uavs (and test helper wait_submissions_idle) to use current_started_with(crate::queue::queued, || STARTED.load(Ordering::Acquire)).
    • Added unit test current_started_reads_queued_before_started verifying load ordering and non-under-counting across a concurrent STARTED increment + QUEUED decrement transition.
  2. crates/victory-gpu/src/queue/behind.rs
    • Upgraded QUEUED.fetch_sub(...) from Relaxed to Release (unfold, Job::Run, Job::Joined, Job::Present) and QUEUED.load(...) in queued() from Relaxed to Acquire, establishing happens-before with STARTED.fetch_add(1, AcqRel) in host.rs.

Rig Specs Tested On

  • CPU: Linux workstation (x86_64)
  • GPU & VRAM: N/A (Windows-only victory-gpu crate; full clippy & tests verified on GitHub Actions windows-latest CI)
  • System RAM: N/A
  • OS & GPU Driver: Linux (x86_64) — Windows x86_64-pc-windows-msvc CI verifies compilation, clippy, and unit tests

Run Settings & Profile

  • Build & Commit SHA: rebased on origin/main (b0842d9)
  • Console Profile & Internal Resolution / Scale: N/A (atomic synchronization fix)
  • Ray Tracing: N/A
  • Upscaling: N/A
  • Frame Generation: N/A
  • Launcher Command / Preset & Extra VICTORY_* Overrides: N/A
  • Scene / Area & Session Length: N/A

Measurements & Verification

  • Base FPS (without Frame Gen): N/A
  • Frame-Gen FPS (if enabled): N/A
  • VRAM / RAM Usage: N/A
  • Crashes / DRED Resets: N/A
  • Automated Checks:
    • cargo clippy --workspace --all-targets --locked -- -D warnings (verified on GitHub Actions windows-latest CI)
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings (verified on GitHub Actions windows-latest CI)
    • cargo test --locked -p xtask -> 8 passed, 0 failed
    • cargo xtask policy -> asset policy: 324 files ok
    • cargo test -p victory-gpu --locked -- --test-threads=1 (verified on GitHub Actions windows-latest CI)
<!-- greyfinch-sync:Androtim/MiniVI:issue:5607160147 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/335). Originally posted by [RUIZ-Enrique-25002136](https://github.com/RUIZ-Enrique-25002136) on 2026-12-02T13:15:09Z. --- ## Summary Fixes the reversed `STARTED` / `QUEUED` load order in `uav_pool::retire_uavs` and strengthens `QUEUED` synchronization in `queue::behind` so still-in-flight scratch UAV buffers cannot be under-counted and prematurely recycled into `UAV_SPARE`. Fixes #316 ### Changes 1. **`crates/victory-gpu/src/host/uav_pool.rs`** - Added `current_started_with(queued, started)` that evaluates `queued()` strictly before `started()`, matching `host::retire` and `host::retire_resource`. - Updated `retire_uavs` (and test helper `wait_submissions_idle`) to use `current_started_with(crate::queue::queued, || STARTED.load(Ordering::Acquire))`. - Added unit test `current_started_reads_queued_before_started` verifying load ordering and non-under-counting across a concurrent `STARTED` increment + `QUEUED` decrement transition. 2. **`crates/victory-gpu/src/queue/behind.rs`** - Upgraded `QUEUED.fetch_sub(...)` from `Relaxed` to `Release` (`unfold`, `Job::Run`, `Job::Joined`, `Job::Present`) and `QUEUED.load(...)` in `queued()` from `Relaxed` to `Acquire`, establishing happens-before with `STARTED.fetch_add(1, AcqRel)` in `host.rs`. ## Rig Specs Tested On - **CPU:** Linux workstation (`x86_64`) - **GPU & VRAM:** N/A (Windows-only `victory-gpu` crate; full clippy & tests verified on GitHub Actions `windows-latest` CI) - **System RAM:** N/A - **OS & GPU Driver:** Linux (`x86_64`) — Windows `x86_64-pc-windows-msvc` CI verifies compilation, clippy, and unit tests ## Run Settings & Profile - **Build & Commit SHA:** rebased on `origin/main` (`b0842d9`) - **Console Profile & Internal Resolution / Scale:** N/A (atomic synchronization fix) - **Ray Tracing:** N/A - **Upscaling:** N/A - **Frame Generation:** N/A - **Launcher Command / Preset & Extra `VICTORY_*` Overrides:** N/A - **Scene / Area & Session Length:** N/A ## Measurements & Verification - **Base FPS (without Frame Gen):** N/A - **Frame-Gen FPS (if enabled):** N/A - **VRAM / RAM Usage:** N/A - **Crashes / DRED Resets:** N/A - **Automated Checks:** - [ ] `cargo clippy --workspace --all-targets --locked -- -D warnings` (verified on GitHub Actions `windows-latest` CI) - [ ] `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` (verified on GitHub Actions `windows-latest` CI) - [x] `cargo test --locked -p xtask` -> 8 passed, 0 failed - [x] `cargo xtask policy` -> `asset policy: 324 files ok` - [ ] `cargo test -p victory-gpu --locked -- --test-threads=1` (verified on GitHub Actions `windows-latest` CI)
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Androtim/MiniVI!335
No description provided.