D3D12.X: fix HEAP_UMA lifetime issue for placed buffers (XCL-BT-001) #2076

Open
saurabhbhoir456 wants to merge 4 commits from upstream-pr/2086 into main
saurabhbhoir456 commented 2026-11-25 03:34:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saurabhbhoir456 on 2026-11-25T03:34:50Z.


What changes and why

Fix XCL-BT-001: HEAP_UMA lifetime issue for placed buffers.

When a HEAP_UMA heap was released (refcount reached 0), its backing memory block was freed immediately even if placed buffers still referenced it. This caused memory corruption when the title's last Release of a buffer raced with the heap's Release.

The fix tracks live_buffers per HEAP_UMA heap:

  • Increment live_buffers when a buffer is placed in a HEAP_UMA heap (2 insertion sites pass a non-zero heap: place_console_buffer and place_at_title_address for heap-allocated buffers)
  • In res_release: decrement live_buffers; if it reaches 0 and the heap was already released (block is Some), free the block
  • In mem_heap_release: if live_buffers == 0, free block immediately and remove entry; otherwise keep the entry and its block so the last buffer's Release can free it

This defers the block free until all buffers in the heap are released.

Commits:

  1. D3D12.X: fix HEAP_UMA lifetime issue for placed buffers (XCL-BT-001) (crates/xcl/src/hle/d3d12x/real.rs)

    • Added live_buffers: usize field to HeapUma struct
    • Changed UmaBuffer type from (usize, usize, bool) to (usize, usize, bool, usize) to store the heap reference
    • Updated the 2 HEAP_UMA insertion sites to increment live_buffers
    • Modified res_release to decrement live_buffers and defer block free
    • Modified mem_heap_release to defer block free when buffers are still alive
  2. D3D12.X: keep HEAP_UMA block until all placed buffers are released (crates/xcl/src/hle/d3d12x/real.rs)

    • Fix: mem_heap_release no longer discards e.block when buffers are still alive, so res_release can free the block once live_buffers reaches zero

What is in it

  • D3D12.X: fix HEAP_UMA lifetime issue for placed buffers (XCL-BT-001) (crates/xcl/src/hle/d3d12x/real.rs)
  • D3D12.X: keep HEAP_UMA block until all placed buffers are released (crates/xcl/src/hle/d3d12x/real.rs)

Tested

  • Hardware: AMD Radeon RX 7900 XTX (RDNA3), Windows 11 26300, Rust 1.83.0 (stable-x86_64-pc-windows-msvc), debug profile
  • Commands: cargo build --workspace; cargo test --workspace -- --test-threads=4
  • Results: 1153 passed, 0 failed, 46 ignored
  • SKIPPED GPU tests: ~160 (no wave64/wave32/mesh shaders on this adapter)

Regression run

  • Not run (requires retail title). Will run scripts/smoke.ps1 -Game <folder> on main and this branch head and paste both xcl-smoke blocks when a title is available.

Not tested

  • Retail title (no game available for smoke test)
  • NVIDIA / Intel GPUs
  • Wave32-only GPU configurations
  • Console GDK validation

