D3D12.X: opt-in staged GPU compute detiling for swizzled 2D textures #3651

Open
Kalmarv wants to merge 1 commit from upstream-pr/3651 into main
Kalmarv commented 2026-12-02 03:46:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T03:46:07Z.


Adds an opt-in (XCL_GPU_DETILE=1, default off) staged GPU compute detiling path in texture_upload::submit() using cs_5_0 shaders (compiled via D3DCompile, no runtime DXC required) and the GF(2) offset tables from gpu::tiling across 1-, 2-, 4-, 8-, and 16-byte elements (R8, R16, RG8, RGBA8, BC1, BC7).

When enabled, 2D swizzled non-tail pieces at or above XCL_GPU_DETILE_MIN_BYTES (default 256 KiB) copy raw tiled blocks into the upload buffer and record known page hashes on the CPU before detiling into a pooled DEFAULT-heap UAV scratch buffer ahead of CopyTextureRegion. This preserves CPU detiling's source-read timing and unchanged-page deduplication. The default stays off until end-to-end GPU-time benefits are measured on heavy streaming workloads; the direct-UMA read path is split out for a separate follow-up PR.

Total diff vs main: 5 files changed, +781 / -34 (+595 / -33 runtime, +186 / -1 unit/GPU tests).

What is in it

  • crates/xcl/src/gpu/tiling.rs (+7): Layout::gpu_detile_tables exposing the existing ox, oy, hx, hy GF(2) tables and fixed XOR bits.
  • crates/xcl/src/hle/d3d12x/gpu_detile.rs (+429, mod gpu_detile in mod.rs):
    • Opt-in toggle XCL_GPU_DETILE=1 (default off) and XCL_GPU_DETILE_MIN_BYTES (default 256 KiB).
    • Five cs_5_0 compute shaders (1, 2, 4, 8, 16 B elements), TablePack layout deduplication, and eligible() filter (2D swizzled non-tail pieces meeting the size threshold).
    • Non-blocking off-thread initialization (xcl-gpu-detile-init): both device-independent D3DCompile + D3D12SerializeRootSignature (cached in OnceLock) and per-queue CreateRootSignature + 5× CreateComputePipelineState run off the submitting thread; uploads fall back cleanly to CPU detiling until ready.
    • Per-queue lifetime: Slot is owned directly by title_textures::QueueUploads and dropped on title_textures::forget_queue, with no global device cache and no ID3D12Device::Release hook (real.rs untouched).
    • Unit tests covering non-blocking Slot::poll state transitions, env parsing, table deduplication, and eligible() filtering.
  • crates/xcl/src/hle/d3d12x/texture_upload.rs (+338 / -29) and crates/xcl/src/hle/d3d12x/title_textures.rs (+6 / -5):
    • Work::RawBlocks staging, pooled DEFAULT-heap UAV detile scratch buffer (ensure_detile_buf), UAV barrier and COMMON/COPY_SOURCE transitions, and Job::in_flight_bytes() accounted against IN_FLIGHT_BYTES / IN_FLIGHT_MAX.
    • take() ranks pooled jobs by smallest fitting upload buffer first (pool_rank), tie-breaking on detile scratch fit, so small GPU batches do not grab the largest pooled upload buffer.
    • Unit and GPU tests: take_ranks_upload_size_before_scratch_fit and gpu_detile_matches_xg_for_all_element_sizes_and_64k_modes (R8, R16, RG8, RGBA8, BC1, BC7 × all four 64 KiB modes, whole textures, array slices, partial dirty-tile updates, known page hashing, in_flight_bytes() accounting, and Slot::Failed CPU fallback).

Tested

  • Hardware & toolchain: NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.1074), AMD Ryzen 9 9950X 16-Core, Windows 11 x64, rustc 1.99.0 (b940084d7 2026-09-28), DXC 1.9.2609.
  • cargo build --release -p xcl: ok (39 pre-existing xcl lib warnings, 0 new vs main, 0 in changed code).
  • .\scripts\test.ps1 (with DXC 1.9.2609): 3010 passed, 0 failed, 52 ignored; 24 SKIPPED (22 no wave64, 2 no heap windows; 0 DXC skips; all 6 new gpu_detile and texture_upload tests passed).
  • Targeted RTX 5070 Ti and WARP runs (cargo test -p xcl --lib gpu_detile -- --test-threads=1, cargo test -p xcl --lib texture_upload::tests -- --test-threads=1, and XCL_ADAPTER=warp cargo test -p xcl --lib texture_upload::tests::gpu_detile -- --test-threads=1): all passed, 0 skipped.

Regression run

main:

xcl-smoke v1
commit: 5eaadb54c14e0fc29597b2a1689d7dbd83491303
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1698 (PresentX 1698)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 15798 MB

PR (default, XCL_GPU_DETILE unset):

xcl-smoke v1
commit: 72a12a04f7d5c76375a715b865f640d9a8abdcf7
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1696 (PresentX 1696)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17246 MB

PR (opt-in, XCL_GPU_DETILE=1):

xcl-smoke v1
commit: 72a12a04f7d5c76375a715b865f640d9a8abdcf7
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1697 (PresentX 1697)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 17256 MB
  • Default (XCL_GPU_DETILE unset) vs main: 1696 vs 1698 frames shown (99.9%), 60 60 60 vs 60 61 60 last presents per 2 s, 0 device removals, 0 crashes, 17246 vs 15798 MB peak commit (109.2%); GPU detiling stays inactive.
  • Opt-in (XCL_GPU_DETILE=1) vs main: 1697 vs 1698 frames shown (99.9%), 60 61 60 vs 60 61 60 last presents per 2 s, 0 device removals, 0 crashes, 17256 vs 15798 MB peak commit (109.2%, +10 MB vs default off). texture upload: GPU compute detiling active (min_bytes=262144) logged at 5.2 s with 0 Present stalls and 0 errors.

Not tested

  • AMD / Intel discrete GPUs, Wine / vkd3d-proton, and macOS / D3DMetal.
  • 3D volume textures, linear textures, and mip-tail levels (remain on the existing CPU detiling path).
  • End-to-end GPU-time vs CPU-time measurements under sustained in-world streaming (left for a follow-up before considering turning XCL_GPU_DETILE on by default).
  • Wave64-only GPU tests (22) and opt-in heap-windows tests (2) skipped on this RTX 5070 Ti adapter.

AI use

  • Antigravity (Gemini 4 Neon): rebased onto origin/main (817eb1fc9), stripped the direct-UMA path out for a separate follow-up PR, defaulted XCL_GPU_DETILE off, moved GpuDetile ownership into per-queue QueueUploads (removing the global cache and real.rs hook), moved both D3DCompile and D3D12 PSO creation onto a background init thread, fixed take() pool ranking with a unit test, and ran the release build, DXC 1.9 test suite, WARP test, and paired 60 s smokes.
  • Claude Opus 5.5: authored the initial staged GPU compute detiling shaders, upload integration, and bit-exactness tests.
