Spread aligned sparse tile keys across hash buckets #230
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!230
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/230/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@AliceWood on GitHub · 2026-11-23 21:25 UTC · original
AliceWood:perf/sparse-tile-hash-eaa36b6→main· +17 −1 · 1 files · 2 commits · merged 2026-11-23 21:29 UTCThe sparse tile map keys its entries by 64 KiB-aligned virtual addresses. Hashing a single address multiplies it by an odd constant, so its low 16 bits remain zero. For maps with at most 65,536 buckets, every aligned address then starts its lookup in the same bucket. Rotating the 64-bit hash right by 23 puts varying bits in the bucket index and moves bits 16 through 22 into the high seven bits used for the table’s short hash.
CPU measurements
The harness compiled each revision's hasher, tile map types and
decommit_tileswith Rust 1.97.1 and-Oon a Ryzen 9 9950X3D running Windows x64. It initialized consecutive tile addresses starting at 4 GiB, excluded setup from the timer, and checked the remaining mappings, clear queue, and reclaimed tile count. The table gives medians from seven processes per variant, alternating which variant ran first.The measurements were taken against
eaa36b6and its patched source. Both source blocks extracted by the benchmark are byte-identical between that baseline and0cd0a53, and between the previously benchmarked patch and this PR at5424468. The third row includes the repeated clear-queue scan in these revisions. PR #203 changes where that scan runs. The first two rows measure operations with an empty queue or direct map lookups.Tests
The regression test hashes 256 consecutive tile addresses and checks that at least half the low-byte bucket indices are used. The original hash used just one. On
5424468, the focused sparse suite passed 10 tests and ignored one timing benchmark. The full library suite reported 584 passed, zero failed, and 20 ignored. The RTX 4080 reported two tests skipped for lack of native wave64. Optional game sample variables were unset, and one optional system XGameRuntime test reported a skip.Retail observations
The retail title build 1.0.2.1 ran on the Ryzen 9 9950X3D and RTX 4080 in fresh offline Windows Sandbox guests using the Series S profile. Both XCL builds used empty guest caches and the same timer around
XMemMapPhysicalPagesScatter, including lock wait. Each run completed six calls of at least 1,024 pages, including two successful 6,720-page calls. The table follows launch order on0cd0a53.The patch was slower in the first pair and faster in the second. All four runs logged
0x80000003atgame_scarlett_master.exe+0xcc2834, the same offset reported in #156. Present counts sum the available two-second activity samples. Visible frames were not measured. An earlier six-run comparison oneaa36b6also reached that breakpoint every time. These runs show no consistent retail loading improvement from the hash change.0cd0a53b58' into perf/sparse-tile-hash-eaa36b6 542446872a@ivall on GitHub · 2026-11-23 21:29 UTC · original
Merged (main
0f34407). Checked on an RX 9070 (RDNA4) with 6 PRs merged together on maind4f17ca:cargo build --workspace && cargo test --workspace -- --test-threads=4- 611 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed; and the retail game still reaches its first menu at 30 fps.