Skip to content

Recompiler: an access may take its base address's window (XCL_WINDOW_NO_CARRY) - #2496

Draft
S1m0ne1997 wants to merge 1 commit into
xcl-dev:mainfrom
S1m0ne1997:window-no-carry
Draft

S1m0ne1997 wants to merge 1 commit into
xcl-dev:mainfrom
S1m0ne1997:window-no-carry

Conversation

@S1m0ne1997

@S1m0ne1997 S1m0ne1997 commented Nov 25, 2026 •

Copy link
Copy Markdown

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. With XCL_WINDOW_NO_CARRY=1 the 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, or with_no_carry for a thread); with it window_at selects 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, as XCL_DIRECT_COMPACT is.
  • 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). Test title_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, an s_load with 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

  • NVIDIA GeForce RTX 4090 24 GB (driver 621.40), AMD Ryzen 9 9950X3D, Windows 11 Home 26300, rustc 1.100.0, debug for the tests, release for the runs.
  • cargo build --workspace, then cargo test --workspace -- --test-threads=4 at 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 (no d3d12SDKLayers.dll), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • With 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 of gpu_{memory,heap}_windows_reject_out_of_uma_aliasing. That is the behaviour the switch changes. With the switch off they pass, as on main.
  • Driver code (GetCachedBlob) of the retail title's compute programs, as the runtime translates them (direct DXIL, heap windows), 12 programs of each family:
family without with XCL_WINDOW_NO_CARRY=1 change
CS_RaytracingResolve 8129 KB 6692 KB −17.7 %
CS_IrradianceCache_Shade 2747 KB 2411 KB −12.2 %
CS_ShadowRenderTiled 7854 KB 7393 KB −5.9 %

Regression run (the switch is off by default, so this run is the default path)

main:

xcl-smoke v1
commit: 6d12f58a229bc73889878a448c64dc3af25eeba0
gpu: NVIDIA GeForce RTX 4090
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1539 (PresentX 1539)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17314 MB

PR:

xcl-smoke v1
commit: 78bba5ca223b8f83976ac1cb070a3edf97bbee08
gpu: NVIDIA GeForce RTX 4090
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1615 (PresentX 1615)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19154 MB

PR with XCL_WINDOW_NO_CARRY=1 (the switch on; same head, same script):

xcl-smoke v1
commit: 78bba5ca223b8f83976ac1cb070a3edf97bbee08
gpu: NVIDIA GeForce RTX 4090
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1661 (PresentX 1661)
presents per 2 s (last 3): 61 60 58
device removals: 0
crashes: 0
peak commit: 18790 MB

Not tested

  • AMD, Intel, other NVIDIA cards and drivers; wave64 hardware.
  • The HLSL path: it keeps the 64-bit sum (the switch applies to direct DXIL only).
  • Accesses that leave their allocation: with the switch they wrap inside their base's window instead of reaching the next window (or reading 0 past the UMA). No title access of that kind was seen, but I did not check every program for it.
  • The title in the world on this head with the switch on (the world run above was on the older local tree); the 60 s run with the switch covers the menus only. How much address space the single-window reservations skip over a session: no reservation failed in that run, but the log does not record each one.

AI use

  • Claude Code (Claude Opus 5.5): measured where the code size comes from, wrote the change and the test, ran the suite, the smoke runs and the title, and wrote this description. I checked the results and pressed through the title's menus.

🤖 Generated with Claude Code

@Kalmarv

Kalmarv commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

@S1m0ne1997 one point on the premise "Allocations never straddle windows (gpu::uma)", from reading main 6d12f58a. XCL's own allocations hold to it. The title's own reservations may not:

  • Uma::sparse_reserve (gpu/uma.rs:390) calls take_sparse_in(..., single_window: false) both times. Only single_window: true keeps a block inside one 4 GiB window (uma.rs:154), so a sparse reservation is first fit at 64 KiB grain and can cross a boundary.
  • The title's reservations go through it. In hle/kernelx.rs, VirtualAlloc of 64 KiB pages lands at line 271, and graphics reservations without the top type bit at line 307. Titles reserve a range, then commit or map pages and place resources inside it, so a buffer the title places in such a range can span two windows.

For an access whose base is in window k and whose final address is in k + 1, window_at with carry picks k + 1, while no-carry picks k. We have not seen such an access in the retail title. We only checked the allocator, so this is a possibility, not an observed failure. One way to keep the saving would be single_window: true for title reservations of 4 GiB or less, or a carry only where the base is in sparse title space. Either would need a run to see what it costs in address space.