<!-- greyfinch-sync:ivall/xcl:issue:5599415684 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-12-02T03:46:07Z. --- Adds an opt-in (`XCL_GPU_DETILE=1`, default off) staged GPU compute detiling path in `texture_upload::submit()` using `cs_5_0` shaders (compiled via `D3DCompile`, no runtime DXC required) and the GF(2) offset tables from `gpu::tiling` across 1-, 2-, 4-, 8-, and 16-byte elements (`R8`, `R16`, `RG8`, `RGBA8`, `BC1`, `BC7`). When enabled, 2D swizzled non-tail pieces at or above `XCL_GPU_DETILE_MIN_BYTES` (default 256 KiB) copy raw tiled blocks into the upload buffer and record `known` page hashes on the CPU before detiling into a pooled DEFAULT-heap UAV scratch buffer ahead of `CopyTextureRegion`. This preserves CPU detiling's source-read timing and unchanged-page deduplication. The default stays off until end-to-end GPU-time benefits are measured on heavy streaming workloads; the direct-UMA read path is split out for a separate follow-up PR. Total diff vs `main`: 5 files changed, `+781 / -34` (`+595 / -33` runtime, `+186 / -1` unit/GPU tests). **What is in it** - `crates/xcl/src/gpu/tiling.rs` (`+7`): `Layout::gpu_detile_tables` exposing the existing `ox`, `oy`, `hx`, `hy` GF(2) tables and fixed XOR bits. - `crates/xcl/src/hle/d3d12x/gpu_detile.rs` (`+429`, `mod gpu_detile` in `mod.rs`): - Opt-in toggle `XCL_GPU_DETILE=1` (default off) and `XCL_GPU_DETILE_MIN_BYTES` (default `256 KiB`). - Five `cs_5_0` compute shaders (`1, 2, 4, 8, 16` B elements), `TablePack` layout deduplication, and `eligible()` filter (2D swizzled non-tail pieces meeting the size threshold). - Non-blocking off-thread initialization (`xcl-gpu-detile-init`): both device-independent `D3DCompile` + `D3D12SerializeRootSignature` (cached in `OnceLock`) and per-queue `CreateRootSignature` + 5× `CreateComputePipelineState` run off the submitting thread; uploads fall back cleanly to CPU detiling until ready. - Per-queue lifetime: `Slot` is owned directly by `title_textures::QueueUploads` and dropped on `title_textures::forget_queue`, with no global device cache and no `ID3D12Device::Release` hook (`real.rs` untouched). - Unit tests covering non-blocking `Slot::poll` state transitions, env parsing, table deduplication, and `eligible()` filtering. - `crates/xcl/src/hle/d3d12x/texture_upload.rs` (`+338 / -29`) and `crates/xcl/src/hle/d3d12x/title_textures.rs` (`+6 / -5`): - `Work::RawBlocks` staging, pooled DEFAULT-heap UAV detile scratch buffer (`ensure_detile_buf`), UAV barrier and `COMMON`/`COPY_SOURCE` transitions, and `Job::in_flight_bytes()` accounted against `IN_FLIGHT_BYTES` / `IN_FLIGHT_MAX`. - `take()` ranks pooled jobs by smallest fitting upload buffer first (`pool_rank`), tie-breaking on detile scratch fit, so small GPU batches do not grab the largest pooled upload buffer. - Unit and GPU tests: `take_ranks_upload_size_before_scratch_fit` and `gpu_detile_matches_xg_for_all_element_sizes_and_64k_modes` (R8, R16, RG8, RGBA8, BC1, BC7 × all four 64 KiB modes, whole textures, array slices, partial dirty-tile updates, `known` page hashing, `in_flight_bytes()` accounting, and `Slot::Failed` CPU fallback). **Tested** - Hardware & toolchain: NVIDIA GeForce RTX 5070 Ti (driver `32.0.16.1074`), AMD Ryzen 9 9950X 16-Core, Windows 11 x64, `rustc 1.99.0 (b940084d7 2026-09-28)`, DXC 1.9.2609. - `cargo build --release -p xcl`: ok (39 pre-existing `xcl` lib warnings, 0 new vs `main`, 0 in changed code). - `.\scripts\test.ps1` (with DXC 1.9.2609): **3010 passed, 0 failed, 52 ignored; 24 `SKIPPED`** (22 `no wave64`, 2 `no heap windows`; 0 DXC skips; all 6 new `gpu_detile` and `texture_upload` tests passed). - Targeted RTX 5070 Ti and WARP runs (`cargo test -p xcl --lib gpu_detile -- --test-threads=1`, `cargo test -p xcl --lib texture_upload::tests -- --test-threads=1`, and `XCL_ADAPTER=warp` `cargo test -p xcl --lib texture_upload::tests::gpu_detile -- --test-threads=1`): all passed, 0 skipped. **Regression run** main: ``` xcl-smoke v1 commit: 5eaadb54c14e0fc29597b2a1689d7dbd83491303 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1698 (PresentX 1698) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 15798 MB ``` PR (default, `XCL_GPU_DETILE` unset): ``` xcl-smoke v1 commit: 72a12a04f7d5c76375a715b865f640d9a8abdcf7 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1696 (PresentX 1696) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17246 MB ``` PR (opt-in, `XCL_GPU_DETILE=1`): ``` xcl-smoke v1 commit: 72a12a04f7d5c76375a715b865f640d9a8abdcf7 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1697 (PresentX 1697) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 17256 MB ``` - Default (`XCL_GPU_DETILE` unset) vs `main`: `1696` vs `1698` frames shown (`99.9%`), `60 60 60` vs `60 61 60` last presents per 2 s, `0` device removals, `0` crashes, `17246` vs `15798` MB peak commit (`109.2%`); GPU detiling stays inactive. - Opt-in (`XCL_GPU_DETILE=1`) vs `main`: `1697` vs `1698` frames shown (`99.9%`), `60 61 60` vs `60 61 60` last presents per 2 s, `0` device removals, `0` crashes, `17256` vs `15798` MB peak commit (`109.2%`, `+10 MB` vs default off). `texture upload: GPU compute detiling active (min_bytes=262144)` logged at 5.2 s with 0 Present stalls and 0 errors. **Not tested** - AMD / Intel discrete GPUs, Wine / vkd3d-proton, and macOS / D3DMetal. - 3D volume textures, linear textures, and mip-tail levels (remain on the existing CPU detiling path). - End-to-end GPU-time vs CPU-time measurements under sustained in-world streaming (left for a follow-up before considering turning `XCL_GPU_DETILE` on by default). - Wave64-only GPU tests (22) and opt-in heap-windows tests (2) skipped on this RTX 5070 Ti adapter. **AI use** - Antigravity (Gemini 4 Neon): rebased onto `origin/main` (`817eb1fc9`), stripped the direct-UMA path out for a separate follow-up PR, defaulted `XCL_GPU_DETILE` off, moved `GpuDetile` ownership into per-queue `QueueUploads` (removing the global cache and `real.rs` hook), moved both `D3DCompile` and D3D12 PSO creation onto a background init thread, fixed `take()` pool ranking with a unit test, and ran the release build, DXC 1.9 test suite, WARP test, and paired 60 s smokes. - Claude Opus 5.5: authored the initial staged GPU compute detiling shaders, upload integration, and bit-exactness tests.
Decodere commented 2026-12-02 08:41:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T08:41:59Z.


Diff review (head d2a7bdba3, read-only code review — not a #3041 merge-check):

The GF(2) compute-detiling math (gpu_detile_tables ox/oy/hx/hy/oz/hz, partial dirty-rect pitch/cols/span, mip-tail offsets, and the cs_5_0 hlsl_packed/hlsl_direct shaders) checks out cleanly against tiling.rs::offset_z. Two lifetime/concurrency hazards should be resolved before enabling this by default:

  1. [HIGH] Device leak and ABA pointer-reuse UB in gpu_detile::of(dev) (crates/xcl/src/hle/d3d12x/gpu_detile.rs:333-358):
    MADE: Mutex<Vec<(usize, Option<Arc<GpuDetile>>)>> caches up to 8 (dev.as_raw() as usize, GpuDetile) entries permanently with no cleanup hook on device destruction. Each GpuDetile owns an ID3D12RootSignature and 5 ID3D12PipelineState objects, pinning up to 8 ID3D12Device instances alive until process exit; worse, if a device is destroyed/evicted and a new ID3D12Device is allocated at the same raw address (ABA), of(dev) returns PSOs/RS created on the dead device. Wiring a forget_device(dev: usize) cleanup hook on device release (matching other D3D12.X caches) closes both the leak and ABA hazard.

  2. [HIGH] Async direct-UMA read race when XCL_GPU_DETILE_DIRECT=1 (currently default ON) (crates/xcl/src/hle/d3d12x/gpu_detile.rs:193-199, crates/xcl/src/hle/d3d12x/texture_upload.rs:1048-1115, crates/xcl/src/hle/d3d12x/title_textures.rs:2658-2889):
    Previously, texture_upload::submit synchronously copied and detiled texels from the title's UMA memory into the staging upload buffer before returning. With direct_va enabled by default, stage_with_gpu_detile performs zero CPU copy for committed coherent UMA textures and submits an asynchronous compute Dispatch (including on XCL's separate OWN_UPLOADS queue) that reads live UMA memory directly, returning while the Dispatch is still queued/in-flight. Any CPU-thread overwrite or buffer reuse of that coherent UMA memory before the upload fence completes will tear/corrupt the uploaded texture. Either defaulting XCL_GPU_DETILE_DIRECT off (until CPU-write synchronization is guaranteed) or fencing/copying mutable staging sources avoids silent texture corruption.

  3. [Scope] Diff size (+1123/-19) & default-ON cross-GPU coverage:
    Since the PR is >800 lines and turns both XCL_GPU_DETILE and XCL_GPU_DETILE_DIRECT on by default across all vendors while tested only on NVIDIA + WARP so far, splitting direct-UMA reading into a small follow-up PR (after verifying packed GPU detile across NVIDIA + AMD/Wine) would reduce risk and keep each PR under the 800-line guideline.

AI use: Antigravity (Gemini 4 Neon) audited the full diff against main and drafted this review.

