GPU: retry prelude reset with a fresh allocator on E_OUTOFMEMORY #3519

Open
github-bot wants to merge 2 commits from github-bot/gh-3519 into main AGit
Owner

@⁠tharun-37 on GitHub · 2026-11-27 12:28 UTC · original
tharun-37:gpu/prelude-oom-recovery → main · +165 −49 · 1 files · 2 commits · open

Refs #3515.

At submission each host list resets its state-transition prelude allocator and list. A diagnostics run reached that reset with 0x8007000E while system commit was still available; the failure is a driver-side allocation failure, not a process or system commit exhaustion, and the run aborted there.

This makes the prelude allocator and list one replaceable object. If the reset fails with E_OUTOFMEMORY, a fresh allocator/list pair is created and the same barriers are recorded into it once. Other errors, or a failure to create the replacement, keep the current behavior. The barriers are still built from the textures' real states and the state stores still happen after recording, so ordering is unchanged.

A synthetic regression forces the reset error and checks that only an out-of-memory result retries, with one replacement and one extra attempt at most. No game files or GPU execution are needed.

Verification:

  • cargo test --locked -p victory-gpu --lib: 230 passed, 1 ignored; the 2 failures are pre-existing and adapter-specific. The new test passes.
  • cargo clippy --locked -p victory-gpu --all-targets -- -A clippy::undocumented_unsafe_blocks -D warnings: clean.

Claimed on #1633 before writing the code: #1633

AI-assisted (OpenCode).

**@⁠tharun-37** on GitHub · 2026-11-27 12:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/3519) `tharun-37:gpu/prelude-oom-recovery` → `main` · +165 −49 · 1 files · 2 commits · open Refs #3515. At submission each host list resets its state-transition prelude allocator and list. A diagnostics run reached that reset with `0x8007000E` while system commit was still available; the failure is a driver-side allocation failure, not a process or system commit exhaustion, and the run aborted there. This makes the prelude allocator and list one replaceable object. If the reset fails with `E_OUTOFMEMORY`, a fresh allocator/list pair is created and the same barriers are recorded into it once. Other errors, or a failure to create the replacement, keep the current behavior. The barriers are still built from the textures' real states and the state stores still happen after recording, so ordering is unchanged. A synthetic regression forces the reset error and checks that only an out-of-memory result retries, with one replacement and one extra attempt at most. No game files or GPU execution are needed. Verification: - `cargo test --locked -p victory-gpu --lib`: 230 passed, 1 ignored; the 2 failures are pre-existing and adapter-specific. The new test passes. - `cargo clippy --locked -p victory-gpu --all-targets -- -A clippy::undocumented_unsafe_blocks -D warnings`: clean. Claimed on #1633 before writing the code: https://git.gtahub.st/github/Marvisak--VIctory/issues/1633 AI-assisted (OpenCode).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 12:32:55 +00:00
Author
Owner

@⁠tharun-37 on GitHub · 2026-11-27 12:29 UTC · original

Baseline check on main: 229 passed, same 2 failures, 1 ignored. This branch: 230 passed (the new test), same 2 failures, 1 ignored.

**@⁠tharun-37** on GitHub · 2026-11-27 12:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/3519#issuecomment-7218307081) Baseline check on `main`: 229 passed, same 2 failures, 1 ignored. This branch: 230 passed (the new test), same 2 failures, 1 ignored.
Author
Owner

@⁠tharun-37 on GitHub · 2026-11-27 12:30 UTC · original

CI clippy failure was three undocumented unsafe blocks in the new code; safety comments added. Local \cargo clippy --workspace --all-targets --locked -- -D warnings\ now passes.

**@⁠tharun-37** on GitHub · 2026-11-27 12:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/3519#issuecomment-7218330871) CI clippy failure was three undocumented unsafe blocks in the new code; safety comments added. Local \cargo clippy --workspace --all-targets --locked -- -D warnings\ now passes.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-27 13:25 UTC · original

Independent WARP/CPU verification of #3519 at head 52f80c15 (base: main 63bcca43, merge-base of this PR). Head re-checked unchanged just before posting.

Setup: Windows 11 Pro 10.0.26200, AMD Ryzen 7 5700X3D, D3D12 WARP only (VICTORY_WARP=1 VICTORY_D3D12_WARP=1, dxil.dll on PATH). Base and head were built in separate worktrees with separate target dirs. Test command: cargo test -p victory-gpu --features diagnostics (the WARP switch is only honoured with that feature).

lane base head
victory-gpu lib 246 passed, 0 failed, 1 ignored 247 passed, 0 failed, 1 ignored

The new prelude_reset_retries_only_out_of_memory test passes. This run had no baseline failures, unlike the 2 in the PR description's local run. cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings passes on the head and on base.

Diff review: no bug found.

  • record_with_retry only retries on E_OUTOFMEMORY, and only if the replacement prelude was created. The commands closure can safely run twice. twin::at_submission is computed once beforehand, moves() only reads copy.state, and the real-state writes happen once in left() after both attempts.
  • The prelude mutex is held across record and replace, and HostList is submitted by one thread, so there is no race. On replace, the old list is closed and dropped before its allocator.
  • Nit, not a blocker: the test covers the retry helper with injected errors, not a real D3D12 allocator OOM. That is hard to provoke, so it is fine.

