Recompiler: heap-window shaders reach all 16 window slots of the heap #3096
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3096"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-28T05:07:08Z.
With
XCL_HEAP_WINDOWS=1a translated program takes memory window k from descriptorMEM_HEAP_BASE + kof the shared heap. The heap already reserves 16 window slots (MAX_HEAP_WINDOWS), but both translators stop at the unified block's own window count, and only the layout's windows are written.This PR lets a heap-window program select all 16 slots, and gives the slots past the layout's windows null views. Nothing changes for a title: an address outside the windows still reads 0 and drops its writes. It prepares for memory that XCL maps into those slots later, without translating the shaders again. That is the next PR, the title's GPU-view memory (#3097), stacked on this one.
Still not on
main7a649b0:lower_mem.rsbounds the window index byself.mems.len(),set_window_viewswriteswindows.len().max(MAX_WINDOWS)views, andrunner::run_in_regionclamps to the arena's windows. #1695 and #2427 (both open, both conflicting withmain) change the same accessors to drop the guard; neither raises the bound to the 16 slots.What is in it
First commit (@MacieGx's, ported from his tree onto current
main):crates/xcl/src/gpu/recomp/emit.rs: the heap accessors test the window index against 16, not against the program's window count. Out-of-window accesses go to the null descriptors (MEM_NULL_LOAD/MEM_NULL_STORE); the bound sits before that select.crates/xcl/src/gpu/dxil/lower_mem.rs: the same bound on the direct path (heap_window_bound), including the direct flat-heap path.crates/xcl/src/gpu/dxil/kernel.rs:TRANSLATOR_VERSIONgoes from 12 to 13.crates/xcl/src/hle/d3d12x/console_heap.rs:mainalready gives a(0, 0)window and the slots up to 4 null views;set_window_viewsnow writes null raw UAVs up to all 16 slots. The completeness rule still follows the layout.crates/xcl/src/gpu/recomp/runner.rs: the test runner's heap (run_in_region) does the same.set_window_viewsmakes for 1, 8 and 16 windows.Second commit (from an independent review):
runner.rs(dispatch_with, the backend-hook pipelines ofgpu_compute_e2e): heap slots 0..3 stay views ofmem, as the root form's four windows, and the slots past them are null views, asrun_in_regionand the runtime.Third commit (found by the full suite on an earlier head):
gpu::uma::tests::expanded_heap_window_shaders_translate_and_validateasserted the old bound (the program's 8 windows); it now checks the 16-slot bound.8 files, +88 / −18 for the three commits. The translator identity changes (the HLSL text and the direct translator's version), so every shader is translated once more.
Tested
370e1c7onmain7a649b0(rebased 29/11, no conflict). RTX 3090 24 GB (Resizable BAR off), driver 616.56, Ryzen 9 5950X, 32 GB RAM, Windows 11 22631; Rust 1.100.0, release tests.XCL_ADAPTER=warp, so the GPU tests run on WARP or skip;XCL_REQUIRE_GPUunset; the tests that open the hardware adapter whateverXCL_ADAPTERsays left out with--skip):cargo test --release -p xcl --lib -- gpu::dxil::core_tests gpu::recomp::heap_window_tests gpu::uma::tests hle::d3d12x::console_heap::tests shaders::pipeline_library::tests shaders::warm_library::tests --test-threads=4: 79 passed, 7 failed, 1 ignored; 14 of the passes are GPU tests that skipped. The 7 failures are 6shaders::pipeline_library::testsandshaders::warm_library::tests::cold_publish_makes_an_unchanged_corpus_reusable:CreateComputePipelineStatereturns E_INVALIDARG on this machine's WARP, which has no SM 6.6 (the other 6 then fail on the poisoned lock or the same error). That is a local artefact of a WARP run here, not the CI failure (an entry count, 3 against 2). This PR's tests passed:heap_windows_select_every_heap_slot(HLSL and direct),expanded_heap_window_shaders_translate_and_validate, the 22console_heaptests run; its GPU tests (gpu_heap_windows_*) skipped ("no GPU").main7a649b0: the same 7 failures with the same errors, nothing else failed (408 passed, 7 failed, 19 ignored for the union of the filters of our five PRs).main7a649b0(no new one).03580be) was 4 tests outside it:shaders::pipeline_library::tests::{builder_deduplicates_names_and_atomically_replaces_output, graphics_pipeline_round_trips_through_serialized_library, mesh_pipeline_round_trips_through_serialized_library}andshaders::warm_library::tests::cold_publish_makes_an_unchanged_corpus_reusable.main's own CI failed the same 4 on227d2cb(run 46201186646); they passed onmainfa20459,d8bd9a3and7a649b0.main7a649b0's CI fails 8 other tests, all inhle::d3d12x::title_textures::tests(run 46261846646): a red Build and test on this head with those 8 ismain's.8956fb4onmaine429936.cargo test --workspace --no-fail-fast -- --test-threads=4(debug, same machine): 2128 passed, 9 failed, 48 ignored. The 9 are the 9 testsmaine429936itself failed on a GPU, the same names as in this report on an RTX 4080. The tests this PR adds or changes passed, among themgpu_heap_windows_reject_out_of_uma_aliasingandgpu_heap_windows_divergent_lanes_match_switch_form, which read window 4 of a 2-window arena through a null slot.8956fb4d:heap_windows_select_every_heap_slot, "2 passed; 0 failed"; JJAutoCompare, Ryzen 7 3800X, headba92a2a8: three CPU tests of this PR, 3 passed.Regression run
Not made on this head yet: the pair below is of
maine429936and the earlier head8956fb4, so the "PR description" check stays red until ascripts/smoke.ps1pair of this head is added. It stays a draft.Earlier pair: same machine, same title, 200 s, the same scripted A presses (
XCL_PRESS_A_AT),XCL_PREPARE=0, noXCL_*switch set (so the root-UAV form, not the heap windows), both throughmain'sscripts/smoke.ps1.main:
earlier head
8956fb4:main's, under CONTRIBUTING's 80 %. Presents per 25 s:main603 / 510 / 693 / 401 / 64 / 78 / 53 / 39, the head 376 / 616 / 543 / 68 / 67 / 81 / 45 / 54; in the world (100–200 s) the head presented 247 frames andmain235.main's own 200 s runs on this machine gave 1,723 (6089122), then 1,908, 2,442 and 1,744 frames (three runs ofe429936).main.Not tested
XCL_HEAP_WINDOWS=1(the regression pair runs the default, root-UAV form). The stacked #3097 ran one withXCL_HEAP_WINDOWS=1on an earlier head.Testing on other setups is welcome. So far this has only run on one RTX 3090 (Resizable BAR off). Results from AMD and Intel GPUs, other NVIDIA generations, or Resizable BAR on would help most. The suite plus a
scripts/smoke.ps1block, as a comment here, is enough.AI use
AI use: the port of the first commit onto
main(with the null views and the tests), the review fixes, the rebases, the test runs and this description were done with Claude Code (Claude Opus 5.5), checked by me.🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-28T06:13:47Z.
Tested
Clean
ba92a2a893f9a8ced71bb4a1060b59f2bca94571on Windows 11 x64 build 26200.9974, Ryzen 7 3800X, and Rust 1.100.1 MSVC debug. I reran the pinned stock libtest with<libtest.exe> --exact <test> --nocapturefor each of these CPU tests.gpu::recomp::heap_window_tests::heap_windows_select_every_heap_slotchecked the emitted HLSL 16-slot guards for 2, 4, 8, and 16 heap windows. The two-window root-UAV switch includedcase 1u: return mem1.and omitted bothcase 2u:andResourceDescriptorHeap[.gpu::dxil::core_tests::heap_windows_select_every_heap_slotchecked that the direct-DXIL bound helper returns 16 for 2, 3, 4, 8, and 16 unified windows.hle::d3d12x::console_heap::tests::window_views_do_not_hold_global_during_device_callschecked descriptor initialization with 15, 8, and 0 null views for 1, 8, and 16 windows. The mock device callbacks verified the global heap mutex was available.3 passed, 0 failed, 0 ignored, 0 runtime skips. Each process exited 0 with 2,030 tests filtered out.
Not tested
GPU workloads, full DXIL emission and validation, the benchmark, the base revision, the #3097 stack, retail titles, or the full suite.
AI use
T3 Code through the Codex harness (
gpt-6.2-sol) verified the stock executable, reran the tests and wrote this report.Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-28T08:26:19Z.
Ran the all-window-slot test at
8956fb4don an NVIDIA Blackwell desktop part:Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
Both matching tests pass, covering the 16-slot heap-window bound in the expanded layout. They are translation-level tests; I did not enable
XCL_HEAP_WINDOWS=1in a real session. The thread has one other test report but no 5070 Ti, so this adds a second Blackwell datapoint with driver 32.0.16.2124.Not tested: a real session with
XCL_HEAP_WINDOWS=1, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-28T08:57:39Z.
@Aniseto thanks for running the slot-bound tests on
8956fb4don a 5070 Ti; I added your result to the description under "Tested elsewhere", as the two translation-level tests it is. If you have the time, ascripts/smoke.ps1block from that card (this head and amaincommit, same title and length) would be the first one from another machine.AI use: Claude Code, model Claude Opus 5.5, read the thread and wrote this reply.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-28T20:14:53Z.
Second-machine smoke pair (RTX 3060 12 GB) for #3097's head
fe2d5b7c, which includes this PR, againstmainb937fbab: comment on #3097. 100.2 % ofmain's frames, 98.9 % of its peak commit, no device removal or crash;XCL_PREPARE=0, default heap windows (the 16-window setup was not exercised).AI use: Claude Code (Claude Opus 5.5) ran the smoke runs and wrote this note.
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-28T20:19:09Z.
High-slot execution on the new
mainintegration commit765b2c5bfff6754e8c9886a73e188a86aca3c64c: I ran a test-only RDNA2 compute fixture on RTX 5070, NVIDIA 616.92, using the production translator and nativerun_in_arenarunner. This tests the heap-window shader behavior discussed here on the integrated baseline; the separate #3097 title-view uploader is absent from this commit.One 64-lane dispatch spread loads, stores and atomic adds across 16 distinguishable windows. Each had 1 MiB of backing and a different input marker at each lane offset. Lane 63 instead used an out-of-range window whose low four bits match slot 15. Its load and returning atomic read zero and its store left every destination untouched.
This covers divergent shader access and real GPU readback, including slots 8–15. The runner supplied the descriptors; title discovery, sparse uploads, graphics stages and retail smoke were outside this fixture.
AI use: OpenAI Codex adapted the fixture, ran both translations, and prepared this report.
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-28T23:26:56Z.
Rebased on
main7db2f39(after #3203); head03580be. Tests (cargo test --release -p xcl --lib,XCL_REQUIRE_GPU=mesh, this PR's modules:heap_window_tests,console_heap,uma::tests,core_tests::heap_windows*): 51 passed, 0 failed. The compiler warnings are the same 18 asmain's.What changed in the rebase:
mainnow gives a(0, 0)window and the slots up to 4 null views itself.set_window_viewskeeps that and writes null views up to all 16 slots (MAX_HEAP_WINDOWS); the completeness rule still follows the layout. The old "aliases window 0" wording and test are gone.TRANSLATOR_VERSIONbump redone:mainis at 12, so 12 → 13 (our commit had 9 → 10).e429936head; the regression pair there is of8956fb4.For comparison,
main7db2f39itself, run with these filters and those of our other PRs, same setting, has 7 failures, all skips thatXCL_REQUIRE_GPU=meshturns into failures on this card: sixlower_dxil::tests::*_on_the_gpu("…, wave64: no wave64") andbind::tests::two_pass_binds_set_the_shared_view_heap("no heap windows").The branch merges with
main227d2cbwithout conflict (not tested there).Setup: RTX 3090 24 GB (Resizable BAR off), driver 616.56, Ryzen 9 5950X, 32 GB RAM, Windows 11 22631, Rust 1.100.0, release tests,
XCL_REQUIRE_GPU=mesh.AI use: Claude Code with Claude Opus 5.5 did the rebase, ran the tests and wrote this. The person running these tests asked for it.
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-29T00:25:41Z.
The red "Build and test" on
03580beis the same 4 tests as on #3230, outside this PR:shaders::pipeline_library::tests::{builder_deduplicates_names_and_atomically_replaces_output, graphics_pipeline_round_trips_through_serialized_library, mesh_pipeline_round_trips_through_serialized_library}andshaders::warm_library::tests::cold_publish_makes_an_unchanged_corpus_reusable. The first fails on an entry count (3 against 2) and the others on the lock it poisoned: the shared library-builder state that #3221 and #3183 address. The heap-window tests, and theTRANSLATOR_VERSIONbump to 13, did not fail. #3097, which carries this PR's three commits, passed the same job. We cannot rerun it from here.AI use: Claude Code with Claude Opus 5.5 read the CI log and wrote this.
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-29T13:57:33Z.
Rebased on
main7a649b0; head370e1c7(no conflict). Measured, CPU only (cargo test --release -p xcl --lib, this PR's modules + the library tests): 79 passed, 7 failed (14 of the passes are skipped GPU tests);heap_windows_select_every_heap_slot,expanded_heap_window_shaders_translate_and_validateand the 22console_heaptests run passed. The 7 failures are the 6shaders::pipeline_library::testsandwarm_library::tests::cold_publish_makes_an_unchanged_corpus_reusable, the same 7 with the same errors onmain7a649b0here: E_INVALIDARG fromCreateComputePipelineStateon this machine's WARP (no SM 6.6). Deduced: a local artefact of WARP here, not the CI failure mode. No GPU run on the card, no title run.Read, CI: the 4
pipeline_library/warm_libraryfailures of our previous CI runs weremain's own on227d2cb(run 46201186646) and passed onmainsincefa20459;main7a649b0now fails 8hle::d3d12x::title_textures::testsin CI (run 46261846646), so a red Build and test with those 8 ismain's. "PR description" stays red only for thexcl-smokepair of the new head, which needs a title run (not made: CPU only this time).Description refreshed (Tested, Regression run, AI use).
Stack: RTX 3090 24 GB (Resizable BAR off), driver 616.56, Ryzen 9 5950X, 32 GB RAM, Windows 11 22631; Rust 1.100.0, release tests,
XCL_ADAPTER=warp,XCL_REQUIRE_GPUunset.AI use: rebase, test runs and this comment done with Claude Code (Claude Opus 5.5), checked by me.
Pull request closed