D3D12.X: a buffers-only heap gets a 64 KiB PC heap, not one of its full size #3377

Open
Prime1997 wants to merge 2 commits from upstream-pr/3377 into main
Prime1997 commented 2026-11-29 11:17:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-29T11:17:54Z.


Requested by Prime

Every heap the title makes gets a PC heap of its full size, and a heap that may hold buffers also gets a block of unified memory as large when its first buffer is placed: buffers go in the block (console code reads them at their addresses), textures in the PC heap. A heap made with ALLOW_ONLY_BUFFERS (both texture kinds denied) never holds a texture, so its PC heap was video memory of the heap's whole size that nothing was placed in, on top of the block.

Such a heap now takes its block at CreateHeap and gets a 64 KiB PC heap; GetDesc answers with the title's size rounded up to 64 KiB, and a title alignment above 64 KiB is promoted to 4 MiB, as dev_create_heap does for any heap description the PC refuses. A buffer that cannot go in the block (and does not fit in the 64 KiB) gets memory of its own of the heap's kind, as a texture past a heap's end already does. When unified memory is full the heap is made as before. XCL_SMALL_BUFFER_HEAPS=0 turns it off.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs (first commit): buffers-only heaps (ALLOW_ONLY_BUFFERS) get their block at CreateHeap and a 64 KiB PC heap, info line D3D12.X: buffers-only heap of ...; tests only_a_heap_that_denies_both_kinds_of_texture_is_buffers_only and a_small_buffer_heap_is_known_by_its_entry
  • crates/xcl/src/hle/d3d12x/real.rs (second commit): the small heap's GetDesc size and alignment follow dev_create_heap's normalisation (the first commit alone failed d3d12_create_heap's console_heap_descs_refused_by_host_are_normalized_by_xcl with 0x12345 where 0x20000 is expected); to be squashed into the first before review
  • README.md: XCL_SMALL_BUFFER_HEAPS

Tested

  • RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, 32 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0; the suite in debug, the smoke on a release build of the head commit
  • cargo test --workspace --no-fail-fast -- --test-threads=4 with the three uma_driver tests below skipped, on e8f6939359: 2606 passed, 1 failed, 49 ignored; failing: hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares (SKIPPED GPU tests: 28 lines: 21 no wave64 (this card runs wave32), 3 a wave32 per-lane form refused by the translator (#1426), 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1), 1 no dxc.exe, 1 cannot disable the driver cache (needs Windows Developer Mode))
  • the three skipped tests on their own (cargo test -p xcl --lib -- --test-threads=1 uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment uma_driver::tests::failed_restore_stops_before_importing_an_unbacked_window): 3 passed, 0 failed. They are left out of the whole run because on this PC's driver they can end the library test process (exit 0x7c10003, "coherent window could not be restored"), on main too
  • the library harness twice more (cargo test -p xcl --lib -- --test-threads=4, same skips): 2468 passed, 0 failed; 2468 passed, 0 failed
  • the failure above: the test's D3D12 call returned E_OUTOFMEMORY (0x8007000E) while the run shared the 8 GB card with the other tests and the desktop; a list_x test failed the same way once on another branch of this set that changes no D3D12 code (DirectStorage only); it passed in the other runs here
  • the whole run again on the same head: 2607 passed, 0 failed, 49 ignored
  • the same whole run on main fa204595a4: 2605 passed, 0 failed, 49 ignored, 28 SKIPPED lines (own-prs-20261129 run, same command)
  • retail title (60 s scripts/smoke.ps1, no input, copied profile and shader cache): blocks below

Regression run

xcl-smoke v1
commit: fa204595a488c60c6c5f905244f0172072c9c2a9
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1334 (PresentX 1334)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 15272 MB
xcl-smoke v1
commit: e8f6939359232ce5272d2ff3e01c109ede2bd192
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1294 (PresentX 1294)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15303 MB

Not tested

  • AMD GPUs (this is an NVIDIA wave32 card)
  • the retail title's world: the 60 s runs end on the title's start-up screens
  • The retail title's 60 s smoke made no buffers-only heap (no buffers-only heap line in its log), so the smoke does not reach this code; the memory saved was not measured on a title that makes such heaps.

AI use

  • Claude Code wrote the change and its test, wrote this description, and ran the tests and the smoke runs on this PC. The model is not named here: this session cannot tell which model served each turn.

Optional temporary Discord for coordinating contributor work, testing and comparing results.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5550181934 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3377). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-29T11:17:54Z. --- <!-- claude-projects-attribution: {"github_login":"Prime1997"} --> _Requested by **Prime**_ Every heap the title makes gets a PC heap of its full size, and a heap that may hold buffers also gets a block of unified memory as large when its first buffer is placed: buffers go in the block (console code reads them at their addresses), textures in the PC heap. A heap made with `ALLOW_ONLY_BUFFERS` (both texture kinds denied) never holds a texture, so its PC heap was video memory of the heap's whole size that nothing was placed in, on top of the block. Such a heap now takes its block at `CreateHeap` and gets a 64 KiB PC heap; `GetDesc` answers with the title's size rounded up to 64 KiB, and a title alignment above 64 KiB is promoted to 4 MiB, as `dev_create_heap` does for any heap description the PC refuses. A buffer that cannot go in the block (and does not fit in the 64 KiB) gets memory of its own of the heap's kind, as a texture past a heap's end already does. When unified memory is full the heap is made as before. `XCL_SMALL_BUFFER_HEAPS=0` turns it off. **What is in it** - `crates/xcl/src/hle/d3d12x/real.rs` (first commit): buffers-only heaps (`ALLOW_ONLY_BUFFERS`) get their block at `CreateHeap` and a 64 KiB PC heap, info line `D3D12.X: buffers-only heap of ...`; tests `only_a_heap_that_denies_both_kinds_of_texture_is_buffers_only` and `a_small_buffer_heap_is_known_by_its_entry` - `crates/xcl/src/hle/d3d12x/real.rs` (second commit): the small heap's `GetDesc` size and alignment follow `dev_create_heap`'s normalisation (the first commit alone failed `d3d12_create_heap`'s `console_heap_descs_refused_by_host_are_normalized_by_xcl` with 0x12345 where 0x20000 is expected); to be squashed into the first before review - `README.md`: `XCL_SMALL_BUFFER_HEAPS` **Tested** - RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, 32 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0; the suite in debug, the smoke on a release build of the head commit - `cargo test --workspace --no-fail-fast -- --test-threads=4` with the three `uma_driver` tests below skipped, on e8f693935923: 2606 passed, 1 failed, 49 ignored; failing: hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares (SKIPPED GPU tests: 28 lines: 21 `no wave64` (this card runs wave32), 3 a wave32 per-lane form refused by the translator (#1426), 2 `no heap windows` (opt-in `XCL_HEAP_WINDOWS=1`), 1 `no dxc.exe`, 1 `cannot disable the driver cache` (needs Windows Developer Mode)) - the three skipped tests on their own (`cargo test -p xcl --lib -- --test-threads=1 uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment uma_driver::tests::failed_restore_stops_before_importing_an_unbacked_window`): 3 passed, 0 failed. They are left out of the whole run because on this PC's driver they can end the library test process (exit 0x7c10003, "coherent window could not be restored"), on `main` too - the library harness twice more (`cargo test -p xcl --lib -- --test-threads=4`, same skips): 2468 passed, 0 failed; 2468 passed, 0 failed - the failure above: the test's D3D12 call returned `E_OUTOFMEMORY` (0x8007000E) while the run shared the 8 GB card with the other tests and the desktop; a `list_x` test failed the same way once on another branch of this set that changes no D3D12 code (DirectStorage only); it passed in the other runs here - the whole run again on the same head: 2607 passed, 0 failed, 49 ignored - the same whole run on `main` fa204595a488: 2605 passed, 0 failed, 49 ignored, 28 `SKIPPED` lines (own-prs-20261129 run, same command) - retail title (60 s `scripts/smoke.ps1`, no input, copied profile and shader cache): blocks below **Regression run** ``` xcl-smoke v1 commit: fa204595a488c60c6c5f905244f0172072c9c2a9 gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 1334 (PresentX 1334) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 15272 MB ``` ``` xcl-smoke v1 commit: e8f6939359232ce5272d2ff3e01c109ede2bd192 gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 1294 (PresentX 1294) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15303 MB ``` **Not tested** - AMD GPUs (this is an NVIDIA wave32 card) - the retail title's world: the 60 s runs end on the title's start-up screens - The retail title's 60 s smoke made no buffers-only heap (no `buffers-only heap` line in its log), so the smoke does not reach this code; the memory saved was not measured on a title that makes such heaps. **AI use** - Claude Code wrote the change and its test, wrote this description, and ran the tests and the smoke runs on this PC. The model is not named here: this session cannot tell which model served each turn. Optional temporary [Discord](https://discord.gg/6B4TykyC4W) for coordinating contributor work, testing and comparing results. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
saintwolf commented 2026-11-29 13:47:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-29T13:47:45Z.


Reviewed and tested at e8f69393.

Code review findings

  1. Eager UMA allocation on CreateHeap (small_buffer_heap, crates/xcl/src/hle/d3d12x/real.rs): Previously note_heap_uma left block: None and heap_block() allocated unified memory lazily on the first placed buffer. small_buffer_heap now calls heap_block(heap) eagerly during CreateHeap / CreateHeap1. Any buffers-only heap created ahead of time (or never populated, or a READBACK heap <= COHERENT_READBACK_MAX) now consumes sparse/coherent UMA immediately. Also, if UMA_BUFFER is empty, small_buffer_heap still creates and immediately Release()s a 64 KiB PC heap before falling back to dev_create_heap_pc. Checking UMA_BUFFER before calling create(&d) would avoid the wasted round-trip.
  2. CreatePlacedResource1 bypass: Only placed_in_heap_x received the is_small_buffer_heap(heap) committed-resource fallback (hr3). Any CreatePlacedResource1 call on a small-buffer heap with offset + size > 64 KiB will fail with E_INVALIDARG.
  3. Alignment > 64 KiB rejected by D3D12: small_buffer_heap sets d.Alignment = D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT (4 MiB) when title.Alignment > 0x1_0000 while setting d.SizeInBytes = SMALL_BUFFER_HEAP (64 KiB). D3D12 rejects SizeInBytes < Alignment, wasting a failed CreateHeap call before falling back. Since buffers_only forbids textures, d.Alignment = 0 is always valid for the 64 KiB PC heap.
  4. Missing test coverage for mem_heap_get_desc and >64 KiB placement: The new tests cover buffers_only() and a direct HEAP_UMA map lookup, but nothing exercises the adopted ID3D12Heap::GetDesc hook (ABI + rounded SizeInBytes) or placing a >64 KiB buffer in a small-buffer heap on D3D12.

Tested locally

  • Windows 11 (build 26300), NVIDIA GeForce RTX 4070 SUPER (driver 32.0.16.2140), AMD Ryzen 7 7800X3D, rustc 1.100.0.
  • cargo test -p xcl --lib hle::d3d12x::real::heap_release_order_tests:: -- --test-threads=1: 5 passed, 0 failed.

AI use

  • Antigravity (Gemini 4 Neon) assisted with code review and drafting; all builds and tests were executed locally on the hardware above.
<!-- greyfinch-sync:ivall/xcl:comment:7256806807 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3377#issuecomment-7256806807). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-29T13:47:45Z. --- Reviewed and tested at `e8f69393`. ### Code review findings 1. **Eager UMA allocation on `CreateHeap` (`small_buffer_heap`, `crates/xcl/src/hle/d3d12x/real.rs`)**: Previously `note_heap_uma` left `block: None` and `heap_block()` allocated unified memory lazily on the first placed buffer. `small_buffer_heap` now calls `heap_block(heap)` eagerly during `CreateHeap` / `CreateHeap1`. Any buffers-only heap created ahead of time (or never populated, or a `READBACK` heap `<= COHERENT_READBACK_MAX`) now consumes sparse/coherent UMA immediately. Also, if `UMA_BUFFER` is empty, `small_buffer_heap` still creates and immediately `Release()`s a 64 KiB PC heap before falling back to `dev_create_heap_pc`. Checking `UMA_BUFFER` before calling `create(&d)` would avoid the wasted round-trip. 2. **`CreatePlacedResource1` bypass**: Only `placed_in_heap_x` received the `is_small_buffer_heap(heap)` committed-resource fallback (`hr3`). Any `CreatePlacedResource1` call on a small-buffer heap with `offset + size > 64 KiB` will fail with `E_INVALIDARG`. 3. **Alignment > 64 KiB rejected by D3D12**: `small_buffer_heap` sets `d.Alignment = D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT` (4 MiB) when `title.Alignment > 0x1_0000` while setting `d.SizeInBytes = SMALL_BUFFER_HEAP` (64 KiB). D3D12 rejects `SizeInBytes < Alignment`, wasting a failed `CreateHeap` call before falling back. Since `buffers_only` forbids textures, `d.Alignment = 0` is always valid for the 64 KiB PC heap. 4. **Missing test coverage for `mem_heap_get_desc` and >64 KiB placement**: The new tests cover `buffers_only()` and a direct `HEAP_UMA` map lookup, but nothing exercises the adopted `ID3D12Heap::GetDesc` hook (ABI + rounded `SizeInBytes`) or placing a >64 KiB buffer in a small-buffer heap on D3D12. ### Tested locally - Windows 11 (build 26300), NVIDIA GeForce RTX 4070 SUPER (driver `32.0.16.2140`), AMD Ryzen 7 7800X3D, `rustc 1.100.0`. - `cargo test -p xcl --lib hle::d3d12x::real::heap_release_order_tests:: -- --test-threads=1`: **5 passed, 0 failed**. ### AI use - Antigravity (Gemini 4 Neon) assisted with code review and drafting; all builds and tests were executed locally on the hardware above.
Aniseto commented 2026-11-29 14:00:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-29T14:00:02Z.


Ran the buffers-only heap tests at e8f69393 on an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.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 cargo test -p xcl --lib only_a_heap_that_denies_both_kinds_of_texture_is_buffers_only -- --test-threads=1
1 passed; 0 failed; 0 ignored; 0 measured; 2499 filtered out      (exit 0)

XCL_ADAPTER=NVIDIA cargo test -p xcl --lib a_small_buffer_heap_is_known_by_its_entry -- --test-threads=1
1 passed; 0 failed; 0 ignored; 0 measured; 2499 filtered out      (exit 0)

Both new tests pass: only a heap that denies both texture kinds is classified as buffers-only, and a small buffer heap is known by its entry with the 64 KiB PC heap size. The PR is a draft and has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti. These are CPU-side classification tests, not a title memory comparison.

Not tested: a retail title, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

<!-- greyfinch-sync:ivall/xcl:comment:7256961759 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3377#issuecomment-7256961759). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-29T14:00:02Z. --- Ran the buffers-only heap tests at `e8f69393` on an NVIDIA Blackwell desktop part: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.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 cargo test -p xcl --lib only_a_heap_that_denies_both_kinds_of_texture_is_buffers_only -- --test-threads=1 1 passed; 0 failed; 0 ignored; 0 measured; 2499 filtered out (exit 0) XCL_ADAPTER=NVIDIA cargo test -p xcl --lib a_small_buffer_heap_is_known_by_its_entry -- --test-threads=1 1 passed; 0 failed; 0 ignored; 0 measured; 2499 filtered out (exit 0) ``` Both new tests pass: only a heap that denies both texture kinds is classified as buffers-only, and a small buffer heap is known by its entry with the 64 KiB PC heap size. The PR is a draft and has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti. These are CPU-side classification tests, not a title memory comparison. Not tested: a retail title, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
minimalhipster990 commented 2026-11-29 18:08:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by minimalhipster990 on 2026-11-29T18:08:14Z.


RTX 4090, a retail title through world loading: it never makes a buffers-only heap, so this PR has nothing to act on there. This covers the "retail title's world" case in the description's Not tested.

Setup

  • RTX 4090 24 GB, NVIDIA 621.40, 32 GB RAM, Windows 11 build 26300, Rust 1.99.1, release with --locked.
  • Tree: main 7a649b0e + #3318 head f5496479 (so the title gets past its load stall) + #3344 head 0f0cc342 + this PR's head e8f69393. Clean merges, local commit 9ff5fe40.
  • cargo test --release --locked -p xcl --lib -- only_a_heap_that_denies_both_kinds_of_texture_is_buffers_only a_small_buffer_heap_is_known_by_its_entry --test-threads=1: 2 passed, 0 failed.
  • Retail title (Series X profile), the same save and inputs as my #3318 / #3344 runs, XCL_ACTIVITY=1 XCL_GFX_PSO_WAIT_MS=50 XCL_CS_PSO_WAIT_MS=200 XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 XCL_COHERENT_HEAPS=sparse XCL_TEXTURE_LEVEL_PAGES=1 XCL_COHERENT_MB=3990 XCL_TWO_PASS_MB=3072, XCL_PREPARE=0, XCL_SMALL_BUFFER_HEAPS unset.

Results

  • One 220 s run of the tree as it is: 0 buffers-only heap of … lines.
  • Two more runs, 220 s and 300 s (the 300 s one was cut short by a device removal at 295.6 s, 1.0 GB of system commit left), with a local probe at the top of dev_create_heap / dev_create_heap1. It logged each heap kind (is_own_work(), flags, type, size) when its count reached a power of two. Both runs logged the same kinds; the counts below are from the 300 s run:
made by flags type size count
XCL (own_work, sparse pools) 0xC0 DEFAULT 4 MiB 2,048 or more by 90 s
XCL (own_work) 0x0 DEFAULT 64 MiB 64 or more by 45 s
the title 0x0 DEFAULT 128 KiB – 63.75 MiB, alignment 64 KiB 11 sizes; 16–21 heaps (330–490 MB) by the last line at 18.0 s
  • Every kind is logged at its first heap, so a buffers-only heap made by the title would have shown up at once; none did. The title's heaps all allow textures. After 18 s no new kind appeared and no count reached its next power of two. The only buffers-only heaps are XCL's sparse pools, which small_buffer_heap rightly leaves alone (is_own_work).
  • The probe was a local diagnostic only (24 lines in real.rs, not part of any PR).

Not tested: other titles, a run past 300 s that reaches the world with this PR (the one 300 s run did not; my #3318 runs with the same setup reached it in 5 of 6, at 169–320 s), AMD, and any memory or frame-time effect: with no heap to act on, there is none to measure on this title.

AI use: Claude Code (Claude Opus 5.5) built the tree, wrote the probe, ran the tests and the replays, and wrote this report. The person running these tests asked for it.

<!-- greyfinch-sync:ivall/xcl:comment:7260240847 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3377#issuecomment-7260240847). Originally posted by [minimalhipster990](https://github.com/minimalhipster990) on 2026-11-29T18:08:14Z. --- **RTX 4090, a retail title through world loading: it never makes a buffers-only heap, so this PR has nothing to act on there.** This covers the "retail title's world" case in the description's Not tested. **Setup** - RTX 4090 24 GB, NVIDIA 621.40, 32 GB RAM, Windows 11 build 26300, Rust 1.99.1, release with `--locked`. - Tree: `main` `7a649b0e` + #3318 head `f5496479` (so the title gets past its load stall) + #3344 head `0f0cc342` + this PR's head `e8f69393`. Clean merges, local commit `9ff5fe40`. - `cargo test --release --locked -p xcl --lib -- only_a_heap_that_denies_both_kinds_of_texture_is_buffers_only a_small_buffer_heap_is_known_by_its_entry --test-threads=1`: 2 passed, 0 failed. - Retail title (Series X profile), the same save and inputs as my #3318 / #3344 runs, `XCL_ACTIVITY=1 XCL_GFX_PSO_WAIT_MS=50 XCL_CS_PSO_WAIT_MS=200 XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 XCL_COHERENT_HEAPS=sparse XCL_TEXTURE_LEVEL_PAGES=1 XCL_COHERENT_MB=3990 XCL_TWO_PASS_MB=3072`, `XCL_PREPARE=0`, `XCL_SMALL_BUFFER_HEAPS` unset. **Results** - One 220 s run of the tree as it is: 0 `buffers-only heap of …` lines. - Two more runs, 220 s and 300 s (the 300 s one was cut short by a device removal at 295.6 s, 1.0 GB of system commit left), with a local probe at the top of `dev_create_heap` / `dev_create_heap1`. It logged each heap kind (`is_own_work()`, flags, type, size) when its count reached a power of two. Both runs logged the same kinds; the counts below are from the 300 s run: | made by | flags | type | size | count | |---|---|---|---|---| | XCL (`own_work`, sparse pools) | `0xC0` | DEFAULT | 4 MiB | 2,048 or more by 90 s | | XCL (`own_work`) | `0x0` | DEFAULT | 64 MiB | 64 or more by 45 s | | the title | `0x0` | DEFAULT | 128 KiB – 63.75 MiB, alignment 64 KiB | 11 sizes; 16–21 heaps (330–490 MB) by the last line at 18.0 s | - Every kind is logged at its first heap, so a buffers-only heap made by the title would have shown up at once; none did. The title's heaps all allow textures. After 18 s no new kind appeared and no count reached its next power of two. The only buffers-only heaps are XCL's sparse pools, which `small_buffer_heap` rightly leaves alone (`is_own_work`). - The probe was a local diagnostic only (24 lines in `real.rs`, not part of any PR). **Not tested:** other titles, a run past 300 s that reaches the world with this PR (the one 300 s run did not; my #3318 runs with the same setup reached it in 5 of 6, at 169–320 s), AMD, and any memory or frame-time effect: with no heap to act on, there is none to measure on this title. AI use: Claude Code (Claude Opus 5.5) built the tree, wrote the probe, ran the tests and the replays, and wrote this report. The person running these tests asked for it.
KOLESNiii commented 2026-11-29 22:39:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T22:39:38Z.

Review: COMMENTED


Static review of e8f69393 for the stack in the #3041 comparison.

I confirmed the CreatePlacedResource1 bypass reported by saintwolf. For example, CreateHeap1 can return a 64 KiB native heap while reporting the requested 4 MiB. Placing a 64 KiB buffer at offset 64 KiB fits that reported heap, but CreatePlacedResource1 passes the operation straight to the native driver and it fails against the actual heap. A regression test using those two entry points would cover the gap. Heap creation ?? Placement wrapper

Review assisted by Codex (GPT-6, exact variant unavailable). No new build or GPU run for this review.

<!-- greyfinch-sync:ivall/xcl:review:6105176118 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3377#pullrequestreview-6105176118). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-29T22:39:38Z. **Review:** COMMENTED --- Static review of `e8f69393` for the stack in the [#3041 comparison](https://github.com/xcl-dev/xcl/issues/3041#issuecomment-7263214809). I confirmed the [`CreatePlacedResource1` bypass reported by saintwolf](https://github.com/xcl-dev/xcl/pull/3377#issuecomment-7256806807). For example, `CreateHeap1` can return a 64 KiB native heap while reporting the requested 4 MiB. Placing a 64 KiB buffer at offset 64 KiB fits that reported heap, but `CreatePlacedResource1` passes the operation straight to the native driver and it fails against the actual heap. A regression test using those two entry points would cover the gap. [Heap creation](https://github.com/xcl-dev/xcl/blob/e8f69393/crates/xcl/src/hle/d3d12x/real.rs#L4654-L4659) ?? [Placement wrapper](https://github.com/xcl-dev/xcl/blob/e8f69393/crates/xcl/src/hle/d3d12x/real.rs#L4562) Review assisted by Codex (GPT-6, exact variant unavailable). No new build or GPU run for this review.
bmjask commented 2026-11-29 22:43:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T22:43:23Z.

Review: COMMENTED


Critical review of current head e8f69393 (source and existing Windows reports; I did not run Windows tests here). Changes needed: The small native heap reports the title's full size, but CreatePlacedResource1 still bypasses placed_in_heap_x; a legal buffer placement beyond 64 KiB can therefore fail against the real 64 KiB heap. Please route all placed-resource entry points through the same UMA/committed fallback and add a CreateHeap1 + CreatePlacedResource1 regression. Also account for the new eager UMA reservation at CreateHeap: unused buffers-only heaps now consume the full block. The existing review describes that lifetime cost. A retail-world run in this thread observed no buffers-only heaps, so the claimed FPS/memory benefit needs a workload that exercises this path.

<!-- greyfinch-sync:ivall/xcl:review:6105190556 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3377#pullrequestreview-6105190556). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-29T22:43:23Z. **Review:** COMMENTED --- Critical review of current head `e8f69393` (source and existing Windows reports; I did not run Windows tests here). **Changes needed:** The small native heap reports the title's full size, but `CreatePlacedResource1` still bypasses `placed_in_heap_x`; a legal buffer placement beyond 64 KiB can therefore fail against the real 64 KiB heap. Please route all placed-resource entry points through the same UMA/committed fallback and add a `CreateHeap1` + `CreatePlacedResource1` regression. Also account for the new eager UMA reservation at `CreateHeap`: unused buffers-only heaps now consume the full block. The [existing review](https://github.com/xcl-dev/xcl/pull/3377#issuecomment-7256806807) describes that lifetime cost. A retail-world run in this thread observed no buffers-only heaps, so the claimed FPS/memory benefit needs a workload that exercises this path.
Foniass commented 2026-12-01 03:35:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:35:48Z.


Review (head e8f69393, diff read, not a merge-check; draft, so not built or run):

  • Title tile mappings into a buffers-only heap. I found no XCL hook on the queue's UpdateTileMappings / CopyTileMappings (the hooked queue slots start at QUEUE_FIRST = 14), so a title's call reaches the PC with the title heap as it is. If a title maps a reserved buffer into a buffers-only heap past 64 KiB, that offset is now out of range of the 64 KiB PC heap; on main the PC heap is full size. I don't know whether any title does this, but it's worth ruling out (or refusing the small heap once a heap is used for tile mappings).
  • Fallback (real.rs ~4461). When placement in the block fails, a buffer that doesn't fit in the 64 KiB becomes its own committed resource. On main it was placed in the PC heap at its offset, so such buffers still aliased each other; now they don't. Any hr2 failure (bad description or state) also turns into a committed resource instead of an error.
  • The block is taken at CreateHeap (~4765), not on the first placed buffer, which reverses the lazy rule documented in main's note_heap_uma (~4697-4707, unified memory filling up and the image flickering). An unused buffers-only heap now holds unified memory.
  • The tests don't test the claim: they cover the flag check and a map lookup, but nothing creates a buffers-only heap and checks the 64 KiB PC heap, GetDesc, a placement past 64 KiB, or the fallback. The smoke run doesn't reach this code, and the memory saved isn't measured.
  • Minor: mem_heap_get_desc (~4787) assumes the (this, out) argument order, while the descriptor-heap GetDesc hook handles both. The second commit is a fixup to squash, CI is red on 2 lib tests that look unrelated, and AI use names no model.

Fine: the buffers-only check is conservative, failure paths release the heap and fall back to the old path, Release frees the block, the GetDesc size matches dev_create_heap's rounding, XCL_SMALL_BUFFER_HEAPS=0 turns it off, and the README is updated.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7299868751 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3377#issuecomment-7299868751). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:35:48Z. --- Review (head e8f69393, diff read, not a merge-check; draft, so not built or run): - **Title tile mappings into a buffers-only heap.** I found no XCL hook on the queue's `UpdateTileMappings` / `CopyTileMappings` (the hooked queue slots start at `QUEUE_FIRST` = 14), so a title's call reaches the PC with the title heap as it is. If a title maps a reserved buffer into a buffers-only heap past 64 KiB, that offset is now out of range of the 64 KiB PC heap; on main the PC heap is full size. I don't know whether any title does this, but it's worth ruling out (or refusing the small heap once a heap is used for tile mappings). - **Fallback (`real.rs` ~4461).** When placement in the block fails, a buffer that doesn't fit in the 64 KiB becomes its own committed resource. On main it was placed in the PC heap at its offset, so such buffers still aliased each other; now they don't. Any `hr2` failure (bad description or state) also turns into a committed resource instead of an error. - **The block is taken at `CreateHeap` (~4765)**, not on the first placed buffer, which reverses the lazy rule documented in main's `note_heap_uma` (~4697-4707, unified memory filling up and the image flickering). An unused buffers-only heap now holds unified memory. - **The tests don't test the claim:** they cover the flag check and a map lookup, but nothing creates a buffers-only heap and checks the 64 KiB PC heap, `GetDesc`, a placement past 64 KiB, or the fallback. The smoke run doesn't reach this code, and the memory saved isn't measured. - Minor: `mem_heap_get_desc` (~4787) assumes the (this, out) argument order, while the descriptor-heap `GetDesc` hook handles both. The second commit is a fixup to squash, CI is red on 2 lib tests that look unrelated, and AI use names no model. Fine: the buffers-only check is conservative, failure paths release the heap and fall back to the old path, Release frees the block, the `GetDesc` size matches `dev_create_heap`'s rounding, `XCL_SMALL_BUFFER_HEAPS=0` turns it off, and the README is updated. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-01 15:54:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T15:54:12Z.


Test report (not a merge-check: draft)
base: b2b1f109d2
head: e8f6939359
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2902 passed, 2 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: hle::d3d12x::uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom, hle::d3d12x::uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment
review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3377#issuecomment-7299868751, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main.
performance: no smoke run.
assessment: 2 tests failed in both runs of this merge: uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom and mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment, both "Map gave

, wanted " when remaking a mixed window (uma_driver.rs ~756 / ~810). Correction to an earlier version of this comment: the same failure also hit #2991 and, once, #3318 (which doesn't touch heaps), while two full runs of main passed them. So it is intermittent on this machine, not clearly caused by this PR, though it hit this PR in both of its runs. A local run of cargo test -p xcl --lib uma_driver a few times on this head would settle it. The rest of the suite passes, and the findings in my review stand.
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.

<!-- greyfinch-sync:ivall/xcl:comment:7316704093 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3377#issuecomment-7316704093). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T15:54:12Z. --- Test report (not a merge-check: draft) base: b2b1f109d27e746a62ec95b04dd1f9924452e682 head: e8f6939359232ce5272d2ff3e01c109ede2bd192 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2902 passed, 2 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: hle::d3d12x::uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom, hle::d3d12x::uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3377#issuecomment-7299868751, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main. performance: no smoke run. assessment: 2 tests failed in both runs of this merge: `uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom` and `mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment`, both "Map gave <address>, wanted <other address>" when remaking a mixed window (`uma_driver.rs` ~756 / ~810). Correction to an earlier version of this comment: the same failure also hit #2991 and, once, #3318 (which doesn't touch heaps), while two full runs of main passed them. So it is intermittent on this machine, not clearly caused by this PR, though it hit this PR in both of its runs. A local run of `cargo test -p xcl --lib uma_driver` a few times on this head would settle it. The rest of the suite passes, and the findings in my review stand. 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.
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/3377:upstream-pr/3377'
git switch 'upstream-pr/3377'

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/3377'
git switch 'upstream-pr/3377'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3377'
git switch 'upstream-pr/3377'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3377'
git switch 'main'
git merge --squash 'upstream-pr/3377'
git switch 'main'
git merge --ff-only 'upstream-pr/3377'
git switch 'main'
git merge 'upstream-pr/3377'
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!3377
No description provided.