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

Manually merged
github merged 1 commit from github-bot/gh-337 into gh-pr/337/base 2026-12-02 13:35:30 +00:00 AGit
Owner

@⁠RUIZ-Enrique-25002136 on GitHub · 2026-12-02 13:26 UTC · original
RUIZ-Enrique-25002136:fix/fence-wake-and-samplers-retry → main · +77 −8 · 2 files · 1 commits · merged 2026-12-02 13:34 UTC

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)
**@⁠RUIZ-Enrique-25002136** on GitHub · 2026-12-02 13:26 UTC · [original](https://github.com/Androtim/MiniVI/pull/337) `RUIZ-Enrique-25002136:fix/fence-wake-and-samplers-retry` → `main` · +77 −8 · 2 files · 1 commits · merged 2026-12-02 13:34 UTC ## 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)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 13:30:01 +00:00
github-bot changed target branch from main to gh-pr/337/base 2026-12-02 13:35:29 +00:00
github manually merged commit 839610299e into gh-pr/337/base 2026-12-02 13:35:30 +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/Androtim--MiniVI!337
No description provided.