Repository navigation
Spread aligned sparse tile keys across hash buckets - #230
Merged
Merged
Conversation
Owner
|
Merged (main 0f34407). Checked on an RX 9070 (RDNA4) with 6 PRs merged together on main d4f17ca: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 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
GTA VI 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.