GPU: fix dynamic descriptor wraparound scan, per-heap walk cap, and capped headroom #89

Closed
dutch2005 wants to merge 1 commit from upstream-pr/89 into main
dutch2005 commented 2026-11-25 13:44:50 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by dutch2005 on 2026-11-25T13:44:50Z.


Summary

Ports and consolidates dynamic descriptor allocator fixes from upstream forks (uiliannn/VItoriaBr a91ef70/b37344f/a65d054 and fxceless/victory-fork#932):

  1. Wraparound scan across cursor (find_dynamic_run): Previously (*next..spare).chain(0..*next) missed contiguous free runs that started before *next and ended after it. Extending the wrapped slice to 0..(cursor + n - 1).min(spare) recovers straddling runs while still never wrapping past the end of the array.
  2. Per-heap walk cap & lock-free free count: Replaced the process-global FAILED static with per-heap free: AtomicU32 (O(1) lock-free capacity check) and per-heap failed_walks, reset inside release() when slots are freed so fragmented misses on one heap never starve other heaps or post-release allocations mid-frame.
  3. Capped heap headroom (DYNAMIC_CAPPED): Doubled DYNAMIC_CAPPED from 1 << 16 to 1 << 17 on hosts capped at PORTABLE_VIEWS.

Verification

  • Ran cargo clippy -p victory-gpu --no-deps --all-targets --locked and --all-features (0 warnings on crates/victory-gpu/src/descriptor/host.rs).
  • Ran cargo test -p victory-gpu --lib -- --test-threads=1 descriptor::host::tests on host AMD Radeon RX 6700 XT: all 15 tests passed, including:
    • find_dynamic_run_scans_contiguous_runs_across_cursor_but_not_end
    • dynamic_allocation_finds_contiguous_range_crossing_search_cursor
    • failed_dynamic_walks_do_not_starve_other_heaps_and_reset_on_release
<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:6605894794 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/89). Originally posted by [dutch2005](https://github.com/dutch2005) on 2026-11-25T13:44:50Z. --- ## Summary Ports and consolidates dynamic descriptor allocator fixes from upstream forks (`uiliannn/VItoriaBr` `a91ef70`/`b37344f`/`a65d054` and `fxceless/victory-fork#932`): 1. **Wraparound scan across cursor (`find_dynamic_run`)**: Previously `(*next..spare).chain(0..*next)` missed contiguous free runs that started before `*next` and ended after it. Extending the wrapped slice to `0..(cursor + n - 1).min(spare)` recovers straddling runs while still never wrapping past the end of the array. 2. **Per-heap walk cap & lock-free free count**: Replaced the process-global `FAILED` static with per-heap `free: AtomicU32` (O(1) lock-free capacity check) and per-heap `failed_walks`, reset inside `release()` when slots are freed so fragmented misses on one heap never starve other heaps or post-release allocations mid-frame. 3. **Capped heap headroom (`DYNAMIC_CAPPED`)**: Doubled `DYNAMIC_CAPPED` from `1 << 16` to `1 << 17` on hosts capped at `PORTABLE_VIEWS`. ## Verification - Ran `cargo clippy -p victory-gpu --no-deps --all-targets --locked` and `--all-features` (0 warnings on `crates/victory-gpu/src/descriptor/host.rs`). - Ran `cargo test -p victory-gpu --lib -- --test-threads=1 descriptor::host::tests` on host AMD Radeon RX 6700 XT: all 15 tests passed, including: - `find_dynamic_run_scans_contiguous_runs_across_cursor_but_not_end` - `dynamic_allocation_finds_contiguous_range_crossing_search_cursor` - `failed_dynamic_walks_do_not_starve_other_heaps_and_reset_on_release`
enriquebruno12 commented 2026-11-25 14:51:51 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by enriquebruno12 on 2026-11-25T14:51:51Z.


Independently tested on Windows with an RX 9070 XT. All 15 descriptor::host::tests passed single-threaded. I repeated the run with the two new hardware tests set to fail if D3D12 heap creation returned None; all 15 passed again. This confirms both the allocation across the search cursor and recovery after releasing slots. No game files were used.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7165933227 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/89#issuecomment-7165933227). Originally posted by [enriquebruno12](https://github.com/enriquebruno12) on 2026-11-25T14:51:51Z. --- Independently tested on Windows with an RX 9070 XT. All 15 descriptor::host::tests passed single-threaded. I repeated the run with the two new hardware tests set to fail if D3D12 heap creation returned None; all 15 passed again. This confirms both the allocation across the search cursor and recovery after releasing slots. No game files were used.

Pull request closed

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
Belobug/VIctory-Belobug-AMD!89
No description provided.