GPU: extend HostHeap wraparound search range to cursor bounds (fixes #871) #974

Merged
pushkarreddyy merged 3 commits from upstream-pr/974 into main 2026-11-25 00:20:50 +00:00
pushkarreddyy commented 2026-11-24 14:36:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T14:36:26Z.


Summary

Extends the second chained wraparound search range in HostHeap::dynamic() to prevent premature heap exhaustion, resolving #871.

Changes

  • In crates/victory-gpu/src/descriptor/host.rs:
    • Changed wraparound search range from 0..*next to 0..cursor.saturating_add(n - 1).min(end).
    • Added regression test host_heap_finds_contiguous_run_spanning_cursor_on_wraparound.

Verification

  • Tested and verified on RTX 4090 under Wine/vkd3d-proton 3.2.
  • Complies with Rule #1 asset policy.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6584229537 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/974). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T14:36:26Z. --- ### Summary Extends the second chained wraparound search range in `HostHeap::dynamic()` to prevent premature heap exhaustion, resolving #871. ### Changes - In `crates/victory-gpu/src/descriptor/host.rs`: - Changed wraparound search range from `0..*next` to `0..cursor.saturating_add(n - 1).min(end)`. - Added regression test `host_heap_finds_contiguous_run_spanning_cursor_on_wraparound`. ### Verification - Tested and verified on RTX 4090 under Wine/vkd3d-proton 3.2. - Complies with Rule #1 asset policy.
mercuryVM commented 2026-11-24 15:03:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T14:39:38Z.

Review: APPROVED


Tested c1be75f on Windows 11, RTX 5070, MSVC: cargo test -p victory-gpu -- --test-threads=1 51 passed, including dynamic_search_can_find_a_run_across_the_cursor. cargo clippy -p victory-gpu --all-targets is clean.

  • Extending the wrap-around pass to cursor + n - 1 lets the existing run counter (which resets on any discontinuity) find a run that starts before the cursor and ends past it. Runs still can't wrap the physical end, which the "free slot at each end" assertion checks.
  • Overlap: #251 fixes the same miss in this function by searching candidate start slots, with an exhaustive 8-slot test against a brute-force first fit. Only one of the two should land. #251's test is the stronger one if you want to keep the run-counter approach.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6041278451 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/974#pullrequestreview-6041278451). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T14:39:38Z. **Review:** APPROVED --- Tested c1be75f on Windows 11, RTX 5070, MSVC: `cargo test -p victory-gpu -- --test-threads=1` 51 passed, including `dynamic_search_can_find_a_run_across_the_cursor`. `cargo clippy -p victory-gpu --all-targets` is clean. - Extending the wrap-around pass to `cursor + n - 1` lets the existing run counter (which resets on any discontinuity) find a run that starts before the cursor and ends past it. Runs still can't wrap the physical end, which the "free slot at each end" assertion checks. - Overlap: #251 fixes the same miss in this function by searching candidate start slots, with an exhaustive 8-slot test against a brute-force first fit. Only one of the two should land. #251's test is the stronger one if you want to keep the run-counter approach. AI-assisted (Claude Code).
Aniseto commented 2026-11-24 16:05:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Aniseto on 2026-11-24T15:06:39Z.


Ran the new test at c1be75f:

Environment: Windows 11 Pro build 26200 x64, Intel Core i5-12400F, 64 GB RAM, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only) driver 32.0.16.2124, Rust 1.98.1 (pinned by rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

cargo test -p victory-gpu dynamic_search_can_find
1 passed; 0 failed; 0 ignored      (exit 0)

descriptor::host::tests::dynamic_search_can_find_a_run_across_the_cursor passes. This is a unit-level test over the heap search, so the adapter is not the variable; the datapoint is the pinned 1.98.1 toolchain.

Not tested: the title run that hit #871 (no game data here), RDNA2/RDNA4 and Intel GPUs.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the test, wrote this report; no game data was used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7135474865 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/974#issuecomment-7135474865). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-24T15:06:39Z. --- Ran the new test at `c1be75f`: Environment: Windows 11 Pro build 26200 x64, Intel Core i5-12400F, 64 GB RAM, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only) driver 32.0.16.2124, Rust 1.98.1 (pinned by `rust-toolchain.toml`), MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` cargo test -p victory-gpu dynamic_search_can_find 1 passed; 0 failed; 0 ignored (exit 0) ``` `descriptor::host::tests::dynamic_search_can_find_a_run_across_the_cursor` passes. This is a unit-level test over the heap search, so the adapter is not the variable; the datapoint is the pinned 1.98.1 toolchain. Not tested: the title run that hit #871 (no game data here), RDNA2/RDNA4 and Intel GPUs. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash 1017** - checked out the PR's head commit in a detached worktree, built it, ran the test, wrote this report; no game data was used.
Zipettte commented 2026-11-24 16:05:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T15:13:06Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at c1be75f: cargo test -p victory-gpu passes, 51 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7135652281 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/974#issuecomment-7135652281). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T15:13:06Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at c1be75f: `cargo test -p victory-gpu` passes, 51 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
pushkarreddyy commented 2026-11-24 16:05:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T15:28:44Z.


Thank you @Aniseto (NVIDIA RTX 5070 Ti) and @Zipettte (AMD Radeon RX 7700 XT) for verifying the wraparound search test across both GPU architectures!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136093919 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/974#issuecomment-7136093919). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T15:28:44Z. --- Thank you @Aniseto (NVIDIA RTX 5070 Ti) and @Zipettte (AMD Radeon RX 7700 XT) for verifying the wraparound search test across both GPU architectures!
upstream-sync closed this pull request 2026-11-25 01:05:06 +00:00
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
Marvisak/VIctory!974
No description provided.