Repository navigation
Recompiler: memory windows from the descriptor heap (no per-access switch) - #680
Conversation
|
A single-program hardware result on RX 7900 XT, Windows 11 build 26100, AMD 32.0.32029.2010, SDK DXC 1.9.2602.17. I used the retail 1.0.2.1 tree-batch-cull compute program that previously occupied the AMD compiler during the world-loading watchdog (#505). Four memory windows, native wave64, zero static samplers. On the local #680 stack, the descriptor-heap form produced 265,368 bytes of DXIL. The previously captured switch form was 346,956 bytes for the same input. The release precompiler with On a saved-profile game run with the heap form enabled and that one pipeline prebuilt, the last loading frames still showed artwork. At 213.511 s the driver reported AI disclosure: Codex ran the tests and prepared this report. |
351a2b2 to
1ad9343
Compare
|
Tested On All 1,024 pixels matched the expected values across four draws: red 0.25 for window 0 and red 0.75 for window 1, with identical readbacks between the switch-based and descriptor-heap paths. The focused test passed 1/1. D3D12 validation was enabled, with no reported errors.
Not tested The title’s descriptor-heap rebinding path, additional memory windows, and retail graphics. AI use Codex with GPT-6.2 Sol wrote the scratch fixture, ran the test, and drafted this report. Update on Seven stock synthetic tests passed with zero failed, ignored or skipped, using the same hardware and toolchain in release mode. The sparse 4 GiB UAV test, both memory-window readbacks, and the descriptor heap lock and rebind tests passed. In the stock OOM test, the injected error refused the stand-in first. The synchronous switch-form retry then passed its GPU readback. I extended the stock async compute test in a scratch copy to inject one Commands used AI use for this update: Codex (GPT-6, exact variant unavailable) ran the tests, extended the scratch fixture and drafted the update. Rebase retest on On the same RTX 3080 Ti / 621.35 setup, both memory-window forms and the last-tile raw UAV fixture passed on DXC 1.8.2502.11 and 1.6.2112.16 (3/3 each). The two stock range-check controls also passed with DXC 1.8 (2/2). Zero failures or skips in these runs. This covers the small synthetic workloads only. I ran Opt-in routing on On the same RTX 3080 Ti / 621.35, Windows 11 build 26300, Rust 1.99.1 MSVC and DXC 1.8.2502.11, I ran the synthetic compute fixture in three fresh processes with four memory windows. Unset and
AI use for this update — Codex (GPT-6, exact variant unavailable) added the scratch assertions, ran the tests, and drafted the update. |
|
Test report: heap-window form on NVIDIA (RTX 4090) with the newer retail title. The driver's compiler ends the process on compute programs. Not a test of this PR's head. It is main Setup: RTX 4090 24 GB, driver 621.24 (32.0.16.2124), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, DXC 1.8.2502.11, Rust 1.100.0. What happens: the title gets through its menus, intro and loading art. When world loading submits its first large compute batch (about 7,100 dispatches in one 2 s window; 118 to 121 s on this base, 230 to 380 s on bases from a few hours earlier), the process ends with It is a fast-fail inside the driver's compiler, so no handler sees it and there is no XCL crash line. It reproduced in more than 10 runs across four bases. Ruled out:
What stops it:
A single 381 KB compute program sent through the switch-form fallback got one run past the abort, but a different program aborted in the next run, so it is not just one shader. Not tested: this PR's exact head, AMD, other NVIDIA generations, DXC 1.9. Suggestion: on wave32-only NVIDIA adapters, build compute programs in the switch form up front, since the existing E_OUTOFMEMORY fallback cannot catch a fast-fail. Past the abort, the run reaches the title's GPU watchdog ( |
|
I found a lock-order issue in It holds Patch: 87b1afd, directly on top of this PR's head. It snapshots the device/base/increment under the lock, then creates the views after releasing it. A child-process fake-device test checks that every UAV callback can acquire Tested
Parallel-run blocker The first parallel run also reported Not tested AI use Current-main integration check Tested and pushed
The four-thread stall was not reproduced on this main-based tree. This result is for the integration branch, not the unchanged PR head. No retail smoke run or large-shader/compiler-fast-fail validation was performed; those limitations remain. Codex performed this integration and validation as well. |
1ad9343 to
2c1a521
Compare
|
Thanks both – head is now @anes66 – confirmed: @tycosnh – that is a blocker if it happens on this form in general, so the PR stays a draft and the description now says so. What I have from this machine (RTX 5080, driver 610.47, DXC 1.9.2602.17, Windows 10 19045), compute programs in the heap form, same title:
The two messages are the bitcode reader's, so the DXC version is my first suspect: yours is 1.8.2502, mine 1.9.2602.17 – and the driver differs too (621.24 against 610.47). If you can run once with DXC 1.9 beside AI use: Claude Code with Claude Fable 5.2 wrote this reply; the numbers are from runs on the machine named. |
|
Test report: on NVIDIA, some compute programs in the heap-window form make the driver's compiler end the process instead of refusing the pipeline. Setup
What happens
So in the heap form, Not tested
AI use: Claude Code with Claude Opus 5.5 ran the builds and the runs above and wrote this report. |
|
Final update, 07:15 UTC – please disregard the access violations I reported here: they come from my own local diagnostics build, not from this PR and not from What settles it, all on the same machine and the same warm caches, 3.5-minute runs:
The nine runs without my diagnostics all end the way (The earlier versions of this comment, for the record: first "it may or may not be this PR", then "the switch form has them too, so it is not this PR" – both written before I had run a build without the diagnostics.) AI use: Claude Code with Claude Fable 5.2; the numbers are from runs on the machine named. |
|
Data point for the open point: on RTX 3060 Ti 8 GB (driver 32.0.16.1742, Windows 11, DXC from SDK 10.0.26100) the heap form of Sequence from the log (same in every failing run): No draw has run yet (0 presents); the first sparse-pool Controls on the same machine, same title, same session:
So on this card the heap-window form breaks the device before any translated draw — the first thing after "memory windows from the shared descriptor heap" is a refused AI use: GPT-6.2 Astra (API model selector) in DSH built both heads, ran the smokes and controls, and drafted this comment; the human contributor reviewed the logs before posting. |
|
@ryosen0 – thank you, that is a clear one, and it is this PR's: on
Where this PR stands, so nobody has to piece it together: three NVIDIA reports are open against the heap form – the compiler's fast-fail on an RTX 4090 with a newer driver and DXC 1.8 (@tycosnh), this device removal at boot on an 8 GB RTX 3060 Ti, and the AI use: Claude Code with Claude Fable 5.2. |
|
Synthetic numbers for the heap-window form on an RTX 5080 (Blackwell), no game files. On this driver neither DXC 1.8 nor DXC 1.9 makes the driver abort, and the heap form builds 9–19× faster than the switch form. Setup: RTX 5080 16 GB, driver 621.14 (32.0.16.2114), Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 26300, rustc 1.100.0, release. This PR's head Probe:
Each pipeline is built in its own process ( 1. Aborts: none. Heap form, 4 shapes × 4 sizes × 2 seeds, 87 KB to 1.3 MB of DXIL: 32/32 built with DXC 1.9.2609.5 and 32/32 with DXC 1.8.2502.11 (the SDK's, the version in both abort reports). So on 621.14, DXC 1.8 alone does not trigger the abort for these patterns. That leaves the driver (621.24 in both abort reports; 610.47 and 621.14 don't abort) or a pattern these shapes lack: textures and samplers from the heap next to the window buffer, LDS, ray-tracing BVH instructions, or the much more irregular control flow of 2. Driver build time, heap form vs switch form (
For Not tested
AI use
|
2c1a521 to
e999741
Compare
|
Rebased onto
AI use: Claude Code with Claude Fable 5.2; the numbers are from runs on the RTX 5080 machine named in the description. |
|
This is opt-in now (head
AI use: Claude Code with Claude Fable 5.2 wrote the change and this note; the numbers are from runs on the RTX 5080 machine named in the description. |
e999741 to
95f34c1
Compare
|
Code/CI review only (not independently runtime-tested by me): clean merge with both checks green ( |
|
Test report: the NVIDIA compiler abort does not reproduce on an RTX 5090 with the same driver (621.24), with either DXC 1.8 or 1.9, on this head or on Setup: RTX 5090 32 GB, driver 621.24; i9-14900KF, 64 GB; Windows 11 Pro 26200; release builds;
Every program reached the driver and came back (the before/after lines pair up in all three runs). The run summary says "4 memory windows from the descriptor heap" each time, so the heap form was in use. Reading: on Blackwell with 621.24, neither the DXC version nor the head brings back the abort. That agrees with @milesah3ad's 5080 numbers, and the two abort reports are a 4090 and a 3080 Ti. The difference seems to be the GPU generation, not DXC. My DXC 1.8 is the GitHub release build (1.8.2502.8), not the SDK build (1.8.2502.11) in both abort reports, so that one gap is still open. Not tested: the full pack in the heap form, a title run with AI use: Claude Code with Claude Opus 5.5 ran the builds and runs above and wrote this report. |
|
Test report: driver compile time with this PR, RTX 3060 (NVIDIA, wave32) Commit tested: this PR's head 95f34c1 with Tested
Not tested
Regression run (same title, 180 s each, cold DXIL and NVIDIA driver caches before each run) main: this PR ( No regression: same frames (+0.1 %), no device removal or crash, same peak commit, same pipeline counts (6 translated, 0 failed, 40 mesh refused as on main). Update: a likely regression on a title run (RTX 3060, cold caches, 300 s,
AI use |
|
Tested
For the combined #680/#759 experiment, I preserved the heap-mode bit in the journal header. #759's one-byte window field would otherwise drop bit Follow-up on XCL main I used A separate heap-window retail run on the same machine captured loading artwork in both the presented frame and the busiest live render target. Host memory pressure limited that run to the loading milestone. Validation after merge at Both new focused regressions ran on the RTX 5060 Laptop GPU under Proton Experimental 11.0-20261112. With the same release on the merged main, local Series X loading changes and matching cache/data seeds, the heap-window run confirmed the shared descriptor heap, reached loading artwork, and then the title GPU watchdog (2,480 presents). The switch-form run reached a 240 s test stop and presented black by the last manual capture (2,754 presents). One bind timeout warning and zero storage failures, device removals and kernel GPU faults occurred in each run. Neither run verified world entry. Not tested Native Windows, AMD, or rendered gameplay. This paired retail run measures the loading milestone and timeout warnings. It does not isolate driver compile times. AI use OpenAI Codex with GPT-6.2-Sol high integrated the local build, ran the tests, and prepared this report. |
…switch With the title's 4 memory windows every load of a translated program goes through an accessor that switches on the window (`xcl_w`). The NVIDIA driver compiles that very slowly in big programs: the retail CS_RaytracingResolve family (13 000 - 21 000 instructions, ~1 150 window switches each, ~1 MB of DXIL) took 30 - 90 s per CreateComputePipelineState, with a bind of the title waiting for it. DXC's level does not matter (-O0 / -O1 / -O3: 39 / 32 / 35.5 s for one of them). Compute HLSL from 1 MiB on now reads every window - the selected one at the address, the others at offset 0 - and selects by `xcl_w`, without a branch. The values are the same, including 0 for an out-of-range window. Stores and atomics keep the switch (one window only). RTX 5090, one CreateComputePipelineState, cold driver cache: - ped_slod_constant_tint:CS_RaytracingResolve (bcca7412e6c66279): 875 916 B DXIL, 32.4 s -> 889 036 B, 12.3 s - standard_secmo:CS_RaytracingResolve (31b81a7b0427b16c): 1 076 296 B, 50.7 s -> 1 091 092 B, 14.0 s - ef008c0f04b6261a: 1 108 268 B, 42.5 s -> 1 124 468 B, 11.1 s - ab570963c407e5c0: 1 071 288 B, 39.5 s -> 1 087 576 B, 11.0 s In the retail title, where a bind waits for each of them (and other compiles run at the same time): 31b81a7b 78.3 s and ef008c0f 85.8 s with the switch, 21.0 s and 20.9 s without it (ab570963 16.9 s). Smaller programs, VS and PS keep byte-identical HLSL and so their DXIL and driver cache entries: 901 of 2 689 CS (and 164 MS) in the title's shaders.rpf change. With heap windows (xcl-dev#680, XCL_HEAP_WINDOWS=1) there is no switch to remove: the heap form is used as before and its HLSL does not change. The flat loads apply to the switch form only, which is the default and also what xcl-dev#680 builds when the driver refuses a pipeline with heap windows. Assisted-by: omp (Claude Opus 5.5)
…switch With the title's 4 memory windows every load of a translated program goes through an accessor that switches on the window (`xcl_w`). The NVIDIA driver compiles that very slowly in big programs: the retail CS_RaytracingResolve family (13 000 - 21 000 instructions, ~1 150 window switches each, ~1 MB of DXIL) took 30 - 90 s per CreateComputePipelineState, with a bind of the title waiting for it. DXC's level does not matter (-O0 / -O1 / -O3: 39 / 32 / 35.5 s for one of them). Compute HLSL from 1 MiB on now reads every window - the selected one at the address, the others at offset 0 - and selects by `xcl_w`, without a branch. The values are the same, including 0 for an out-of-range window. Stores and atomics keep the switch (one window only). RTX 5090, one CreateComputePipelineState, cold driver cache: - ped_slod_constant_tint:CS_RaytracingResolve (bcca7412e6c66279): 875 916 B DXIL, 32.4 s -> 889 036 B, 12.3 s - standard_secmo:CS_RaytracingResolve (31b81a7b0427b16c): 1 076 296 B, 50.7 s -> 1 091 092 B, 14.0 s - ef008c0f04b6261a: 1 108 268 B, 42.5 s -> 1 124 468 B, 11.1 s - ab570963c407e5c0: 1 071 288 B, 39.5 s -> 1 087 576 B, 11.0 s In the retail title, where a bind waits for each of them (and other compiles run at the same time): 31b81a7b 78.3 s and ef008c0f 85.8 s with the switch, 21.0 s and 20.9 s without it (ab570963 16.9 s). Smaller programs, VS and PS keep byte-identical HLSL and so their DXIL and driver cache entries: 901 of 2 689 CS (and 164 MS) in the title's shaders.rpf change. With heap windows (xcl-dev#680, XCL_HEAP_WINDOWS=1) there is no switch to remove: the heap form is used as before and its HLSL does not change. The flat loads apply to the switch form only, which is the default and also what xcl-dev#680 builds when the driver refuses a pipeline with heap windows. Assisted-by: omp (Claude Opus 5.5)
|
PR #680 follow-up. Tested merge commit $env:XCL_ADAPTER = 'RTX 3060 Ti'
$env:XCL_HEAP_WINDOWS = '1'
$env:XCL_REQUIRE_GPU = 'wave64'
cargo test --locked -p xcl --test gpu_compute_e2e heap_window_out_of_memory_falls_back_to_the_switch_form -- --exact --nocapture --test-threads=11 passed, 0 failed, 0 skipped. XCL enabled heap windows and retried once in switch form after the test injected AI use — OpenAI Codex ran the test and drafted this report. Exact model version unavailable. |
…direct DXIL) Brings in upstream xcl-dev#680 (descriptor-heap memory windows without per-access switches, with switch fallback) and xcl-dev#1426 (direct RDNA2 -> DXIL backend behind XCL_DIRECT_DXIL=1 / XCL_DIRECT_DXIL=all, bypassing HLSL and DXC). Retains xcl-dev#1398 no-GVN retry, xcl-dev#1410 wave64 logging, and xcl-dev#1428 folded X dispatch group limit alongside xcl-dev#680 and xcl-dev#1426.
|
Clean- Setup
1. Workspace tests (
|
| run | heap DXIL cache | last non-zero presents | stop | peak commit | peak local / non-local VRAM | fresh compute PSOs (sum / max / >= 5 s) |
driver blobs |
|---|---|---|---|---|---|---|---|
default (XCL_PSO_WAIT_MS unset) |
warm | 132.1 s | 0x887a0006 device removed at 133.8 s |
23198 MB | 11007 / 4894 MB | 5 (3.9 s / 2.46 s / 0) | 1 |
XCL_HEAP_WINDOWS=1 (XCL_PSO_WAIT_MS unset) |
cold | 168.1 s | +0x23cf683 (0xc0000005) at 195.8 s |
28579 MB | 14008 / 4896 MB | 39 (29.1 s / 7.48 s / 2) | 1 |
default + XCL_PSO_WAIT_MS=50 |
warm | 144.1 s | +0x23cf683 (0xc0000005) at 204.8 s |
30799 MB | 14446 / 4929 MB | 196 (379.6 s / 38.87 s / 23) | 28 |
XCL_HEAP_WINDOWS=1 + XCL_PSO_WAIT_MS=50 |
warm | 88.1 s | 0x887a0006 device removed at 89.8 s |
24395 MB | 12429 / 4894 MB | 5 (5 ms / 3 ms / 0) | 5 |
Findings on the three open points
- Window VA / acceleration structures above 2^40:
window 0 buffer at VA 0x3e0000000was identical withXCL_HEAP_WINDOWSoff and on in every run (UMA: 3 sparse VRAM window(s) (12 GiB VA) + 4095 MB coherent window at 0x400000000). Noxboxbvhbuildererror orRAYTRACING_ACCELERATION_STRUCTURElog line appeared, though these runs stopped before acceleration-structure builds were logged so that path was not directly exercised. - NVIDIA driver compiler fast-fail: Not seen on this Ampere card with driver
621.01(32.0.16.2101) across all tests, smokes, and 39 fresh heap-window compute PSO builds (up to409,812 B DXIL / 7,477 ms,0refused,0Invalid record/Never resolved value,0switch-form fallbacks). For scale on this card, the longest switch-form compute builds reached38.9 s(829 KB DXIL) and26.5 s(610 KB DXIL) with7builds>= 10 s, vs max7.5 s(410 KB DXIL) and0>= 10 swith heap windows. - 8 GB card with the new view cap: Both
XCL_HEAP_WINDOWS=1runs enabledmemory windows from the shared descriptor heap (no per-access switch)cleanly at~1.5–1.6 swith0CreateHeaprefusals and0switch-form fallbacks, and the first world-load run streamed up to14,008 MBlocal video memory (195.8 s) with0device removals. Note that0x887a0006(DXGI_ERROR_DEVICE_HUNG) did occur once in each mode during heavy 8 GB VRAM overcommit (11,007 MBlocal in default at133.8 s;12,429 MBlocal inXCL_HEAP_WINDOWS=1 + XCL_PSO_WAIT_MS=50at89.8 s), while the other run in each mode reached+0x23cf683with0device removals.
Not tested: driver 621.24, offline xcl shaders --precompile --pipelines, multiple repeats per configuration, acceleration-structure build stage.
AI use: Antigravity (Gemini 4 Neon) built, ran, and parsed these tests and logs on this machine and drafted this comment; reviewed before posting. No game files attached.
…g, DirectStorage, and stream tracking Cherry-picks upstream stabilization improvements across VRAM allocation, pipeline caching, DirectStorage lifetime, descriptor heap indexing, Media Foundation device bridging, and stream PSO tracking: - D3D12.X: reclaim cooling and idle tiles on pool heap OOM (xcl-dev#1663, addressing xcl-dev#1585 and xcl-dev#1668). When CreateHeap returns 0x8007000E (E_OUTOFMEMORY), Pages::take_tile waits on Pages::fence up to 1000 ms to drain cooling tiles or force-evict idle pages rather than failing immediately. (by Nikita Romanovich) - DirectStorage: close a queue when its last reference is released (xcl-dev#1675). Moves queue_close logic into QueueInner::close and invokes it when the final queue reference is released, preventing background workers from writing to freed caller buffers and marking pending entries complete with E_QUEUE_CLOSED. (by eizispark) - D3D12.X: a pipeline the driver gave up on is not built again (xcl-dev#1665). Persists driver E_OUTOFMEMORY refusal state into used-pipelines.txt (!<key>) so giant compute pipelines that the host driver refuses to compile are skipped on subsequent runs. (by zorde23) - Recompiler: access outside heap windows takes a null view without branching (xcl-dev#1669, xcl-dev#680). Replaces conditional branches in XCL_HEAP_WINDOWS=1 (if (xcl_w >= windows)) with a branchless select pointing out-of-bounds accesses to a dedicated null UAV view (MEM_HEAP_NULL). (by milesah3ad) - HLE: bridge ID3D12Device before direct ResetDevice and cache D3D11 companion (xcl-dev#1677). Fixes MFResetDXGIDeviceManagerX in mfplat.rs to bridge ID3D12Device COM pointers and caches multithreaded companion ID3D11Device instances per adapter LUID. (by eizispark) - D3D12.X: route stream graphics PSOs through create_graphics_pso_tracked (xcl-dev#1661, finding XCL-BT-023 from xcl-dev#1489). Ensures stream-created graphics PSOs receive D3D12_PIPELINE_STATE_FLAG_DYNAMIC_DEPTH_BIAS and are tracked in device_x::note_base for CreateDerivedPipelineStateX and RSSetDepthBiasX. (by fixgep) Assisted-by: Antigravity
…switch With the title's 4 memory windows every load of a translated program goes through an accessor that switches on the window (`xcl_w`). The NVIDIA driver compiles that very slowly in big programs: the retail CS_RaytracingResolve family (13 000 - 21 000 instructions, ~1 150 window switches each, ~1 MB of DXIL) took 30 - 90 s per CreateComputePipelineState, with a bind of the title waiting for it. DXC's level does not matter (-O0 / -O1 / -O3: 39 / 32 / 35.5 s for one of them). Compute HLSL from 1 MiB on now reads every window - the selected one at the address, the others at offset 0 - and selects by `xcl_w`, without a branch. The values are the same, including 0 for an out-of-range window. Stores and atomics keep the switch (one window only). RTX 5090, one CreateComputePipelineState, cold driver cache: - ped_slod_constant_tint:CS_RaytracingResolve (bcca7412e6c66279): 875 916 B DXIL, 32.4 s -> 889 036 B, 12.3 s - standard_secmo:CS_RaytracingResolve (31b81a7b0427b16c): 1 076 296 B, 50.7 s -> 1 091 092 B, 14.0 s - ef008c0f04b6261a: 1 108 268 B, 42.5 s -> 1 124 468 B, 11.1 s - ab570963c407e5c0: 1 071 288 B, 39.5 s -> 1 087 576 B, 11.0 s In the retail title, where a bind waits for each of them (and other compiles run at the same time): 31b81a7b 78.3 s and ef008c0f 85.8 s with the switch, 21.0 s and 20.9 s without it (ab570963 16.9 s). Smaller programs, VS and PS keep byte-identical HLSL and so their DXIL and driver cache entries: 901 of 2 689 CS (and 164 MS) in the title's shaders.rpf change. With heap windows (xcl-dev#680, XCL_HEAP_WINDOWS=1) there is no switch to remove: the heap form is used as before and its HLSL does not change. The flat loads apply to the switch form only, which is the default and also what xcl-dev#680 builds when the driver refuses a pipeline with heap windows. Assisted-by: omp (Claude Opus 5.5)
|
Point 2 (the NVIDIA compiler fast-fail) on Turing with 621.35: not seen on 56 retail compute programs, including the two families from the 3080 Ti report. For Pipodi's list in #1269. Tested: RTX 2070 SUPER 8 GB (Turing, 32-lane waves, so the split wave64 form), driver 621.35 (32.0.16.2135), Ryzen 7 5800X3D, 32 GB, Windows 11 Pro 26300, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), release build of How:
Programs (seed 1269):
Result:
Driver time, on the programs that built in both forms:
In the heap form, DXIL was 14–21 % smaller per group and DXC took 11–22 % less time. Not tested:
AI use: Claude Code, Claude Opus 5.5 chose the programs, ran the builds, parsed the results and wrote this comment. The numbers come from those runs on the hardware above. |
…or heap) Conflicts, resolved keeping both sides: - emit.rs: windowed / mem_accessors take both `heap` (xcl-dev#680) and `flat` (our flat window loads for compute HLSL >= 1 MiB). The heap form returns first (it has no switch); `flat` applies only to the switch form, so the default (switch) HLSL is unchanged and xcl-dev#680's switch-form fallback still gets flat loads for big compute programs. - pso.rs: mem_windows keeps our `set_mem_windows` override (xcl pipelines) and adds xcl-dev#680's HEAP_WINDOWS flag / in_switch_form / heap_windows. - real.rs: our prep_graphics split stays; translated_graphics_pso becomes xcl-dev#680's with_switch_fallback wrapper around translated_graphics_pso_once. - shaders.rs: --precompile passes both our --used and xcl-dev#680's heap key. - tests.rs: the out-of-UMA test runs the heap form, or the switch and flat forms; big_programs_read_their_windows_without_a_switch also checks that a big program with heap windows has one heap access per load.
…m the descriptor heap) try-up680 (21e701c) merged upstream 9e3831e onto integ b555b63; integ has since gained 3950766..67c2526. Conflict: - crates/xcl/src/shaders.rs (`xcl shaders --precompile`): integ's `--used [file]` (`used_file(.., pso_async::used_path)`, passed as `used.as_deref()`) kept, with xcl-dev#680's runtime window key (`windows | HEAP_WINDOWS` when `pso::heap_windows()`). Auto-merged with integ's later changes (gpu_profile hooks, warm's max_dxil / translated, shaders_key_of) in pso.rs, bind.rs, console_list.rs, list_x.rs and real.rs; checked hunk by hunk against both parents.
Merged onto c8b2b74 (integ 67c2526 + try-up680, which already resolves upstream xcl-dev#680 against integ: emit.rs, pso.rs mem_windows, real.rs and tests.rs as in 21e701c, shaders.rs --precompile in c8b2b74). Conflicts: - crates/xcl/src/gpu/recomp/pso.rs: integ's `compute_shape` (XCL_GPU_PROFILE) and xcl-dev#1426's `direct_fallback` / `direct_compute` / `dump_direct` / `direct_graphics` are separate new functions at the same spot; both kept. - crates/xcl/src/main.rs (usage): xcl-dev#1426's `xcl shaders --direct ...` option lines kept under `xcl shaders`, followed by integ's `xcl pipelines` entry. - crates/xcl/src/gpu/recomp/tests.rs `gpu_sparse_vram_descriptors_buffers_and_xmem`: as in 028f3cb (pr/flat-window-loads-v3): the switch-form PSO built through `direct_or(..)` (direct DXIL with XCL_DIRECT_DXIL=1) and the flat form (`flat_window_loads`) through DXC. - crates/xcl/src/gpu/recomp/tests.rs `gpu_split_wave64_waves_diverge`: integ's group-barrier cases kept (HLSL edit, compiled with DXC); the counter cases go through xcl-dev#1426's `direct_or(..)`. Default behaviour (XCL_DIRECT_DXIL / XCL_HEAP_WINDOWS unset) is integ's.
|
Point 2: both fast-fail reports ran the heap form from before the merge, and its window index differs from the merged form and from #1695 Both reports built every memory accessor with In DXIL, from a small probe with two accessors, compiled with DXC 1.9.2602.17 (
Since the merge, nobody has reported the fast-fail:
So the fast-fail may follow the What this means for #1695. It builds the index in one of two ways:
If the inference holds, putting the null view in the unused window slots too would let both cases use A rerun that would settle it, if @LeonardoS11 still has the RTX 3080 Ti with 621.24:
If Not tested: the old form on this machine (the 2070 SUPER did not abort with the merged form, so it could not tell the two forms apart), DXC 1.8, and #1695 on the retail programs. AI use: Claude Code, Claude Opus 5.5 compared the three forms in the source, compiled the probe and wrote this comment. |
With more than one memory window every memory access of a translated shader is a
switchover the windows' root UAVs, inlined once per window. That is what makes the big compute programs of a retail title slow to compile, in DXC and in the driver (#156, #346). Here window k is also a raw UAV in the shared descriptor heap and an access is oneResourceDescriptorHeapload or store.Opt-in:
XCL_HEAP_WINDOWS=1turns the heap form on. Unset, a run is as onmain: the shared heap is not made early, no window views are written, shaders are translated in the switch form undermain's cache keys. It is off by default because of two NVIDIA reports in the comments, of which one is not explained yet (Why it is opt-in, below).This is the heap-window part of #187 by @RemingtonWilcox, which was closed without being merged; in #186 the maintainer wrote that memory windows from the descriptor heap "fit where this should go - a PR on current main is welcome". The three commits keep their author; I carried them onto current
main, left out that PR's physical-page change and its aperture experiments and compile-time bench, and measured them on a retail title. If the author would rather reopen their own, I will close this one.What is in it
Recompiler: memory windows from the descriptor heap, no per-access switch(Memory windows from the descriptor heap (no per-access switch); NVIDIA OOM fallback; physical-page fixes #187c3fb89e,864ce8e,33c92dd) –gpu/recomp/emit.rs(the accessors),mod.rs/pso.rs(Options::heap_windows, theHEAP_WINDOWSflag in the cache keys, opt-in: on withXCL_HEAP_WINDOWS=1),hle/d3d12x/console_heap.rs(the windows' raw views are the first 4 descriptors of the shared heap),bind.rs/list_x.rs/console_list.rs(a list that set no heap gets the shared one before an ABI draw or dispatch),shaders.rs(--precompileuses the same key),runner.rs(raw_window_uav, the test runner binds the heap). Tests:gpu_memory_windows_from_the_heap,gpu_raw_window_view_reaches_its_top(new fileheap_window_tests.rs).D3D12.X: SetDescriptorHeaps(0, NULL) clears the list's record of bound heaps(Memory windows from the descriptor heap (no per-access switch); NVIDIA OOM fallback; physical-page fixes #1878b4e398) –list_x.rs, with its test.D3D12.X: a pipeline the driver refuses with heap windows is built in the switch form(Memory windows from the descriptor heap (no per-access switch); NVIDIA OOM fallback; physical-page fixes #18741d4506) –real.rs,pso.rs, test intests/gpu_compute_e2e.rs. NVIDIA refuses a few big programs in the heap form withE_OUTOFMEMORY; they are built as before.Recompiler: a heap window's view ends 32 bytes below 4 GiB(new; found and measured by @CharlyRien, Recompiler: memory windows from the descriptor heap (no per-access switch) #680 (comment)) –runner.rs(raw_window_uav),heap_window_tests.rs. The D3D12 runtime of Windows 11 23H2 (D3D12Core 10.0.22621) refuses a raw view that ends more than 4 GiB − 32 bytes from the start of its resource and removes the device; newer runtimes take the larger one. The view is capped there: in the heap form the last 32 bytes of a 4 GiB window read 0 and drop their stores (it was the last 4). The HLSL and the cache keys stay the same;gpu_raw_window_view_reaches_its_topchecks up to the new end.console_heap::set_window_views) – the device may be an adopted one whose UAV hook takes the heaps' lock, which other paths take first. Found and fixed by @anes66, with the testwindow_views_do_not_hold_global_during_device_calls; folded into the first commit with aCo-Authored-By.main's range check of the windows (f9e5ee9, merged after this PR was opened): in the heap form anxcl_woutside the windows reads 0, drops its store and zeroes an atomic'soutby one comparison before the heap access, as the switch'sdefaultdoes.main's test of that rule runs in both forms now (gpu_heap_windows_reject_out_of_uma_aliasing).list_x.rsandconsole_heap.rs. Changed against Memory windows from the descriptor heap (no per-access switch); NVIDIA OOM fallback; physical-page fixes #187: the view's cap above, the test file holds only the raw-view test (and reports a missing GPU / DXC, or an adapter that makes no 4 GiB reserved buffer – the CI's – throughskip_test), commit subjects carry their area.Measured (this PC, hardware below; a retail title's shader pack, numbers only)
After
main's range check of the windows, which changed both forms (measured one999741onmain1ec4c98; the head now differs from that by the opt-in default and a rebase over commits that do not touch the recompiler): the same 83 programs and method as below, 3 rounds, the forms in turn.main)Without the 5.8 s of reading the pack: the driver's part is 214 – 233 s against 54 – 60 s, about 4 times less, DXC's 34 – 35 s against 29 – 30 s. Before the range check it was 9 – 10 times (next table): the switch form got cheaper with it, and the heap form now pays one comparison an access.
As first opened (before
main's range check; kept for the record):xcl shaders <pack> --precompile --only cs --limit 22240: the first 83 compute programs of a retail title's pack, this change onmaincb868b2(13dcab8), release; the switch form is the same executable withXCL_HEAP_WINDOWS=0. 3 rounds, the two forms in turn, every run on an empty DXIL cache and under an executable name the driver had not seen (its shader cache is per executable). Step 2 is the same command with--pipelineson the DXIL cache step 1 filled (4 driver compiles at once). Seconds of the whole command; 5.6 – 5.9 s of each is reading the pack.main)Tested
stable-x86_64-pc-windows-msvc; debug for the tests, release for the title and the timings.cargo build --workspace && cargo test --workspace -- --test-threads=4ondeb4b92(rebased ontomainb7aa9f3), as it is: 776 passed, 0 failed, 41 ignored (SKIPPED GPU tests:gpu_wave32_program_in_wave64_hardware,gpu_geometry_wave32_prefix_count_over_a_mask– no wave64;heap_window_out_of_memory_falls_back_to_the_switch_form– it goes through the runtime switch, which is off).XCL_HEAP_WINDOWS=1in the environment: 776 passed, 0 failed, 41 ignored (that test runs; the two wave64 ones are SKIPPED as above). The recompiler-level GPU tests of the heap form (gpu_memory_windows_from_the_heap,gpu_heap_windows_reject_out_of_uma_aliasing,gpu_raw_window_view_reaches_its_top) set the option themselves and run in both.XCL_NETWORK=0, pad script throughXCL_PRESS_AT, empty DXIL cache; an earlier head of this change (onmain9ce2070, beforemain's range check, the heap form on) in a local stack that gets the title to its world's graphics set-up on this PC (Rect lists: the CPU expansion finds the rect's corner, not always v1 #266, Textures: a layout's high-coordinate tables hold one period, not 65536 entries #435, D3D12.X: a placement on title pages sweeps the idle ones, not every page #490, D3D12.X: a slow graphics pipeline waits at most 4 s once per build (#232) #267 and theCopyFromSubresourcefix of D3D12.X / XG: async texture upload, detiling, VRAM, XG ABI, and PSO scheduling improvements #539). The title's screens are drawn as before; the set-up starts at 132 s and its compute dispatches run (up to 212 in a 2 s window). In the first 217 s 125 compute pipelines were built at their first bind, 212.9 s in all, the longest 12.6 s (DXC and driver together, both cold). The driver refused 2 of them withE_OUTOFMEMORY; they were built in the switch form (the third commit at work) and the run went on.Regression run
main:
PR (default: the switch form, as
main):PR with
XCL_HEAP_WINDOWS=1:Each block was made after one run of that build and form that filled its DXIL cache (the heap form has its own cache entries); the log of the third block's run has the line
memory windows from the shared descriptor heap, the second's does not. A second round of the three: 1392 (main), 1377 (PR), 1407 (PR with the form on). The head is rebased ontob7aa9f3, the commit of the main block.Why it is opt-in: two reports below of NVIDIA setups where the heap form fails, neither of which this machine shows – @tycosnh: RTX 4090, driver 621.24, DXC 1.8.2502, #187's branch: the driver's compiler ends the process on compute programs when the title's world submits its first large compute batch; @ryosen0: RTX 3060 Ti 8 GB, this PR's earlier head: the device is removed at boot, right after the shared heap and the windows' views are made (the switch form is clean there). Against that, @milesah3ad's synthetic probe on an RTX 5080 (driver 621.14) had no abort with DXC 1.8 or 1.9, and this RTX 5080 (driver 610.47, DXC 1.9.2602.17) went through that compute batch in every run and made over 550 compute pipelines in the heap form with
xcl shaders --pipelines(5 refused with an error code, none ending the process). For the second there is now a cause that fits (@CharlyRien, RTX 3090 on Windows 11 23H2, #680 (comment)): there the device removal at boot reproduces, and it is that system's D3D12 runtime refusing the windows' 4 GiB − 4 raw view, with the debug layer namingCreateUnorderedAccessView; it is not the driver. The fourth commit caps the view at 4 GiB − 32 bytes, the change they ran there (no device removal in two title runs, the heap tests pass). Whether @ryosen0's machine has that runtime is not confirmed. I cannot reproduce the removal on this PC (its runtime takes the larger view), so on my side the commit is checked only for doing no harm here: the suite and the three blocks above. The first report, the driver's compiler ending the process, is still neither reproduced nor explained (it did not come on an RTX 5090 or an RTX 5080 with that driver, nor on an RTX 4090 with an older one, in the comments below), so the form stays off by default; the default can change later, with more reports.Not tested
AI use
main, trimmed the tests, ran the suite, the timings and the title runs on the machine named, and wrote this description. The fourth commit is the one-line change @CharlyRien found and measured, applied with the test's new end by Claude Code with Claude Fable 5.2.Duplicate check (Gate A 02:15 UTC on
main9ce2070, Gate B 03:22 UTC on91f9a5e, again 03:54, 04:39, 08:05 and 08:47 UTC,main077ce40; again 17:03 UTC onb7aa9f3b): no open PR makes the windows come from the heap; read #187 (closed), #174 (links the accessors: DXC time only, the DXIL stays the same), #346 (docs: collects the measurements), #533 / #539 / #267 (schedule around slow compiles, do not change them), #573; opened since, other ways to cut the switch's cost: #1380 (big compute programs read all windows and select, the root UAVs stay) and #1439 (one switch for a multi-dword access).🤖 Generated with Claude Code