GPU: split duplicate HostList entries into separate ExecuteCommandLists batches #1400

Closed
github-bot wants to merge 1 commit from gh-pr/1400/head into gh-pr/1400/base
Owner

@⁠piyonchu on GitHub · 2026-11-24 17:45 UTC · original
piyonchu:fix/host-duplicate-list-prelude → main · +174 −54 · 1 files · 1 commits · closed without merging

Summary

Fixes a D3D12 prelude-clobbering and duplicate-command-list submission bug when the same HostList appears more than once in Host::execute(runs).

Cause

HostList owns a single (allocator, list) pair in self.prelude. Previously Host::execute iterated every entry of runs, called list.prelude(), and appended the returned ID3D12CommandList to one lists slice passed to a single ExecuteCommandLists batch:

  1. Calling list.prelude() a second time on the same HostList in the same runs slice reset its allocator and list, overwriting the barriers recorded for the first occurrence before ExecuteCommandLists ran.
  2. Submitting the same closed ID3D12GraphicsCommandList twice in one ExecuteCommandLists batch violates D3D12 batch uniqueness and triggers DXGI_ERROR_DEVICE_HUNG (0x887A0006) even with separate preludes.

Change

  • crates/victory-gpu/src/host.rs:
    • Flush run_deferred(&mut batch) across runs up front, then partition runs into contiguous duplicate-free slices inside Host::execute, running list.prelude() -> ExecuteCommandLists -> fence Signal + WaitForSingleObject per slice.
    • Non-duplicate submissions (the common case) execute in a single batch with zero extra fence waits or allocations.
    • Added GPU regression test host::tests::duplicate_list_in_submission_runs_without_clobbering_prelude submitting [&list_a, &list_b, &list_a] twice in a row with intervening texture state changes (COMMON -> COPY_DEST -> RENDER_TARGET -> PIXEL_SHADER_RESOURCE).

Verification

Hardware: Intel Core i9-14900HX, NVIDIA GeForce RTX 4060 Laptop GPU (driver 32.0.16.1656), Windows 11 x64 (10.0.26100), rustc 1.98.1.

  • cargo clippy --workspace --locked -- -D warnings: pass
  • cargo clippy --workspace --all-features --locked -- -D warnings: pass
  • cargo test -p victory-gpu --locked: 51 passed, 0 failed, 1 ignored (texture_checks_per_submission)
  • cargo test -p victory-gpu --all-features --locked: 54 passed, 0 failed, 1 ignored
  • cargo test -p xtask --locked: 4 passed, 0 failed (includes repository_passes_policy)
  • cargo test --workspace --locked -- --skip v_med3_f32_matches_rdna2_with_nan: passed (v_med3_f32_matches_rdna2_with_nan fails at baseline on NVIDIA as tracked in #726 / #745)
  • git diff --check: clean

AI Disclosure

Prepared, implemented, tested, and verified locally with Antigravity (Google DeepMind); no proprietary game assets, bytes, or dumps were used or included.

**@⁠piyonchu** on GitHub · 2026-11-24 17:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/1400) `piyonchu:fix/host-duplicate-list-prelude` → `main` · +174 −54 · 1 files · 1 commits · closed without merging ### Summary Fixes a D3D12 prelude-clobbering and duplicate-command-list submission bug when the same `HostList` appears more than once in `Host::execute(runs)`. ### Cause `HostList` owns a single `(allocator, list)` pair in `self.prelude`. Previously `Host::execute` iterated every entry of `runs`, called `list.prelude()`, and appended the returned `ID3D12CommandList` to one `lists` slice passed to a single `ExecuteCommandLists` batch: 1. Calling `list.prelude()` a second time on the same `HostList` in the same `runs` slice reset its `allocator` and `list`, overwriting the barriers recorded for the first occurrence before `ExecuteCommandLists` ran. 2. Submitting the same closed `ID3D12GraphicsCommandList` twice in one `ExecuteCommandLists` batch violates D3D12 batch uniqueness and triggers `DXGI_ERROR_DEVICE_HUNG` (`0x887A0006`) even with separate preludes. ### Change - **`crates/victory-gpu/src/host.rs`**: - Flush `run_deferred(&mut batch)` across `runs` up front, then partition `runs` into contiguous duplicate-free slices inside `Host::execute`, running `list.prelude()` -> `ExecuteCommandLists` -> fence `Signal` + `WaitForSingleObject` per slice. - Non-duplicate submissions (the common case) execute in a single batch with zero extra fence waits or allocations. - Added GPU regression test `host::tests::duplicate_list_in_submission_runs_without_clobbering_prelude` submitting `[&list_a, &list_b, &list_a]` twice in a row with intervening texture state changes (`COMMON -> COPY_DEST -> RENDER_TARGET -> PIXEL_SHADER_RESOURCE`). ### Verification Hardware: Intel Core i9-14900HX, NVIDIA GeForce RTX 4060 Laptop GPU (driver `32.0.16.1656`), Windows 11 x64 (`10.0.26100`), `rustc 1.98.1`. - `cargo clippy --workspace --locked -- -D warnings`: pass - `cargo clippy --workspace --all-features --locked -- -D warnings`: pass - `cargo test -p victory-gpu --locked`: 51 passed, 0 failed, 1 ignored (`texture_checks_per_submission`) - `cargo test -p victory-gpu --all-features --locked`: 54 passed, 0 failed, 1 ignored - `cargo test -p xtask --locked`: 4 passed, 0 failed (includes `repository_passes_policy`) - `cargo test --workspace --locked -- --skip v_med3_f32_matches_rdna2_with_nan`: passed (`v_med3_f32_matches_rdna2_with_nan` fails at baseline on NVIDIA as tracked in #726 / #745) - `git diff --check`: clean ### AI Disclosure Prepared, implemented, tested, and verified locally with Antigravity (Google DeepMind); no proprietary game assets, bytes, or dumps were used or included.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:30:28 +00:00
github-bot closed this pull request 2026-11-26 04:30:28 +00:00
Author
Owner

@⁠piyonchu on GitHub · 2026-11-25 01:06 UTC · original

Closing #1400 in favor of #1414, which solves the same duplicate-HostList ExecuteCommandLists submission bug (with the same batch-splitting boundary approach) and already has maintainer/contributor reviews across multiple GPUs and #595 coordination.

**@⁠piyonchu** on GitHub · 2026-11-25 01:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/1400#issuecomment-7149208510) Closing `#1400` in favor of `#1414`, which solves the same duplicate-`HostList` `ExecuteCommandLists` submission bug (with the same batch-splitting boundary approach) and already has maintainer/contributor reviews across multiple GPUs and `#595` coordination.

Pull request closed

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!1400
No description provided.