AI use: Claude Code (Claude Opus 5.5) read the allocator and the reservation paths on main and wrote this comment.

@SlopTart

Copy link
Copy Markdown

gpu_ suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

S1m0ne1997 added a commit to S1m0ne1997/xcl that referenced this pull request Nov 25, 2026
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>
@S1m0ne1997

S1m0ne1997 commented Nov 25, 2026 •

Copy link
Copy Markdown
Author

@Kalmarv Thanks, you're right. I checked sparse_reserve and the two kernelx.rs paths: title reservations were first fit across window boundaries, so the premise held for XCL's own allocations only.

The change now makes it hold for the title's too, the way you suggested: with XCL_WINDOW_NO_CARRY=1, a title reservation of 4 GiB or less that would cross a boundary starts at the next window instead. Without the switch nothing changes. Test: title_reservations_stay_in_one_window_without_the_carry (with the switch the second reservation starts in the next window; without it, it crosses as before).

The PR is now one commit, 78bba5c (the code is the same as the two commits it replaced). Results at it (RTX 4090, driver 621.40):

  • cargo test --workspace -- --test-threads=4: 1425 passed, 0 failed, 46 ignored (on the same tree before the squash).
  • scripts/smoke.ps1 -Seconds 60 on the retail title, switch off (the default path): 1615 frames, 0 removals, 0 crashes. Block in the description.
  • The same with XCL_WINDOW_NO_CARRY=1: 1661 frames, 0 removals, 0 crashes, and no title reservation failed in the log.

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.

@S1m0ne1997

Copy link
Copy Markdown
Author

@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>
@Eterst

Eterst commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

