perf(gpu,hle,loader,shader): add opt-in in-place heap, descriptor marks, raw CBV, and sharded journal #3470

Open
github-bot wants to merge 1 commit from github-bot/gh-3470 into main AGit
Owner

@⁠legayclightning22 on GitHub · 2026-11-27 04:23 UTC · original
legayclightning22:perf/renderer-inplace-heap-and-descriptors → main · +1508 −13 · 14 files · 1 commits · open

Summary

Adds opt-in in-place graphics heap/memory port support, descriptor-record mark/audit tracking, raw CBV reads (VICTORY_PORT_CBV), per-block write guards (VICTORY_PORT_GUARD), and sharded submit journaling (VICTORY_PORT_JOURNAL) (616b6f9, +1508/-13).

Changes

  • Add in-place heap/reservation handling, descriptor mark/audit tracking, raw CBV lowering, fine write guards, and sharded journal support across victory-gpu, victory-hle, victory-loader, and victory-shader.
  • Keep new port flags safely gated (0/off by default) and bounded for low-memory hosts.
  • Add unit tests covering descriptor marks, sharded journal behavior, and flag-gated CBV/guard paths.

Verification

  • cargo test --locked -p victory-gpu --lib and cargo test --locked -p victory-hle --lib
  • cargo clippy --locked -p victory-gpu -p victory-hle -p victory-shader --all-targets --all-features -- -D warnings
  • cargo xtask policy
**@⁠legayclightning22** on GitHub · 2026-11-27 04:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/3470) `legayclightning22:perf/renderer-inplace-heap-and-descriptors` → `main` · +1508 −13 · 14 files · 1 commits · open ## Summary Adds opt-in in-place graphics heap/memory port support, descriptor-record mark/audit tracking, raw CBV reads (`VICTORY_PORT_CBV`), per-block write guards (`VICTORY_PORT_GUARD`), and sharded submit journaling (`VICTORY_PORT_JOURNAL`) (`616b6f9`, `+1508/-13`). ## Changes - Add in-place heap/reservation handling, descriptor mark/audit tracking, raw CBV lowering, fine write guards, and sharded journal support across `victory-gpu`, `victory-hle`, `victory-loader`, and `victory-shader`. - Keep new port flags safely gated (`0`/off by default) and bounded for low-memory hosts. - Add unit tests covering descriptor marks, sharded journal behavior, and flag-gated CBV/guard paths. ## Verification - `cargo test --locked -p victory-gpu --lib` and `cargo test --locked -p victory-hle --lib` - `cargo clippy --locked -p victory-gpu -p victory-hle -p victory-shader --all-targets --all-features -- -D warnings` - `cargo xtask policy` ```[cite: 42]
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 04:25:48 +00:00
Author
Owner

@⁠borosf on GitHub · 2026-11-27 07:21 UTC · original

@⁠legayclightning22 — I compared the three in-place PRs in #880 (comment 7212390146). Two overlaps from it: this PR and #2494 both touch xmem.rs and watch.rs (yours changes the guards' lock to shared and journals per-block writes, #2494 adds a section hook), and the in-place heap here cannot be judged against the other two while it is bundled with the descriptor marks, raw CBV and journal — splitting it would let each part be decided on its own.

**@⁠borosf** on GitHub · 2026-11-27 07:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/3470#issuecomment-7212393637) @⁠legayclightning22 — I compared the three in-place PRs in #880 (comment 7212390146). Two overlaps from it: this PR and #2494 both touch `xmem.rs` and `watch.rs` (yours changes the guards' lock to shared and journals per-block writes, #2494 adds a section hook), and the in-place heap here cannot be judged against the other two while it is bundled with the descriptor marks, raw CBV and journal — splitting it would let each part be decided on its own.
Author
Owner

@⁠oddmaniv on GitHub · 2026-11-27 08:19 UTC · original

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

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 08:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/3470#issuecomment-7213400173) Independent verification of the PR author's concurrent WARP pipeline/draw test at `616b6f903ce51aebd056de4b9fc2196d59085007`. `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 10:06 UTC · original

