victory-gpu: binary-search gone set and skip unused sort (NEW-493) #3566

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

@⁠cloph-dsp on GitHub · 2026-11-27 18:01 UTC · original
cloph-dsp:fix/new493-gone-set → main · +23 −3 · 2 files · 1 commits · open

Depends on: #1633

Claim: NEW-493 (original claim by @⁠borosf; PR #3250 closed unmerged on 2026-11-27, so the item is free under the board rule).

This re-applies the two small CPU-side optimizations from the closed PR with a focused regression test.

  • crates/victory-gpu/src/descriptor/host.rs: HostHeap::evict collects the gone pointers into a Vec<usize>, sorts it once per call, and uses binary_search instead of a HashSet::contains probe for each kept slot.
  • crates/victory-gpu/src/resource.rs: choose returns the idle set immediately when over is already 0, skipping the rest.sort_by_key that only feeds the least-recently-used pick.
  • Added resource::tests::choose_keeps_only_idle_when_nothing_is_over_budget to pin the no-over-budget result.

Validation (Windows, Rust 1.100.0/MSVC, per-worktree CARGO_TARGET_DIR=D:\Victory-Contrib\target-new493):

  • cargo test --locked -p victory-gpu --lib -- resource::tests::choose_keeps_only_idle_when_nothing_is_over_budget --exact --test-threads=1 --quiet → 1 passed, 0 failed, 232 filtered, exit 0.
  • git diff --check HEAD → exit 0.

AI-assisted: Hy4 flash. GPU/driver: N/A (CPU-only paths). No game data, assets, extracted shaders or DRM involved.

**@⁠cloph-dsp** on GitHub · 2026-11-27 18:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/3566) `cloph-dsp:fix/new493-gone-set` → `main` · +23 −3 · 2 files · 1 commits · open Depends on: #1633 Claim: NEW-493 (original claim by @⁠borosf; PR #3250 closed unmerged on 2026-11-27, so the item is free under the board rule). This re-applies the two small CPU-side optimizations from the closed PR with a focused regression test. - `crates/victory-gpu/src/descriptor/host.rs`: `HostHeap::evict` collects the gone pointers into a `Vec<usize>`, sorts it once per call, and uses `binary_search` instead of a `HashSet::contains` probe for each kept slot. - `crates/victory-gpu/src/resource.rs`: `choose` returns the idle set immediately when `over` is already 0, skipping the `rest.sort_by_key` that only feeds the least-recently-used pick. - Added `resource::tests::choose_keeps_only_idle_when_nothing_is_over_budget` to pin the no-over-budget result. Validation (Windows, Rust 1.100.0/MSVC, per-worktree `CARGO_TARGET_DIR=D:\Victory-Contrib\target-new493`): - `cargo test --locked -p victory-gpu --lib -- resource::tests::choose_keeps_only_idle_when_nothing_is_over_budget --exact --test-threads=1 --quiet` → 1 passed, 0 failed, 232 filtered, exit 0. - `git diff --check HEAD` → exit 0. AI-assisted: Hy4 flash. GPU/driver: N/A (CPU-only paths). No game data, assets, extracted shaders or DRM involved.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 18:03:52 +00:00
Author
Owner

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

Independent verification of #3566 at head dbf9a004ef6b2e3d58b54aa8fa4209e4b032e9bd, base 63bcca43c6a00a758510398fa43096ce7e4f7df0. AI-assisted: verification by Claude Code (Claude Sonnet 5.5).

Environment: Windows 11 build 26200, WARP d3d10warp.dll 10.0.26100.9818 (no physical GPU), VICTORY_WARP=1 and VICTORY_D3D12_WARP=1, Windows SDK 10.0.26100 dxil.dll.

Ran cargo test -p victory-gpu --lib --features diagnostics --locked -- --test-threads=1:

  • base: 246 passed, 0 failed, 1 ignored
  • head: 247 passed, 0 failed, 1 ignored (new: choose_keeps_only_idle_when_nothing_is_over_budget)
  • cargo clippy -p victory-gpu --all-targets --features diagnostics --locked -- -D warnings: clean on base and on head

Control: the new test also passes on base (1 passed, 0 failed). That is expected, because both changes keep the behaviour. It pins the over == 0 result but is not a regression test, so it cannot fail on base.

Review: no correctness problem found. In choose the early return at resource.rs:1669 gives the same result as before, since the old loop broke immediately when over == 0. In HostHeap::evict the sorted Vec with binary_search has the same membership semantics as the HashSet, and the sort happens once per call. I did not measure the speed-up. WARP has no real descriptor or texture load, so the performance claim is untested here.

**@⁠oni-swr** on GitHub · 2026-11-27 18:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/3566#issuecomment-7225507629) Independent verification of #3566 at head `dbf9a004ef6b2e3d58b54aa8fa4209e4b032e9bd`, base `63bcca43c6a00a758510398fa43096ce7e4f7df0`. AI-assisted: verification by Claude Code (Claude Sonnet 5.5). Environment: Windows 11 build 26200, WARP d3d10warp.dll 10.0.26100.9818 (no physical GPU), `VICTORY_WARP=1` and `VICTORY_D3D12_WARP=1`, Windows SDK 10.0.26100 dxil.dll. Ran `cargo test -p victory-gpu --lib --features diagnostics --locked -- --test-threads=1`: - base: 246 passed, 0 failed, 1 ignored - head: 247 passed, 0 failed, 1 ignored (new: `choose_keeps_only_idle_when_nothing_is_over_budget`) - `cargo clippy -p victory-gpu --all-targets --features diagnostics --locked -- -D warnings`: clean on base and on head Control: the new test also passes on base (1 passed, 0 failed). That is expected, because both changes keep the behaviour. It pins the `over == 0` result but is not a regression test, so it cannot fail on base. Review: no correctness problem found. In `choose` the early return at `resource.rs:1669` gives the same result as before, since the old loop broke immediately when `over == 0`. In `HostHeap::evict` the sorted `Vec` with `binary_search` has the same membership semantics as the `HashSet`, and the sort happens once per call. I did not measure the speed-up. WARP has no real descriptor or texture load, so the performance claim is untested here.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-27 22:04 UTC · original

NVIDIA full-suite run, to go with the reports above by oni-swr, since none of them names a GPU run. Tested exact head dbf9a00 (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: choose_keeps_only_idle_when_nothing_is_over_budget.
  • --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 22:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/3566#issuecomment-7228999067) NVIDIA full-suite run, to go with the reports above by oni-swr, since none of them names a GPU run. Tested exact head `dbf9a00` (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: `choose_keeps_only_idle_when_nothing_is_over_budget`. - `--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/3566/head:github-bot/gh-3566'
git switch 'github-bot/gh-3566'

Merge

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