<!-- greyfinch-sync:ivall/xcl:comment:7339806964 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7339806964). Originally posted by [Decodere](https://github.com/Decodere) on 2026-12-02T08:41:59Z. --- Diff review (head `d2a7bdba3`, read-only code review — not a `#3041` merge-check): The GF(2) compute-detiling math (`gpu_detile_tables` `ox/oy/hx/hy/oz/hz`, partial dirty-rect `pitch`/`cols`/`span`, mip-tail offsets, and the `cs_5_0` `hlsl_packed`/`hlsl_direct` shaders) checks out cleanly against `tiling.rs::offset_z`. Two lifetime/concurrency hazards should be resolved before enabling this by default: 1. **[HIGH] Device leak and ABA pointer-reuse UB in `gpu_detile::of(dev)`** (`crates/xcl/src/hle/d3d12x/gpu_detile.rs:333-358`): `MADE: Mutex<Vec<(usize, Option<Arc<GpuDetile>>)>>` caches up to 8 `(dev.as_raw() as usize, GpuDetile)` entries permanently with no cleanup hook on device destruction. Each `GpuDetile` owns an `ID3D12RootSignature` and 5 `ID3D12PipelineState` objects, pinning up to 8 `ID3D12Device` instances alive until process exit; worse, if a device is destroyed/evicted and a new `ID3D12Device` is allocated at the same raw address (ABA), `of(dev)` returns PSOs/RS created on the dead device. Wiring a `forget_device(dev: usize)` cleanup hook on device release (matching other D3D12.X caches) closes both the leak and ABA hazard. 2. **[HIGH] Async direct-UMA read race when `XCL_GPU_DETILE_DIRECT=1` (currently default ON)** (`crates/xcl/src/hle/d3d12x/gpu_detile.rs:193-199`, `crates/xcl/src/hle/d3d12x/texture_upload.rs:1048-1115`, `crates/xcl/src/hle/d3d12x/title_textures.rs:2658-2889`): Previously, `texture_upload::submit` synchronously copied and detiled texels from the title's UMA memory into the staging upload buffer before returning. With `direct_va` enabled by default, `stage_with_gpu_detile` performs zero CPU copy for committed coherent UMA textures and submits an asynchronous compute `Dispatch` (including on XCL's separate `OWN_UPLOADS` queue) that reads live UMA memory directly, returning while the `Dispatch` is still queued/in-flight. Any CPU-thread overwrite or buffer reuse of that coherent UMA memory before the upload fence completes will tear/corrupt the uploaded texture. Either defaulting `XCL_GPU_DETILE_DIRECT` off (until CPU-write synchronization is guaranteed) or fencing/copying mutable staging sources avoids silent texture corruption. 3. **[Scope] Diff size (`+1123/-19`) & default-ON cross-GPU coverage**: Since the PR is >800 lines and turns both `XCL_GPU_DETILE` and `XCL_GPU_DETILE_DIRECT` on by default across all vendors while tested only on NVIDIA + WARP so far, splitting direct-UMA reading into a small follow-up PR (after verifying packed GPU detile across NVIDIA + AMD/Wine) would reduce risk and keep each PR under the 800-line guideline. AI use: Antigravity (Gemini 4 Neon) audited the full diff against `main` and drafted this review.
Foniass commented 2026-12-02 08:46:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T08:46:13Z.


Review (head d2a7bdba, diff read, not a merge-check):

  • The detile scratch is not counted in the in-flight cap. title_textures.rs ~2689 adds f.bytes to the queue's in-flight bytes, and Job.bytes is only the UPLOAD buffer. On the GPU path that buffer holds the tables plus any copied raw blocks, so a batch of direct pieces is about BUFFER_MIN (1 MiB) (texture_upload.rs ~1067, take(dev, plan.upload_bytes)). Each job also holds a DEFAULT-heap detile_buf the size of the batch's linear texels (ensure_detile_buf ~879). So IN_FLIGHT_BYTES / IN_FLIGHT_MAX no longer limit what is in flight: up to about 2048 jobs, each with its own VRAM scratch. take() picks a pooled job by upload size only, and the pool keeps 64 MiB of scratch. A large batch therefore makes a new committed DEFAULT buffer on the submitting thread. The smoke block reports commit, not VRAM.
  • The production direct path is not tested. Both GPU tests pass their own direct closures to stage_with_gpu_detile, so gpu_detile::direct_va (uma_device() check, in_committed_window, uma_va_of onto the real window buffers) never runs with a positive result. The "device guard" assertion (texture_upload.rs ~1774, direct_va(&dev, bc7_src, ..) == None) cannot fail: bc7_src is a VirtualAlloc outside every UMA window, so in_committed_window or existing() returns None before the device is compared.
  • When the source is read changes; the description does not say so. Before, the PC texture got the bytes the CPU copied at submit. Now a direct piece gets whatever the window holds when the GPU runs the list. On XCL's own queue (when the title's queue takes no internal work) that can be well after submit. The pages are then forgotten (Hashes::forget ~633). A later write is still uploaded, but every write-watch hit on those pages now re-uploads with no hash comparison. That is a cost the throughput table cannot show: the table measures CPU staging cycles only, not the GPU time of the up to 118 dispatches.
  • Size: 1123 lines in one commit, and the description gives no reason it cannot be split (CONTRIBUTING: over ~800 lines it must). It splits cleanly: gpu_detile_tables plus the gpu_detile module and its tests, not called yet; staged GPU detiling in submit(); direct UMA reads; and the benches/formats.rs detile_blocks bench. The bench measures the CPU detile_blocks path and is unrelated to the GPU change.

Fine: the swizzle math matches Layout::offset_z / detile_blocks (same ox/oy/hx/hy, slice oz^hz^base_xor, power-of-two masks enforced in eligible). Direct reads stay inside span ((rows-1)*pitch+cols blocks, block stride matching block_at), and committed, non-shadowed windows are required. The scratch barriers (COMMON→UAV→COPY_SOURCE→COMMON) are right. Every failure (no PSO, no scratch, size overflow) falls back to the CPU path. Both switches are on by default. Merges cleanly with #3653 / #3662 / #3665: their new trailing view windows are not committed windows, so textures there keep the copy path.

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

<!-- greyfinch-sync:ivall/xcl:comment:7339902907 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7339902907). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T08:46:13Z. --- Review (head d2a7bdba, diff read, not a merge-check): - **The detile scratch is not counted in the in-flight cap.** `title_textures.rs ~2689` adds `f.bytes` to the queue's in-flight bytes, and `Job.bytes` is only the UPLOAD buffer. On the GPU path that buffer holds the tables plus any copied raw blocks, so a batch of direct pieces is about `BUFFER_MIN` (1 MiB) (`texture_upload.rs ~1067`, `take(dev, plan.upload_bytes)`). Each job also holds a DEFAULT-heap `detile_buf` the size of the batch's linear texels (`ensure_detile_buf ~879`). So `IN_FLIGHT_BYTES` / `IN_FLIGHT_MAX` no longer limit what is in flight: up to about 2048 jobs, each with its own VRAM scratch. `take()` picks a pooled job by upload size only, and the pool keeps 64 MiB of scratch. A large batch therefore makes a new committed DEFAULT buffer on the submitting thread. The smoke block reports commit, not VRAM. - **The production direct path is not tested.** Both GPU tests pass their own `direct` closures to `stage_with_gpu_detile`, so `gpu_detile::direct_va` (`uma_device()` check, `in_committed_window`, `uma_va_of` onto the real window buffers) never runs with a positive result. The "device guard" assertion (`texture_upload.rs ~1774`, `direct_va(&dev, bc7_src, ..) == None`) cannot fail: `bc7_src` is a `VirtualAlloc` outside every UMA window, so `in_committed_window` or `existing()` returns None before the device is compared. - **When the source is read changes; the description does not say so.** Before, the PC texture got the bytes the CPU copied at submit. Now a direct piece gets whatever the window holds when the GPU runs the list. On XCL's own queue (when the title's queue takes no internal work) that can be well after submit. The pages are then forgotten (`Hashes::forget ~633`). A later write is still uploaded, but every write-watch hit on those pages now re-uploads with no hash comparison. That is a cost the throughput table cannot show: the table measures CPU staging cycles only, not the GPU time of the up to 118 dispatches. - **Size: 1123 lines in one commit, and the description gives no reason it cannot be split** (CONTRIBUTING: over ~800 lines it must). It splits cleanly: `gpu_detile_tables` plus the `gpu_detile` module and its tests, not called yet; staged GPU detiling in `submit()`; direct UMA reads; and the `benches/formats.rs` `detile_blocks` bench. The bench measures the CPU `detile_blocks` path and is unrelated to the GPU change. Fine: the swizzle math matches `Layout::offset_z` / `detile_blocks` (same `ox/oy/hx/hy`, slice `oz^hz^base_xor`, power-of-two masks enforced in `eligible`). Direct reads stay inside `span` (`(rows-1)*pitch+cols` blocks, block stride matching `block_at`), and committed, non-shadowed windows are required. The scratch barriers (COMMON→UAV→COPY_SOURCE→COMMON) are right. Every failure (no PSO, no scratch, size overflow) falls back to the CPU path. Both switches are on by default. Merges cleanly with #3653 / #3662 / #3665: their new trailing view windows are not committed windows, so textures there keep the copy path. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-02 10:46:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T10:46:14Z.


