Avoid per-block allocations in GPU landing order #4006

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

@⁠Rosynb666 on GitHub · 2026-11-30 14:20 UTC · original
Rosynb666:perf/land-order-in-place → main · +18 −5 · 2 files · 1 commits · open

What it changes

land::ordered previously allocated and copied a temporary index vector for
each block containing multiple pieces from a single copy. This patch sorts
the existing index slice in place and emits singleton blocks directly.
Stable sorting preserves the first source index for equal addresses.
Mixed-copy blocks retain their input order.

How it was tested

Baseline: 41adb551. Synthetic CPU benchmark on macOS ARM64, Rust 1.98.1.
Times are medians per call. Allocation counts were measured separately.

Workload Allocations before → after Time before → after
256 blocks × 4 same-copy pieces 259 → 3 26.42 → 16.03 µs
96 blocks × 16 same-copy pieces 99 → 3 30.80 → 26.71 µs
1,024 singleton blocks 3 → 3 12.76 → 12.76 µs
256 blocks × 4 mixed-copy pieces 3 → 3 12.77 → 13.12 µs

Two isolated Rust unit tests passed, including the new regression test.
10,003 differential cases matched the original output and overlap counter.
cargo check passed for victory-gpu on the Windows x64 MSVC target,
using blake3/pure for the cross-check.

Full native Windows test suite and in-game frame-time measurements are pending.

Checked for overlap

Related open PRs include #2881 and #3626. This patch focuses on the
per-block index allocation inside land::ordered.

**@⁠Rosynb666** on GitHub · 2026-11-30 14:20 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4006) `Rosynb666:perf/land-order-in-place` → `main` · +18 −5 · 2 files · 1 commits · open ## What it changes `land::ordered` previously allocated and copied a temporary index vector for each block containing multiple pieces from a single copy. This patch sorts the existing index slice in place and emits singleton blocks directly. Stable sorting preserves the first source index for equal addresses. Mixed-copy blocks retain their input order. ## How it was tested Baseline: 41adb551. Synthetic CPU benchmark on macOS ARM64, Rust 1.98.1. Times are medians per call. Allocation counts were measured separately. | Workload | Allocations before → after | Time before → after | | --- | --- | --- | | 256 blocks × 4 same-copy pieces | 259 → 3 | 26.42 → 16.03 µs | | 96 blocks × 16 same-copy pieces | 99 → 3 | 30.80 → 26.71 µs | | 1,024 singleton blocks | 3 → 3 | 12.76 → 12.76 µs | | 256 blocks × 4 mixed-copy pieces | 3 → 3 | 12.77 → 13.12 µs | Two isolated Rust unit tests passed, including the new regression test. 10,003 differential cases matched the original output and overlap counter. `cargo check` passed for `victory-gpu` on the Windows x64 MSVC target, using `blake3/pure` for the cross-check. Full native Windows test suite and in-game frame-time measurements are pending. ## Checked for overlap Related open PRs include #2881 and #3626. This patch focuses on the per-block index allocation inside `land::ordered`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 14:25:35 +00:00
Author
Owner

@⁠dyshay on GitHub · 2026-11-30 14:53 UTC · original

Merged for testing into our integration branch dyshay/VIctory-NVIDIA janus-prs. Builds and the targeted CPU tests pass; a run on an RTX 4090 (Series S, hardware RT) is queued and I'll post the result here.

**@⁠dyshay** on GitHub · 2026-11-30 14:53 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4006#issuecomment-7282095258) Merged for testing into our integration branch [dyshay/VIctory-NVIDIA `janus-prs`](https://github.com/dyshay/VIctory-NVIDIA/tree/janus-prs). Builds and the targeted CPU tests pass; a run on an RTX 4090 (Series S, hardware RT) is queued and I'll post the result here.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/4006/head:github-bot/gh-4006'
git switch 'github-bot/gh-4006'

Merge

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