AI-assisted: Claude Code, Claude Sonnet 5.5.

**@⁠oni-swr** on GitHub · 2026-11-27 13:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/3519#issuecomment-7219469073) Independent WARP/CPU verification of #3519 at head `52f80c15` (base: main `63bcca43`, merge-base of this PR). Head re-checked unchanged just before posting. **Setup:** Windows 11 Pro 10.0.26200, AMD Ryzen 7 5700X3D, D3D12 WARP only (`VICTORY_WARP=1 VICTORY_D3D12_WARP=1`, dxil.dll on PATH). Base and head were built in separate worktrees with separate target dirs. Test command: `cargo test -p victory-gpu --features diagnostics` (the WARP switch is only honoured with that feature). | lane | base | head | |---|---|---| | victory-gpu lib | 246 passed, 0 failed, 1 ignored | 247 passed, 0 failed, 1 ignored | The new `prelude_reset_retries_only_out_of_memory` test passes. This run had no baseline failures, unlike the 2 in the PR description's local run. `cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings` passes on the head and on base. **Diff review:** no bug found. - `record_with_retry` only retries on `E_OUTOFMEMORY`, and only if the replacement prelude was created. The `commands` closure can safely run twice. `twin::at_submission` is computed once beforehand, `moves()` only reads `copy.state`, and the real-state writes happen once in `left()` after both attempts. - The prelude mutex is held across record and replace, and `HostList` is submitted by one thread, so there is no race. On replace, the old list is closed and dropped before its allocator. - Nit, not a blocker: the test covers the retry helper with injected errors, not a real D3D12 allocator OOM. That is hard to provoke, so it is fine. AI-assisted: Claude Code, Claude Sonnet 5.5.
Author
Owner

@⁠oddmaniv on GitHub · 2026-11-27 14:16 UTC · original

Independent verification of the PR author's concurrent WARP pipeline/draw test at 52f80c15d3e898df72dae5ca0cab22c4339ade4e.

cargo test --locked -p victory-shader --lib emit::host::tests::parallel_warp_pipelines_and_draws -- --exact --nocapture

Tree Result
Unmodified PR head 1 passed, 0 failed, 0 ignored; native exit 0
Unmodified main 1 passed, 0 failed, 0 ignored; native exit 0
PR patch applied to pinned main 1 passed, 0 failed, 0 ignored; native exit 0

Main baseline pin: 63bcca43c6a00a758510398fa43096ce7e4f7df0.

Windows x86_64 MSVC native runs. Local and remote source snapshots matched before and after each check. The adaptation applies the PR diff without additional source edits.
This is focused regression coverage, not the full workspace suite, a gameplay test, or an independent validation of every behavior in the PR. No new fix is claimed.

AI-assisted verification.

**@⁠oddmaniv** on GitHub · 2026-11-27 14:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/3519#issuecomment-7220581719) Independent verification of the PR author's concurrent WARP pipeline/draw test at `52f80c15d3e898df72dae5ca0cab22c4339ade4e`. `cargo test --locked -p victory-shader --lib emit::host::tests::parallel_warp_pipelines_and_draws -- --exact --nocapture` | Tree | Result | | --- | --- | | Unmodified PR head | 1 passed, 0 failed, 0 ignored; native exit 0 | | Unmodified main | 1 passed, 0 failed, 0 ignored; native exit 0 | | PR patch applied to pinned main | 1 passed, 0 failed, 0 ignored; native exit 0 | Main baseline pin: `63bcca43c6a00a758510398fa43096ce7e4f7df0`. Windows x86_64 MSVC native runs. Local and remote source snapshots matched before and after each check. The adaptation applies the PR diff without additional source edits. This is focused regression coverage, not the full workspace suite, a gameplay test, or an independent validation of every behavior in the PR. No new fix is claimed. AI-assisted verification.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-27 19:42 UTC · original

NVIDIA full-suite run, to go with the reports above by oddmaniv, oni-swr, since none of them names a GPU run. Tested exact head 52f80c1 (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: prelude_reset_retries_only_out_of_memory.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-27 19:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/3519#issuecomment-7226796498) NVIDIA full-suite run, to go with the reports above by oddmaniv, oni-swr, since none of them names a GPU run. Tested exact head `52f80c1` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **867 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `prelude_reset_retries_only_out_of_memory`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3519/head:github-bot/gh-3519'
git switch 'github-bot/gh-3519'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3519'
git switch 'github-bot/gh-3519'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3519'
git switch 'github-bot/gh-3519'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3519'
git switch 'main'
git merge --squash 'github-bot/gh-3519'
git switch 'main'
git merge --ff-only 'github-bot/gh-3519'
git switch 'main'
git merge 'github-bot/gh-3519'
git push origin 'main'
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/Marvisak--VIctory!3519
No description provided.