perf(shader): reuse 64 KiB page directory lookups in ray walkers (VICTORY_MEMORY_NEAR) #328

Merged
wike1701 merged 1 commit from upstream-pr/328 into main 2026-11-29 00:24:47 +00:00
wike1701 commented 2026-11-27 21:05:11 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wike1701 on 2026-11-27T21:05:11Z.


Summary

Ports the ray-walker page-directory lookup caching optimization (VICTORY_MEMORY_NEAR) from xceless/victory-fork (GPL-3.0, commit 299fba):

  • Same-page lookup reuse (Lower::memory_near / Lower::memory_near_words): in BVH/ray-walking compute shaders (non-spilled), consecutive global loads and node tests that hit the same 64 KiB title-memory page as a dominating earlier lookup reuse that lookup's view handle and byte offset instead of reloading from the 16 MB page directory and picking a descriptor handle per lane.
  • 128-byte box node second-half fast path (Lower::bvh_second_words): reads the second 64 bytes of a 128-byte BVH box node through the first half's view whenever it does not cross a 64 KiB page boundary (within <= 0xFF80).
  • Shader cache key: adds VICTORY_MEMORY_NEAR to shader_cache.rs so toggling VICTORY_MEMORY_NEAR=0 (A/B benchmarking) never serves stale cached shaders.

Verification

  • cargo test -p victory-shader --lib -- intersect — 6 passed, 0 failed (including live D3D12 GPU tests he_64_bit_node_test_over_title_memory_matches_the_reference_on_the_card and he_32_bit_node_test_over_title_memory_matches_the_reference_on_the_card)
  • cargo check -p victory-gpu — ok (0 new warnings)
  • cargo xtask policy — 287 files ok
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5533087168 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/328). Originally posted by [wike1701](https://github.com/wike1701) on 2026-11-27T21:05:11Z. --- ## Summary Ports the ray-walker page-directory lookup caching optimization (VICTORY_MEMORY_NEAR) from xceless/victory-fork (GPL-3.0, commit 299fba): - **Same-page lookup reuse (Lower::memory_near / Lower::memory_near_words)**: in BVH/ray-walking compute shaders (non-spilled), consecutive global loads and node tests that hit the same 64 KiB title-memory page as a dominating earlier lookup reuse that lookup's view handle and byte offset instead of reloading from the 16 MB page directory and picking a descriptor handle per lane. - **128-byte box node second-half fast path (Lower::bvh_second_words)**: reads the second 64 bytes of a 128-byte BVH box node through the first half's view whenever it does not cross a 64 KiB page boundary (within <= 0xFF80). - **Shader cache key**: adds VICTORY_MEMORY_NEAR to shader_cache.rs so toggling VICTORY_MEMORY_NEAR=0 (A/B benchmarking) never serves stale cached shaders. ## Verification - cargo test -p victory-shader --lib -- intersect — **6 passed, 0 failed** (including live D3D12 GPU tests he_64_bit_node_test_over_title_memory_matches_the_reference_on_the_card and he_32_bit_node_test_over_title_memory_matches_the_reference_on_the_card) - cargo check -p victory-gpu — **ok** (0 new warnings) - cargo xtask policy — **287 files ok**
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!328
No description provided.