NVIDIA full-suite run, to go with the reports above by oddmaniv, since none of them names a GPU run. Tested exact head 616b6f9 (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: 887 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: caps_disable_low_hosts, only_32_bit_graphics_memory_is_wanted_with_the_switch, a_stretch_of_one_committed_section_is_found, raw_table_views_need_sixteen_bytes, raw_reads_follow_the_shader_switch, marks_layout_matches_the_loader, marked_slots_are_taken_once_as_runs, audit_pages_are_bounded_and_round_robin, plan_parts_keeps_marked_runs_and_check_pages_disjoint, ranges_name_their_parts, claims_are_per_shard_and_per_generation, advancing_settles_old_claims, without_the_switch_every_page_is_fresh, test_flags_are_thread_local, busy_claims_are_per_block, shared_guards_yield_to_a_writer, the_sites_lea_their_stores_address, byte_check_gates_every_site, other_bytes_are_left_alone, raw_root_cbv_needs_the_switch_and_a_root_descriptor, constants_raw_is_opt_in.
  • --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 10:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/3470#issuecomment-7215480791) NVIDIA full-suite run, to go with the reports above by oddmaniv, since none of them names a GPU run. Tested exact head `616b6f9` (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`: **887 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `caps_disable_low_hosts`, `only_32_bit_graphics_memory_is_wanted_with_the_switch`, `a_stretch_of_one_committed_section_is_found`, `raw_table_views_need_sixteen_bytes`, `raw_reads_follow_the_shader_switch`, `marks_layout_matches_the_loader`, `marked_slots_are_taken_once_as_runs`, `audit_pages_are_bounded_and_round_robin`, `plan_parts_keeps_marked_runs_and_check_pages_disjoint`, `ranges_name_their_parts`, `claims_are_per_shard_and_per_generation`, `advancing_settles_old_claims`, `without_the_switch_every_page_is_fresh`, `test_flags_are_thread_local`, `busy_claims_are_per_block`, `shared_guards_yield_to_a_writer`, `the_sites_lea_their_stores_address`, `byte_check_gates_every_site`, `other_bytes_are_left_alone`, `raw_root_cbv_needs_the_switch_and_a_root_descriptor`, `constants_raw_is_opt_in`. - `--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.
Author
Owner

@⁠legayclightning22 on GitHub · 2026-11-27 13:41 UTC · original

Thanks @⁠borosf for checking the overlap with #880 and #2494. Splitting this makes total sense—I will separate the in-place graphics heap (port.rs / xmem.rs) into its own focused PR so it can be judged independently against the other #880 approaches, and keep this PR scoped cleanly to the opt-in descriptor marks, raw CBV reads, fine write guards, and sharded submit journal.

**@⁠legayclightning22** on GitHub · 2026-11-27 13:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/3470#issuecomment-7219820948) Thanks @⁠borosf for checking the overlap with #880 and #2494. Splitting this makes total sense—I will separate the in-place graphics heap (`port.rs` / `xmem.rs`) into its own focused PR so it can be judged independently against the other #880 approaches, and keep this PR scoped cleanly to the opt-in descriptor marks, raw CBV reads, fine write guards, and sharded submit journal.
Author
Owner

@⁠rpmaster2 on GitHub · 2026-11-27 18:07 UTC · original

RDNA4 (RX 9070 XT, 32 GB): the PR regresses the world even with every flag off; with the ports on it is unplayable and the copies balloon.

Setup

GPU Radeon RX 9070 XT 16 GB (RDNA4), Adrenalin 26.11.2, driver 32.0.32029.2010, host wave lanes min=32 max=64
CPU / RAM Ryzen 5 5600 (6 cores / 12 threads), 32 GB DDR4-3600, page file 32-48 GB on the game NVMe
OS Windows 11 10.0.26100.9974
Build this PR, 616b6f9, cargo build --locked --profile diag -p victory --features diagnostics (27.6 s)
Title 1.0.2.1, the same dump and the same save for every run
Settings --console series-x, VICTORY_PRESENT_TARGET=1x1:1, scripted keys, nothing else
Caches shader and pipeline caches warm (cache-upstream, built by translate --cache --pipelines 28,164 pipelines), the driver's own shader cache emptied and the machine rebooted before the pair, so both runs start from the same state

Method: two runs of 300 s, base first (no flags) and then with VICTORY_PORT_CBV=1 VICTORY_PORT_GUARD=1 VICTORY_PORT_JOURNAL=1; private bytes, working set, free RAM, commit and page-file usage sampled every 20 s.

Results

base, no flags + PORT_CBV/_GUARD/_JOURNAL control: main 63bcca4, same machine
frames 0.3-1.4 fps, 693-3,351 ms 0.3-1.0 fps, 1,029-3,111 ms 0.5-1.2 fps, 810-2,126 ms
draws a frame 627-1,953 684-817 2,004-7,195
copies 33-99 ms, 76-203 MB 165-247 ms, 235-609 MB 137-492 ms, 465-994 MB
copy-back 105-109 ms 95-109 ms 104-142 ms
on the GPU 98-100 ms 65-147 ms 211-270 ms
black frames logged 3 4 5
faults 0 0 0

Memory, sampled every 20 s:

base:  15.6 -> 19.7 -> 23.5 -> 25.1 GB private; page file 99 MB -> 2.8 GB at 300 s
ports: 15.1 -> 18.4 -> 19.2 -> 24.3 GB private; page file ~1.0 GB throughout
main:  15.6 -> 25.6 -> 28.1 GB private; page file 2.86 GB

What was on screen

  • base, no flags: black screen from the start, white by the end of the 300 s; the picture never assembled. Draw counts confirm it: 627-1,953 against 2,004-7,195 on main.
  • with the ports: the start splash takes minutes to come up, the picture is black, and the audio plays in bursts of a fraction of a second every few seconds. Not playable in any sense.

That is with all port flags at their default (off) in the first run, which is the part I would look at first: on this card the PR changes the world even when the switches are not set. The signature (black, then white, subtitle text drawn over itself, very low draw counts) is the same one I saw when testing the in-place sections of #2494, so my guess is that the in-place heap or the descriptor marks are taking effect outside their flag, or that they change the copy path for ranges the switch was meant to leave alone. That is a guess from the outside; the logs above are the facts.

Also worth noting for the ports run: copies go up, not down (235-609 MB a frame against 76-203 MB in the base run and 465-994 MB on main), and dropped stays at 314-455 a frame, so the switches are not doing here what they do in the AMD fork on the same card, where PORT_CBV and the journal were worth ~10 ms and the copies fell.

What would help me help you

  • tell me whether the in-place path is supposed to be inert without a flag; if it is, this is a plain bug on RDNA4 and I can bisect it inside the PR by reverting file by file on this card;
  • if you want the flags judged separately, I can run PORT_CBV alone, PORT_GUARD alone and PORT_JOURNAL alone, 5 minutes each, on the same save — I have the machine and the warm caches, it is ~15 minutes of runs;
  • for reference, the AMD fork's own port switches on this card gave: base 59.8-61.4 ms, PORT_* all on 48.7-51.1 ms in a scene of ~3,000 draws, with the copies halved. So the idea is sound; what I see here is that this implementation, on RDNA4, does not reach that state.

AI-assisted: written by DeepSeek (OpenCode harness) from my run logs; counts, switches and driver version only, no game files or paths.

**@⁠rpmaster2** on GitHub · 2026-11-27 18:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/3470#issuecomment-7225141950) **RDNA4 (RX 9070 XT, 32 GB): the PR regresses the world even with every flag off; with the ports on it is unplayable and the copies balloon.** ## Setup | | | |---|---| | GPU | Radeon RX 9070 XT 16 GB (RDNA4), Adrenalin 26.11.2, driver 32.0.32029.2010, `host wave lanes min=32 max=64` | | CPU / RAM | Ryzen 5 5600 (6 cores / 12 threads), 32 GB DDR4-3600, page file 32-48 GB on the game NVMe | | OS | Windows 11 10.0.26100.9974 | | Build | this PR, `616b6f9`, `cargo build --locked --profile diag -p victory --features diagnostics` (27.6 s) | | Title | 1.0.2.1, the same dump and the same save for every run | | Settings | `--console series-x`, `VICTORY_PRESENT_TARGET=1x1:1`, scripted keys, nothing else | | Caches | shader and pipeline caches warm (`cache-upstream`, built by `translate --cache --pipelines` 28,164 pipelines), the driver's own shader cache emptied and the machine rebooted before the pair, so both runs start from the same state | Method: two runs of 300 s, base first (no flags) and then with `VICTORY_PORT_CBV=1 VICTORY_PORT_GUARD=1 VICTORY_PORT_JOURNAL=1`; private bytes, working set, free RAM, commit and page-file usage sampled every 20 s. ## Results | | base, no flags | + `PORT_CBV`/`_GUARD`/`_JOURNAL` | control: `main` 63bcca4, same machine | |---|---|---|---| | frames | 0.3-1.4 fps, 693-3,351 ms | 0.3-1.0 fps, 1,029-3,111 ms | 0.5-1.2 fps, 810-2,126 ms | | draws a frame | 627-1,953 | 684-817 | **2,004-7,195** | | copies | 33-99 ms, 76-203 MB | **165-247 ms, 235-609 MB** | 137-492 ms, 465-994 MB | | copy-back | 105-109 ms | 95-109 ms | 104-142 ms | | on the GPU | 98-100 ms | 65-147 ms | 211-270 ms | | black frames logged | 3 | 4 | 5 | | faults | 0 | 0 | 0 | Memory, sampled every 20 s: ``` base: 15.6 -> 19.7 -> 23.5 -> 25.1 GB private; page file 99 MB -> 2.8 GB at 300 s ports: 15.1 -> 18.4 -> 19.2 -> 24.3 GB private; page file ~1.0 GB throughout main: 15.6 -> 25.6 -> 28.1 GB private; page file 2.86 GB ``` ## What was on screen - **base, no flags**: black screen from the start, white by the end of the 300 s; the picture never assembled. Draw counts confirm it: 627-1,953 against 2,004-7,195 on `main`. - **with the ports**: the start splash takes minutes to come up, the picture is black, and the audio plays in bursts of a fraction of a second every few seconds. Not playable in any sense. That is with **all port flags at their default (off)** in the first run, which is the part I would look at first: on this card the PR changes the world even when the switches are not set. The signature (black, then white, subtitle text drawn over itself, very low draw counts) is the same one I saw when testing the in-place sections of #2494, so my guess is that the in-place heap or the descriptor marks are taking effect outside their flag, or that they change the copy path for ranges the switch was meant to leave alone. That is a guess from the outside; the logs above are the facts. Also worth noting for the ports run: copies go *up*, not down (235-609 MB a frame against 76-203 MB in the base run and 465-994 MB on `main`), and `dropped` stays at 314-455 a frame, so the switches are not doing here what they do in the AMD fork on the same card, where `PORT_CBV` and the journal were worth ~10 ms and the copies fell. ## What would help me help you - tell me whether the in-place path is supposed to be inert without a flag; if it is, this is a plain bug on RDNA4 and I can bisect it inside the PR by reverting file by file on this card; - if you want the flags judged separately, I can run `PORT_CBV` alone, `PORT_GUARD` alone and `PORT_JOURNAL` alone, 5 minutes each, on the same save — I have the machine and the warm caches, it is ~15 minutes of runs; - for reference, the AMD fork's own port switches on this card gave: base 59.8-61.4 ms, `PORT_*` all on 48.7-51.1 ms in a scene of ~3,000 draws, with the copies halved. So the idea is sound; what I see here is that this implementation, on RDNA4, does not reach that state. AI-assisted: written by DeepSeek (OpenCode harness) from my run logs; counts, switches and driver version only, no game files or paths.
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/3470/head:github-bot/gh-3470'
git switch 'github-bot/gh-3470'

Merge

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