Recompiler: flat heap reads outside the windows take the null view #3486
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3486"
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 KDenKC on 2026-11-30T01:21:30Z.
With
XCL_HEAP_FLAT=1(heap windows on), the direct DXIL translator reads a compute program's heap memory windows without a branch (2f523330). The access runs for every lane, and a lane outside the windows or under a false guard (a buffer index pastnum_records, a lane EXEC leaves out) had its value set to zero afterwards. But its access went to window 0's descriptor, at the address it was given. So it read window 0's memory at an address the program never reaches: the guarded form branches around that access, and the HLSL accessors (409cf071) send it to the null viewMEM_NULL_LOAD. Now the direct form selectsMEM_NULL_LOADfor it too, so it touches no window's memory.Stacked on #3349: the branch is
main1c8b5514+ #3349's commit unchanged (42bd1090, Kalmarv) + this PR's commit87c10e69; only the top commit belongs here.It needs #3349 for the null view to be a buffer: on main,
console_heap::shared_heaprunsfill_nullsafternull_window_viewsand writes a Texture2D null SRV overMEM_NULL_LOAD, which the HLSL accessors already select today. #3349 writes the raw-UAV null views afterfill_nulls. Kalmarv's #2428 (flat heap windows by default on NVIDIA) still has the window-0 select.Related: #2626 (a compute dispatch's GPU VA 0 fault on the first world frame), #2403, #2088.
What is in it (one commit,
87c10e69: the fixes and their tests)gpu/dxil/lower_mem.rswith_mem_i32s: the flat form selects descriptorMEM_NULL_LOADinstead of window 0 for an access outside the windows or under a false guard. Its callers only load (memory loads and the BVH node loads), so the null load view is the one.gpu/dxil/lower_mem.rsscalar_flat_read(the flats_buffer_loadpath from #3500) andgpu/dxil/lower_window.rshigh_one_slot(the carry case's slot for a high dword of one): an address outside the windows takesMEM_NULL_LOADtoo, not window 0 (bmjask's review). The scalar read's dwords stay masked as before.gpu/dxil/core_tests.rsraw_loads_in_root_windows_are_branchless: the flat form selects the null-load view, and a program of ones_buffer_loadalone does too (that part fails without thescalar_flat_readchange).gpu/dxil/module/opt.rsthe_flat_read_carry_rewrite_keeps_the_null_select: the optimizer'sFlatReadcarry rewrite turns the read's bounds test and slot into carry selects and leaves its null select in place (Foniass's review).main1c8b5514, stacked on #3349. Before that, onmaind52ff48c: #3500 (b5973e3e) touched the same lines but did not change this: its flat read still selects window 0 (sel(ok, w, 0)) for an access outside the windows. ItsFlatReadrecord keeps pointing at the descriptor-index add, which its carry rewrite changes; the null select is after that add, andokisinside(also rewritten), so the carry form keeps the null view too.Tested
87c10e69(main1c8b5514+ #3349's commit + this commit):cargo test --workspace --no-fail-fast -- --test-threads=4: 2903 passed, 5 failed, 51 ignored. The 5 fail onmain1c8b5514too:title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, the 3stream_recheck_*tests, and e2etest_title_runs_and_game_folder_is_untouched. SKIPPED: 28 (22 no wave64, 2 no heap windows, 3 no debug layer, 1 driver cache cannot be disabled). The run leaves out the 3uma_drivertests, as every run on this VM.scalar_flat_readchange (the test commit alone onmain1c8b5514):scalar flat heap reads must select the null-load view (descriptor 20),test result: FAILED. 0 passed; 1 failed; green with it:test result: ok. 1 passed; 0 failed.-- the_flat_read_carry_rewrite_keeps_the_null_select: 1 passed, 0 failed.2d3e3fe1(maind52ff48c+ the first fix), same machine:d52ff48c+ the test only):cargo test -p xcl --lib -- raw_loads_in_root_windows_are_branchless --nocapture --test-threads=1:2d3e3fe1, the same command:cargo test --workspace --no-fail-fast -- --test-threads=4(leaving out the 3uma_drivertests that need a GPU upload segment this VM has not): 2868 passed, 6 failed, 51 ignored. SKIPPED: 28 (22 no wave64, 2 no heap windows, 3 no debug layer, 1 driver cache cannot be disabled). The 6 failures:gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16,title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, the 3stream_recheck_*tests, andtest_title_runs_and_game_folder_is_untouched.d52ff48con the same machine fails the same tests:gpu_direct_image_get_resinfo_d16, the 3stream_recheck_*andtest_title_runs_and_game_folder_is_untouched. Its parallel run lost the lib binary, so its lib tests come from a one-thread rerun that left out all ofuma_driver::tests(2721 passed, 5 failed, 31 ignored); its counts are not comparable to the line above, the failing names are.XCL_HEAP_FLAT=1with heap windows, the debug layer and DRED on,XCL_PREPARE=0, 200 s. The change is in our integration build of open PRs (93d11d74: the same commit on top of it); the build under it alone (1b108007) is the "before":1b108007), the device is removed on the first world frame:93d11d74), the frame is drawn and the run ends at its timer: The debug layer's other errors in that run: ids 1422, 527, 538 and 1047, 8 each (uninitialized placed targets, barrier states and the sparse queue race, seen before this change too); none of them a device removal.Regression run
RTX 5090, 600 s each, JIT (
XCL_PREPARE=0), seeded profile and held Enter. The main block is reused from the earlier gate-batch-t pair and was validated against the full main SHA and network line. Heap windows were on, butXCL_HEAP_FLATwas unset, so this smoke checks the default path rather than the opt-in path changed here. Head frames are 114% of main and peak commit is 102.2% of main; both are within the smoke limits.main
1c8b5514(reused block):#3486 head
87c10e69:Not tested
main+ this commit alone; the title's first world frame is the only place it was seen.XCL_HEAP_FLAT=1at this head.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:11:22Z.
merge-check
base:
7d86c5d2b7head:
2d3e3fe111merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2896 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (lower_mem.rs +6/-2, core_tests.rs +3). Nothing changes by default (
XCL_HEAP_FLATis opt-in) and there's no added cost (the select moves after the add). A lane outside the windows, or under a false guard, now reads descriptorMEM_NULL_LOADinstead of window 0's view at its own address; values are still zeroed (sel(ok, v, z), ~431) and every caller only loads. Findings: (1) on main, descriptor 20 isn't a raw UAV yet:shared_heapwrites it innull_window_views(console_heap.rs~503), thenfill_nulls(~511) replaces it with a null Texture2D SRV, andset_window_viewsonly rewrites 4..19. Until #3349 is merged, these lanes access a descriptor of the wrong type (undefined; the HLSL accessors already do this today). The PR says it needs #3349 but isn't stacked on it, so it should merge after #3349. (2) The new assertion (core_tests.rs ~1463) only checks that someselect ... i32 20exists; the carry-rewrite form (opt.rs~1424-1441) is argued, not tested. No smoke run: flat reads are off by default. Fine: in the carry caseokis the rewritteninsideandslotis the add it replaces, so the null select still applies, and the test failed before the fix.performance: no smoke run (the default path doesn't reach this change); not measured.
verdict: safe to merge after #3349 (on its own, the lanes it redirects read a descriptor that isn't a raw UAV yet; that's undefined, but it is opt-in and no worse than the HLSL accessors today)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-12-01T09:20:53Z.
Ran the named
raw_loads_in_root_windows_are_branchlesstest at2d3e3fe1on an NVIDIA Blackwell desktop part with 16 GB of VRAM.Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), 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,
XCL_ADAPTER=NVIDIA, detached worktree at the exact PR head, no local patches.The new test passes at this head; the author's red run without the fix is not repeated here. This adapter is NVIDIA, where the flat heap windows are relevant.
Not tested: the full workspace suite, a GPU run showing the original fault, a title run,
XCL_HEAP_FLAT=1in the world, the dependency on #3349, AMD adapters, Wine, wave64 hosts, release profile, game data.AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the test, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:03:35Z.
Triage (#1607) – head
2d3e3feNo open or merged PR makes the same change. Main (after #3500) still has
sel(ok, w, 0)inwith_mem_i32s, and #2428 keeps the window-0 select.The null select comes after the descriptor-index add that
FlatReadrecords, so the optimizer's carry rewrite oftest/slotstill feedssel(ok, slot, MEM_NULL_LOAD). That looks right.This depends on #3349 (open): until then main's
shared_heapwrites a Texture2D null SRV overMEM_NULL_LOAD, and this path would bind that descriptor as a raw buffer UAV. It should merge after #3349, or say so at the top of the description.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T10:40:15Z.
merge-check claim
head:
2d3e3fe111Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T10:46:17Z.
merge-check claim
head:
2d3e3fe111Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T10:59:20Z.
merge-check
base:
493dbd3dd0head:
2d3e3fe111merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2899 passed, 1 failed, 51 ignored; 29 SKIPPED lines
failing: test_title_runs_and_game_folder_is_untouched
review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review.
performance: not assessed beyond the suite.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:48:14Z.
Code review location:
crates/xcl/src/gpu/dxil/lower_mem.rs; line 426Flat reads now index MEM_NULL_LOAD (descriptor 20) as a RWByteAddressBuffer, but on main that slot holds a Texture2D null SRV.
console_heap::shared_heaprunsnull_window_views(line 503) beforefill_nulls(MEM_HEAP_BASE..cap)(line 511), which copies an even-index Texture2D SRV over slot 20. That ordering is fixed in #3349, which is still open, and this branch isn't stacked on it. If this merges first, with XCL_HEAP_FLAT=1 and heap windows on, any lane with VAR_WIN >= mems.len() or a false EXEC/num_records guard creates a raw-buffer UAV handle from a Texture2D SRV descriptor. That descriptor-type mismatch is undefined: garbage reads, a GBV error, or device removal. The regression run at2d3e3fe1had XCL_HEAP_FLAT unset, so this path wasn't exercised. Stacking on #3349, or including its 3-line reorder here, would make it safe to merge alone.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:48:14Z.
Review: COMMENTED
Review of
2d3e3fe1: 2 finding(s). 1 are inline. These are on lines outside the diff:crates/xcl/src/gpu/dxil/lower_mem.rs:1191:scalar_flat_read, the flat s_buffer_load path from #3500, still computesslot = sel(valid, w, 0) + MEM_HEAP_BASE, so an out-of-window access still reads window 0's descriptor, the root cause this PR fixes inwith_mem_i32s. Under XCL_HEAP_FLAT=1, an s_buffer_load whose V# high word is outside the windows still runs rawBufferLoad on window 0 (only masked afterwards by lim = 0).raw_loads_in_root_windows_are_branchlessincludes S_BUFFER_LOAD_DWORDX4 and still passes because it only checks that some select uses, i32 20.high_one_slot(lower_window.rs:170) has the same window-0 fallback, so a sharedheap_load_slot(ok, w)returningsel(ok, w + MEM_HEAP_BASE, MEM_NULL_LOAD)used at all three sites would fix them together.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T09:59:28Z.
Follow-up review (head
df2d4d0f, since2d3e3fe, diff read, not a merge-check; checks red):MEM_NULL_LOADis not a raw UAV onmainuntil #3349 lands: partly fixed. The description and commit now say it depends on #3349, but #3349 is still open and this PR is not stacked on it; it builds onmainalone, whereshared_heapstill writes the null window views first (console_heap.rs~503) andfill_nulls(~511) then puts a Texture2D null SRV overMEM_NULL_LOAD. Merged first, the redirected lanes (now including the scalar path,lower_mem.rs~1193-1197) would bind that descriptor as a raw buffer UAV withXCL_HEAP_FLAT=1, so it has to merge after #3349.FlatReadcarry rewrite is argued, not tested: still open; the new block (core_tests.rs~1535-1549) coversscalar_flat_read, and nothing checks the rewrite inopt.rs~1424-1441 next to the null select.New:
xcl-smokeblock names2d3e3fe1, not the headdf2d4d0f(the reasonPR descriptionis red).df2d4d0falso changesscalar_flat_read(lower_mem.rs~1191-1198) and adds a scalar test, but What is in it lists onlywith_mem_i32sand every Tested result is at2d3e3fe1, before it.Fine: the null select comes after the descriptor-index add, so after the carry rewrite a lane with no valid window still gets
MEM_NULL_LOADand the window-0 fallback inhigh_one_slotcan no longer be reached; values are still masked; opt-in (XCL_HEAP_FLAT); the scalar test reachesscalar_flat_read.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Pipodi on 2026-12-02T10:27:56Z.
merge-check
base:
1c8b551475head:
df2d4d0f1amerge: clean (merge commit d5e88baec8118dc557a45f3145ca87b438075968)
build: cargo build --workspace -> ok (and cargo build --release -p xcl -> ok)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2909 passed, 0 failed, 51 ignored; failing: none. 25 SKIPPED lines (22 no wave64, 2 no heap windows, 1 cannot disable the driver cache).
raw_loads_in_root_windows_are_branchlessruns and passes; with the base'slower_mem.rsit fails at core_tests.rs:1503 (vector flat read), and with only thescalar_flat_readhunk reverted it fails at core_tests.rs:1549 (scalar flat read), so both new assertions catch their half of the change.review:
MEM_NULL_LOAD(descriptor 20) is not a raw buffer UAV.console_heap::shared_heapwritesnull_window_views(console_heap.rs:503) and thenfill_nulls(MEM_HEAP_BASE..cap)(:511) copies the null block over it; 20 is even, so it ends up a Texture2D null SRV (null_views_in, :555-562). WithXCL_HEAP_FLAT=1, every lane outside the windows or under a false guard now binds that descriptor as a raw UAV, where before it read window 0 at a bounds-checked address and the value was masked to 0 anyway. The description says it depends on #3349 (still open), but the PR is not stacked on it and merges into main alone. It has to land after #3349.with_mem_i32scallers: buffer loads in lower_mem.rs:337, image/BVH loads in lower_image.rs:176/285); stores and atomics keep the guardedwith_mem_many_tysform. The null select sits after the descriptor-index add, soopt.rs1424-1441 can rewritetest/slotfor the high-dword carry and a lane with no valid window still getsMEM_NULL_LOAD;okisinsidethere (the carry case requires no guard).high_one_slot's window-0 fallback is no longer reachable. Values stay masked to 0.select ... i32 20exists in the disassembly, not that the carry-rewritten form (FlatRead) keeps it.with_mem_i32sand has test results and a smoke block from2d3e3fe1, not from this head (PR descriptioncheck is red).performance: XCL_HEAP_FLAT is off by default, so the default path is unchanged. The flat path gains one select per read. Smoke pair on the retail title, 60 s, same scripted presses on both sides, one untimed warm-up run before each: main 1611 frames, peak commit 19846 MB; merge 1600 frames (99.3 %), 20310 MB (102.3 %); 0 device removals and 0 crashes on both. The smoke runs do not set XCL_HEAP_FLAT, so they do not reach the changed code.
main (base):
this PR merged into base:
verdict: not yet: merge after #3349 (on main today
MEM_NULL_LOADis a Texture2D null SRV, so the flat path would bind it as a raw UAV); rebase or stack on it and the rest holdshardware / tool and model: NVIDIA GeForce RTX 4090 24 GB, driver 621.40; Intel Core i9-13900K, 32 GB; Windows 11 build 26300; rustc 1.100.0; debug suite, release smoke. Claude Code, Claude Opus 5.5 (ran the merge, build, suite, revert test and smoke pair, and wrote this check).
Imported from ivall/xcl. Originally posted by KDenKC on 2026-12-02T10:29:05Z.
@Pipodi thanks for picking this up; a heads-up so your merge-check isn't wasted: a new head is coming shortly. It adds bmjask's last point (
high_one_slotalso takes the null view), a test for the FlatRead carry rewrite that Foniass asked for, and it will be stacked on #3349 (which provides the raw-UAV null view this PR relies on). I'll post here the moment it's pushed.AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.
Imported from ivall/xcl. Originally posted by KDenKC on 2026-12-02T10:52:06Z.
@Pipodi the new head is pushed:
87c10e69, stacked on #3349 (main1c8b5514+ #3349's commit unchanged + this PR's one commit). Sincedf2d4d0f:high_one_slotalso takes the null view, and a test for the FlatRead carry rewrite (the_flat_read_carry_rewrite_keeps_the_null_select). Whole suite at87c10e69on an RTX 3090: 2903 passed, 5 failed (the same 5 asmain), 51 ignored, 28 SKIPPED. The description and a new smoke pair follow.AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T10:54:12Z.
Follow-up review (head
87c10e69, sincedf2d4d0f, diff read, not a merge-check; checks red):MEM_NULL_LOADis not a raw UAV onmainuntil #3349 lands: fixed in the branch; it now carries #3349's commit (42bd1090, the same patch as5dc64ea7), so it is stacked on #3349 and no longer sends lanes to a Texture2D null SRV whichever order they merge in. AStacked on #3349line at the top would make that explicit.FlatReadcarry rewrite is argued, not tested: fixed;the_flat_read_carry_rewrite_keeps_the_null_select(module/opt.rs~1983) checks that the null select stays on top of the rewritten slot.2d3e3fe1, not87c10e69.with_mem_i32s; it does not mention the scalarscalar_flat_readchange, the newlower_window.rschange (~166-171: the window choice for a lane outside the windows now selectsMEM_NULL_LOADinstead of window 0) or the carried #3349 commit, and every Tested result is from2d3e3fe1.New: none.
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by KDenKC on 2026-12-02T11:18:10Z.
@Pipodi @Foniass New head
87c10e69(stacked on #3349) has its regression pair: 600 s smoke on an RTX 5090,main1c8b55141724 frames, 0 removals, 47581 MB peak commit;87c10e691962 frames, 0 removals, 48639 MB. Both blocks are in the description's Regression run, and the whole suite at87c10e69on an RTX 3090 is 2903 passed, 5 failed (the same 5 asmain), 51 ignored.AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.
Imported from ivall/xcl. Originally posted by Pipodi on 2026-12-02T11:23:29Z.
merge-check
base:
1c8b551475head:
87c10e6924merge: clean (merge commit be998edb2b43389df9d7c753461e62c7fa913dd1). The PR is stacked on #3349 (still open), so this merge brings #3349's commit too:
42bd1090here has the samegit patch-id --stableas #3349's head5dc64ea7. Merging #3349 first and then this PR is also clean and gives the identical tree (0-line diff against be998edb).build: cargo build --workspace -> ok (and cargo build --release -p xcl -> ok)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2908 passed, 3 failed, 51 ignored; failing:
title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels(title_textures.rs:6368, "superseded unaligned extra_pages must be reclaimed immediately"), andstream_recheck_partial_upload_without_an_entry_queues_a_whole_uploadandstream_recheck_schedule_catches_late_writes_and_resets_milestones(PoisonError after the first one). They are flaky and fail on the base too:cargo test -p xcl --lib title_textures, run 3 times on each side: the merge passed 3/3 (65 passed); the base1c8b5514failed run 1 (the sameplaced_...andstream_recheck_schedule_...) and passed runs 2 and 3. This PR touches none of that code. 25 SKIPPED lines (22 no wave64, 2 no heap windows, 1 cannot disable the driver cache).raw_loads_in_root_windows_are_branchless,the_flat_read_carry_rewrite_keeps_the_null_selectand #3349'sshared_heap_preserves_null_window_raw_uavsrun and pass.Reverting fixes, with the tests kept: base
lower_mem.rs->raw_loads_...fails at core_tests.rs:1503 (vector flat read); only thescalar_flat_readhunk reverted -> fails at :1549 (scalar flat read). Both earlier results hold. The newthe_flat_read_carry_rewrite_keeps_the_null_selectstill passes with the baselower_mem.rsandlower_window.rstogether (no recompiler change at all): it builds its IR by hand and checks the unchangedopt.rsrewrite, so it locks that behaviour in rather than failing without this PR. Reverting only thelower_window.rshunk (high_one_slot) passes every test.review:
df2d4d0fis resolved: the merge result now has #3349's fix, soMEM_NULL_LOADis a raw buffer UAV when the flat path binds it. Whoever merges should either merge #3349 first (then this PR adds only its own commit, seemerge:) or close #3349 as included here; both give the same tree.df2d4d0f:high_one_slot(lower_window.rs) falls back toMEM_NULL_LOADinstead of window 0. This is correct but no test catches it, and on the flat-read path it cannot be reached. Its only user is theFlatReadcarry rewrite: the slot becomescarry ? slot1 : window 0and the read's testcarry ? valid1 : true, and the null select on top already picksMEM_NULL_LOADwhenevervalid1is false. That makes it consistency only, which is how the commit message presents it.tests:. The new carry test is a guard on the optimizer and does not fail without the change. The vector and scalar assertions inraw_loads_...are the ones that fail without it.df2d4d0fand still holds: only loads take the flat path, stores and atomics keep the guarded form, and values stay masked to 0. I read the whole diff (lower_mem.rs, lower_window.rs, core_tests.rs, module/opt.rs, and #3349's console_heap.rs change and test).performance: no cost by default: XCL_HEAP_FLAT (and XCL_HEAP_WINDOWS) are off, so the default path is unchanged. The flat path gains one select per read. Smoke pair on the retail title, 60 s, same scripted presses on both sides, one untimed warm-up run before each: main 1611 frames, peak commit 19846 MB; merge 1598 frames (99.2 %), 19965 MB (100.6 %); 0 device removals and 0 crashes on both. Those runs do not reach the changed code.
Extra, not a regression pair: one more run of the merge with XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1 (same 60 s and presses, warm-up first). The log confirms heap windows were on ("memory windows from the shared descriptor heap"); XCL_HEAP_FLAT came from the same environment but the log does not print it. It showed 1347 frames, peak commit 21980 MB, 0 device removals, 0 crashes. It is not comparable to the default runs: a different shader key set.
main (base):
this PR merged into base:
extra, this PR merged into base with XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1:
verdict: safe to merge (it lands #3349's commit too: merge #3349 first or close it as included)
hardware / tool and model: NVIDIA GeForce RTX 4090 24 GB, driver 621.40; Intel Core i9-13900K, 32 GB; Windows 11 build 26300; rustc 1.100.0; debug suite, release smoke. Claude Code, Claude Opus 5.5 (ran the merge, build, suite, reruns, revert tests and smoke runs, and wrote this check).
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:12:49Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.