AI use

  • Claude Code, Claude Opus 5.5: implemented the HEAP_UMA lifetime fix, fixed a block-pointer leak in mem_heap_release; wrote PR description

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5484655212 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2086). Originally posted by [saurabhbhoir456](https://github.com/saurabhbhoir456) on 2026-11-25T03:34:50Z. --- **What changes and why** Fix XCL-BT-001: HEAP_UMA lifetime issue for placed buffers. When a HEAP_UMA heap was released (refcount reached 0), its backing memory block was freed immediately even if placed buffers still referenced it. This caused memory corruption when the title's last `Release` of a buffer raced with the heap's `Release`. The fix tracks `live_buffers` per HEAP_UMA heap: - Increment `live_buffers` when a buffer is placed in a HEAP_UMA heap (2 insertion sites pass a non-zero heap: `place_console_buffer` and `place_at_title_address` for heap-allocated buffers) - In `res_release`: decrement `live_buffers`; if it reaches 0 and the heap was already released (block is `Some`), free the block - In `mem_heap_release`: if `live_buffers == 0`, free block immediately and remove entry; otherwise keep the entry and its block so the last buffer's `Release` can free it This defers the block free until all buffers in the heap are released. Commits: 1. `D3D12.X: fix HEAP_UMA lifetime issue for placed buffers (XCL-BT-001)` (`crates/xcl/src/hle/d3d12x/real.rs`) - Added `live_buffers: usize` field to `HeapUma` struct - Changed `UmaBuffer` type from `(usize, usize, bool)` to `(usize, usize, bool, usize)` to store the heap reference - Updated the 2 HEAP_UMA insertion sites to increment `live_buffers` - Modified `res_release` to decrement `live_buffers` and defer block free - Modified `mem_heap_release` to defer block free when buffers are still alive 2. `D3D12.X: keep HEAP_UMA block until all placed buffers are released` (`crates/xcl/src/hle/d3d12x/real.rs`) - Fix: `mem_heap_release` no longer discards `e.block` when buffers are still alive, so `res_release` can free the block once `live_buffers` reaches zero **What is in it** - `D3D12.X: fix HEAP_UMA lifetime issue for placed buffers (XCL-BT-001)` (`crates/xcl/src/hle/d3d12x/real.rs`) - `D3D12.X: keep HEAP_UMA block until all placed buffers are released` (`crates/xcl/src/hle/d3d12x/real.rs`) **Tested** - Hardware: AMD Radeon RX 7900 XTX (RDNA3), Windows 11 26300, Rust 1.83.0 (stable-x86_64-pc-windows-msvc), debug profile - Commands: `cargo build --workspace; cargo test --workspace -- --test-threads=4` - Results: 1153 passed, 0 failed, 46 ignored - SKIPPED GPU tests: ~160 (no wave64/wave32/mesh shaders on this adapter) **Regression run** - Not run (requires retail title). Will run `scripts/smoke.ps1 -Game <folder>` on main and this branch head and paste both xcl-smoke blocks when a title is available. **Not tested** - Retail title (no game available for smoke test) - NVIDIA / Intel GPUs - Wave32-only GPU configurations - Console GDK validation **AI use** - Claude Code, Claude Opus 5.5: implemented the HEAP_UMA lifetime fix, fixed a block-pointer leak in mem_heap_release; wrote PR description 🤖 Generated with [Claude Code](https://claude.com/claude-code)
frenziedcoder commented 2026-11-25 05:08:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by frenziedcoder on 2026-11-25T04:23:57Z.


NVIDIA test report for 697caca: no new test failures (the 4 that fail also fail on cbc296a), no own test to run, and a clean smoke pair on the retail title (1605 vs 1655 frames).

Tested

  • NVIDIA GeForce RTX 5080 16 GB (driver 617.14, 32-lane waves), AMD Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head 697cacae7a8ad7e6897dc4d7d7c8a9f00e836014, no local changes.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4 (debug): 1150 passed, 4 failed, 46 ignored; the PR adds no test of its own. SKIPPED: gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu (no wave64), gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu (no wave64), gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu (no wave64), gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu (no wave64), gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu (no wave64), gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu (const_mask, wave64: no wave64), gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu (f16 arithmetic, wave64: no wave64), gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu (f16 packed, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 arithmetic, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 compares, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 conversions, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 rounding, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 three-source, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 transcendentals, wave64: no wave64), gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu (f64, wave64: no wave64), gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu (integer arithmetic, wave64: no wave64), gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu (integer carries, wave64: no wave64), gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (mask_ff0_flbit, wave64: no wave64), gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • The 4 failures are fuzz_validate_and_gpu_0, fuzz_validate_and_gpu_1, fuzz_validate_and_gpu_2, fuzz_validate_and_gpu_3 in gpu::dxil::fuzz_tests. They fail the same way on the base cbc296a here (0x8007000E from CreateComputePipelineState on seeds 70, 545, 1019 and 1507, the NVIDIA refusal @PHeitor1 reported on #1679), so this PR adds no failure.
  • test_title_draws_with_a_root_signature_under_the_debug_layer reports ok, but this machine has no D3D12 debug layer (debug layer requested but unavailable … (0x887A002D)), so it ran without the layer and is no evidence either way.

Regression run (scripts/smoke.ps1 -Seconds 60, release, the retail title of #505 at its start screen; XCL_PSO_PRELOAD=0 for both builds, because this machine's preload list holds the program of #1307)

base (cbc296a, this PR's merge base with main):

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: NVIDIA GeForce RTX 5080
title: 16b5e5d4
seconds: 60
exit: 0x0
frames shown: 1655 (PresentX 1656)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14410 MB

this PR:

xcl-smoke v1
commit: 697cacae7a8ad7e6897dc4d7d7c8a9f00e836014
gpu: NVIDIA GeForce RTX 5080
title: 16b5e5d4
seconds: 60
exit: 0x0
frames shown: 1605 (PresentX 1605)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14403 MB

Not tested: the world load (the smoke runs stop at the start screen, so code that only runs later is not exercised there); AMD.

AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it.

<!-- greyfinch-sync:ivall/xcl:comment:7152806500 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7152806500). Originally posted by [frenziedcoder](https://github.com/frenziedcoder) on 2026-11-25T04:23:57Z. --- **NVIDIA test report for `697caca`: no new test failures (the 4 that fail also fail on `cbc296a`), no own test to run, and a clean smoke pair on the retail title (1605 vs 1655 frames).** **Tested** - NVIDIA GeForce RTX 5080 16 GB (driver 617.14, 32-lane waves), AMD Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 `stable-x86_64-pc-windows-msvc`, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head `697cacae7a8ad7e6897dc4d7d7c8a9f00e836014`, no local changes. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4` (debug): **1150 passed, 4 failed, 46 ignored**; the PR adds no test of its own. SKIPPED: `gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu` (no wave64), `gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu` (no wave64), `gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu` (no wave64), `gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu` (no wave64), `gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu` (no wave64), `gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu` (const_mask, wave64: no wave64), `gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu` (f16 arithmetic, wave64: no wave64), `gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu` (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu` (f16 packed, wave64: no wave64), `gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu` (f32 arithmetic, wave64: no wave64), `gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu` (f32 compares, wave64: no wave64), `gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu` (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu` (f32 conversions, wave64: no wave64), `gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu` (f32 rounding, wave64: no wave64), `gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu` (f32 three-source, wave64: no wave64), `gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu` (f32 transcendentals, wave64: no wave64), `gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu` (f64, wave64: no wave64), `gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu` (integer arithmetic, wave64: no wave64), `gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu` (integer carries, wave64: no wave64), `gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu` (mask_ff0_flbit, wave64: no wave64), `gpu_geometry_wave32_prefix_count_over_a_mask` (no wave64), `gpu_wave32_program_in_wave64_hardware` (no wave64), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - The 4 failures are `fuzz_validate_and_gpu_0`, `fuzz_validate_and_gpu_1`, `fuzz_validate_and_gpu_2`, `fuzz_validate_and_gpu_3` in `gpu::dxil::fuzz_tests`. They fail the same way on the base `cbc296a` here (`0x8007000E` from `CreateComputePipelineState` on seeds 70, 545, 1019 and 1507, the NVIDIA refusal @PHeitor1 reported on #1679), so this PR adds no failure. - `test_title_draws_with_a_root_signature_under_the_debug_layer` reports ok, but this machine has no D3D12 debug layer (`debug layer requested but unavailable … (0x887A002D)`), so it ran without the layer and is no evidence either way. **Regression run** (`scripts/smoke.ps1 -Seconds 60`, release, the retail title of #505 at its start screen; `XCL_PSO_PRELOAD=0` for both builds, because this machine's preload list holds the program of #1307) base (`cbc296a`, this PR's merge base with `main`): ``` xcl-smoke v1 commit: cbc296ab65a2661a61e3e2da109134bcd5319f60 gpu: NVIDIA GeForce RTX 5080 title: 16b5e5d4 seconds: 60 exit: 0x0 frames shown: 1655 (PresentX 1656) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14410 MB ``` this PR: ``` xcl-smoke v1 commit: 697cacae7a8ad7e6897dc4d7d7c8a9f00e836014 gpu: NVIDIA GeForce RTX 5080 title: 16b5e5d4 seconds: 60 exit: 0x0 frames shown: 1605 (PresentX 1605) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14403 MB ``` **Not tested:** the world load (the smoke runs stop at the start screen, so code that only runs later is not exercised there); AMD. *AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it.*
JoaoPauluu commented 2026-11-25 06:05:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-25T05:22:19Z.


A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with main (1365 here; 1371 and 1356 on the two main runs). Nothing in the log points to the placed-buffer HEAP_UMA path, so I cannot tell whether this run reached it; this is a regression run only.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. 697caca as it is (based on cbc296a) and main f5c5bdf, no uncommitted changes. Retail title 1.0.2.1, scripts/linux/smoke.sh (#257) for 60 s, no input. Runs in order: main, this PR (with other PRs in between), main.

Regression run

main (first run):

xcl-smoke v1
commit: f5c5bdf0e91035f8f1404f46f4f2f7aedc259e7f
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1371 (PresentX 1371)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: 697cacae7a8ad7e6897dc4d7d7c8a9f00e836014
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1365 (PresentX 1365)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The second main run: 1356 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the test suite on this head, a scene known to reach the placed-buffer lifetime case, native Windows.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
<!-- greyfinch-sync:ivall/xcl:comment:7153706251 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7153706251). Originally posted by [JoaoPauluu](https://github.com/JoaoPauluu) on 2026-11-25T05:22:19Z. --- A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with `main` (1365 here; 1371 and 1356 on the two `main` runs). Nothing in the log points to the placed-buffer `HEAP_UMA` path, so I cannot tell whether this run reached it; this is a regression run only. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `697caca` as it is (based on `cbc296a`) and `main` `f5c5bdf`, no uncommitted changes. Retail title 1.0.2.1, `scripts/linux/smoke.sh` (#257) for 60 s, no input. Runs in order: main, this PR (with other PRs in between), main. **Regression run** main (first run): ``` xcl-smoke v1 commit: f5c5bdf0e91035f8f1404f46f4f2f7aedc259e7f gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1371 (PresentX 1371) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` this PR: ``` xcl-smoke v1 commit: 697cacae7a8ad7e6897dc4d7d7c8a9f00e836014 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1365 (PresentX 1365) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` The second `main` run: 1356 frames, `exit: 0x0`, no device removal, no crash. Under Wine, `peak commit` reads 0 MB, so these blocks do not check memory. **Not tested** - the test suite on this head, a scene known to reach the placed-buffer lifetime case, native Windows. **AI use** - Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
DavidM1911 commented 2026-11-25 06:05:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T05:26:59Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7153785281 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7153785281). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T05:26:59Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Toons29 commented 2026-11-25 10:10:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T09:38:19Z.


Regression run of e11ce9b7 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 568e7db7, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1566 (PresentX 1566)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14592 MB
xcl-smoke v1
commit: e11ce9b7aa75766eea747d8f6d5ebfdd65dff92a
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1638 (PresentX 1639)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14622 MB

Against the limits in CONTRIBUTING.md: 105 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.

<!-- greyfinch-sync:ivall/xcl:comment:7158600829 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7158600829). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-25T09:38:19Z. --- Regression run of `e11ce9b7` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `568e7db7`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1566 (PresentX 1566) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14592 MB ``` ``` xcl-smoke v1 commit: e11ce9b7aa75766eea747d8f6d5ebfdd65dff92a gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1638 (PresentX 1639) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14622 MB ``` Against the limits in CONTRIBUTING.md: 105 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; a script posted this right after the run, with both blocks exactly as printed.
raylitebull commented 2026-11-25 11:09:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T10:48:58Z.


Code review on e11ce9b:

  • Scope mismatch / duplicate changes: This diff bundles unrelated edits in runner.rs (already landed via #2022) and dstorage.rs / dstorage/parallel.rs (overlapping #2094 / #2159).
  • Bug in HEAP_UMA block lifetime (
    eal.rs):
    res_release frees e.block as soon as e.live_buffers == 0 without checking whether the heap itself was released (mem_heap_release hit
    == 0)
    . If a title keeps a HEAP_UMA heap alive, places and releases a first buffer, and later places a second buffer on the same heap, e.block will already have been freed (leaving e.block == None). Tracking an explicit heap_released: bool on HeapUma (removing the entry + freeing e.block only once both heap_released && live_buffers == 0) fixes this safely.
  • CI workflow approved (running); PR description also needs fixing once narrowed and fixed.
<!-- greyfinch-sync:ivall/xcl:comment:7160210082 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7160210082). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T10:48:58Z. --- Code review on `e11ce9b`: - **Scope mismatch / duplicate changes:** This diff bundles unrelated edits in `runner.rs` (already landed via #2022) and `dstorage.rs` / `dstorage/parallel.rs` (overlapping #2094 / #2159). - **Bug in `HEAP_UMA` block lifetime ( eal.rs):** `res_release` frees `e.block` as soon as `e.live_buffers == 0` **without checking whether the heap itself was released (mem_heap_release hit == 0)**. If a title keeps a HEAP_UMA heap alive, places and releases a first buffer, and later places a second buffer on the same heap, `e.block` will already have been freed (leaving e.block == None). Tracking an explicit heap_released: bool on HeapUma (removing the entry + freeing e.block only once both heap_released && live_buffers == 0) fixes this safely. - CI workflow approved (running); PR description also needs fixing once narrowed and fixed.
fromthemoonx commented 2026-11-25 13:05:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-25T12:53:33Z.


The suite passes on NVIDIA, but nothing in it reaches the changed release order. I agree with @raylitebull's review above: the block is freed under a live heap, and the heap_released flag fixes that. It would also fix the entry of a heap released before its buffers, which the last buffer frees but never removes. Three more points:

  • No test. CONTRIBUTING asks for one that fails without the fix. A GPU test like the existing HEAP_UMA ones would cover both orders: release the heap before its buffer and check that the block is freed once and the entry is gone; and release a live heap's only buffer, place a new one at the same offset, and check that its data stays where it was.
  • #1394 reports this bug and has been claimed since 2026-11-24 with another approach (stacked on #1070: late_release::hold keeps the block until the queues are past it). Worth agreeing with that claim before both land.
  • The Tested section (Rust 1.83.0, 694 passed, 71 SKIPPED) does not match this tree. With Rust 1.100.0 its suite runs 1154 tests. Was that run made on another commit?

Tested (RTX 3060 12 GB, driver 610.88, Windows 11 Pro 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug; on main cbc296a): cargo build --workspace + cargo test --workspace --no-fail-fast -- --test-threads=4: 1154 passed, 0 failed, 46 ignored, at both fe97ba1 and 697caca. 24 SKIPPED (no wave64, the per-lane refusals, no heap windows; the same as on main). The HEAP_UMA code is unchanged at e11ce9b.

Not tested: a title, the two release orders at run time.

AI use: Claude Code (Claude Opus 5.5) ran the suite, read the diff and wrote this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7163001215 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7163001215). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-11-25T12:53:33Z. --- The suite passes on NVIDIA, but nothing in it reaches the changed release order. I agree with @raylitebull's review above: the block is freed under a live heap, and the `heap_released` flag fixes that. It would also fix the entry of a heap released before its buffers, which the last buffer frees but never removes. Three more points: - **No test.** CONTRIBUTING asks for one that fails without the fix. A GPU test like the existing `HEAP_UMA` ones would cover both orders: release the heap before its buffer and check that the block is freed once and the entry is gone; and release a live heap's only buffer, place a new one at the same offset, and check that its data stays where it was. - **#1394** reports this bug and has been claimed since 2026-11-24 with another approach (stacked on #1070: `late_release::hold` keeps the block until the queues are past it). Worth agreeing with that claim before both land. - The **Tested** section (Rust 1.83.0, 694 passed, 71 SKIPPED) does not match this tree. With Rust 1.100.0 its suite runs 1154 tests. Was that run made on another commit? **Tested** (RTX 3060 12 GB, driver 610.88, Windows 11 Pro 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug; on `main` `cbc296a`): `cargo build --workspace` + `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1154 passed, 0 failed, 46 ignored, at both `fe97ba1` and `697caca`. 24 SKIPPED (no wave64, the per-lane refusals, no heap windows; the same as on `main`). The `HEAP_UMA` code is unchanged at `e11ce9b`. **Not tested:** a title, the two release orders at run time. **AI use:** Claude Code (Claude Opus 5.5) ran the suite, read the diff and wrote this comment.
throny commented 2026-11-25 18:04:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-25T17:24:11Z.


Two contributors checked independently and found that #1648 solves the same problem (for #1488) in a different way: #1607, group D88. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

<!-- greyfinch-sync:ivall/xcl:comment:7169451744 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7169451744). Originally posted by [throny](https://github.com/throny) on 2026-11-25T17:24:11Z. --- <!-- xcl-1607-hint:D88 --> Two contributors checked independently and found that #1648 solves the same problem (for #1488) in a different way: #1607, group D88. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
upstream-sync closed this pull request 2026-11-25 23:08:00 +00:00
CalvyPZ commented 2026-11-25 23:09:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:42:15Z.


This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.

<!-- greyfinch-sync:ivall/xcl:comment:7176688128 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7176688128). Originally posted by [CalvyPZ](https://github.com/CalvyPZ) on 2026-11-25T22:42:15Z. --- This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
upstream-sync reopened this pull request 2026-11-26 00:04:50 +00:00
DavidM1911 commented 2026-11-26 08:04:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T07:28:41Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7185499844 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7185499844). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T07:28:41Z. --- 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
Foniass commented 2026-12-01 07:19:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:19:25Z.


Triage (#1607) – head e11ce9b

The HEAP_UMA fix does not take effect. In real.rs place_at_title_address and place_console_buffer, heap is the UMA window's heap (UMA_HEAPS[k]). HEAP_UMA is keyed by the title's ID3D12Heap (note_heap_uma), so h.get_mut(&heap) never finds an entry and live_buffers stays 0. The title's heap is not passed down from dev_create_placed_resource_x, and sparse placements record heap 0. As a result mem_heap_release still frees the block while buffers placed in it are alive.
If the count did work, res_release would free the block as soon as the last buffer goes, even while the heap itself is still alive, because nothing records that the heap was released.
#1648 was opened first. It records the title heap at dev_create_placed_resource_x, keeps a released flag and has a test.
This PR also bundles the commits of #2150 (debug layer in the test runner) and #2159 (DirectStorage counters), which are separate changes.
Recommendation: close (bad: placed-buffer count never matches a HEAP_UMA entry; see #1648).

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7303917734 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7303917734). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:19:25Z. --- **Triage (#1607)** – head e11ce9b The HEAP_UMA fix does not take effect. In `real.rs` `place_at_title_address` and `place_console_buffer`, `heap` is the UMA window's heap (`UMA_HEAPS[k]`). `HEAP_UMA` is keyed by the title's `ID3D12Heap` (`note_heap_uma`), so `h.get_mut(&heap)` never finds an entry and `live_buffers` stays 0. The title's heap is not passed down from `dev_create_placed_resource_x`, and sparse placements record heap 0. As a result `mem_heap_release` still frees the block while buffers placed in it are alive. If the count did work, `res_release` would free the block as soon as the last buffer goes, even while the heap itself is still alive, because nothing records that the heap was released. #1648 was opened first. It records the title heap at `dev_create_placed_resource_x`, keeps a `released` flag and has a test. This PR also bundles the commits of #2150 (debug layer in the test runner) and #2159 (DirectStorage counters), which are separate changes. Recommendation: close (bad: placed-buffer count never matches a HEAP_UMA entry; see #1648). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2086:upstream-pr/2086'
git switch 'upstream-pr/2086'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2086'
git switch 'upstream-pr/2086'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2086'
git switch 'upstream-pr/2086'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2086'
git switch 'main'
git merge --squash 'upstream-pr/2086'
git switch 'main'
git merge --ff-only 'upstream-pr/2086'
git switch 'main'
git merge 'upstream-pr/2086'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2076
No description provided.