merge-check
base: 1c8b551475
head: d2a7bdba3b
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2915 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7339902907 and its findings stand. Most serious: the VRAM scratch for detiling isn't counted in the in-flight cap, and the real direct path has no test.
performance: 60 s smoke of a retail title, main 1c8b5514 vs this merge (d2a7bdba): 1652 -> 1426 frames shown (86 %; last presents per 2 s: 60 60 60), peak commit 18228 -> 18099 MB, 0 device removals, 0 crashes. This run is lower than most today: the PC was in use at the time (a browser and Discord running), and main's own runs on this machine today ranged from 1370 to 1652 frames, so the difference isn't clearly from this PR.
verdict: not yet: the VRAM scratch for detiling isn't counted in the in-flight cap, and the real direct path has no test (see the review)
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:7342955346 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7342955346). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T10:46:14Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: d2a7bdba3b81396bae98df5d25f797bf8fab66db merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2915 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: read by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7339902907 and its findings stand. Most serious: the VRAM scratch for detiling isn't counted in the in-flight cap, and the real direct path has no test. performance: 60 s smoke of a retail title, main 1c8b5514 vs this merge (d2a7bdba): 1652 -> 1426 frames shown (86 %; last presents per 2 s: 60 60 60), peak commit 18228 -> 18099 MB, 0 device removals, 0 crashes. This run is lower than most today: the PC was in use at the time (a browser and Discord running), and main's own runs on this machine today ranged from 1370 to 1652 frames, so the difference isn't clearly from this PR. verdict: not yet: the VRAM scratch for detiling isn't counted in the in-flight cap, and the real direct path has no test (see the review) 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.
Kalmarv commented 2026-12-02 14:57:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T14:57:02Z.


