GPU: share one state-prelude allocator across host lists #3643

Open
Luislariosss wants to merge 1 commit from upstream-pr/3643 into main
Luislariosss commented 2026-11-28 01:48:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Luislariosss on 2026-11-28T01:48:08Z.


Every HostList previously allocated and kept two ID3D12CommandAllocators: one for its own recording and one for its state prelude. Because state preludes only record at submission under the submission lock (one list at a time) and execute waits for each submission to finish before returning, all preludes can safely share a single allocator reset once per submission.

Changes

  • Move the prelude command allocator and a pool of closed prelude command lists onto Host.
  • Drop the per-HostList prelude allocator, halving command-allocator memory across retained/idle lists.
  • Add regression test host::tests::the_prelude_allocator_resets_between_submissions_only verifying single reset per submission, list reuse, and multi-prelude execution.

Verification

  • cargo xtask policy (191 files ok)
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default and --features diagnostics)
  • cargo test -p victory-gpu --lib host:: (36/36) and list::
<!-- greyfinch-sync:Marvisak/VIctory:issue:5535513433 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3643). Originally posted by [Luislariosss](https://github.com/Luislariosss) on 2026-11-28T01:48:08Z. --- Every `HostList` previously allocated and kept two `ID3D12CommandAllocator`s: one for its own recording and one for its state prelude. Because state preludes only record at submission under the submission lock (one list at a time) and `execute` waits for each submission to finish before returning, all preludes can safely share a single allocator reset once per submission. ### Changes - Move the prelude command allocator and a pool of closed prelude command lists onto `Host`. - Drop the per-`HostList` prelude allocator, halving command-allocator memory across retained/idle lists. - Add regression test `host::tests::the_prelude_allocator_resets_between_submissions_only` verifying single reset per submission, list reuse, and multi-prelude execution. ### Verification - `cargo xtask policy` (191 files ok) - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default and `--features diagnostics`) - `cargo test -p victory-gpu --lib host::` (36/36) and `list::`
oni-swr commented 2026-11-28 03:13:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-28T03:13:58Z.


Independent WARP verification for #3643 by Gemini 4 Neon.

  • Base 63bcca43c6a00a758510398fa43096ce7e4f7df0 and PR head 63f337ca8e1e432ab0fbc8ef94618ae89d9612f4 merge cleanly (fast-forward) to tree 4d860f0ce26d9550ef361d76c1fca14cd9a58b52.
  • WARP only, with both VICTORY_WARP=1 and VICTORY_D3D12_WARP=1 set. The victory-gpu test process loaded d3d10warp.dll 10.0.26100.9818 (d3d12.dll / d3d12core.dll 10.0.26100.9818), with Windows SDK dxil.dll 1.8.2502.11 on PATH (not loaded by victory-gpu unit tests).
  • victory-gpu unit tests (passed / failed / ignored) went from 231 / 0 / 1 on clean base to 232 / 0 / 1 on the merged tree (same ignored synthetic benchmark object::tests::benchmark_private_data_release), with doctests 0 / 0 / 0 on both. The new host::tests::the_prelude_allocator_resets_between_submissions_only test passed (1 / 0 / 0), and --features diagnostics --lib host:: passed (37 / 0 / 0).
  • Merged Clippy (cargo clippy -p victory-gpu --tests -- -D warnings and --all-targets --features diagnostics -- -D warnings) and cargo xtask policy (191 files ok) passed. crates/victory-gpu/src/host.rs grew from 181,915 to 192,180 bytes.
  • Reviewed every hunk in crates/victory-gpu/src/host.rs. No blocking defects found: Host::execute holds self.submitted from preparation through fence completion and only locks self.preludes during sequential prelude recording (dropping it before ExecuteCommandLists), preserving D3D12's single-recording-list and post-wait reset invariants including under diagnostics per-list timing groups; pooling distinct prelude lists per submission also avoids clobbering if runs repeats a HostList. Non-blocking notes: Preludes::list does a redundant Close() + Reset() on newly created lists (legal, keeps a uniform path), and a test-only caught panic between preludes.list() and list.Close() would leave that list open. Pairwise merges with open host.rs PRs #3641 (31374faf) and #3644 (c06688f1) both conflict in crates/victory-gpu/src/host.rs (shared test insertion point, Host/HostList fields, and constructors).
<!-- greyfinch-sync:Marvisak/VIctory:comment:7232904468 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3643#issuecomment-7232904468). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-28T03:13:58Z. --- Independent WARP verification for #3643 by Gemini 4 Neon. - Base `63bcca43c6a00a758510398fa43096ce7e4f7df0` and PR head `63f337ca8e1e432ab0fbc8ef94618ae89d9612f4` merge cleanly (fast-forward) to tree `4d860f0ce26d9550ef361d76c1fca14cd9a58b52`. - WARP only, with both `VICTORY_WARP=1` and `VICTORY_D3D12_WARP=1` set. The `victory-gpu` test process loaded `d3d10warp.dll` `10.0.26100.9818` (`d3d12.dll` / `d3d12core.dll` `10.0.26100.9818`), with Windows SDK `dxil.dll` `1.8.2502.11` on `PATH` (not loaded by `victory-gpu` unit tests). - `victory-gpu` unit tests (passed / failed / ignored) went from **231 / 0 / 1** on clean base to **232 / 0 / 1** on the merged tree (same ignored synthetic benchmark `object::tests::benchmark_private_data_release`), with doctests **0 / 0 / 0** on both. The new `host::tests::the_prelude_allocator_resets_between_submissions_only` test passed (**1 / 0 / 0**), and `--features diagnostics --lib host::` passed (**37 / 0 / 0**). - Merged Clippy (`cargo clippy -p victory-gpu --tests -- -D warnings` and `--all-targets --features diagnostics -- -D warnings`) and `cargo xtask policy` (`191 files ok`) passed. `crates/victory-gpu/src/host.rs` grew from **181,915** to **192,180** bytes. - Reviewed every hunk in `crates/victory-gpu/src/host.rs`. No blocking defects found: `Host::execute` holds `self.submitted` from preparation through fence completion and only locks `self.preludes` during sequential prelude recording (dropping it before `ExecuteCommandLists`), preserving D3D12's single-recording-list and post-wait reset invariants including under `diagnostics` per-list timing groups; pooling distinct prelude lists per submission also avoids clobbering if `runs` repeats a `HostList`. Non-blocking notes: `Preludes::list` does a redundant `Close()` + `Reset()` on newly created lists (legal, keeps a uniform path), and a test-only caught panic between `preludes.list()` and `list.Close()` would leave that list open. Pairwise merges with open `host.rs` PRs `#3641` (`31374faf`) and `#3644` (`c06688f1`) both conflict in `crates/victory-gpu/src/host.rs` (shared test insertion point, `Host`/`HostList` fields, and constructors).
futurepro62 commented 2026-11-29 21:34:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-29T21:34:47Z.


Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head 63f337c (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: the_prelude_allocator_resets_between_submissions_only.
  • --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.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7262987289 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3643#issuecomment-7262987289). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-29T21:34:47Z. --- Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head `63f337c` (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: `the_prelude_allocator_resets_between_submissions_only`. - `--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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3643:upstream-pr/3643'
git switch 'upstream-pr/3643'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3643'
git switch 'upstream-pr/3643'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3643'
git switch 'upstream-pr/3643'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3643'
git switch 'main'
git merge --squash 'upstream-pr/3643'
git switch 'main'
git merge --ff-only 'upstream-pr/3643'
git switch 'main'
git merge 'upstream-pr/3643'
git push origin 'main'
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!3643
No description provided.