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. |
78bba5c to
ae56502
Compare
…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 and heap windows, 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; Kalmarv in xcl-dev#2496). A larger reservation still spans windows and is logged. Root-UAV windows keep the carry: they have no bounds, so an access that leaves its allocation and wraps inside its base's window could hang the GPU (a window test did on an RTX 3090, xcl-dev#2496); heap views read 0 past the window's end. 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, in the direct translator's output identity too (programs that go direct as enormous without XCL_DIRECT_DXIL; pvfreis in xcl-dev#2496), 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>
|
Updated to
Tests at
Results so far, from the reports above:
AI use: Claude Code (Claude Opus 5.5) made the changes, ran the suite and the smoke runs, and drafted this. |
…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 and heap windows, 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; Kalmarv in xcl-dev#2496). A larger reservation still spans windows and is logged. Root-UAV windows keep the carry: they have no bounds, so an access that leaves its allocation and wraps inside its base's window could hang the GPU (a window test did on an RTX 3090, xcl-dev#2496); heap views read 0 past the window's end. 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, in the direct translator's output identity too (programs that go direct as enormous without XCL_DIRECT_DXIL; pvfreis in xcl-dev#2496), 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>
ae56502 to
2e8ff6b
Compare
|
Follow-up to the summary above: |
|
AMD Windows rerun for #2496 at Setup: as in my comment above, with this PR at DXIL, all 2,689 compute programs (translation only)
With the switch off, both forms match Driver, 26 large programs, 2 interleaved rounds (off, on, then on, off)
With heap windows the mean is 96.1 → 82.0 s (−15 %); the six split programs make 43 pieces instead of 46. The switch-window arms differ by 2 %, which is noise for identical DXIL. This machine is busier today than when I measured AI use: Claude Code (Claude Opus 5.5) built the binary, ran the measurements and wrote this; I posted it. |
…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 and heap windows, 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 start at the next window instead of crossing, where a window has room (Kalmarv in xcl-dev#2496). Where none has, the reservation is placed across a boundary as without the switch and logged, rather than refused: a reservation the sparse windows refuse goes to plain memory (kernelx), which the switch must not make more frequent. A reservation larger than 4 GiB still spans windows and is logged. Root-UAV windows keep the carry: they have no bounds, so an access that leaves its allocation and wraps inside its base's window could hang the GPU (a window test did on an RTX 3090, xcl-dev#2496); heap views read 0 past the window's end. 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, in the direct translator's output identity too (programs that go direct as enormous without XCL_DIRECT_DXIL; pvfreis in xcl-dev#2496), and the translator thread takes its caller's setting so a test can choose it. The two tests that check the 64-bit sum on purpose pin the switch off. Part of xcl-dev#2403. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2e8ff6b to
8164067
Compare
|
Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2496 updated head Setup
Targeted RTX 4060 release unit & GPU tests (
|
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=1and heap windows (XCL_HEAP_WINDOWS=1) the window is taken from the base address, which makes the driver's code for big compute programs smaller. Root-UAV windows keep the carry: they have no bounds, so an access that leaves its allocation and wraps inside its base's window could hang the GPU (a window test did on an RTX 3090, below); heap views read 0 past the window's end. 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 it and heap windows,window_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, and of the direct translator's output identity (programs that go direct asenormouswithoutXCL_DIRECT_DXIL).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). A larger reservation cannot stay in one window and is logged. Where no window has room for a reservation in one piece, it is placed across a boundary as without the switch (and logged) rather than refused: a reservation the sparse windows refuse goes to plain memory (kernelx), which the switch must not make more frequent. Testa_reservation_crosses_a_boundary_when_no_window_has_room(fails without this). Testtitle_reservations_stay_in_one_window_without_the_carry.crates/xcl/src/gpu/recomp/tests.rs: the two carry tests pin the switch off (with_no_carry(false)).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, the DXIL is smaller with it with heap windows and unchanged with root UAVs. 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: 1438 passed, 0 failed, 47 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 whole suite again: 1438 passed, 0 failed, 47 ignored. The two existing tests that check the 64-bit sum on purpose (gpu_window_at_32bit_carry_edge_cases,memory_windows_reject_out_of_uma_aliasing) now pin the switch off for their translations, so they test the carry path whatever the environment; the new test covers the path without it.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 XCL_HEAP_WINDOWS=1(the switch on; same head, same script):The switch-off peak commit (21,394 MB) is 124 % of
main's in this pair; with the switch off this PR's code paths aremain's, and the same arm read 16,474–18,374 MB in the runs of the earlier heads.Not tested
AI use
🤖 Generated with Claude Code