Skip to content

Shaders: report only missing title-memory pages - #308

Open
gomeaw wants to merge 1 commit into
fxceless:mainfrom
gomeaw:perf/shader-page-fault-writes
Open

gomeaw wants to merge 1 commit into
fxceless:mainfrom
gomeaw:perf/shader-page-fault-writes

Conversation

@gomeaw

@gomeaw gomeaw commented Nov 24, 2026 •

Copy link
Copy Markdown

Summary

Raw title-memory shaders write a page number into the fault UAV for every lookup. Resident pages and masked lanes write to dword 0, which the host never reads. With many threads traversing the same structures, these writes all target the same address.

Emit the fault store only when an executing lane finds an absent page. Keep the hash and slot for actual faults. Continue from the join before using the resolved view in raw memory instructions or reading a wide BVH node. There is no host binding or configuration change.

This addresses GPU work in the builder and traversal paths discussed in #284. The proposed dirty-page mask in that issue reduces host refresh and copy-back work. This patch also applies cleanly alongside the title-memory watermarks in #205 and both builder changes #156 and #294.

Validation

  • With the real shader page directory on Windows WARP, a resident box node spanning two independent backing buffers produces the same result. An active lane reports missing page 3 and a masked lane leaves missing page 4 unreported. A sentinel at dword 0 stays intact. The baseline fails specifically at the sentinel check.
  • A synthetic resident-page WARP run takes 28.788 ms → 21.453 ms (25.5% less). These are medians of nine timed dispatches per build, with 128 groups of 32 threads traversing the same resident split-page node for 96 iterations. The timing includes dispatch setup and readback. The fixture checks the node results against the Rust reference, and the Windows job uses the same lowering source as this PR. Hardware GPU and in-game FPS measurements remain open. WARP test and timing
  • Both Windows Clippy configurations, the asset-policy check, and the Windows workspace suite passed. The workspace suite reported 496 passed, 11 ignored, and 0 failed. The targeted WARP cases ran separately. Windows workspace job The WARP fixtures and benchmark reuse the harness from Test ray-box intersections across two backing pages on WARP #33 and loop from Shader tests: measure the emulated ray-tracing node test on the card #46 on the validation branch, with those commits credited there. Validation fork branch

AI-assisted with Codex. All inputs were synthetic.

Move raw fault writes into the missing-page path. Keep masked lanes out of the fault buffer and use the continuation block for raw accesses and wide BVH nodes.
@HyperEndgame

Copy link
Copy Markdown

In-game numbers for this idea on real hardware. I measured my own implementation of the same change (the fault store guarded on missing, with the block re-bound after the lookup), not this branch: it is based on an older main and conflicts with the ray-tracing stack I test on. So these numbers describe the technique, not this exact diff.

Setup

Card time per binding, before → after

Program Before After
Largest trace program (f22a76fcb967ee59) 11.4 ms 0.96 ms
Trace program (6d7fe7745ab9c6d8) 4.9 ms 0.61 ms
ReloadTriangles (5062bc7a48e842f8) 0.62 ms 0.17 ms
CopyForBVHUpdate (c42a31951201f9a0) 11.2 ms 9.8 ms
RefitBVH4 (5279ae36796c31fc) 1.16 ms 1.11 ms
  • Frame time: 379 → 355 ms (the mean of usual frames). The trace programs were already a small part of the frame with the builder on.
  • Rays still trace after the change: 2.4–3.4M node tests a frame with hits (VICTORY_RAY_PROBE=1 check run).

A pitfall worth checking here
In my first version, the scalar path (memory_smem) kept the block handle from before the lookup. Once the lookup split the block, translation panicked with "forward reference outside a phi" on the builder programs (16 panics offline over the builder DLL), and the unit tests didn't catch it. This branch does re-bind c in memory_smem, so it looks fine. A translate --list --validate over the builder DLL is a cheap way to confirm it after the rebase.

Not tested

  • This branch itself.
  • The default configuration with the builder off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants