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

Open
github-bot wants to merge 4 commits from github-bot/gh-2086 into main AGit
Owner

@⁠saurabhbhoir456 on GitHub · 2026-11-25 03:34 UTC · original
saurabhbhoir456:fix/xcl-bt-001-heap-uma-lifetime-v2 → main · +103 −26 · 4 files · 4 commits · open

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

**@⁠saurabhbhoir456** on GitHub · 2026-11-25 03:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/2086) `saurabhbhoir456:fix/xcl-bt-001-heap-uma-lifetime-v2` → `main` · +103 −26 · 4 files · 4 commits · open **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)
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 the heap (5 insertion sites)
- 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 set block = None and keep entry so last buffer's Release can
  free it

This defers the block free until all buffers in the heap are released.
mem_heap_release set e.block = None when buffers were still alive,
discarding the pointer res_release needs to free the block when
live_buffers reaches zero. This leaked the backing block whenever a
heap was released before its placed buffers.

Keep the entry and its block so res_release frees the block once
live_buffers hits 0 (checked via e.block.is_some()).

Build: cargo build --workspace passes. Tests: cargo test --workspace
1153 passed, 0 failed (GPU tests skipped: no wave64 on AMD RDNA3).

Co-Authored-By: Claude Code <[email protected]>
Fixes #2016: XCL_D3D12_DEBUG=1 removes the GPU test runner's device once a
test starts the D3D12.X backend.

The GPU test runner creates its D3D12 device in runner::init(), but the
debug layer was being enabled in the D3D12.X backend after the device
already existed. The debug layer must be enabled before any device is
created.

Enable the debug layer in runner::init() when XCL_D3D12_DEBUG is set,
before adapter selection and device creation.

Co-Authored-By: Claude Code <[email protected]>
Fixes #2059: DirectStorage byte counter includes failed reads.

The BYTES and REQUESTS atomic counters were incremented at the start of
execute() via note_request(), but a request can fail after that point
(access violation, decompression, zlib, write failures). This caused
failed requests to be counted in the byte/request totals.

Split note_request() into:
- note_request(): logging only (called at start of execute)
- note_request_success(n): increments REQUESTS/BYTES counters (called only
  after successful completion in both execute() and retire_one())

This ensures only successfully completed requests are counted.

Co-Authored-By: Claude Code <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:18:16 +00:00
Author
Owner

@⁠frenziedcoder on GitHub · 2026-11-25 04:23 UTC · original

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.

**@⁠frenziedcoder** on GitHub · 2026-11-25 04:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7152806500) **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.*
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-25 05:22 UTC · original

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.
**@⁠JoaoPauluu** on GitHub · 2026-11-25 05:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7153706251) 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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 05:26 UTC · original

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!

**@⁠DavidM1911** on GitHub · 2026-11-25 05:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7153785281) 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!
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 09:38 UTC · original

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.

**@⁠Toons29** on GitHub · 2026-11-25 09:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7158600829) 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.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 10:48 UTC · original

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.
**@⁠raylitebull** on GitHub · 2026-11-25 10:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7160210082) 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.
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-25 12:53 UTC · original

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.

**@⁠fromthemoonx** on GitHub · 2026-11-25 12:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7163001215) 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.
Author
Owner

@⁠throny on GitHub · 2026-11-25 17:24 UTC · original

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.

**@⁠throny** on GitHub · 2026-11-25 17:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7169451744) <!-- 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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 07:28 UTC · original

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

**@⁠DavidM1911** on GitHub · 2026-11-26 07:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/2086#issuecomment-7185499844) 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
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2086/head:github-bot/gh-2086'
git switch 'github-bot/gh-2086'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2086'
git switch 'github-bot/gh-2086'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2086'
git switch 'github-bot/gh-2086'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2086'
git switch 'main'
git merge --squash 'github-bot/gh-2086'
git switch 'main'
git merge --ff-only 'github-bot/gh-2086'
git switch 'main'
git merge 'github-bot/gh-2086'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.