fix(gpu): wake WaitOnAddress in fence::written and fail fast on non-sharing errors in samplers::open_alone (#318) #337

Merged
RUIZ-Enrique-25002136 merged 1 commit from upstream-pr/337 into main 2026-12-02 13:34:30 +00:00
RUIZ-Enrique-25002136 commented 2026-12-02 13:26:41 +00:00 (Migrated from github.com)

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


Summary

Fixes both synchronization and I/O stall bugs in crates/victory-gpu tracked in #318.

Fixes #318

Changes

  1. crates/victory-gpu/src/fence.rs (fence::written):
    • Captured (&raw const fence.value).cast() before releasing waiters and live locks, then called WakeByAddressAll(addr) under #[cfg(windows)] (matching fence::set).
    • Added #[cfg(windows)] unit test a_write_at_the_fence_address_wakes_wait_on_address verifying WaitOnAddress wakes promptly on bottom-of-pipe Written::Value writes.
  2. crates/victory-gpu/src/pipeline/samplers.rs (open_alone / open_alone_in):
    • Extracted open_alone_in(dir) and gated the 10-second retry loop specifically on e.raw_os_error() == Some(ERROR_SHARING_VIOLATION) (32), so permanent errors (ERROR_ACCESS_DENIED, ERROR_PATH_NOT_FOUND, etc.) fail immediately instead of stalling threads on the global MADE mutex.
    • Added unit test open_alone_fails_fast_on_non_sharing_error using a blocking directory at FILE to verify non-sharing errors return None without stalling.

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
  • 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:5607357366 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/337). Originally posted by [RUIZ-Enrique-25002136](https://github.com/RUIZ-Enrique-25002136) on 2026-12-02T13:26:41Z. --- ## Summary Fixes both synchronization and I/O stall bugs in `crates/victory-gpu` tracked in #318. Fixes #318 ### Changes 1. **`crates/victory-gpu/src/fence.rs` (`fence::written`):** - Captured `(&raw const fence.value).cast()` before releasing `waiters` and `live` locks, then called `WakeByAddressAll(addr)` under `#[cfg(windows)]` (matching `fence::set`). - Added `#[cfg(windows)]` unit test `a_write_at_the_fence_address_wakes_wait_on_address` verifying `WaitOnAddress` wakes promptly on bottom-of-pipe `Written::Value` writes. 2. **`crates/victory-gpu/src/pipeline/samplers.rs` (`open_alone` / `open_alone_in`):** - Extracted `open_alone_in(dir)` and gated the 10-second retry loop specifically on `e.raw_os_error() == Some(ERROR_SHARING_VIOLATION)` (`32`), so permanent errors (`ERROR_ACCESS_DENIED`, `ERROR_PATH_NOT_FOUND`, etc.) fail immediately instead of stalling threads on the global `MADE` mutex. - Added unit test `open_alone_fails_fast_on_non_sharing_error` using a blocking directory at `FILE` to verify non-sharing errors return `None` without stalling. ## 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 - **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!337
No description provided.