Repository navigation
Recompiler: an access may take its base address's window (XCL_WINDOW_NO_CARRY) - #2496
S1m0ne1997 wants to merge 1 commit into
Conversation
|
@S1m0ne1997 one point on the premise "Allocations never straddle windows (
For an access whose base is in window k and whose final address is in k + 1, AI use: Claude Code (Claude Opus 5.5) read the allocator and the reservation paths on |
|
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
With XCL_WINDOW_NO_CARRY=1 shaders take an access's window from its base address, which assumes that nothing a shader reads spans two windows. XCL's own allocations hold to that, but the title's sparse reservations did not: sparse_reserve took the first fit across window boundaries, and a title places resources inside its reservations (Kalmarv, xcl-dev#2496). With the switch on, a reservation of 4 GiB or less now starts at the next window when it would cross a boundary. Without the switch nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Kalmarv Thanks, you're right. I checked The change now makes it hold for the title's too, the way you suggested: with The PR is now one commit,
What these runs don't show: that run covers the start and the menus, not a session in the world. The log does not record each reservation, so I can't put a number on the address space the skipped window tails cost. AI use: Claude Code (Claude Opus 5.5) checked the allocator, wrote the change and the test, ran the suite and the smoke runs, and drafted this reply. |
|
@SlopTart Thanks for the run on your machine. |
…NO_CARRY) The direct DXIL translator adds every offset of a memory access to its 64-bit address with a carry into the high dword, then selects the memory window from the high dword (window_at). Every access then gets its own window index, range check and heap handle, and accesses off the same base share none of them. With XCL_WINDOW_NO_CARRY=1 the window is taken from the base address. An access inside the allocation its base points into never carries or borrows, provided nothing straddles a window: XCL's allocations never do (gpu::uma), and with the switch the title's sparse reservations of 4 GiB or less no longer do either (sparse_reserve starts them at the next window instead of crossing; pointed out by Kalmarv in xcl-dev#2496). Off by default; without the switch nothing changes. On an RTX 4090 (driver 621.40) the driver's code for 12 programs of each family of a retail title shrinks by 17.7 % (CS_RaytracingResolve), 12.2 % (CS_IrradianceCache_Shade) and 5.9 % (CS_ShadowRenderTiled). On NVIDIA the code of the pipelines in use is limited (xcl-dev#2403). The setting is part of the translation cache's identity, as XCL_DIRECT_COMPACT is, and the translator thread takes its caller's setting so a test can choose it. Part of xcl-dev#2403. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0d87f44 to
78bba5c
Compare
|
A run on NVIDIA as asked on #2403, with one caveat: it has this PR and #2427 ( Setup: RTX 4070 SUPER 12 GB, driver 616.92, Windows 10 19045, release. A local test tree (#2057 and a few other open PRs on Where the device is removed
Driver code of the compute programs the precompile rebuilt (
The two rows are not the same set of programs (each counts what that precompile built anew), so read them as distributions, not as a per-program saving. Not tested: this PR without #2427 and the other way round; more than one run; AMD / Intel; a bound-code counter in the title (the sizes above are of what was built, not of what was in use at once). AI use: Claude Code (Claude Opus 5.5) merged the PRs into the test tree, ran the precompiles and the runs, and wrote this; posted with my OK. |
|
By reading only, at
AI use: Claude Code (Claude Opus 5.5) found this; a second Claude Opus 5.5 re-derived it; Claude Fable 5.2 reviewed the text; checked by a person before posting. |
|
@S1m0ne1997 the NVIDIA in-title A/B you asked for, RTX 5090. Tested
Not tested / caveats
So on this card the saving is real but not enough to move the #2403 removal. With ~400 MB logged at the end, a 6 % cut buys tens of MB against a cliff the title crosses anyway at this scene. AI use: Claude Code (Claude Opus 5.5) built and ran both arms and wrote this; Antigravity CLI (Gemini 4 Neon) analysed the logs and cache. |
|
Review on 78bba5c (read from the diff, not run), following up @Kalmarv's point: the fix keeps title reservations of ≤ 4 GiB in one window, but one case of the "allocations never straddle windows" premise is still open. Since the switch is opt-in, a log line when a reservation over 4 GiB is made with |
|
Test report for Tested
Not tested: outputs in release, split chains, GS, mesh, graphics; reservations over 4 GiB; code in use in a title; timing; other GPUs. AI use: Claude Code. Claude Opus 5.5 wrote the test, ran it and wrote this; Claude Fable 5.2 rechecked it. |
…cl-dev#2496), zeroed target pages XCL_WINDOW_NO_CARRY=1: the direct translator's compute programs take an access's memory window from its base address (ported from xcl-dev/xcl pull request 2496 by S1m0ne1997: less driver code for the big compute programs, whose total is what removes the device on NVIDIA). Here the switch is a flag in the compute programs' window count, so only their cache entries are new. XCL_ZERO_TARGET_PAGES=1: a pool tile given to a render target, depth buffer or UAV texture is zeroed first (a reserved buffer mapped over the tiles, zeros copied in): tiles come back from evicted streamed textures with their bytes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
Thanks! — Devin |
|
AMD Windows driver timing for #2496: on the RX 9070 XT, Setup
DXIL size, all 2,689 compute programs (translation only)
With the switch off the output matches Driver time, 26 large programs (switch windows), 2 interleaved rounds (off, on, then on, off)
Mean 81.0 → 70.4 s (−13 %). Every one of the 20 unsplit programs in the set was faster with the switch, by 3–24 %. The largest ones:
The pieces also change: with the switch, the six programs that are split produce 46 pieces instead of 56. Not tested: heap windows in the driver, GPU output, and a title run. AI use: Claude Code (Claude Opus 5.5) built the binaries, ran the measurements and wrote this report; I posted it. |
|
Test report, RTX 3090 (616.56), one run per arm. With
In the title, same settings, only the switch differs
Window tests in our tree (
Setup
Not measured
AI use: Claude Code with Claude Opus 5.5, as the coordinating session and as its agents. The agents ported the PR, resolved the conflicts, wrote the diagnostic and the test and run jobs, read the logs and drafted this report. The coordinating session ran the builds, the tests and the runs, and checked the numbers quoted here. |
The direct DXIL translator selects the memory window of every access from its 64-bit address, with the offsets added and carried into the high dword (
window_at). Each access then gets its own window index, range check and heap handle, and accesses off the same base share none of them. XCL's allocations never straddle windows (gpu::uma), and with the switch the title's reservations do not either. So an access inside the allocation its base points into never carries or borrows: its window is its base's. WithXCL_WINDOW_NO_CARRY=1the window is taken from the base address, which makes the driver's code for big compute programs smaller. Off by default.Part of #2403: on NVIDIA the code of the pipelines in use is limited, and the retail title's world needs more than that.
What is in it
crates/xcl/src/gpu/dxil/lower_window.rs:no_carry()(XCL_WINDOW_NO_CARRY=1, orwith_no_carryfor a thread); with itwindow_atselects the window from the base's high dword.crates/xcl/src/gpu/dxil/kernel.rs:window_no_carry(); the translator thread takes its caller's setting.crates/xcl/src/gpu/recomp/pso.rs: the setting is part of the translation cache's identity, asXCL_DIRECT_COMPACTis.crates/xcl/src/gpu/uma.rs: with the switch, a title reservation (sparse_reserve) of 4 GiB or less that would cross a window boundary starts at the next window, so nothing the title places in it spans two windows (pointed out by @Kalmarv below). Testtitle_reservations_stay_in_one_window_without_the_carry.crates/xcl/src/gpu/recomp/tests.rs:gpu_window_no_carry_reads_inside_allocations_alike. Accesses inside an allocation (global loads with positive and negative offsets, ans_loadwith an offset) read the same words with and without the switch, with the windows in root UAVs and in the descriptor heap, and the DXIL is smaller with it. A 32-bit (hi == 0) pointer still reads window 0, and a base outside the UMA still reads 0.Tested
rustc 1.100.0, debug for the tests, release for the runs.cargo build --workspace, thencargo test --workspace -- --test-threads=4at the head: 1425 passed, 0 failed, 46 ignored. SKIPPED: the wave64 cases (no wave64 on this card),pso_measurement_compiles_an_exact_synthetic_record(no Developer Mode), the D3D12 debug layer tests (nod3d12SDKLayers.dll),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).XCL_DIRECT_DXIL=1 XCL_WINDOW_NO_CARRY=1, the 38 window tests (cargo test -p xcl --lib window): the new one passes. Three existing ones fail on the cases they build on purpose, an address whose final value is in the next window:gpu_window_at_32bit_carry_edge_cases, and the carry and borrow cases ofgpu_{memory,heap}_windows_reject_out_of_uma_aliasing. That is the behaviour the switch changes. With the switch off they pass, as onmain.GetCachedBlob) of the retail title's compute programs, as the runtime translates them (direct DXIL, heap windows), 12 programs of each family:XCL_WINDOW_NO_CARRY=1CS_RaytracingResolveCS_IrradianceCache_ShadeCS_ShadowRenderTiledmain(0829441) with D3D12.X: integration branch that reaches the in-world HUD on NVIDIA (reference, not for merge) #2057 and the same change (direct DXIL, heap windows, warm caches): the world-load removal of NVIDIA: the device is removed when the pipelines in use need more than 512 MB of shader code (0x887a0005) #2403 came 72 s after the start of the world load, against 8–9 s in two runs without it. Bound at the removal: 1295 pipelines, against 1145–1172. It is still removed: this makes the limit come later, it does not avoid it.Regression run (the switch is off by default, so this run is the default path)
main:
PR:
PR with
XCL_WINDOW_NO_CARRY=1(the switch on; same head, same script):Not tested
AI use
🤖 Generated with Claude Code