A run on NVIDIA as asked on #2403, with one caveat: it has this PR and #2427 (XCL_HEAP_FLAT=1) together, so the two are not separated.

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 main), before: main 06055a7; after: main 6d12f58 + 78bba5c (this PR) + d356a74 (#2427). The retail title with XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1, split programs off (XCL_DIRECT_SPLIT_INSTRUCTIONS=0), caches rebuilt by a full precompile (xcl shaders --precompile --only cs --pipelines, then xcl pipelines) with the same switches as the run.

Where the device is removed

runs end
before 4 0x887a0005 at 261–303 s, always at the same point of the title (last frame before it 2,300–2,480); DRED page fault VA 0, no event
XCL_WINDOW_NO_CARRY=1 XCL_HEAP_FLAT=1 1 no removal: frame 2,630 at 395 s, stopped at 418 s by my own RAM guard (free RAM 0.4 GB), not by the title or the driver

Driver code of the compute programs the precompile rebuilt (.pso files, the GetCachedBlob bytes):

programs total median 90th pct ≥ 1 MB
before 2,227 905 MB 215 KB 1,055 KB 308 (343 MB)
with both switches 2,565 757 MB 136 KB 848 KB 32 (40 MB)

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.

@pvfreis

pvfreis commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

By reading only, at 78bba5c:

  1. Cache identity. direct_output_identity (pso.rs:503) lacks the switch, and identity() adds it only when the backend is not HLSL. With XCL_DIRECT_DXIL unset, compute programs over 8 MiB of HLSL still go direct (enormous), without the carry when the switch is set, and are stored under rerouted_identity. A later run without the switch loads that DXIL while its reservations cross windows again; the other way round, the switch does nothing for those programs. I have not seen a crossing access. Recompiler: key rerouted DXIL by compact nesting policy #2257 fixed the same gap for the nesting tag.
  2. Description. Reservations over 4 GiB still span windows (uma.rs:332 describes one of 8 GiB + 4 MiB); that case is missing under Not tested.

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.

@KDenKC

KDenKC commented Nov 25, 2026 •

Copy link
Copy Markdown

@S1m0ne1997 the NVIDIA in-title A/B you asked for, RTX 5090. XCL_WINDOW_NO_CARRY=1 makes the driver code smaller (about −5 to −6 % of the code bound in the title, −10 % per split piece), but both arms lost the device at the same point in the title. One run per arm.

Tested

  • RTX 5090 32 GB (driver 621.24), Ryzen 7 9800X3D, 62 GB RAM, Windows 11 26200, release. Tree: main 2898511 + D3D12.X: an ExecuteIndirect of a split program runs its pieces #2404 (5ca9c23) + this PR (78bba5c, cherry-picked), plus a local diagnostic not in any PR: XCL_LOCAL_CODE_SUM=1 calls GetCachedBlob on each PC pipeline at its first bind (the PC list's SetPipelineState hook) and logs the running sum.
  • Both arms: XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0, default XCL_PSO_WAIT_MS. Each started from its own copy of the same warm cache, ran xcl shaders --precompile --only cs --pipelines with its switches, then the retail title for 600 s.
switch off XCL_WINDOW_NO_CARRY=1
precompile: pipelines made / split programs (pieces) 8,687 / 816 (6,814) 8,311 / 811 (6,433)
mean .chain.pso blob (driver code per split piece) 121.7 KiB 109.9 KiB (−9.7 %)
bound code at 2,400 / 2,800 / 3,005 pipelines 338 / 382 / 406 MB 317 / 358 / 384 MB (−5.4 to −6.4 %)
world rendering 128–186 s (88 presents) 124–182 s (83 presents)
device removed 0x887a0005 409.9 s 324.6 s
last logged bound code before it 416 MB (3,082 pipelines) 384 MB (3,005 pipelines)
  • Both arms rendered the same ~58 s of the opening, then stalled on the same cold graphics pipelines (one title thread building them serially, see [OFFICIAL] Swarm: cold PSO compilation to first playable frame #2088), and lost the device 1.6–2.4 s after the last of them finished and world submission resumed. So the removal is tied to the same point in the title in both, not to the clock. The 85 s difference is order: the switch-off arm ran first and paid 91 s of driver time for 30 graphics pipelines that the second arm then got from NVIDIA's cache (0.1 s).
  • No nvlddmkm / Display events at the removal.

Not tested / caveats

  • One run per arm, with the diagnostic on (its GetCachedBlob calls add CPU time at each first bind). An earlier run on the same cache lineage without the diagnostic or this PR was removed at 123.8 s, right at world start, so the run-to-run spread is large.
  • The counter does see the pieces XCL binds itself (split pieces, the slicer, whole forms): XCL patches the PC list's SetPipelineState slot in place, so its own calls go through the hook (checked in the code). Only pipelines set at CreateCommandList / Reset / ClearState and never set again are missed.
  • This PR's own tests, graphics-only effects (the switch doesn't change graphics DXIL), other GPUs.

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.

@Oliwettoo

Copy link
Copy Markdown

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. take_sparse_in lets a reservation larger than a window (size > WINDOW) cross a boundary even with single_window: true (uma.rs:154). A buffer the title places across that boundary inside such a reservation is within its allocation, yet with XCL_WINDOW_NO_CARRY=1 its accesses wrap into the base's window and touch the wrong memory, with no warning.

Since the switch is opt-in, a log line when a reservation over 4 GiB is made with no_carry on (or a note in the README entry) would make such runs easy to spot.

@pvfreis

pvfreis commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Test report for 78bba5c with #2428 ab2855f (#2427 d356a74 in it) on main e1d84b7d (tree 76fc443d): outputs and driver code size with XCL_WINDOW_NO_CARRY=1.

Tested

  • RTX 3060 (617.14), Ryzen 9 5900XT, Windows 11 26300. Sandbox: non-interactive session, Low integrity, debug, --test-threads=4, NVIDIA 32-lane waves only. One run each.
  • Suite (plus our test arms and a test-build-only fault switch in two runtime files): 1429 passed, 1 failed, 46 ignored, 24 SKIPPED. main e1d84b7d: 1422 / 1 / 46, 25. The failure on both is e2e presents.
  • Outputs: no carry with root UAV, guarded and flat heap windows, wave32 and split wave64, in a new test (offsets of both signs, window edges, out of range, inactive lanes): all expected values met. Three no-carry arms in Recompiler: direct DXIL reads heap memory windows without a branch #2427's test equal its switch-form run. Three one-line breaks of the no-carry path each fail the new test.
  • Expected values: our arithmetic from AMD's public RDNA2 ISA (sections 7.2.1, 8.1.5, 9.1–9.4, 12.18.3); out of range is XCL's contract; a load leaving its base's window follows this PR's documentation, not the 64-bit sum.
  • Size only: GetCachedBlob bytes, 60 compute programs (30 largest, 30 sampled, chosen first), unsplit, built at opt-level 3 without debug assertions; plain debug gives the same DXIL and root signatures (60/60, every arm).
    • guarded heap 42.19 → 35.96 MB (0.852; per program 0.797–0.991)
    • flat heap 41.11 → 34.76 MB (0.845; 0.785–0.987)
  • Failed check: repeats of the flat arm without the switch gave equal sizes 60/60 but different contents in 18/60, and 8/60 in a second job; cause not investigated.

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.

MacieGx added a commit to MacieGx/xcl that referenced this pull request Nov 26, 2026
…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>
@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

@bielfreedom

Copy link
Copy Markdown

AMD Windows driver timing for #2496: on the RX 9070 XT, XCL_WINDOW_NO_CARRY=1 makes AMD's CreateComputePipelineState about 13 % faster over 26 large retail compute programs, with 11 % less direct DXIL over all 2,689. Nothing failed in either arm. This measures cost only, not whether the window premise holds (the thread above).

Setup

  • GPU: RX 9070 XT 16 GB (RDNA4, native wave64), AMD driver 32.0.32029.2010.
  • CPU and memory: Ryzen 7 7700 (16 threads), 32 GB RAM, Windows 11, release.
  • Build: this PR at 78bba5c merged onto main 08db802, plus a local timing patch in xcl shaders that writes each program's DXIL size and each CreateComputePipelineState time to a file. One binary for both arms; only the switch differs.
  • Offline: xcl shaders <retail shaders.rpf> --precompile --only cs --pipelines with XCL_DIRECT_DXIL=1, XCL_PSO_DISK_CACHE=0, one driver thread, a fresh translation cache and a fresh executable name for every run (the AMD driver keys its own cache on the exe name, so every build is cold).

DXIL size, all 2,689 compute programs (translation only)

windows switch off XCL_WINDOW_NO_CARRY=1 change programs changed
switch (default) 885.9 MB 788.1 MB −11.0 % 2,659
heap (XCL_HEAP_WINDOWS=1) 728.9 MB 674.0 MB −7.5 % 2,659

With the switch off the output matches main byte for byte.

Driver time, 26 large programs (switch windows), 2 interleaved rounds (off, on, then on, off)

arm pipelines (incl. split pieces) DXIL to driver driver time r1 / r2 peak memory
off 76 9.63 MB 78.7 / 83.3 s 1.51 GB
XCL_WINDOW_NO_CARRY=1 66 8.28 MB 67.5 / 73.2 s 1.43 GB

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:

program DXIL off → on driver ms off driver ms on
620491641aa9bad6 378 → 346 KB 10,830 / 11,334 9,486 / 10,579
6d1e4583f8129771 638 → 590 KB 6,819 / 6,994 5,974 / 6,336
6fd9a5ebc95aee46 322 → 289 KB 3,055 / 2,960 2,403 / 2,601
d2d3c6c5d8463f50 151 → 135 KB 1,405 / 1,471 1,126 / 1,246

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.

@CharlyRien

Copy link
Copy Markdown
Contributor

Test report, RTX 3090 (616.56), one run per arm. With XCL_WINDOW_NO_CARRY=1 the title ran 187 s into the world, through the heavy scene where our earlier run without the switch lost the device, and the run ended on its time limit with no removal. The witness, same settings without the switch, lost the device (0x887a0005) earlier than that: at world + 44 s. The code we count as bound was lower with the switch: 406 MB at most, against 420 MB at the witness's removal. Two more things measured:

  • the title makes two reservations over 4 GiB (the case @Oliwettoo raised);
  • with the switch set for the whole test process, two window tests hang the GPU on this card. Both use root-UAV windows, and both put an address below its base's window on purpose.

In the title, same settings, only the switch differs

VNIGHT2, switch off VNC2, XCL_WINDOW_NO_CARRY=1
world (first 2 s with > 7,000 draws) 120.2 s 122.5 s
end 0x887a0005 at 164.4 s, world + 44 s, in busy world rendering (1,100-2,400 draws per 2 s) ran to 309 s, world + 187 s, stopped by its time limit; no removal
heavy scene (2 s with ~4,500 draws and ~13,000 dispatches after about a minute of near-idle frames) not reached 230.3 s, passed
bound code, world + 0 to + 44 s (10 s reports and budget warnings) 361.6 → 383.7 MB; compute 235.4 → 253.1 MB 312.5-378.8 MB; compute 188.8-227.4 MB
bound code at the end at the removal: 366.2 MB bound + 54.2 MB awaiting release = 420.4 MB. Compute 255.4, mesh 46.4, graphics 64.5 peak over the run 406.2 MB (bound + awaiting). Compute peak 257.6 MB, in the heavy scene (389.2 MB bound then)
process commit, peak in the log 44.1 GB 45.0 GB
  • "Bound code" is our local pipeline budget's count: the GetCachedBlob size of each pipeline XCL built for a stand-in, from its first bind to its release.
  • Earlier pair, same trees, with more memory for page and GPU-view buffers (2048 / 1536 MB) and frame dumps:
    • without the switch (VNIGHT1): 0x887a0005 0.2 s into the heavy scene, world + 158 s, at 437.1 MB with compute 273.6 MB;
    • with the switch (VNC1): ran 6 s into the same scene, with 427.1 MB at most and compute 254.1 MB. Then our own memory guard stopped it (free system commit under 5 GB), not the driver.
    • The two witnesses were lost at different points of the title (world + 44 s and + 158 s), so the point of removal moves from run to run.
  • The switch run had one long stall in the heavy scene: 0 submits and 0 presents from 238 to 248 s.
    • Measured: in that window one compute pipeline of 22,188 bytes of DXIL was compiled with no blob on disk, in 14.8 s ("kept on disk", 32 KB of code). Our budget's longest rebuild of a released pipeline, 14.4 s, ended at the same time.
    • Its DXIL has no blob in the cache we used without the switch, so it is a program whose DXIL the switch changed and that our precompile and warm-up run had not built. Probably a mesh or GS compute pass: the offline tool does not build those as pipelines. That last part is our reading, not checked.
    • So switching costs some cold compiles in the title until the cache is warm. We did not see a cost of the switch's code itself.
  • With the switch, 0 placed title buffers crossed a window boundary in VNC2 (local log at CreatePlacedResourceX).
    • But the title reserves 24,576 MB and 6,236 MB in its first 10 s, in both switch runs (5.2 / 6.9 s in VNC1, 6.1 / 9.1 s in VNC2). These reservations span window boundaries even with this PR.
    • We did not check raw accesses that cross a boundary from one base inside them.
    • VNC2 made no frame dumps, so its image was not compared. In VNC1 the image showed no clear difference against VNIGHT1, but it was 3 frames against 6.

Window tests in our tree (cargo test --release -p xcl --lib -- window, 42 tests)

  • Switch unset: 42 passed. That includes gpu_window_no_carry_reads_inside_allocations_alike (it runs both arms itself, root and heap windows) and title_reservations_stay_in_one_window_without_the_carry.
  • XCL_DIRECT_DXIL=1 XCL_WINDOW_NO_CARRY=1 for the whole process, all tests at once: 12 failed. 10 of them failed with "GPU fence still pending after 10000 ms", then 0x887a0006: one test hung the GPU and the others followed, the HLSL arms included.
  • The same, one process per test (--exact --test-threads=1): 37 passed, 5 failed. All 5 pass with the switch unset, run the same way. Each one crosses a window on purpose:
test with the switch what it builds
window_at_lowers_to_32bit_carry_without_int64 assertion "expected UMul in DXIL" checks the DXIL shape of the carry
raw_loads_in_root_windows_respect_exec_and_bounds assertion at wave32 lane 7 (slot 7), global_load_dwordx2 a 64-bit load at a window edge
gpu_heap_windows_reject_out_of_uma_aliasing assertion "64-bit carry global_load must cross from w0 into w1" (w0 + 0xFFFF_FFF0) + 0x20: it reads w0 + 0x10
gpu_memory_windows_reject_out_of_uma_aliasing GPU fence still pending after 10 s the same program, windows in root UAVs
gpu_window_at_32bit_carry_edge_cases GPU fence still pending after 10 s root-UAV windows
  • The two hangs are the two root-UAV tests. The heap form of the same program only gives a wrong value.
    • Our reading of the test code, not instrumented: both root-UAV tests contain an access that borrows below the start of its base's window. The out-of-UMA test does w0 + 0 - 16; the edge-case test does a store at (w0 + 0x30) - 0x30 - 16.
    • Without the switch that access leaves the UMA: it reads 0 and its store is dropped.
    • With the switch it stays in window 0 at offset 0xFFFF_FFF0. The test arena backs 1 MB per window and a root UAV has no bounds, so we take it to be a page fault.
  • So, as far as these tests show: the switch only misses data when an access leaves its base's window, unless the windows are root UAVs. Then an access that lands on unbacked memory hangs the GPU on this card instead of reading 0.
    • We did not get the removal reason for these two processes.
    • @pvfreis's out-of-range cases met their expected values with root UAVs on a 3060. We did not compare the addresses those cases use.

Setup

Not measured

  • More than one run per arm. The witnesses lost the device at two different points (world + 44 s and + 158 s).
  • Whether the switch run would hold past 187 s of world.
  • Raw accesses that cross a window boundary inside the two big reservations.
  • The image in VNC2.
  • The removal reason in the two hanging tests.
  • Other cards and drivers.
  • This PR without our local pipeline budget.

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.

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.

10 participants