Encode the native BVH64 mirror base before shader execution #219

Manually merged
github merged 5 commits from github-bot/gh-219 into main 2026-12-03 17:29:32 +00:00 AGit
Owner

@⁠tommiehansen on GitHub · 2026-12-02 19:12 UTC · original
tommiehansen:perf/bvh64-native-pointer → main · +147 −39 · 7 files · 5 commits · merged 2026-12-03 17:20 UTC

The native node-test shader reconstructs the GPU mirror address and puts it into the hardware pointer format each time it issues a node test. This branch encodes and biases the fixed base on the CPU. The shader adds the absolute guest node number in pointer units. It keeps the original descriptor and checks for mirror bounds, descriptor bounds and node width. The qualification probe exercises the same full-address encoding alongside the relative-address check.

The base is biased modulo the address bits retained by the instruction. Before and after this change, the same aligned byte address contributes bits 6 through 47 to the pointer and the same three bits encode the node kind. Canonical sign extension is outside the retained bits. The branch also updates the translator cache version so cached shaders using the old root data are invalidated.

The new encoding removes integer IR from the native test path. The Vulkan compiler may already fold some of the arithmetic, and shader register use remains to be measured. The portable shader suite passed 280 tests with two ignored. The test covering the emitted pointer operations matched the original formula for 20,480 inputs. The GPU crate and executable passed Windows-target Rust checking.

Shader work removed

Operation Previous Updated
Fixed mirror base encoding Reconstructed by the shader Pre-encoded on the CPU
Mirror window check Relative node index arithmetic Absolute node index comparison
Relative 64-bit subtractions in the revised bounds check 2 0

This table describes the emitted IR, not guaranteed final RDNA ISA. The follow-up below documents the bounds-check verification.

Hardware testing

Hardware benchmarking was unavailable. Please compare the qualification probe, target shader ISA and frame times at native 1080p on RX 9060 XT 16 GB and native 1440p on RX 9070 XT under Linux, with RT enabled and frame generation disabled. Include a cold shader cache and a warm repeat.

Follow-up on native mirror bounds

The shader now compares absolute node indices with the mirror window. This removes two 64-bit relative subtractions per native test and keeps the original descriptor limit, box32 extent, and miss result. The emitted predicate matched 35,840 cases, the shader suite passed 281 tests with two ignored, and diagnostic Windows-target Rust checking passed. Actual ISA, occupancy, and GPU timing still need hardware testing.

**@⁠tommiehansen** on GitHub · 2026-12-02 19:12 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/219) `tommiehansen:perf/bvh64-native-pointer` → `main` · +147 −39 · 7 files · 5 commits · merged 2026-12-03 17:20 UTC The native node-test shader reconstructs the GPU mirror address and puts it into the hardware pointer format each time it issues a node test. This branch encodes and biases the fixed base on the CPU. The shader adds the absolute guest node number in pointer units. It keeps the original descriptor and checks for mirror bounds, descriptor bounds and node width. The qualification probe exercises the same full-address encoding alongside the relative-address check. The base is biased modulo the address bits retained by the instruction. Before and after this change, the same aligned byte address contributes bits 6 through 47 to the pointer and the same three bits encode the node kind. Canonical sign extension is outside the retained bits. The branch also updates the translator cache version so cached shaders using the old root data are invalidated. The new encoding removes integer IR from the native test path. The Vulkan compiler may already fold some of the arithmetic, and shader register use remains to be measured. The portable shader suite passed 280 tests with two ignored. The test covering the emitted pointer operations matched the original formula for 20,480 inputs. The GPU crate and executable passed Windows-target Rust checking. ## Shader work removed | Operation | Previous | Updated | |---|---|---| | Fixed mirror base encoding | Reconstructed by the shader | Pre-encoded on the CPU | | Mirror window check | Relative node index arithmetic | Absolute node index comparison | | Relative 64-bit subtractions in the revised bounds check | 2 | 0 | This table describes the emitted IR, not guaranteed final RDNA ISA. The follow-up below documents the bounds-check verification. ## Hardware testing Hardware benchmarking was unavailable. Please compare the qualification probe, target shader ISA and frame times at native 1080p on RX 9060 XT 16 GB and native 1440p on RX 9070 XT under Linux, with RT enabled and frame generation disabled. Include a cold shader cache and a warm repeat. ### Follow-up on native mirror bounds The shader now compares absolute node indices with the mirror window. This removes two 64-bit relative subtractions per native test and keeps the original descriptor limit, box32 extent, and miss result. The emitted predicate matched 35,840 cases, the shader suite passed 281 tests with two ignored, and diagnostic Windows-target Rust checking passed. Actual ISA, occupancy, and GPU timing still need hardware testing.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 19:28:00 +00:00
github-bot force-pushed github-bot/gh-219 from 8d540e1e34 to e7e7bb4c25 2026-12-02 19:33:55 +00:00 Compare
The native node test subtracts the mirror start from both ends of
each node in 64-bit arithmetic. Compute the end of the mirror from
the two uniform constants and compare against absolute bounds.

If the final node index is below the mirror end, the original
node index fits in a dword. Use that dword for the lower bound.
Retain the descriptor limit, the extra box32 node, and the original
miss pointer. Bump the translator cache version.

The emitted predicate matched the previous arithmetic on 35,840
inputs. The portable shader tests and diagnostic Windows-target
Rust checking passed. Hardware benchmarking was unavailable.
The upstream merge retained both declarations and prevents the shader crate from compiling. Preserve native BVH64 pointer decoding under its dedicated cache version.

Passed 282 portable shader tests and the diagnostics Windows-target check. Hardware benchmarking was unavailable.
github manually merged commit fb2a9da9a9 into main 2026-12-03 17:29:31 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.