Rebased onto origin/main (5eaadb54c) and updated to 5d0b81e4a addressing all points from @Decodere and @Foniass:

  1. Device leak & ABA eviction in gpu_detile::of (@Decodere #1): Wired gpu_detile::take_device / forget_device into ID3D12Device::Release (real::dev_release via release_taking_first in overrides(Kind::Device)) so cached root signatures and PSOs are evicted before IUnknown::Release can free or reuse the device address. Covered by gpu_detile::tests::forget_device_evicts_cached_entry and real::heap_release_order_tests::device_release_evicts_gpu_detile_before_address_reuse.
  2. In-flight VRAM scratch accounting & pool selection (@Foniass #1): Made Job.bytes private and added Job::in_flight_bytes() (bytes + detile_bytes), used by title_textures.rs (submit_on / reclaim) so IN_FLIGHT_BYTES / IN_FLIGHT_MAX bound both UPLOAD staging and DEFAULT detile scratch. Updated take(dev, bytes, detile_bytes) to prefer pooled jobs whose detile_buf already fits detile_bytes (or jobs without a detile_buf when detile_bytes == 0).
  3. XCL_GPU_DETILE_DIRECT defaulted OFF & read-timing/hash-forget semantics documented (@Decodere #2, @Foniass #3): XCL_GPU_DETILE_DIRECT now requires explicit =1 opt-in; default (XCL_GPU_DETILE=1, XCL_GPU_DETILE_DIRECT=0) uses staged packed GPU detiling, copying raw blocks and hashing pages at submit so source-read timing and known-page deduplication match CPU detiling. The PR description and gpu_detile.rs doc comments state the live-read timing and Hashes::forget re-upload tradeoff of opt-in XCL_GPU_DETILE_DIRECT=1.
  4. Real committed UMA test of gpu_detile::direct_va and production submit() (@Foniass #2): Replaced the VirtualAlloc assertion with isolated subprocess test gpu_detile_direct_va_uses_real_uma_window_and_rejects_other_device (XCL_GPU_DETILE_DIRECT=1), which opens a real committed coherent UMA window via real::open_uma_for_test, asserts positive direct_va(&dev, src, len) == Some(uma_va_of(src)), asserts wrong-device rejection on that exact committed UMA address, checks alignment/OOB rejection, and executes production texture_upload::submit() over a 9-mip BC7 chain (incl. mip tail) with DISPATCHES delta == 9, in_flight_bytes() == bytes + detile_bytes, and bit-exact readback.
  5. Scope & unrelated bench hunk (@Foniass #4, @Decodere #3): Dropped the unrelated crates/xcl/benches/formats.rs change and added a size justification to the PR description (~560 lines runtime + ~740 lines tests, with direct UMA opt-in).

Re-verified on RTX 5070 Ti + WARP (cargo build --release -p xcl: 39 lib warnings, 0 new; scripts/test.ps1 with DXC 1.9: 2983 passed / 0 failed / 52 ignored / 24 SKIPPED [22 no wave64, 2 no heap windows]; clean 60 s smoke vs 5eaadb54c: 1657 vs 1698 frames, 61 61 60 presents/2s, 0 removals, 0 crashes, 17593 vs 15798 MB commit).

AI use: Antigravity (Gemini 4 Neon) implemented these review fixes, ran the tests and smoke, and drafted this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7349423962 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7349423962). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-12-02T14:57:02Z. --- Rebased onto `origin/main` (`5eaadb54c`) and updated to `5d0b81e4a` addressing all points from @Decodere and @Foniass: 1. **Device leak & ABA eviction in `gpu_detile::of` (@Decodere #1):** Wired `gpu_detile::take_device` / `forget_device` into `ID3D12Device::Release` (`real::dev_release` via `release_taking_first` in `overrides(Kind::Device)`) so cached root signatures and PSOs are evicted before `IUnknown::Release` can free or reuse the device address. Covered by `gpu_detile::tests::forget_device_evicts_cached_entry` and `real::heap_release_order_tests::device_release_evicts_gpu_detile_before_address_reuse`. 2. **In-flight VRAM scratch accounting & pool selection (@Foniass #1):** Made `Job.bytes` private and added `Job::in_flight_bytes()` (`bytes + detile_bytes`), used by `title_textures.rs` (`submit_on` / `reclaim`) so `IN_FLIGHT_BYTES` / `IN_FLIGHT_MAX` bound both UPLOAD staging and DEFAULT detile scratch. Updated `take(dev, bytes, detile_bytes)` to prefer pooled jobs whose `detile_buf` already fits `detile_bytes` (or jobs without a `detile_buf` when `detile_bytes == 0`). 3. **`XCL_GPU_DETILE_DIRECT` defaulted OFF & read-timing/hash-forget semantics documented (@Decodere #2, @Foniass #3):** `XCL_GPU_DETILE_DIRECT` now requires explicit `=1` opt-in; default (`XCL_GPU_DETILE=1`, `XCL_GPU_DETILE_DIRECT=0`) uses staged packed GPU detiling, copying raw blocks and hashing pages at submit so source-read timing and `known`-page deduplication match CPU detiling. The PR description and `gpu_detile.rs` doc comments state the live-read timing and `Hashes::forget` re-upload tradeoff of opt-in `XCL_GPU_DETILE_DIRECT=1`. 4. **Real committed UMA test of `gpu_detile::direct_va` and production `submit()` (@Foniass #2):** Replaced the `VirtualAlloc` assertion with isolated subprocess test `gpu_detile_direct_va_uses_real_uma_window_and_rejects_other_device` (`XCL_GPU_DETILE_DIRECT=1`), which opens a real committed coherent UMA window via `real::open_uma_for_test`, asserts positive `direct_va(&dev, src, len) == Some(uma_va_of(src))`, asserts wrong-device rejection on that exact committed UMA address, checks alignment/OOB rejection, and executes production `texture_upload::submit()` over a 9-mip BC7 chain (incl. mip tail) with `DISPATCHES` delta == 9, `in_flight_bytes() == bytes + detile_bytes`, and bit-exact readback. 5. **Scope & unrelated bench hunk (@Foniass #4, @Decodere #3):** Dropped the unrelated `crates/xcl/benches/formats.rs` change and added a size justification to the PR description (~560 lines runtime + ~740 lines tests, with direct UMA opt-in). Re-verified on RTX 5070 Ti + WARP (`cargo build --release -p xcl`: 39 lib warnings, 0 new; `scripts/test.ps1` with DXC 1.9: 2983 passed / 0 failed / 52 ignored / 24 `SKIPPED` [22 `no wave64`, 2 `no heap windows`]; clean 60 s smoke vs `5eaadb54c`: 1657 vs 1698 frames, `61 61 60` presents/2s, 0 removals, 0 crashes, 17593 vs 15798 MB commit). AI use: Antigravity (Gemini 4 Neon) implemented these review fixes, ran the tests and smoke, and drafted this reply.
Foniass commented 2026-12-02 18:01:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T18:01:56Z.


merge-check
base: 5eaadb54c1
head: 5d0b81e4a9
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2983 passed, 0 failed, 52 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: follow-up on 5d0b81e4 (reworked and rebased from d2a7bdba, my last review's head). Now one commit of +1298/-26 in 6 files; the benches/formats.rs hunk is gone. Reading straight from the UMA window is now opt-in (XCL_GPU_DETILE_DIRECT=1); the default path copies the raw tiled blocks into the upload buffer (hashing them on the CPU), then detiles them on the GPU for pieces of at least 256 KiB. A pooled DEFAULT-heap scratch buffer is counted through Job::in_flight_bytes(), ID3D12Device::Release gets a hook to evict the per-device pipeline cache, and a child-process test covers direct_va and submit() on a real committed window. Earlier findings: (1) scratch missing from the in-flight cap: fixed (title_textures.rs ~2620 / ~2705 add and subtract in_flight_bytes()); a large batch still creates a committed DEFAULT buffer on the submitting thread (ensure_detile_buf, texture_upload.rs ~886). (2) the direct path untested: fixed (gpu_detile_direct_va_uses_real_uma_window_and_rejects_other_device, ~1735). (3) source-read timing not stated: fixed for the default path. (4) size: partly fixed; the bench is dropped and there's a size note, but it says only that the parts were kept together, its "~560 lines of runtime code" is about 785 by count, and the opt-in direct path (direct_va*, uma_device, open_uma_for_test, Hashes::forget, the direct branches, two GPU tests) is still a separable second PR. New: (a) GPU detiling is on by default for every title with no measured benefit: the throughput harness prints CPU cycles only, the dispatches' GPU time isn't measured, and the PR's own smoke shows 97.6 % frames and peak commit 15798 -> 17593 MB (111.4 %), unexplained; the default path also needs a DEFAULT scratch buffer the size of the linear data on top of the upload buffer. (b) The dev_release hook (real.rs ~4835) runs on every device Release and evicts only when release_taking_first sees the last reference, which device children likely never allow on a real device; the ABA protection is shown only on a fake refcounted object (~15409). (c) The first eligible upload compiles five cs_5_0 shaders with D3DCompile inside own_work on the submitting thread (gpu_detile.rs ~366), a one-time stall on the title's thread. (d) take() with detile_bytes > 0 (texture_upload.rs ~926) ranks by scratch fit before upload size, so a small GPU batch can take the largest pooled upload buffer. Fine: the swizzle math matches offset_z / detile_blocks; RawBlocks reads the same block runs as Work::Blocks and notes their pages the same way; the scratch barriers are right; every failure falls back to the CPU path; the default path is checked bit-exact for R8 / R16 / RG8 / RGBA8 / BC1 / BC7 in the four 64 KiB modes.
performance: 60 s smoke of a retail title, main 5eaadb54 vs this merge (5d0b81e4): 1422 -> 1675 frames shown (117 %; last presents per 2 s: 60 60 61), peak commit 17184 -> 16410 MB, 0 device removals, 0 crashes.
verdict: not yet: GPU detiling is now on by default for every title with no measured benefit (its own smoke shows 97.6 % frames and +1.8 GB peak commit), bundled with the separable opt-in direct-UMA path in a 1298-line PR (see the review)
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:7353877475 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7353877475). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T18:01:56Z. --- merge-check base: 5eaadb54c14e0fc29597b2a1689d7dbd83491303 head: 5d0b81e4a90c1c354af3a890767a5ea359feb98e merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2983 passed, 0 failed, 52 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: follow-up on 5d0b81e4 (reworked and rebased from d2a7bdba, my last review's head). Now one commit of +1298/-26 in 6 files; the `benches/formats.rs` hunk is gone. Reading straight from the UMA window is now opt-in (`XCL_GPU_DETILE_DIRECT=1`); the default path copies the raw tiled blocks into the upload buffer (hashing them on the CPU), then detiles them on the GPU for pieces of at least 256 KiB. A pooled DEFAULT-heap scratch buffer is counted through `Job::in_flight_bytes()`, `ID3D12Device::Release` gets a hook to evict the per-device pipeline cache, and a child-process test covers `direct_va` and `submit()` on a real committed window. Earlier findings: (1) scratch missing from the in-flight cap: fixed (`title_textures.rs` ~2620 / ~2705 add and subtract `in_flight_bytes()`); a large batch still creates a committed DEFAULT buffer on the submitting thread (`ensure_detile_buf`, `texture_upload.rs` ~886). (2) the direct path untested: fixed (`gpu_detile_direct_va_uses_real_uma_window_and_rejects_other_device`, ~1735). (3) source-read timing not stated: fixed for the default path. (4) size: partly fixed; the bench is dropped and there's a size note, but it says only that the parts were kept together, its "~560 lines of runtime code" is about 785 by count, and the opt-in direct path (`direct_va*`, `uma_device`, `open_uma_for_test`, `Hashes::forget`, the `direct` branches, two GPU tests) is still a separable second PR. New: (a) **GPU detiling is on by default for every title with no measured benefit**: the throughput harness prints CPU cycles only, the dispatches' GPU time isn't measured, and the PR's own smoke shows 97.6 % frames and peak commit 15798 -> 17593 MB (111.4 %), unexplained; the default path also needs a DEFAULT scratch buffer the size of the linear data on top of the upload buffer. (b) The `dev_release` hook (`real.rs` ~4835) runs on every device Release and evicts only when `release_taking_first` sees the last reference, which device children likely never allow on a real device; the ABA protection is shown only on a fake refcounted object (~15409). (c) The first eligible upload compiles five `cs_5_0` shaders with `D3DCompile` inside `own_work` on the submitting thread (`gpu_detile.rs` ~366), a one-time stall on the title's thread. (d) `take()` with `detile_bytes > 0` (`texture_upload.rs` ~926) ranks by scratch fit before upload size, so a small GPU batch can take the largest pooled upload buffer. Fine: the swizzle math matches `offset_z` / `detile_blocks`; `RawBlocks` reads the same block runs as `Work::Blocks` and notes their pages the same way; the scratch barriers are right; every failure falls back to the CPU path; the default path is checked bit-exact for R8 / R16 / RG8 / RGBA8 / BC1 / BC7 in the four 64 KiB modes. performance: 60 s smoke of a retail title, main 5eaadb54 vs this merge (5d0b81e4): 1422 -> 1675 frames shown (117 %; last presents per 2 s: 60 60 61), peak commit 17184 -> 16410 MB, 0 device removals, 0 crashes. verdict: not yet: GPU detiling is now on by default for every title with no measured benefit (its own smoke shows 97.6 % frames and +1.8 GB peak commit), bundled with the separable opt-in direct-UMA path in a 1298-line PR (see the review) 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.
bmjask commented 2026-12-02 18:26:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:26:44Z.

Review: COMMENTED


Review of 5d0b81e4: 1 finding(s) (1 medium), most severe first.

  1. Medium crates/xcl/src/hle/d3d12x/real.rs:4837: Not certain about this one, because it depends on D3D12 device children holding a reference on their device: the new dev_release hook probably never evicts the gpu_detile cache for a real device. (inline)

These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.

<!-- greyfinch-sync:ivall/xcl:review:6156471547 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#pullrequestreview-6156471547). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T18:26:44Z. **Review:** COMMENTED --- Review of `5d0b81e4`: 1 finding(s) (1 medium), most severe first. 1. **Medium** `crates/xcl/src/hle/d3d12x/real.rs:4837`: Not certain about this one, because it depends on D3D12 device children holding a reference on their device: the new `dev_release` hook probably never evicts the gpu_detile cache for a real device. (inline) --- _These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it._
bmjask commented 2026-12-02 18:26:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:26:45Z.

Code review location: crates/xcl/src/hle/d3d12x/real.rs; line 4837

@@ -4821,6 +4832,12 @@ fn heap_block(heap: usize) -> Option<(usize, bool)> {
     Some((p, cpu_readback))
 }
 
+/// ID3D12Device::Release: evict per-device GPU detile pipelines before the final Release frees the
+/// address (preventing both device leaks and ABA reuse).
+unsafe extern "system" fn dev_release(this: *mut c_void) -> u32 {

Medium: Not certain about this one, because it depends on D3D12 device children holding a reference on their device: the new dev_release hook probably never evicts the gpu_detile cache for a real device. The cached root signature and five PSOs are device children, so while the entry exists the device refcount never drops to the value the AddRef probe looks for. After one large GPU-detiled upload, the title's final Release leaves the device, its PSOs and the MADE slot alive for the life of the process (up to 8 devices before FIFO eviction). If children don't hold that reference, the opposite problem appears: release_taking_first drops the taken PSOs in after only after the final Release has already freed the device. The unit test uses a fake object with no child references, so it can't tell the two apart. Evicting from an explicit device-teardown point, or holding the cache by weak/private-data association, would avoid both.

<!-- greyfinch-sync:ivall/xcl:review-comment:4773980300 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#discussion_r4773980300). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T18:26:45Z. **Code review location:** `crates/xcl/src/hle/d3d12x/real.rs`; line 4837 ~~~~diff @@ -4821,6 +4832,12 @@ fn heap_block(heap: usize) -> Option<(usize, bool)> { Some((p, cpu_readback)) } +/// ID3D12Device::Release: evict per-device GPU detile pipelines before the final Release frees the +/// address (preventing both device leaks and ABA reuse). +unsafe extern "system" fn dev_release(this: *mut c_void) -> u32 { ~~~~ --- **Medium**: Not certain about this one, because it depends on D3D12 device children holding a reference on their device: the new `dev_release` hook probably never evicts the gpu_detile cache for a real device. The cached root signature and five PSOs are device children, so while the entry exists the device refcount never drops to the value the AddRef probe looks for. After one large GPU-detiled upload, the title's final Release leaves the device, its PSOs and the MADE slot alive for the life of the process (up to 8 devices before FIFO eviction). If children don't hold that reference, the opposite problem appears: `release_taking_first` drops the taken PSOs in `after` only after the final Release has already freed the device. The unit test uses a fake object with no child references, so it can't tell the two apart. Evicting from an explicit device-teardown point, or holding the cache by weak/private-data association, would avoid both.
bmjask commented 2026-12-02 18:26:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:26:46Z.


@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.

<!-- greyfinch-sync:ivall/xcl:comment:7354596371 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7354596371). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T18:26:46Z. --- @Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Kalmarv commented 2026-12-02 18:41:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T18:41:13Z.


Thanks @Foniass and @bmjask for the thorough reviews — reworked and rebased onto origin/main (817eb1fc9) as 72a12a04f (+781 / -34 across 5 files: +595 / -33 runtime, +186 / -1 tests):

  • Split out the direct-UMA path (direct_va*, uma_device, open_uma_for_test, Hashes::forget, direct branches and direct GPU tests) for a separate follow-up PR so this PR covers staged GPU compute detiling only and stays cleanly scoped.
  • Defaulted XCL_GPU_DETILE OFF (opt-in XCL_GPU_DETILE=1) until end-to-end GPU-time vs CPU-time gains are measured on heavy streaming workloads.
  • Fixed device/pipeline lifetime (@Foniass (b) & @bmjask real.rs:4837): removed the global MADE cache and the dev_release hook completely (crates/xcl/src/hle/d3d12x/real.rs is untouched vs main). Each upload queue now owns its gpu_detile::Slot directly inside title_textures::QueueUploads and drops it in title_textures::forget_queue.
  • Fixed submitting-thread init stall (@Foniass (c)): moved both device-independent D3DCompile + D3D12SerializeRootSignature and per-queue CreateRootSignature + 5× CreateComputePipelineState onto background thread xcl-gpu-detile-init, falling back transparently to CPU detiling until ready (slot_poll_is_non_blocking_until_background_init_finishes). (Testing XCL_GPU_DETILE=1 during the initial smoke caught that CreateComputePipelineState alone contended with startup background PSO compiles for 12.3 s when left on the submitting thread; moving PSO creation off-thread too eliminated the stall completely.)
  • Fixed take() pool ranking (@Foniass (d)): pool_rank now ranks pooled jobs by smallest fitting upload buffer first and tie-breaks on detile scratch fit, with unit test take_ranks_upload_size_before_scratch_fit.

Verification on 72a12a04f (RTX 5070 Ti, driver 32.0.16.1074, Ryzen 9 9950X, Windows 11 x64, rustc 1.99.0, DXC 1.9.2609):

  • cargo build --release -p xcl: ok (39 pre-existing warnings, 0 new).
  • .\scripts\test.ps1: 3010 passed, 0 failed, 52 ignored; 24 SKIPPED (22 no wave64, 2 no heap windows; 0 DXC skips), plus targeted WARP gpu_detile_matches_xg_for_all_element_sizes_and_64k_modes pass.
  • Paired 60 s smokes (title: ea3b5e4d, main 5eaadb54c: 1698 frames, 15798 MB peak commit):
    • Default (XCL_GPU_DETILE unset): 1696 frames (99.9%), 60 60 60, 0 removals, 0 crashes, 17246 MB peak commit.
    • Opt-in (XCL_GPU_DETILE=1): 1697 frames (99.9%), 60 61 60, 0 removals, 0 crashes, 17256 MB peak commit (GPU compute detiling active at 5.2 s, 0 Present stalls).

Ready for re-check. (Update authored with Antigravity, Gemini 4 Neon.)

<!-- greyfinch-sync:ivall/xcl:comment:7354995553 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7354995553). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-12-02T18:41:13Z. --- Thanks @Foniass and @bmjask for the thorough reviews — reworked and rebased onto `origin/main` (`817eb1fc9`) as `72a12a04f` (`+781 / -34` across 5 files: `+595 / -33` runtime, `+186 / -1` tests): - **Split out the direct-UMA path** (`direct_va*`, `uma_device`, `open_uma_for_test`, `Hashes::forget`, direct branches and direct GPU tests) for a separate follow-up PR so this PR covers staged GPU compute detiling only and stays cleanly scoped. - **Defaulted `XCL_GPU_DETILE` OFF** (opt-in `XCL_GPU_DETILE=1`) until end-to-end GPU-time vs CPU-time gains are measured on heavy streaming workloads. - **Fixed device/pipeline lifetime (`@Foniass` (b) & `@bmjask` `real.rs:4837`)**: removed the global `MADE` cache and the `dev_release` hook completely (`crates/xcl/src/hle/d3d12x/real.rs` is untouched vs `main`). Each upload queue now owns its `gpu_detile::Slot` directly inside `title_textures::QueueUploads` and drops it in `title_textures::forget_queue`. - **Fixed submitting-thread init stall (`@Foniass` (c))**: moved both device-independent `D3DCompile` + `D3D12SerializeRootSignature` and per-queue `CreateRootSignature` + 5× `CreateComputePipelineState` onto background thread `xcl-gpu-detile-init`, falling back transparently to CPU detiling until ready (`slot_poll_is_non_blocking_until_background_init_finishes`). (Testing `XCL_GPU_DETILE=1` during the initial smoke caught that `CreateComputePipelineState` alone contended with startup background PSO compiles for 12.3 s when left on the submitting thread; moving PSO creation off-thread too eliminated the stall completely.) - **Fixed `take()` pool ranking (`@Foniass` (d))**: `pool_rank` now ranks pooled jobs by smallest fitting upload buffer first and tie-breaks on detile scratch fit, with unit test `take_ranks_upload_size_before_scratch_fit`. Verification on `72a12a04f` (RTX 5070 Ti, driver `32.0.16.1074`, Ryzen 9 9950X, Windows 11 x64, `rustc 1.99.0`, DXC 1.9.2609): - `cargo build --release -p xcl`: ok (39 pre-existing warnings, 0 new). - `.\scripts\test.ps1`: **3010 passed, 0 failed, 52 ignored; 24 `SKIPPED`** (22 no wave64, 2 no heap windows; 0 DXC skips), plus targeted WARP `gpu_detile_matches_xg_for_all_element_sizes_and_64k_modes` pass. - Paired 60 s smokes (`title: ea3b5e4d`, `main` `5eaadb54c`: `1698` frames, `15798 MB` peak commit): - Default (`XCL_GPU_DETILE` unset): `1696` frames (`99.9%`), `60 60 60`, `0` removals, `0` crashes, `17246 MB` peak commit. - Opt-in (`XCL_GPU_DETILE=1`): `1697` frames (`99.9%`), `60 61 60`, `0` removals, `0` crashes, `17256 MB` peak commit (`GPU compute detiling active` at 5.2 s, 0 Present stalls). Ready for re-check. *(Update authored with Antigravity, Gemini 4 Neon.)*
jsalzy commented 2026-12-03 01:09:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jsalzy on 2026-12-03T01:09:41Z.


merge-check claim
head: 72a12a04f7

<!-- greyfinch-sync:ivall/xcl:comment:7364022490 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7364022490). Originally posted by [jsalzy](https://github.com/jsalzy) on 2026-12-03T01:09:41Z. --- merge-check claim head: 72a12a04f7d5c76375a715b865f640d9a8abdcf7
jsalzy commented 2026-12-03 01:16:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jsalzy on 2026-12-03T01:16:55Z.


merge-check
base: 078358a058
head: 72a12a04f7
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3012 passed, 0 failed, 52 ignored (44 test binaries); SKIPPED: 25 (22 no wave64 on this GPU; 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1); 1 driver cache cannot be disabled without Windows Developer Mode); failing: none. All 6 tests the PR adds ran and passed, gpu_detile_matches_xg_for_all_element_sizes_and_64k_modes on the RTX 4070 SUPER (not skipped). git diff --check clean; 39 compiler warnings, the same as main.
title run: not run
review: (1) Off by default, and the default path is unchanged: with XCL_GPU_DETILE unset, submit() passes no minimum, so no GPU plan is made and the Slot never starts its init thread. take() ranks by upload size alone when no pooled job has scratch (pool_rank reduces to (bytes, false, 0)), in_flight_bytes() equals bytes, and give_back's scratch trim does nothing. (2) With XCL_GPU_DETILE=1: when no pooled scratch fits, the batch's DEFAULT scratch buffer is created on the submitting thread (ensure_detile_buf, texture_upload.rs ~631); Foniass's earlier point, still the case. The benefit is unmeasured (the PR keeps it off for that reason), and no run with it on is reported here. (3) The bit-for-bit GPU test ran here on NVIDIA only; no AMD run here (the PR is gpu:both). (4) Open #3747 (same author) conflicts with this PR in texture_upload.rs and title_textures.rs (git merge-tree); whichever lands second has to adapt. Checked and fine: the compute shaders use the same GF(2) tables as Layout::offset_z (Layout::gpu_detile_tables, tiling.rs:254). The GPU test compares against xg's CPU detile bit for bit for 1/2/4/8/16-byte elements in four 64 KiB modes, including partial rectangles, array slices, page hashing and the CPU fallback. The 1- and 2-byte forms pack 4/E elements per dword and stay inside the 256-byte-aligned row pitch. eligible() keeps 3D textures, mip tails, non-power-of-two layouts and pieces over 4 GiB on the CPU. RawBlocks reads through the same read() and note() as the CPU path, so source-read timing and page hashing don't change. The scratch buffer goes COMMON -> UAV for the dispatches, UAV -> COPY_SOURCE before the copies and back to COMMON after, and it counts against the in-flight cap. D3DCompile and PSO creation run on the xcl-gpu-detile-init thread, and uploads stay on the CPU path until it's ready. The Slot belongs to its upload queue and is dropped in forget_queue; real.rs is untouched. Duplicates: I searched open and merged PRs for GPU detile, compute detile, detiling compute shader, XCL_GPU_DETILE, gpu_detile, detile on the GPU, swizzled textures GPU and untile compute, and checked #1607's groups (none lists 3651). No open PR makes the same change. Closed #1513 (not merged) took the same approach (GPU detile into a scratch UAV, also behind XCL_GPU_DETILE).
performance: Default: no cost (reasoned: the feature is off and the default path is unchanged, review (1)). With XCL_GPU_DETILE=1 (not measured): a DEFAULT scratch buffer the size of the batch's linear data on top of the upload buffer, at most 64 MiB of it kept pooled (DETILE_FREE_BYTES), counted against the in-flight cap.
verdict: safe to merge: off by default with the default path unchanged, no blocking finding, and the suite passes, the bit-for-bit GPU test included. Its benefit when switched on is still unmeasured.
hardware / tool and model: RTX 4070 SUPER 12 GB (621.24 / 32.0.16.2124), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 25H2 26200.9974, Rust 1.100.0, debug / Claude app (Claude Opus 5.5): merge, build and suite run on this PC with git and cargo only; diff review by Claude Opus 5.5.

<!-- greyfinch-sync:ivall/xcl:comment:7364163601 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7364163601). Originally posted by [jsalzy](https://github.com/jsalzy) on 2026-12-03T01:16:55Z. --- merge-check base: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a head: 72a12a04f7d5c76375a715b865f640d9a8abdcf7 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3012 passed, 0 failed, 52 ignored (44 test binaries); SKIPPED: 25 (22 no wave64 on this GPU; 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1); 1 driver cache cannot be disabled without Windows Developer Mode); failing: none. All 6 tests the PR adds ran and passed, gpu_detile_matches_xg_for_all_element_sizes_and_64k_modes on the RTX 4070 SUPER (not skipped). git diff --check clean; 39 compiler warnings, the same as main. title run: not run review: (1) Off by default, and the default path is unchanged: with XCL_GPU_DETILE unset, submit() passes no minimum, so no GPU plan is made and the Slot never starts its init thread. take() ranks by upload size alone when no pooled job has scratch (pool_rank reduces to (bytes, false, 0)), in_flight_bytes() equals bytes, and give_back's scratch trim does nothing. (2) With XCL_GPU_DETILE=1: when no pooled scratch fits, the batch's DEFAULT scratch buffer is created on the submitting thread (ensure_detile_buf, texture_upload.rs ~631); Foniass's earlier point, still the case. The benefit is unmeasured (the PR keeps it off for that reason), and no run with it on is reported here. (3) The bit-for-bit GPU test ran here on NVIDIA only; no AMD run here (the PR is gpu:both). (4) Open #3747 (same author) conflicts with this PR in texture_upload.rs and title_textures.rs (git merge-tree); whichever lands second has to adapt. Checked and fine: the compute shaders use the same GF(2) tables as Layout::offset_z (Layout::gpu_detile_tables, tiling.rs:254). The GPU test compares against xg's CPU detile bit for bit for 1/2/4/8/16-byte elements in four 64 KiB modes, including partial rectangles, array slices, page hashing and the CPU fallback. The 1- and 2-byte forms pack 4/E elements per dword and stay inside the 256-byte-aligned row pitch. eligible() keeps 3D textures, mip tails, non-power-of-two layouts and pieces over 4 GiB on the CPU. RawBlocks reads through the same read() and note() as the CPU path, so source-read timing and page hashing don't change. The scratch buffer goes COMMON -> UAV for the dispatches, UAV -> COPY_SOURCE before the copies and back to COMMON after, and it counts against the in-flight cap. D3DCompile and PSO creation run on the xcl-gpu-detile-init thread, and uploads stay on the CPU path until it's ready. The Slot belongs to its upload queue and is dropped in forget_queue; real.rs is untouched. Duplicates: I searched open and merged PRs for GPU detile, compute detile, detiling compute shader, XCL_GPU_DETILE, gpu_detile, detile on the GPU, swizzled textures GPU and untile compute, and checked #1607's groups (none lists 3651). No open PR makes the same change. Closed #1513 (not merged) took the same approach (GPU detile into a scratch UAV, also behind XCL_GPU_DETILE). performance: Default: no cost (reasoned: the feature is off and the default path is unchanged, review (1)). With XCL_GPU_DETILE=1 (not measured): a DEFAULT scratch buffer the size of the batch's linear data on top of the upload buffer, at most 64 MiB of it kept pooled (DETILE_FREE_BYTES), counted against the in-flight cap. verdict: safe to merge: off by default with the default path unchanged, no blocking finding, and the suite passes, the bit-for-bit GPU test included. Its benefit when switched on is still unmeasured. hardware / tool and model: RTX 4070 SUPER 12 GB (621.24 / 32.0.16.2124), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 25H2 26200.9974, Rust 1.100.0, debug / Claude app (Claude Opus 5.5): merge, build and suite run on this PC with git and cargo only; diff review by Claude Opus 5.5.
Foniass commented 2026-12-03 10:55:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T10:55:14Z.


merge-check
base: 16c2fd082a
head: 72a12a04f7
merge: clean
build: ok
tests: 3018 passed, 0 failed, 56 ignored; 28 skipped, the same as on main
review: 1 medium, 3 nits (below)
performance: 60 s smoke run: 1683 → 1652 frames (98 % of main), peak commit 18505 → 18585 MB, no device removal, no crash
title run: retail title on the RTX 5070 Ti (driver 621.14), into the world by scripted presses: 232 s there, 0 device removals, 0 crashes, 2.8 presents/s; run with XCL_SKIP_CS=95cc13288a27a96e (the NVIDIA hang at the end of loading, #3541) and NVIDIA's 2048 MB shader heap (#2590)
verdict: safe to merge: no blocking finding (the points below are medium or nits), the suite passes and the smoke run is clean
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5


In short: Adds opt-in (XCL_GPU_DETILE=1) staged GPU compute detiling: raw tiled blocks are copied and hashed on the CPU, then detiled by cs_5_0 shaders into a pooled DEFAULT scratch buffer before CopyTextureRegion. The rework fixes my last merge-check's points: it is off by default, the direct-UMA path is split out, init runs off-thread, the pipelines belong to each queue, and the pool ranking is fixed. With the switch unset the default path is unchanged. Nothing blocks.

Medium

  1. Scratch buffer still made on the submitting thread (opt-in only). Still open from my last merge-check. With XCL_GPU_DETILE=1, a batch that no pooled job's scratch fits creates a committed DEFAULT buffer inside submit on the title's thread (ensure_detile_buf, texture_upload.rs ~866). This cost is unmeasured; the opt-in smoke run reports peak commit only. It matters before the switch is turned on by default.

Nit

  1. Size. 781 changed lines (595 runtime), over the ~400 target. The tiling tables and the gpu_detile module with its tests, not called yet, could have gone first, with the wiring in submit() after.
  2. New switches not in README. XCL_GPU_DETILE and XCL_GPU_DETILE_MIN_BYTES are opt-in user switches like others README lists.
  3. Conflicts with open #3747. Same author; a test merge conflicts in texture_upload.rs and title_textures.rs. Whichever lands second has to adapt.
Checked and fine
  • Earlier finding fixed: GPU detiling is now off by default (XCL_GPU_DETILE must be 1)
  • Earlier finding fixed: the direct-UMA path (direct_va, open_uma_for_test, Hashes::forget) is out of this PR, so source reads happen at submit as on the CPU path
  • Earlier finding fixed: the dev_release hook and the global per-device cache are gone; each QueueUploads owns its Slot and drops it in forget_queue
  • Earlier finding fixed: D3DCompile and PSO creation run on xcl-gpu-detile-init, and uploads stay on the CPU path until the Slot is ready
  • Earlier finding fixed: pool_rank ranks by smallest fitting upload buffer first, with take_ranks_upload_size_before_scratch_fit
  • Default path: with the switch unset there is no plan, the Slot stays Pending, pool_rank reduces to upload size, and in_flight_bytes equals bytes
  • The shaders use the same GF(2) tables as offset_z (gpu_detile_tables), eligible() keeps 3D, tails and non-power-of-two layouts on the CPU, and the GPU test is bit-exact for 1 to 16-byte elements in the four 64 KiB modes, including partial rects, array slices, page hashing and the CPU fallback
  • Scratch barriers go COMMON, UAV, COPY_SOURCE, COMMON; raw_at is 256-aligned and dst_at 512-aligned; a failed scratch allocation returns the job to the pool and falls back to the CPU path
How this was tested
  • Merged onto main 16c2fd08, then cargo build --workspace and cargo test --workspace --no-fail-fast -- --test-threads=4.
  • The skipped GPU tests are those this card can't run (no wave64 on NVIDIA, no D3D12 debug layer, and similar).
  • scripts/smoke.ps1: 60 s of a retail title on main 16c2fd08 and on this merge; presents per 2 s at the end: 60 60 60.
  • Title run: the release build of this merge launched the retail title with XCL_RUN_SECONDS=300 and scripted A presses counted from the first frame (XCL_PRESS_BASE=frame, #3712) into the world from an existing save; time in the world is counted from the first in-world draw call to the end of the run.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7375959711 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3651#issuecomment-7375959711). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T10:55:14Z. --- merge-check base: 16c2fd082ae2e96967a2ab553bc2e1032e491f70 head: 72a12a04f7d5c76375a715b865f640d9a8abdcf7 merge: clean build: ok tests: 3018 passed, 0 failed, 56 ignored; 28 skipped, the same as on main review: 1 medium, 3 nits (below) performance: 60 s smoke run: 1683 → 1652 frames (98 % of main), peak commit 18505 → 18585 MB, no device removal, no crash title run: retail title on the RTX 5070 Ti (driver 621.14), into the world by scripted presses: 232 s there, 0 device removals, 0 crashes, 2.8 presents/s; run with `XCL_SKIP_CS=95cc13288a27a96e` (the NVIDIA hang at the end of loading, #3541) and NVIDIA's 2048 MB shader heap (#2590) verdict: safe to merge: no blocking finding (the points below are medium or nits), the suite passes and the smoke run is clean hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 --- **In short:** Adds opt-in (XCL_GPU_DETILE=1) staged GPU compute detiling: raw tiled blocks are copied and hashed on the CPU, then detiled by cs_5_0 shaders into a pooled DEFAULT scratch buffer before CopyTextureRegion. The rework fixes my last merge-check's points: it is off by default, the direct-UMA path is split out, init runs off-thread, the pipelines belong to each queue, and the pool ranking is fixed. With the switch unset the default path is unchanged. Nothing blocks. #### Medium 1. **Scratch buffer still made on the submitting thread (opt-in only).** Still open from my last merge-check. With XCL_GPU_DETILE=1, a batch that no pooled job's scratch fits creates a committed DEFAULT buffer inside submit on the title's thread (ensure_detile_buf, texture_upload.rs ~866). This cost is unmeasured; the opt-in smoke run reports peak commit only. It matters before the switch is turned on by default. #### Nit 2. **Size.** 781 changed lines (595 runtime), over the ~400 target. The tiling tables and the gpu_detile module with its tests, not called yet, could have gone first, with the wiring in submit() after. 3. **New switches not in README.** XCL_GPU_DETILE and XCL_GPU_DETILE_MIN_BYTES are opt-in user switches like others README lists. 4. **Conflicts with open #3747.** Same author; a test merge conflicts in texture_upload.rs and title_textures.rs. Whichever lands second has to adapt. <details><summary>Checked and fine</summary> - Earlier finding fixed: GPU detiling is now off by default (XCL_GPU_DETILE must be 1) - Earlier finding fixed: the direct-UMA path (direct_va, open_uma_for_test, Hashes::forget) is out of this PR, so source reads happen at submit as on the CPU path - Earlier finding fixed: the dev_release hook and the global per-device cache are gone; each QueueUploads owns its Slot and drops it in forget_queue - Earlier finding fixed: D3DCompile and PSO creation run on xcl-gpu-detile-init, and uploads stay on the CPU path until the Slot is ready - Earlier finding fixed: pool_rank ranks by smallest fitting upload buffer first, with take_ranks_upload_size_before_scratch_fit - Default path: with the switch unset there is no plan, the Slot stays Pending, pool_rank reduces to upload size, and in_flight_bytes equals bytes - The shaders use the same GF(2) tables as offset_z (gpu_detile_tables), eligible() keeps 3D, tails and non-power-of-two layouts on the CPU, and the GPU test is bit-exact for 1 to 16-byte elements in the four 64 KiB modes, including partial rects, array slices, page hashing and the CPU fallback - Scratch barriers go COMMON, UAV, COPY_SOURCE, COMMON; raw_at is 256-aligned and dst_at 512-aligned; a failed scratch allocation returns the job to the pool and falls back to the CPU path </details> <details><summary>How this was tested</summary> - Merged onto main `16c2fd08`, then `cargo build --workspace` and `cargo test --workspace --no-fail-fast -- --test-threads=4`. - The skipped GPU tests are those this card can't run (no wave64 on NVIDIA, no D3D12 debug layer, and similar). - `scripts/smoke.ps1`: 60 s of a retail title on main `16c2fd08` and on this merge; presents per 2 s at the end: 60 60 60. - Title run: the release build of this merge launched the retail title with `XCL_RUN_SECONDS=300` and scripted A presses counted from the first frame (`XCL_PRESS_BASE=frame`, #3712) into the world from an existing save; time in the world is counted from the first in-world draw call to the end of the run. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
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/3651:upstream-pr/3651'
git switch 'upstream-pr/3651'

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