Shader tests: measure what the emulated ray/node test costs on the card #65
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/65"
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?
Imported from fxceless/victory-fork. Originally posted by marquezinii on 2026-11-24T21:04:05Z.
docs/fork-ray-tracing.mdlisted "Cost on the GPU is unmeasured" for the emulatedimage_bvh64_intersect_ray. This adds an ignored test that measures the node test alone, and records what it gives on an RTX 5070.How it measures
intersect_cost_on_the_cardtakes the program of the existing node tests and puts the instruction in a scalar loop. It dispatches 65535 groups of 32 threads with 1025 passes and with 1 pass, and prints the time difference per added test. It does this for 32-bit box nodes, 16-bit box nodes and triangle nodes, each using the cases ofscene().Without care, the host compiler would make the loop nearly free, so I took two measures:
The stored XOR is compared with the reference for every thread, so a broken loop fails the test instead of giving a number. Each dispatch stays far under the 2 s TDR limit (about 30 ms on this card).
Results
RTX 5070, driver 621.40, Windows 11. Best of five per dispatch, over several runs:
At the 2.9 GHz the card ran, that is about 150 to 250 lane-cycles a test. Doubling the passes to 2049 doubles the time (58 ms against 30 ms), so the number is the test and not fixed overhead. The range comes from the clock and from other work on the card between runs.
What it means for #17
This is only the per-node test, with the nodes in cache. It does not cover the title's traversal loops (stack in LDS, raw-address loads), cache misses on real structures, or the builder. A million rays at 40 node tests each would be about 0.5 ms of node tests. So, on this card, the emulated instruction is unlikely to be what makes ray tracing expensive. Comparing with host DXR still needs the traversal and memory traffic measured on the title's own programs, which I can't run (no game files here).
cargo test -p victory-shader --locked: 210 passed, 3 ignored.cargo clippy --workspace --all-targets --locked -- -D warningsis clean. Anyone can reproduce on another GPU with:Imported from fxceless/victory-fork. Originally posted by marquezinii on 2026-11-24T21:04:46Z.
Closing: duplicate of #46, which measures the same node test and updates the same doc line.
Pull request closed