Tracking & Static Audit: 50 New Source-Level Bugs + 150 Prioritized Backlog Items [Part 1/3] #1488

Open
opened 2026-11-26 04:55:22 +00:00 by github-bot · 12 comments
Owner

@⁠hyperland956-lgtm on GitHub · 2026-11-24 16:51 UTC · original

Multi-Part Series (1/3): Part 1/3 (this issue) | Part 2/3: https://github.com/ivall/xcl/issues/1489 | Part 3/3: https://github.com/ivall/xcl/issues/1490

Tracking & Static Audit: 50 New Source-Level Bugs (D3D12.X Lifetime/Sync, Shader Recompiler, DirectStorage, XMA2, Tiling) + 150 Prioritized Backlog Items

Tracking & Audit Issue: This tracking issue groups 50 newly identified, non-duplicate source-level findings alongside a prioritized index of 150 existing canonical open issues/PRs (200 total work items) to help contributors pick up high-impact, separable fixes without opening duplicates.

Scope, Testing & Policy Disclosure: AI-assisted static code audit (prepared with Gemini; per CONTRIBUTING.md, individual implementation PRs will require Windows cargo test --workspace -- --test-threads=4 and scripts/smoke.ps1 regression runs). All findings are strictly source-level and synthetic (zero proprietary game bytes, disassembly, extracted shaders, or screenshots). Algorithmic/numeric reproducers (thick 3D mip-tail depth, f16 single-rounding ties, v_mad_f16 vs v_fma_f16, MUBUF OOB_SELECT=3 SOFFSET, physical-page double-free counter, FMT_INFO clamping, and singular BVH inverse) were verified via Python reference checks on Linux; cargo test on Windows MSVC / D3D12 GPU has not yet been run on these fixes.

  • Repository: https://github.com/ivall/xcl

  • Audited Revision: main (2026-11-24 snapshot)

  • Date: 2026-11-24

1. Highest-Impact Active Bottlenecks (Existing Canonical Issues/PRs — Do Not Duplicate)

  1. BCPack Zero-Byte Texture Fills (Black World) — Tracked in #878 (184 MB of BC1/BC3/BC5/BC6H/BC7 requests filling 0 bytes; prior PRs #905 and #950 closed unmerged).

  2. AS-Slot Mesh Pipeline Refusals (42 Pipelines) — Reported in #534 and #878.

  3. Commit Growth (~40 GB) & Late-Release Memory Retention — Reported in #534; active work in #1040, #968, and #1070 (building on merged #866).

  4. DirectStorage Deferred Page-Array Safety — Tracked in #476 and open PR #509.

2. Newly Identified, Non-Duplicate Findings (50 Separable Tasks)

Each item below was checked against all existing open, merged, and closed issues/PRs and comments, and can be implemented and tested in its own focused PR.

# ID Priority Location Summary
1 XCL-BT-001 P0 crates/xcl/src/hle/d3d12x/real.rs lines 2713-2731, 3007-3021 HEAP_UMA Frees Backing Sparse/UMA Block Immediately on ID3D12Heap::Release While Placed Buffers Remain Alive (CPU Crash / GPU UAF)
2 XCL-BT-002 P0 crates/xcl/src/gpu/recomp/emit.rs lines 1704-1728, 3750-3769, 1495-1524 MUBUF/MTBUF bounds checks ignore V# OOB_SELECT, omit SOFFSET in raw mode, wrap u32, and mischeck s_buffer_load
3 XCL-BT-003 P0 crates/xcl/src/hle/d3d12x/cpu_writes.rs lines 56-104 Single global xcl-cpu-writes FIFO worker deadlocks/HOL-blocks across independent queues & tears 64-bit immediate writes
4 XCL-BT-004 P0 crates/xcl/src/hle/dstorage.rs lines 881-940 Uncompressed DirectStorage requests with source_size < destination_size panic (physical) or heap-over-read UB (virtual)
5 XCL-BT-005 P0 crates/xcl/src/hle/d3d12x/device_x.rs lines 355-386, 446-500, 521-565 Unretained Raw pRootSignature Pointer in device_x::Base::desc Causes COM Use-After-Free in RSSetDepthBiasX and CreateDerivedPipelineStateX
6 XCL-BT-006 P0 crates/xcl/src/hle/dstorage.rs lines 615-627 dstorage.rs: factory_create_status_array initializes slots to E_PENDING instead of S_OK, deadlocking ring-buffer callers
7 XCL-BT-007 P0 crates/xcl/src/hle/kernelx.rs lines 1222-1242 kernelx.rs: map_pages allows consecutive page numbers spanning two distinct PHYS_BLOCKS allocations to commit past allocation A's bounds
8 XCL-BT-008 P0 crates/xcl/src/hle/d3d12x/pso_async.rs, crates/xcl/src/hle/d3d12x/real.rs lines pso_async.rs:354-367, 376-394, 448-458; real.rs:1598-1606 pso_async::resolve / resolve_wait Returns Unretained Raw ID3D12PipelineState* Pointer Racing With released() (COM Use-After-Free)
9 XCL-BT-009 P0 crates/xcl/src/hle/d3d12x/sparse.rs lines 587-601, 1355-1413, 1454-1456 sparse::flush_parked Returns Unmapped VRAM Pool Tiles to self.free Without Waiting for In-Flight Title Queues (GPU UAF / Corruption)
10 XCL-BT-010 P1 crates/xcl/src/gpu/recomp/emit.rs lines 1780, 1816 FMT_INFO[min(fmt, 77u)] clamps out-of-range 7-bit format codes 78..127 to format 77 (32_32_32_32_FLOAT) instead of 0 (INVALID)
11 XCL-BT-011 P1 crates/xcl/src/hle/kernelx.rs lines 1154-1199 FreeTitlePhysicalPages double-free UAF of live sibling pages & monotonic NEXT_PAGE_INDEX 21-bit exhaustion
12 XCL-BT-012 P1 crates/xcl/src/gpu/recomp/emit.rs lines 1919-1985 Pixel shader export_graphics ignores VM (Valid Mask) bit and per-MRT color export masks
13 XCL-BT-013 P1 crates/xcl/src/hle/d3d12x/alloc_pool.rs lines 89-102, 195-216 TOCTOU Race Between alloc_pool::reset_list and Concurrent title_reset Allows Resetting an Actively Recording Command Allocator
14 XCL-BT-014 P1 crates/xcl/src/gpu/tiling.rs lines 299-317 Thick 3D mip-tail predicate in tiling.rs omits depth_of(i) <= td
15 XCL-BT-015 P1 crates/xcl/src/hle/xma2/mod.rs lines 69-94 XMA2 StreamConfig::from_xma2_wfx Miscomputes Stereo/Mono Channel Layout for Multi-Stream XMA2WAVEFORMATEX (e.g., 5.1 4-Stream, 4.0 3-Stream)
16 XCL-BT-016 P1 crates/xcl/src/hle/xma2/mod.rs lines 1764-1780 XMA2 advance_stream Decrements skip_packets == 255 (0xFF EOF Sentinel), Causing Finished Streams to Steal Packets After 255 Packets
17 XCL-BT-017 P1 crates/xcl/src/hle/xma2/mod.rs lines 1566-1582 XMA2 decode_packet_step Unconditionally Decodes Incomplete Reservoir on 3+-Packet Spanning Frames, Triggering packet_loss and Wiping Saved Bits
18 XCL-BT-018 P1 crates/xcl/src/hle/acphal.rs lines 711-717, 775, 927-953 acphal.rs: XApu ignores XAPU_CONNECT_OPTION_DEINTERLEAVED_OUTPUT (options & 4), corrupting stereo PCM layout
19 XCL-BT-019 P1 crates/xcl/src/hle/d3d12x/bind.rs lines 175-182, 235-261 bind::execute_indirect Uses Unretained Raw s.rs_gfx With SetGraphicsRootSignature Even on COMPUTE Lists (COM UAF + Invalid Compute Queue Call)
20 XCL-BT-020 P1 crates/xcl/src/gpu/recomp/emit.rs lines 1787-1805 buffer_load_format_d16_* / tbuffer_load_format_d16_* zeroes odd-channel high 16 bits, truncates UINT/SINT, and double-rounds UNORM/SNORM
21 XCL-BT-021 P1 crates/xcl/src/gpu/bvh.rs lines 217-235 bvh::world_to_object Divides by Unguarded det, Writing NaN/Inf Inverse Transforms for Zero-Scale or Degenerate TLAS Instances
22 XCL-BT-022 P1 crates/xcl/src/hle/d3d12x/console_list.rs lines 377-393 console_list::cl_release Immediately Frees UMA Argument/IO Blocks While Submitted GPU Work Is Still In Flight (GPU UAF Under XCL_CONSOLE_LISTS)
23 XCL-BT-023 P1 crates/xcl/src/hle/d3d12x/real.rs lines 4660-4670 dev_create_pipeline_state Bypasses device_x::create_graphics_pso_tracked, Breaking RSSetDepthBiasX and CreateDerivedPipelineStateX for All Stream-Created Graphics PSOs
24 XCL-BT-024 P1 crates/xcl/src/hle/d3d12x/list_x.rs lines 3155-3219, 3341-3360 draw_indexed_x Never Re-Syncs Mirrored Non-UMA Inline Index Buffers After Initial Bind, Rendering Stale Indices
25 XCL-BT-025 P1 crates/xcl/src/gpu/recomp/emit.rs lines 5282-5284 fmt_comp fills missing MUBUF typed buffer channels with (0,0,0,1) instead of c mod n and quiets 16_FLOAT sNaN payloads via f16tof32
26 XCL-BT-026 P1 crates/xcl/src/gpu/recomp/emit.rs lines 5344-5358 fmt_encode typed buffer stores violate four measured RDNA2 hardware contracts (INT saturation, SCALED, float16/11/10 RTZ+max-finite, UNORM/SNORM rounding)
27 XCL-BT-027 P1 crates/xcl/src/hle/gameinput.rs lines 815-842 gameinput.rs: IGameInput::RegisterDeviceCallback completely ignores statusFilter (_filter)
28 XCL-BT-028 P1 crates/xcl/src/gpu/recomp/emit.rs lines 2217-2223, 2455-2459 image_load / image_load_mip with D16=1 truncates 32-bit UINT/SINT texels and zeroes vdst[31:16] on odd-channel loads
29 XCL-BT-029 P1 crates/xcl/src/hle/kernelx.rs, crates/xcl/src/hle/kernelx/lazy.rs lines kernelx.rs:1169-1176; lazy.rs:47-59 kernelx.rs: FreeTitlePhysicalPages removes away mappings without calling lazy::unmark(at), leaving stale VEH entries in LAZY
30 XCL-BT-030 P1 crates/xcl/src/hle/kernelx.rs lines 453-467 kernelx.rs: VirtualAllocEx(GetCurrentProcess(), ...) bypasses placeholders::alloc, UMA, sparse VRAM, and GRAPHICS_RESERVATIONS
31 XCL-BT-031 P1 crates/xcl/src/hle/d3d12x/list_x.rs lines 3738-3753 resolve_subresource_x and resolve_subresource_region_x Omit title_textures::note_gpu_write(dst) and Console DXGI Format Translation
32 XCL-BT-032 P1 crates/xcl/src/hle/d3d12x/list_x.rs lines 3486-3517 resource_barrier_x Records BEGIN_ONLY Split Transition Barriers as Completed StateAfter in title_textures::note_transitions
33 XCL-BT-033 P1 crates/xcl/src/hle/d3d12x/sparse.rs lines 970-997, 1021-1038 sparse::sync_sent_range Hashes Entire 64-Byte Chunks After Sub-64-Byte GPU Readbacks, Silently Dropping Un-Uploaded CPU Writes in Same Cacheline
34 XCL-BT-034 P1 crates/xcl/src/hle/d3d12x/real.rs lines 4549-4577 stream_pipeline Unconditionally Defaults DepthEnable=TRUE Even When DEPTH_STENCIL Subobject Is Omitted and DSVFormat Is UNKNOWN
35 XCL-BT-035 P1 crates/xcl/src/hle/d3d12x/title_textures.rs lines 260-266, 426-451 title_textures::recheck_gpu_view_sources Increments PENDING for Shadowed Textures, Permanently Leaking PENDING Counter and Breaking Fast-Path Skip
36 XCL-BT-036 P1 crates/xcl/src/hle/d3d12x/real.rs lines 4347-4414 translated_gs_pso Copies Raw Console RTV/DSV DXGI Formats Into StreamOut Pipeline Stream Without pc_target_format / pc_view_format Translation
37 XCL-BT-037 P1 crates/xcl/src/gpu/recomp/upper_lanes.rs lines 549-555 upper_lanes::step() misses S_MOVRELSD_2_B32 when invalidating SGPR abstract state
38 XCL-BT-038 P1 crates/xcl/src/gpu/recomp/emit.rs lines 3304-3308 v_pack_b32_f16 silently drops VOP3 abs and neg source modifiers
39 XCL-BT-039 P1 crates/xcl/src/gpu/recomp/emit.rs lines 2960-2965, 3186-3191 valu16 and valu64 apply VOP3 omod (mul:2/mul:4/div:2) to f16/f64 despite RDNA2 gating omod off under MODE.denorm_mode_16_64 = 3
40 XCL-BT-040 P1 crates/xcl/src/hle/xgameruntime/api.rs lines 366-379 xgameruntime/api.rs: query_interface on all XGameRuntime COM objects refuses IID_IUnknown with E_NOINTERFACE
41 XCL-BT-041 P1 crates/xcl/src/hle/xgameruntime/mod.rs lines 867-871, 891-910 xgameruntime/mod.rs: association_call ignores canceled flag and XUserUnregisterForDeviceAssociationChanged ignores wait, causing UAF on caller context
42 XCL-BT-042 P2 crates/xcl/src/gpu/recomp/emit.rs lines 5008-5011, 5059 Float compare-and-swap atomics use bitwise InterlockedCompareExchange instead of IEEE float equality (-0.0 == +0.0, NaN != NaN)
43 XCL-BT-043 P2 crates/xcl/src/hle/acphal.rs lines 955-962, 985-994 acphal.rs: XApuEnqueueCommand and XApuGetResultCount report current queue length instead of cumulative enqueued/dequeued totals
44 XCL-BT-044 P2 crates/xcl/src/hle/kernelx.rs lines 648-667 kernelx.rs: XMemVirtualQuery writes only a 32-bit CPU-only flag at +48, leaving +52..+64 uninitialized and clearing GPU visibility
45 XCL-BT-045 P2 crates/xcl/src/hle/d3d12x/present.rs lines 158-171 present::note_rtv Retains ID3D12Resource COM References Indefinitely in RTVS Without Cleanup on Descriptor Heap Destruction (COM & VRAM Leak)
46 XCL-BT-046 P2 crates/xcl/src/gpu/recomp/emit.rs lines 2564-2573, 3633-3638, 5851 v_cmp_class_f32 applies abs/neg via float arithmetic (flushing denormals & quieting sNaNs)
47 XCL-BT-047 P2 crates/xcl/src/gpu/recomp/emit.rs lines 3471-3472, 3547-3555, 5624 v_div_scale_f32 / v_div_fmas_f32 / v_div_fixup_f32 drops pre/post-scaling and mishandles NaN q, sign, and underflow cutoff
48 XCL-BT-048 P2 crates/xcl/src/gpu/recomp/emit.rs lines 2025-2031 v_interp_p2_f16 double-rounds through binary32 instead of single-rounding to binary16
49 XCL-BT-049 P2 crates/xcl/src/gpu/recomp/emit.rs lines 2987-2992, 3362-3375 v_min_f32 / v_max_f32 / v_min3_f32 / v_max3_f32 violate RDNA2 -0.0 < +0.0 signed-zero ordering on NVIDIA/WARP
50 XCL-BT-050 P2 crates/xcl/src/hle/xgameruntime/networking.rs lines 421-442 xgameruntime/networking.rs: check_thumbprints for XNetworkingThumbprintType::Issuer only inspects chain_sha1s.get(1), failing on 4+ cert chains

Technical Details for All Newly Identified Findings

1. XCL-BT-001 — HEAP_UMA Frees Backing Sparse/UMA Block Immediately on ID3D12Heap::Release While Placed Buffers Remain Alive (CPU Crash / GPU UAF) (P0)

  • Location: crates/xcl/src/hle/d3d12x/real.rs lines 2713-2731, 3007-3021

  • Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records (issues_and_prs.json=1,035, pulls.json=849, issue_comments.json=3,395). Searched 'heap_uma', 'mem_heap_release', 'uma_buffers', 'create_placed_resource_x': only PR #40 (initial routing) and unrelated depth/format PRs (#163, #651, #1063) matched; zero issues or PRs cover premature HEAP_UMA deallocation on heap release.

  • Root Cause: In dev_create_placed_resource_x (real.rs:2713-2731), buffers placed into a HEAP_UMA heap are backed by block + offset (UMA_BUFFERS.insert(res, (va, bytes, false))) rather than being created inside the PC ID3D12Heap, so the PC placed buffer holds no COM reference on heap. In D3D12, titles routinely release an ID3D12Heap immediately after creating placed resources from it (expecting the runtime to keep the heap alive until all placed resources are destroyed). When mem_heap_release (real.rs:3007-3021) observes the heap refcount drop to 0, it immediately calls sparse::free(p) or u.free(p) on the backing UMA/sparse block even though placed ID3D12Resource buffers inside that block are still alive and referenced by CPU pointers and in-flight GPU command lists.

  • Edge-Case / Verification Note: Checked whether placed buffers hold an explicit AddRef on heap anywhere in dev_create_placed_resource_x or res_release: UMA_BUFFERS stores only (va, bytes, owns_block: false) and never stores or AddRefs the parent heap pointer. Thus releasing heap while any placed buffer is live unconditionally frees the underlying memory.

  • Synthetic Reproducer: Create a buffer ID3D12Heap (routed to HEAP_UMA), call CreatePlacedResource for a buffer at offset 0, call heap->Release() (valid D3D12 lifetime), then read/write the placed buffer's GPU VA or CPU UMA address in a subsequent draw/dispatch. Observe immediate access violation or GPU page fault / corrupted reads after sparse::free(p) decommits or recycles the block.

  • Proposed Fix & Risk: - Fix: Track the parent heap pointer (with AddRef on placement and Release in res_release) or reference-count HEAP_UMA backing blocks via Arc shared between the heap entry and every placed buffer in UMA_BUFFERS, deferring sparse::free(p) / u.free(p) until both the heap and all placed buffers (and any late_release GPU holds) have released.

  • Regression Risk: Low; adds a lightweight Arc or heap AddRef/Release pair per placed buffer in HEAP_UMA, matching standard D3D12 placed-resource heap lifetime semantics. (Estimated size: M)

2. XCL-BT-002 — MUBUF/MTBUF bounds checks ignore V# OOB_SELECT, omit SOFFSET in raw mode, wrap u32, and mischeck s_buffer_load (P0)

  • Location: crates/xcl/src/gpu/recomp/emit.rs lines 1704-1728, 3750-3769, 1495-1524

  • Prior-Work Check: Searched all 4,430 XCL records for OOB_SELECT, soffset bounds, s_buffer_load partial-dword (Issue #307 only discussed num_records * stride; 0 hits for OOB_SELECT or missing SOFFSET).

  • Root Cause: Native RDNA2 (gfx1036) & RDNA1 (gfx1011) measurements (Leonida/docs/buffer_bounds.md, 732 cases) prove hardware selects bounds checks by V# word 3 OOB_SELECT (d3[29:28]): mode 0 checks index >= N || offset + bytes > stride, mode 1 checks index >= N, mode 2 checks N == 0, mode 3 (raw) checks offset + soffset + bytes > N. XCL ignores d3[29:28] (using stride == 0), omits soff from t_off in raw mode (allowing OOB VRAM reads/writes whenever SOFFSET != 0), skips offset + bytes <= stride in mode 0, wraps 32-bit uint in single-window mode, and checks t_off < t_lim instead of t_off + 4 <= t_lim in s_buffer_load.

  • Edge-Case / Verification Note: Alternative hypothesis: most shaders might pass SOFFSET = 0. Falsification: AMD's LLVM backend routinely places constant/loop-invariant byte offsets in SOFFSET; synthetic raw buffer_load_dword with N=18, voff=8, soff=8 proves OOB leak.

  • Synthetic Reproducer: Raw V# (OOB_SELECT=3, NUM_RECORDS=18), buffer_load_dword at voff=8, soff=8 (8+8+4=20 > 18): RDNA2 hardware returns 0; XCL reads out-of-bounds VRAM because 8+4 <= 18.

  • Proposed Fix & Risk: - Fix: Decode oob = (d3 >> 28) & 3u, perform bounds checks in uint64_t, include (uint64_t)soff in mode 3, check t_off + bytes <= stride in mode 0, check d2 != 0u in mode 2, and fix s_buffer_load to (uint64_t)t_off + 4ull <= (uint64_t)t_lim.

  • Regression Risk: Low; strictly aligns with measured RDNA1/RDNA2 silicon. (Estimated size: M)

3. XCL-BT-003 — Single global xcl-cpu-writes FIFO worker deadlocks/HOL-blocks across independent queues & tears 64-bit immediate writes (P0)

  • Location: crates/xcl/src/hle/d3d12x/cpu_writes.rs lines 56-104

  • Prior-Work Check: Searched all 4,430 XCL records for xcl-cpu-writes, cpu_writes, AtomicU32 torn writes (PR #1005/#1034 cover VirtualQuery/watch only; 0 hits for cross-queue FIFO deadlock or torn 64-bit writes).

  • Root Cause: (1) One global xcl-cpu-writes FIFO thread pops jobs from all command queues in enqueue order and blocks on WaitForSingleObject(event, 10_000). If Queue A is waiting on a signal from Queue B's bottom-of-pipe write, Queue B's job is head-of-line blocked for 10 seconds until Queue A times out—and then Queue A's writes are prematurely committed before Queue A's GPU work completes. (2) write_now() (101-103) commits Write::Immediate(va, vec![lo, hi]) as two non-atomic AtomicU32::store calls, exposing torn 64-bit fence values to polling title threads.

  • Edge-Case / Verification Note: Alternative hypothesis: titles might only use Write64BitValueBottomOfPipeX on a single Direct queue. Falsification: modern GDK engines (including the retail title) use separate Direct, Async Compute, and Copy queues with cross-queue fence dependencies; synthetic 2-queue test deterministically triggers the 10 s deadlock.

  • Synthetic Reproducer: Submit Write64BitValueBottomOfPipeX on Queue A waiting on Fence B, then submit Write64BitValueBottomOfPipeX on Queue B whose CPU poll unblocks Fence B -> xcl-cpu-writes stalls 10 s and fires Queue A's write prematurely.

  • Proposed Fix & Risk: - Fix: Dispatch one worker per queue (or WaitForMultipleObjects across per-queue queues) and add Write::ImmediateU64(usize, u64) committed via AtomicU64::store(..., Ordering::Release).

  • Regression Risk: Low; preserves strict in-queue FIFO ordering while removing false cross-queue serialization. (Estimated size: M)

4. XCL-BT-004 — Uncompressed DirectStorage requests with source_size < destination_size panic (physical) or heap-over-read UB (virtual) (P0)

  • Location: crates/xcl/src/hle/dstorage.rs lines 881-940

  • Prior-Work Check: Searched all 4,430 XCL records; PR #21 fixed only compressed intermediate buffers (d.len() < n inside if r.zlib()), leaving the uncompressed raw path (!r.zlib() && bc == 0) unguarded.

  • Root Cause: When !r.zlib() && bc == 0, payload has length r.source_size. Line 935 indexes &payload[..n] (where n = destination_size), panicking if source_size < destination_size; line 939 calls std::ptr::copy_nonoverlapping(payload.as_ptr(), dst, n), causing heap-buffer-over-read UB.

  • Edge-Case / Verification Note: Alternative hypothesis: GDK DirectStorage may reject source_size < destination_size on uncompressed requests as E_INVALIDARG. Either way, panicking or executing UB heap-over-read is a confirmed defect; whether to zero-pad or return E_INVALIDARG should be matched to GDK behavior.

  • Synthetic Reproducer: Unit test calling execute_request with uncompressed memory source (source_size = 64, destination_size = 128) -> panics on physical-page dest / over-reads 64 B on virtual dest.

  • Proposed Fix & Risk: - Fix: Validate payload.len() >= n (returning E_INVALIDARG if invalid per GDK spec, or zero-padding payload.resize(n, 0) if padded destinations are permitted) before lines 935/939.

  • Regression Risk: Very low. (Estimated size: XS)

5. XCL-BT-005 — Unretained Raw pRootSignature Pointer in device_x::Base::desc Causes COM Use-After-Free in RSSetDepthBiasX and CreateDerivedPipelineStateX (P0)

  • Location: crates/xcl/src/hle/d3d12x/device_x.rs lines 355-386, 446-500, 521-565

  • Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'note_base', 'depth_bias_pso', 'create_derived_pso_x', 'prootsignature', 'derivedpipelinestate': only PR #23 (initial implementation) and PR #144 (untranslated root sig binding) matched; zero issues or PRs report the unretained pRootSignature UAF in Base::desc.

  • Root Cause: device_x::note_base (device_x.rs:355-386) copies the raw bytes of D3D12_GRAPHICS_PIPELINE_STATE_DESC—including the raw pRootSignature COM pointer at offset 0x00—into Base::desc without calling AddRef on pRootSignature (even though it carefully deep-copies InputLayout descriptors and shader bytecode). In D3D12, titles are allowed to call root_sig->Release() immediately after creating a PSO. Later, when depth_bias_pso (device_x.rs:446-500) or create_derived_pso_x (device_x.rs:521-565) clones Base::desc and passes it to CreateGraphicsPipelineState, the driver dereferences a freed/dangling ID3D12RootSignature*.

  • Edge-Case / Verification Note: Verified Base struct definition and forget_base in device_x.rs: Base owns Vec<u8> copies of input layout/semantics/shaders but stores pRootSignature solely as raw bytes inside desc, with no Option<ID3D12RootSignature> field and no AddRef/Release lifecycle management.

  • Synthetic Reproducer: Create a root signature rs, create a graphics PSO pso with rs (e.g. without dynamic depth bias or on Intel/bundle fallback), call rs->Release(), then trigger RSSetDepthBiasX or CreateDerivedPipelineStateX on pso. The driver crashes with an access violation dereferencing the freed rs vtable inside CreateGraphicsPipelineState.

  • Proposed Fix & Risk: - Fix: Extract pRootSignature in note_base, retain an Option<ID3D12RootSignature> via from_raw_borrowed + .clone() on Base (releasing automatically when Base is dropped in forget_base), and keep it alive for the lifetime of Base.

  • Regression Risk: Low; retains one COM reference per cached base PSO until forget_base runs on PSO destruction. (Estimated size: S)

6. XCL-BT-006 — dstorage.rs: factory_create_status_array initializes slots to E_PENDING instead of S_OK, deadlocking ring-buffer callers (P0)

  • Location: crates/xcl/src/hle/dstorage.rs lines 615-627

  • Prior-Work Check: Verified 0 hits across ivall_xcl issues_and_prs.json, pulls.json, issue_comments.json, and review_comments.json for createstatusarray / statusarray E_PENDING.

  • Root Cause: In dstorage.rs:622, factory_create_status_array initializes every slot with AtomicI32::new(E_PENDING). Per Microsoft's DirectStorage specification (IDStorageStatusArray::IsComplete / GetHResult, and matching VIctory's dstorage.rs:165), newly created status array entries start in the completed state (S_OK, IsComplete() == true) until EnqueueStatus transitions a slot to E_PENDING.

  • Edge-Case / Verification Note: Titles that only call IsComplete(i) after calling EnqueueStatus(array, i) do not observe the initial state, which is why existing unit tests passed. However, standard DirectStorage ring-buffer patterns wait on IsComplete(slot) before recycling slot on its first pass.

  • Synthetic Reproducer: Call IDStorageFactoryX::CreateStatusArray(4, ...) and immediately call status->IsComplete(0) and status->GetHResult(0); returns false and E_PENDING instead of true and S_OK.

  • Proposed Fix & Risk: - Fix: Initialize slots in factory_create_status_array with AtomicI32::new(S_OK) at dstorage.rs:622.

  • Regression Risk: Low; matches DirectStorage specification and only affects pre-enqueue slot state. (Estimated size: S)

7. XCL-BT-007 — kernelx.rs: map_pages allows consecutive page numbers spanning two distinct PHYS_BLOCKS allocations to commit past allocation A's bounds (P0)

  • Location: crates/xcl/src/hle/kernelx.rs lines 1222-1242

  • Prior-Work Check: Verified 0 hits across ivall_xcl corpus for map_pages consecutive / cross-allocation PHYS_BLOCKS.

  • Root Cause: At kernelx.rs:1223-1225, map_pages checks consecutive on the numeric page IDs (pages[0] + i * FRAMES == pages[i]) and then sets home = page_home(pages[0]).filter(|_| page_home(pages[n - 1]).is_some()). Because AllocateTitlePhysicalPages assigns monotonically increasing page IDs across separate allocations, two independent allocations A (at virtual address home_A) and B (at unrelated virtual address home_B) have consecutive page IDs. page_home(pages[n - 1]).is_some() passes even though page_home(pages[n - 1]) != Some(home_A + (n - 1) * PHYS_PAGE), causing commit_homes(home_A, n) to walk past block A's end.

  • Edge-Case / Verification Note: Single-allocation mappings always have contiguous homes, so single-block tests pass. The bug triggers whenever a title concatenates page IDs from two consecutive physical allocations into one MapTitlePhysicalPages call.

  • Synthetic Reproducer: Call AllocateTitlePhysicalPages twice (1 page each -> page IDs p0 and p0+16 with distinct non-adjacent home VAs), then call MapTitlePhysicalPages(NULL, 2, 0, PAGE_READWRITE, [p0, p0+16]); commits 128 KiB starting at home(p0) instead of returning ERROR_NOT_SUPPORTED.

  • Proposed Fix & Risk: - Fix: Verify that pages[0] and pages[n - 1] belong to the SAME PHYS_BLOCKS entry (or that page_home(pages[n - 1]) == Some(home_0 + (n - 1) * PHYS_PAGE) and all intermediate pages belong to the same block) before taking the contiguous home fast path.

  • Regression Risk: Low; strictly tightens safety validation on the home fast path. (Estimated size: S)

8. XCL-BT-008 — pso_async::resolve / resolve_wait Returns Unretained Raw ID3D12PipelineState* Pointer Racing With released() (COM Use-After-Free) (P0)

  • Location: crates/xcl/src/hle/d3d12x/pso_async.rs, crates/xcl/src/hle/d3d12x/real.rs lines pso_async.rs:354-367, 376-394, 448-458; real.rs:1598-1606

  • Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'pso_async', 'resolve_wait', 'resolve_for_bind', 'pso_release': matches cover async compute registration (#102), wait logging (#899), preload worker priority inversion (#1007), and duplicate build experiment (#754); zero issues or PRs cover the raw-pointer UAF race between resolve/resolve_wait and released().

  • Root Cause: pso_async::resolve (pso_async.rs:354-367) and resolve_wait (pso_async.rs:376-394) load p.real.load(Ordering::Acquire) and return the raw usize ID3D12PipelineState* pointer without incrementing its COM refcount. Concurrently, another thread releasing the stand-in PSO invokes pso_release (real.rs:1598-1606) -> pso_async::released(standin) (pso_async.rs:448-458), which atomically swaps p.real to 0 and calls release(real), dropping the sole COM reference to the compiled PSO while the first thread is about to pass that raw pointer to SetPipelineState, Reset, or CreateCommandList.

  • Edge-Case / Verification Note: Confirmed that p.real holds the only COM reference to the compiled PSO (the title only owns a reference to standin). Neither resolve nor resolve_wait holds a lock or calls AddRef before returning the raw usize to callers in list_x.rs, bind.rs, and real.rs, creating a classic cross-thread COM UAF window whenever a streaming/GC thread releases a PSO concurrently with command-list recording.

  • Synthetic Reproducer: On thread A, bind a stand-in PSO via SetPipelineState (resolve_for_bind / resolve_wait); on thread B, concurrently call standin->Release() once the background compile finishes. Thread A receives the raw real pointer just before thread B's released() drops its refcount to 0, causing SetPipelineState to dereference a freed ID3D12PipelineState.

  • Proposed Fix & Risk: - Fix: Have resolve / resolve_wait return an owned ID3D12PipelineState (calling AddRef while holding the map/entry guard before released() can run release(real)), or route released() through late_release / a mutex-protected Option<ID3D12PipelineState> cloned before unlocking.

  • Regression Risk: Low; adds one atomic AddRef/Release pair per async-PSO resolution on the binding path. (Estimated size: M)

9. XCL-BT-009 — sparse::flush_parked Returns Unmapped VRAM Pool Tiles to self.free Without Waiting for In-Flight Title Queues (GPU UAF / Corruption) (P0)

  • Location: crates/xcl/src/hle/d3d12x/sparse.rs lines 587-601, 1355-1413, 1454-1456

  • Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'flush_parked', 'decommit_range', 'take_tile', 'parked': PR #532 introduced parked tile batching to reduce UpdateTileMappings overhead, PR #923/#930 addressed retired 64 MiB pool reuse after unmap fence, and Issue #262 covers upload-vs-title simultaneous access on the same reserved buffer; zero issues or PRs cover flush_parked immediately recycling unmapped pool tiles to self.free before in-flight title queues finish.

  • Root Cause: In sparse::flush_parked (sparse.rs:1355-1413), called from before_execute (sparse.rs:1454-1456), decommitted tiles are unmapped via UpdateTileMappings on XCL's private s.queue and then immediately pushed back into self.free (for tile in freed { self.free.push(tile); }). flush_parked never waits for any title command queues (DIRECT/COMPUTE/COPY) that may still have GPU work in flight reading or writing those tiles, nor does it even wait for s.queue's own unmap fence before take_tile (sparse.rs:587-601) pops the tile, remaps it to a different virtual address, and zeroes/overwrites it via upload_zeros/upload_dirty.

  • Edge-Case / Verification Note: Verified Pool::retire_empty vs flush_parked: PR #930 added a fence check for retired 64 MiB pools, but individual tiles freed by decommit_range -> flush_parked bypass any fence wait and are returned straight to self.free synchronously inside flush_parked, allowing immediate reuse on the very next commit while prior title submits are still executing on the GPU.

  • Synthetic Reproducer: Submit a GPU compute/graphics command list reading from sparse address A, immediately decommit A (VirtualFree/FreeTitlePhysicalPages) and commit new sparse address B (which pops A's pool tile from self.free and uploads zeros/new data on s.queue). The in-flight title draw/dispatch reads zeroed or B's data from the recycled physical tile.

  • Proposed Fix & Risk: - Fix: Place tiles unmapped by flush_parked into a per-fence retired tile quarantine (recording the current fence values of s.queue and active title queues, or reusing the existing late_release queue-fence drain), and only move them into self.free once all in-flight queue fences have completed.

  • Regression Risk: Medium; slightly increases transient VRAM pool watermark by one frame's worth of decommitted tiles, which is bounded and avoids silent GPU data corruption. (Estimated size: M)

10. XCL-BT-010 — FMT_INFO[min(fmt, 77u)] clamps out-of-range 7-bit format codes 78..127 to format 77 (32_32_32_32_FLOAT) instead of 0 (INVALID) (P1)

  • Location: crates/xcl/src/gpu/recomp/emit.rs lines 1780, 1816

  • Prior-Work Check: Searched all 4,430 XCL records for FMT_INFO and min(fmt, 77 (0 hits).

  • Root Cause: Measured on RDNA2 silicon (ProjectLeonidaL/leonida docs/buffer_formats.md:24), 7-bit unified buffer format codes outside 1..=77 (specifically 0 and 78..=127) are INVALID: loads decode to 0 and stores are no-ops. emit.rs:1780 and emit.rs:1816 index FMT_INFO[min(fmt, 77u)], silently aliasing every invalid format code 78..=127 to format 77 (32_32_32_32_FLOAT), reading/writing 16 bytes of garbage memory instead of returning 0 / storing nothing.

  • Edge-Case / Verification Note: Alternative hypothesis: valid Xbox titles never bind descriptors with format codes >= 78. Falsification: null/uninitialized or dynamically-patched buffer descriptors (and tbuffer immediate format encodings) can carry format codes >= 78, causing out-of-bounds 16-byte writes instead of hardware no-ops.

  • Synthetic Reproducer: Bind a buffer V# with FORMAT = 80 and execute buffer_store_format_xyzw or buffer_load_format_xyzw. Hardware performs a no-op / returns 0; XCL indexes FMT_INFO[77] and reads/writes 16 bytes as 32_32_32_32_FLOAT.

  • Proposed Fix & Risk: - Fix: Replace min(fmt, 77u) with (fmt <= 77u ? fmt : 0u) at emit.rs:1780 and emit.rs:1816 so out-of-range codes map to FMT_INFO[0] (INVALID).

  • Regression Risk: Very low; two one-line ternary guards. (Estimated size: XS)

11. XCL-BT-011 — FreeTitlePhysicalPages double-free UAF of live sibling pages & monotonic NEXT_PAGE_INDEX 21-bit exhaustion (P1)

  • Location: crates/xcl/src/hle/kernelx.rs lines 1154-1199

  • Prior-Work Check: Searched all 4,430 XCL records for FreeTitlePhysicalPages double-free and NEXT_PAGE_INDEX recycling (PR #40/#348 cover multi-window bounds and test lock ordering only; 0 hits for double-free UAF or index exhaustion).

  • Root Cause: PHYS_BLOCKS stores (count, live_count, home) per block. FreeTitlePhysicalPages decrements e.1 without per-page liveness tracking, so freeing the same page twice drops e.1 to 0 and releases home while sibling pages in the block are still live (UAF). Separately, NEXT_PAGE_INDEX monotonically increments and is never recycled.

  • Edge-Case / Verification Note: Alternative hypothesis: well-behaved titles never double-free physical pages. Falsification: duplicate free is a single-line reproducer in unit tests, and monotonic NEXT_PAGE_INDEX inevitably hits 21-bit exhaustion under long streaming churn.

  • Synthetic Reproducer: Allocate 2 pages [p0, p1] in one block; call FreeTitlePhysicalPages(1, &[p0]) twice -> e.1 hits 0 and home is freed while p1 is still live.

  • Proposed Fix & Risk: - Fix: Store a per-block freed bitset (Vec<u64>) so duplicate frees are ignored, and recycle freed page indices via a free-list.

  • Regression Risk: Low. (Estimated size: S)

12. XCL-BT-012 — Pixel shader export_graphics ignores VM (Valid Mask) bit and per-MRT color export masks (P1)

  • Location: crates/xcl/src/gpu/recomp/emit.rs lines 1919-1985

  • Prior-Work Check: Searched all 4,430 XCL records for export_graphics, xcl_live, and valid mask (only #706 mentions vm in disassembler text formatting; 0 hits for export_graphics semantics).

  • Root Cause: Measured across 18 pixel shader programs on RDNA2 gfx1036 (ProjectLeonidaL/leonida docs/design.md:267, ps_oracle.py), pixel survival is determined by the EXEC mask of the last exp with VM=1 (overwriting earlier VM masks rather than OR-accumulating), and color target survival is masked per-MRT. emit.rs:1919-1985 ignores the VM bit entirely and OR-accumulates if (act) xcl_live = true; on DONE, so a later exp null done vm under a narrower EXEC fails to kill lanes that were active during an earlier export.

  • Edge-Case / Verification Note: Alternative hypothesis: pixel shaders might only emit a single DONE export at exit. Falsification: multi-MRT and early-discard shaders emit exp mrt0 before branching to exp null done vm, where OR-accumulating xcl_live on DONE leaks killed pixels into the framebuffer.

  • Synthetic Reproducer: Pixel shader executing exp mrt0 ... with EXEC = 0xF, then narrowing EXEC = 0x3 and executing exp null ... done vm. Hardware kills lanes 2 and 3; XCL keeps them alive or mis-tracks survival when multiple exports carry VM/DONE.

  • Proposed Fix & Risk: - Fix: Decode the VM bit from the EXP instruction in export_graphics, assign xcl_live = act; (overwrite, not OR-accumulate) on every VM=1 export, and guard final discard with if (!xcl_live) discard; while tracking per-MRT export masks.

  • Regression Risk: Low-medium; localized to pixel-shader export_graphics. (Estimated size: M)

13. XCL-BT-013 — TOCTOU Race Between alloc_pool::reset_list and Concurrent title_reset Allows Resetting an Actively Recording Command Allocator (P1)

  • Location: crates/xcl/src/hle/d3d12x/alloc_pool.rs lines 89-102, 195-216

  • Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'alloc_pool', 'reset_list', 'title_reset', 'move_list': PR #1012 fixed released list cleanup, PR #1023 fixed moving recording only after successful Reset, PR #1051/#994 fixed failed replacement/aside handling, and PR #1071 fixed split/created list tracking; zero issues or PRs cover the lock-drop TOCTOU race between reset_list and title_reset.

  • Root Cause: In alloc_pool::reset_list (alloc_pool.rs:89-102), the function queries let backing = current(alloc); (releasing the POOLS mutex), invokes the native list->Reset(backing) callback without holding the POOLS mutex or pinning backing, and only acquires POOLS afterward to call move_list(list, backing). If another thread concurrently calls title_reset(alloc) (alloc_pool.rs:195-216) during that window, title_reset sees backing's users set as empty (users.is_empty() == true) and immediately calls ID3D12CommandAllocator::Reset() on backing while list is actively recording into backing (violating D3D12's requirement that no open command list use a resetting allocator, causing E_FAIL / driver crash / device removal).

  • Edge-Case / Verification Note: Verified current(alloc) drops the POOLS guard before returning backing, and title_reset checks pool.users.get(&backing).is_none_or(|u| u.is_empty()) before resetting backing in place. While PR #1023 intentionally moved move_list after reset(backing) so failed Reset doesn't corrupt state, leaving backing unpinned across the unlocked native call opens a direct race with concurrent title_reset.

  • Synthetic Reproducer: On thread A, call list->Reset(alloc, pso) while alloc currently has 0 open lists; on thread B, concurrently call alloc->Reset() right after thread A reads backing = current(alloc) and enters native list->Reset(backing). Thread B resets backing in place while thread A's list is now open on backing.

  • Proposed Fix & Risk: - Fix: Increment an in-flight pin/reservation count on backing (or insert a pending reservation entry in POOLS) while holding the POOLS lock before calling reset(backing), have title_reset treat pinned backings as busy (swapping in a spare instead of resetting in place), and commit move_list or roll back the pin after reset(backing) returns.

  • Regression Risk: Low; purely internal synchronization inside alloc_pool.rs with negligible lock contention. (Estimated size: S)

14. XCL-BT-014 — Thick 3D mip-tail predicate in tiling.rs omits depth_of(i) <= td (P1)

  • Location: crates/xcl/src/gpu/tiling.rs lines 299-317

  • Prior-Work Check: Searched all 4,430 XCL records for first_tail, GetMipTailDim, thick tail depth (PR #1028 covers linear tile-mapping region on 3D mips; 0 hits for tiling.rs:315 missing depth check).

  • Root Cause: GetMipTailDim halves h, w, or d by blk % 3, yet tiling.rs:299-316 discards td and tests only w <= tw && h <= th && mips - i <= max_tail, forcing deep narrow thick 3D mips (e.g. 16x16x64) into the single-block mip tail.

  • Edge-Case / Verification Note: Alternative hypothesis: retail volume textures tested so far had w > tw or h > th whenever d > td. Falsification: unit test Chain::new_3d(Layout::new_3d(5, 2, cfg), 16, 16, 64, 1, 4) places mip 0 into the mip tail.

  • Synthetic Reproducer: Unit test in gpu/tiling.rs: 16x16x64 thick 3D texture with 4 mips -> levels[0].tail.is_some() despite 64 depth slices exceeding block depth.

  • Proposed Fix & Risk: - Fix: Compute td = if !thick { usize::MAX } else if blk % 3 == 2 { bd / 2 } else { bd } and add && (!thick || depth_of(i) <= td) at line 315.

  • Regression Risk: Very low. (Estimated size: XS)

15. XCL-BT-015 — XMA2 StreamConfig::from_xma2_wfx Miscomputes Stereo/Mono Channel Layout for Multi-Stream XMA2WAVEFORMATEX (e.g., 5.1 4-Stream, 4.0 3-Stream) (P1)

  • Location: crates/xcl/src/hle/xma2/mod.rs lines 69-94

  • Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'from_xma2_wfx', 'xma2waveformatex', 'num_streams': PR #20 introduced the XMA2 decoder and open PR #861 adds tests only without fixing the layout formula in from_xma2_wfx.

  • Root Cause: In StreamConfig::from_xma2_wfx (xma2/mod.rs:69-94), when XMA2WAVEFORMATEX specifies channels and num_streams (without per-stream descriptors), the loop assigns 2 channels to every stream where (i + 1) * 2 <= channels and 1 otherwise. For standard Xbox 5.1 (channels = 6, num_streams = 4, layout [2, 2, 1, 1] = FL/FR, BL/BR, C, LFE) or 4.0 (channels = 4, num_streams = 3, layout [2, 1, 1]), this loop assigns 2 to streams 0, 1, 2 and 1 to stream 3, producing [2, 2, 2, 1] (sum = 7 != 6) or [2, 2, 1] (sum = 5 != 4), which then fails Decoder::new's channel-sum check (channel sum 7 != 6) and completely breaks playback of valid multi-stream surround XMA2 assets.

  • Edge-Case / Verification Note: Verified algebraically: given C total channels across S streams where each stream has 1 or 2 channels (S <= C <= 2*S), the unique count of stereo (2-channel) streams is stereo = C - S and mono (1-channel) streams is 2*S - C. For C=6, S=4, stereo = 2 -> [2, 2, 1, 1] (sum 6); the existing code computes i=0,1,2 as 2 because (2+1)*2 <= 6, producing [2, 2, 2, 1] (sum 7) and unconditionally failing.

  • Synthetic Reproducer: Call StreamConfig::from_xma2_wfx with a valid 5.1 XMA2WAVEFORMATEX header (nChannels = 6, NumStreams = 4, nSamplesPerSec = 48000) and pass the resulting config to Decoder::new(cfg). Decoder::new returns Err("channel sum 7 != 6").

  • Proposed Fix & Risk: - Fix: Validate channels >= num_streams && channels <= num_streams * 2, compute let stereo = (channels - num_streams) as usize;, and assign if i < stereo { 2 } else { 1 } for each stream i in 0..num_streams.

  • Regression Risk: Very low; preserves existing [2, 2, 2] (6ch/3-stream) and [2, 1] (3ch/2-stream) behavior while fixing all mixed stereo/mono multi-stream surround layouts. (Estimated size: XS)

16. XCL-BT-016 — XMA2 advance_stream Decrements skip_packets == 255 (0xFF EOF Sentinel), Causing Finished Streams to Steal Packets After 255 Packets (P1)

  • Location: crates/xcl/src/hle/xma2/mod.rs lines 1764-1780

  • Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'advance_stream', 'skip_packets': only PR #20 (initial XMA2 decoder commit) matched; zero issues or PRs cover the skip_packets == 255 EOF sentinel bug.

  • Root Cause: In the XMA2 packet header, the 8-bit PacketSkipCount value 255 (0xFF) is the stream-finished sentinel indicating that no further packets belong to that stream. In Decoder::advance_stream (xma2/mod.rs:1764-1780), every stream's counter is unconditionally decremented via s.skip_packets = s.skip_packets.saturating_sub(1);. In multi-stream surround or multi-track XMA2 audio where one stream ends earlier than another by more than 255 packets, the finished stream's skip_packets counts down 255 -> 254 -> ... -> 0, after which advance_stream selects the finished stream as best (min_skip == 0) and feeds another active stream's packets into it, corrupting both streams.

  • Edge-Case / Verification Note: Verified xma2/mod.rs:1525-1535 parses skip_packets directly as an 8-bit u8 (0..=255) from the 32-bit XMA2 packet header, and advance_stream (1777-1779) has no if s.skip_packets != 255 guard. In FFmpeg wmaprodec.c, skip_packets == 0xff is explicitly treated as a pinned terminal state (never decremented).

  • Synthetic Reproducer: Decode a 2-stream (e.g. 4-channel) XMA2 asset where stream 0 finishes (PacketSkipCount = 255) while stream 1 has 260 more packets. After 255 packets of stream 1, stream 0's skip_packets reaches 0 and stream 0 steals stream 1's packet 256, causing bitstream decode errors or channel corruption.

  • Proposed Fix & Risk: - Fix: Guard the decrement in advance_stream: if s.skip_packets != 255 { s.skip_packets = s.skip_packets.saturating_sub(1); } (and mark or skip streams with skip_packets == 255 unless all streams are 255).

  • Regression Risk: Very low; 1-line guard matching the XMA2 packet header specification and FFmpeg. (Estimated size: XS)

17. XCL-BT-017 — XMA2 decode_packet_step Unconditionally Decodes Incomplete Reservoir on 3+-Packet Spanning Frames, Triggering packet_loss and Wiping Saved Bits (P1)

  • Location: crates/xcl/src/hle/xma2/mod.rs lines 1566-1582

  • Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'decode_packet_step', 'num_bits_prev_frame', 'packet_loss', 'num_saved_bits': only PR #20 (initial decoder commit) matched; zero issues or PRs report the 3+-packet spanning frame bug.

  • Root Cause: In StreamDecoder::decode_packet_step (xma2/mod.rs:1566-1582), when a frame spans across packets and the current packet's num_bits_prev_frame >= remaining_packet_bits (including the XMA2 continuation sentinel 0x7FFF meaning no new frame starts in this packet), the code sets self.packet_done = true, clamps the bit count to remaining_packet_bits, appends those bits to the saved-bit reservoir via save_bits, and then unconditionally calls self.decode_frame(out_frame) on line 1575. When a large frame spans 3 or more packets (num_bits_prev_frame > remaining_packet_bits), the reservoir does not yet contain the end of the frame: decode_frame fails mid-frame, sets self.packet_loss = true, and line 1580 wipes self.num_saved_bits = 0, permanently corrupting the spanning frame and dropping audio.

  • Edge-Case / Verification Note: Compared directly against FFmpeg's xma_decode_packet / decode_packet in libavcodec/wmaprodec.c: when num_bits_prev_frame > remaining_packet_bits (e.g., 0x7FFF continuation packet), FFmpeg appends all remaining_packet_bits to the saved reservoir and returns immediately (got_frame = 0) WITHOUT calling decode_frame, waiting for the subsequent packet that completes the frame. xma2/mod.rs:1566-1582 conflates >= (exact completion vs strict continuation) and always calls decode_frame.

  • Synthetic Reproducer: Feed a valid XMA2 stream containing a high-bitrate frame spanning 3 consecutive 2048-byte packets (packet 1 starts the frame, packet 2 has bit_offset == 0x7FFF / num_bits_prev_frame > 16352, packet 3 finishes the frame). On packet 2, decode_packet_step calls decode_frame on the incomplete reservoir, fails with packet_loss = true, and zeroes num_saved_bits.

  • Proposed Fix & Risk: - Fix: Distinguish num_bits_prev_frame > remaining_packet_bits: append remaining_packet_bits via save_bits, set self.packet_done = true, and return Ok((pgb.bits_count() >> 3, false)) without invoking decode_frame or clearing num_saved_bits.

  • Regression Risk: Low; matches FFmpeg wmaprodec.c behavior for multi-packet XMA2 continuation packets. (Estimated size: S)

18. XCL-BT-018 — acphal.rs: XApu ignores XAPU_CONNECT_OPTION_DEINTERLEAVED_OUTPUT (options & 4), corrupting stereo PCM layout (P1)

  • Location: crates/xcl/src/hle/acphal.rs lines 711-717, 775, 927-953

  • Prior-Work Check: Verified 0 hits across ivall_xcl corpus for deinterleaved.

  • Root Cause: XApu struct (acphal.rs:711-717) never stores i.options from XApuConnectInput, and XApuEnqueueCommand (lines 933-943) unconditionally copies interleaved f32 samples from decode_into into p.output regardless of whether options & 4 (DEINTERLEAVED_OUTPUT) was requested.

  • Edge-Case / Verification Note: Titles using interleaved output (options & 4 == 0) or mono streams (channels == 1) are unaffected, but stereo deinterleaved titles (explicitly supported in VIctory's apu.rs:46,345-348) receive garbled audio.

  • Synthetic Reproducer: Connect with XApuConnectInput { options: 4, ... }, activate a 2-channel Opus stream, enqueue XAPU_PROCESS, and inspect p.output; samples are interleaved [L0, R0, L1, R1] instead of [L0..L(n-1), R0..R(n-1)].

  • Proposed Fix & Risk: - Fix: Store options: u32 in struct XApu at XApuConnect, and when x.options & 4 != 0 && channels == 2, deinterleave out into [L0..Ln, R0..Rn] before copying to p.output.

  • Regression Risk: Low; only affects stereo streams with option bit 2 set. (Estimated size: S)

19. XCL-BT-019 — bind::execute_indirect Uses Unretained Raw s.rs_gfx With SetGraphicsRootSignature Even on COMPUTE Lists (COM UAF + Invalid Compute Queue Call) (P1)

  • Location: crates/xcl/src/hle/d3d12x/bind.rs lines 175-182, 235-261

  • Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'rs_gfx', 'execute_indirect', 'setgraphicsrootsignature': PR #144 added rs_gfx binding, PR #267/#667/#1124 cover slow PSO waits, ABI caching, and two-pass mesh skip; zero issues or PRs cover unretained rs_gfx UAF or invalid SetGraphicsRootSignature on COMPUTE lists in execute_indirect.

  • Root Cause: Two compounded bugs in bind.rs: (1) set_graphics_root_signature (bind.rs:175-182) stores the title's root signature as a raw usize (s.rs_gfx = rs as usize) without AddRefing it; if the title releases the root signature while the command list is still recording (valid in D3D12 while referenced by the command list, or across inherit_for_split), execute_indirect (bind.rs:256-259) borrows and calls list.SetGraphicsRootSignature(r) on a dangling pointer. (2) When execute_indirect runs with an untranslated PC compute pipeline on a COMPUTE command list, if !gfx && !compute (bind.rs:241-260) unconditionally attempts list.SetGraphicsRootSignature(r) if s.rs_gfx != 0 (invalid on D3D12_COMMAND_LIST_TYPE_COMPUTE), and never restores a compute root signature (rs_compute is not even tracked).

  • Edge-Case / Verification Note: Verified State in bind.rs:22-37: rs_gfx: usize is a raw integer with no Option<ID3D12RootSignature> wrapper, and execute_indirect lines 256-259 do not check list.GetType() == D3D12_COMMAND_LIST_TYPE_DIRECT before calling SetGraphicsRootSignature.

  • Synthetic Reproducer: Bind a graphics root signature rs, release rs on CPU, then invoke ExecuteIndirect with an untranslated PC PSO (triggering COM UAF on rs); or execute an untranslated compute ExecuteIndirect after a translated dispatch without restoring the compute root signature.

  • Proposed Fix & Risk: - Fix: Store rs_gfx: Option<ID3D12RootSignature> (retained via from_raw_borrowed + .clone(), cleared on reset/clear_state/forget) and guard list.SetGraphicsRootSignature in execute_indirect to only run on DIRECT/BUNDLE command lists (tracking and restoring rs_compute: Option<ID3D12RootSignature> for compute lists).

  • Regression Risk: Low; retains at most two COM root-signature references per active command list until reset/release. (Estimated size: S)

20. XCL-BT-020 — buffer_load_format_d16_* / tbuffer_load_format_d16_* zeroes odd-channel high 16 bits, truncates UINT/SINT, and double-rounds UNORM/SNORM (P1)

  • Location: crates/xcl/src/gpu/recomp/emit.rs lines 1787-1805

  • Prior-Work Check: Searched all 4,430 XCL records for mubuf_d16 and buffer_load_format_d16 (only #159 opcode census; 0 hits for odd-channel high half, integer saturation, or UNORM/SNORM double-rounding).

  • Root Cause: Measured on RDNA2 gfx1031 (ProjectLeonidaL/leonida docs/shader_validation.md:1642,1658-1665, d16_format_probe.py), *_load_format_d16_* has three contracts violated by emit.rs:1787-1805: (1) odd-channel loads (d16_x, d16_xyz) preserve vdst[31:16], whereas XCL overwrites the full 32-bit VGPR with zeroed high 16 bits; (2) 32-bit UINT/SINT formats saturate to [0, 65535] / [-32768, 32767], whereas XCL truncates via & 0xFFFFu; (3) 16_UNORM/16_SNORM single-round directly to f16 RNE (0xFFAF -> 0x3BFD, 0xFFEF -> 0x3BFF, 0x7FF7 -> 0x3BFF, 0x8009 -> 0xBBFF), whereas XCL widens to f32 and calls f32tof16, double-rounding boundary values.

  • Edge-Case / Verification Note: Alternative hypothesis: odd-channel d16 destinations might not hold live high-half state. Falsification: RDNA2 16-bit register allocation packs two independent half-precision values into one VGPR, and integer truncation turns 65536 into 0.

  • Synthetic Reproducer: Pre-load v0 = 0x5A5A_0000, run buffer_load_format_d16_x v0, v1, s[0:3], 0 idxen on a 32_UINT value 70000. Hardware produces v0 = 0x5A5A_FFFF; XCL produces 0x0000_1170.

  • Proposed Fix & Risk: - Fix: Preserve (vdst & 0xFFFF0000u) on odd trailing channels, clamp UINT/SINT to 16-bit signed/unsigned ranges before masking, and perform direct single-rounded f16 RNE conversion for UNORM/SNORM.

  • Regression Risk: Low; localized to mubuf_d16. (Estimated size: S)

21. XCL-BT-021 — bvh::world_to_object Divides by Unguarded det, Writing NaN/Inf Inverse Transforms for Zero-Scale or Degenerate TLAS Instances (P1)

  • Location: crates/xcl/src/gpu/bvh.rs lines 217-235

  • Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'world_to_object', 'bvh.rs', 'singular', 'det == 0': PR #26 (initial BVH) and PR #107 (triangle_hit det underflow/overflow) matched; zero issues or PRs cover singular/zero-scale instance matrices in world_to_object.

  • Root Cause: In bvh::world_to_object (bvh.rs:217-235), the 3x3 cofactor matrix of a TLAS instance's object -> world transform is unconditionally divided by det (row.map(|x| x / det)). Titles routinely disable or cull dynamic raytracing instances without rebuilding instance buffers by writing an all-zero or zero-scale 3x4 transform matrix (det == 0.0). Dividing by 0.0 populates all 12 f32 words of the instance node's world -> object transform (offset +64..+112) with NaN or ±inf. When a ray reaches the instance node, transforming the ray into object space produces NaN ray origin/direction, propagating NaN through BLAS traversal or causing undefined hit behavior.

  • Edge-Case / Verification Note: Verified build_top (bvh.rs:98-121) unconditionally calls world_to_object(m) for every Instance without checking det == 0.0 or skipping singular transforms. While transform_aabb collapses a zero-scale instance to a point AABB (t, t), rays grazing or originating at t still pass the box test and enter the NaN instance transform.

  • Synthetic Reproducer: Call bvh::build_top with an Instance whose transform is all zeros (or has a zero scale row/column). Inspect bytes +64..+112 of the emitted 128-byte instance node: all 12 f32 values are NaN.

  • Proposed Fix & Risk: - Fix: Guard if det.abs() <= 1e-30 (or !det.is_finite() || det == 0.0) in world_to_object and return a safe zero/identity fallback (and in build_top, emit a NaN-disabled AABB for degenerate zero-area/singular instances with det == 0.0 so rays cleanly skip them).

  • Regression Risk: Very low; preserves exact inverse matrices for all invertible transforms while preventing NaN propagation on disabled/degenerate instances. (Estimated size: XS)

22. XCL-BT-022 — console_list::cl_release Immediately Frees UMA Argument/IO Blocks While Submitted GPU Work Is Still In Flight (GPU UAF Under XCL_CONSOLE_LISTS) (P1)

  • Location: crates/xcl/src/hle/d3d12x/console_list.rs lines 377-393

  • Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'console_list', 'cl_release', 'free_uma': PR #45 (initial sparse VRAM), PR #510 (reuse record chunk across Reset), and PR #806 (oversized chunks) do not mention cl_release freeing st.uma immediately instead of deferring to PENDING[st.alloc].

  • Root Cause: In console_list.rs, cl_reset properly defers freeing the previous recording's UMA argument-table/IO blocks (st.uma) by moving them into PENDING[old_alloc] via hold_until_reset, so they stay alive until the title resets the command allocator after GPU completion. However, cl_release (console_list.rs:377-393) calls free_uma(&st.uma) immediately when the command list's refcount drops to 0. In D3D12, titles are allowed to release a closed command list right after calling ExecuteCommandLists while the GPU is still executing it (only the command allocator must stay alive). Calling free_uma(&st.uma) immediately frees and recycles the UMA argument tables and IO buffers out from under in-flight GPU shaders.

  • Edge-Case / Verification Note: Compared bind::forget (bind.rs:125-129, which correctly calls console_list::hold_until_reset(s.allocator, s.uma)) against console_list::cl_release (console_list.rs:377-393, which directly calls free_uma(&st.uma)). bind::forget already demonstrates the right allocator-scoped deferral; cl_release missed it.

  • Synthetic Reproducer: Under XCL_CONSOLE_LISTS=1, record a command list with translated dispatches/draws (allocating UMA blocks in st.uma), close it, submit it via ExecuteCommandLists, and immediately call list->Release() before the GPU finishes executing the list. cl_release frees st.uma immediately while the GPU still reads those argument tables.

  • Proposed Fix & Risk: - Fix: In console_list::cl_release, replace free_uma(&st.uma) with hold_until_reset(st.alloc, st.uma) (matching cl_reset and bind::forget).

  • Regression Risk: Very low; 1-line fix matching cl_reset and bind::forget. (Estimated size: XS)


Continue Series: Part 1/3 (this issue) | Part 2/3: https://github.com/ivall/xcl/issues/1489 | Part 3/3: https://github.com/ivall/xcl/issues/1490

**@⁠hyperland956-lgtm** on GitHub · 2026-11-24 16:51 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488) > **Multi-Part Series (1/3):** **Part 1/3 (this issue)** | Part 2/3: `https://github.com/ivall/xcl/issues/1489` | Part 3/3: `https://github.com/ivall/xcl/issues/1490` # Tracking & Static Audit: 50 New Source-Level Bugs (D3D12.X Lifetime/Sync, Shader Recompiler, DirectStorage, XMA2, Tiling) + 150 Prioritized Backlog Items > **Tracking & Audit Issue:** This tracking issue groups **50 newly identified, non-duplicate source-level findings** alongside a prioritized index of **150 existing canonical open issues/PRs** (**200 total work items**) to help contributors pick up high-impact, separable fixes without opening duplicates. > > **Scope, Testing & Policy Disclosure:** AI-assisted static code audit (prepared with Gemini; per CONTRIBUTING.md, individual implementation PRs will require Windows `cargo test --workspace -- --test-threads=4` and `scripts/smoke.ps1` regression runs). All findings are strictly source-level and synthetic (zero proprietary game bytes, disassembly, extracted shaders, or screenshots). Algorithmic/numeric reproducers (thick 3D mip-tail depth, `f16` single-rounding ties, `v_mad_f16` vs `v_fma_f16`, MUBUF `OOB_SELECT=3` `SOFFSET`, physical-page double-free counter, `FMT_INFO` clamping, and singular BVH inverse) were verified via Python reference checks on Linux; `cargo test` on Windows MSVC / D3D12 GPU has not yet been run on these fixes. * **Repository:** `https://github.com/ivall/xcl` * **Audited Revision:** `main (2026-11-24 snapshot)` * **Date:** `2026-11-24` ## 1. Highest-Impact Active Bottlenecks (Existing Canonical Issues/PRs — Do Not Duplicate) 1. **BCPack Zero-Byte Texture Fills (Black World)** — Tracked in [`#878`](https://github.com/ivall/xcl/issues/878) (184 MB of BC1/BC3/BC5/BC6H/BC7 requests filling 0 bytes; prior PRs `#905` and `#950` closed unmerged). 2. **AS-Slot Mesh Pipeline Refusals (42 Pipelines)** — Reported in [`#534`](https://github.com/ivall/xcl/issues/534) and [`#878`](https://github.com/ivall/xcl/issues/878). 3. **Commit Growth (\~40 GB) & Late-Release Memory Retention** — Reported in [`#534`](https://github.com/ivall/xcl/issues/534); active work in [`#1040`](https://github.com/ivall/xcl/issues/1040), [`#968`](https://github.com/ivall/xcl/pull/968), and [#1070](https://www.google.com/search?q=https://github.com/ivall/xcl/pull/1070) (building on merged `#866`). 4. **DirectStorage Deferred Page-Array Safety** — Tracked in [`#476`](https://github.com/ivall/xcl/issues/476) and open PR [`#509`](https://github.com/ivall/xcl/pull/509). ## 2. Newly Identified, Non-Duplicate Findings (50 Separable Tasks) Each item below was checked against all existing open, merged, and closed issues/PRs and comments, and can be implemented and tested in its own focused PR. | \# | ID | Priority | Location | Summary | | ----- | ----- | ----- | ----- | ----- | | 1 | `XCL-BT-001` | **P0** | `crates/xcl/src/hle/d3d12x/real.rs` lines `2713-2731, 3007-3021` | HEAP_UMA Frees Backing Sparse/UMA Block Immediately on ID3D12Heap::Release While Placed Buffers Remain Alive (CPU Crash / GPU UAF) | | 2 | `XCL-BT-002` | **P0** | `crates/xcl/src/gpu/recomp/emit.rs` lines `1704-1728, 3750-3769, 1495-1524` | MUBUF/MTBUF bounds checks ignore V# OOB_SELECT, omit SOFFSET in raw mode, wrap u32, and mischeck s_buffer_load | | 3 | `XCL-BT-003` | **P0** | `crates/xcl/src/hle/d3d12x/cpu_writes.rs` lines `56-104` | Single global xcl-cpu-writes FIFO worker deadlocks/HOL-blocks across independent queues & tears 64-bit immediate writes | | 4 | `XCL-BT-004` | **P0** | `crates/xcl/src/hle/dstorage.rs` lines `881-940` | Uncompressed DirectStorage requests with source_size < destination_size panic (physical) or heap-over-read UB (virtual) | | 5 | `XCL-BT-005` | **P0** | `crates/xcl/src/hle/d3d12x/device_x.rs` lines `355-386, 446-500, 521-565` | Unretained Raw pRootSignature Pointer in device_x::Base::desc Causes COM Use-After-Free in RSSetDepthBiasX and CreateDerivedPipelineStateX | | 6 | `XCL-BT-006` | **P0** | `crates/xcl/src/hle/dstorage.rs` lines `615-627` | dstorage.rs: factory_create_status_array initializes slots to E_PENDING instead of S_OK, deadlocking ring-buffer callers | | 7 | `XCL-BT-007` | **P0** | `crates/xcl/src/hle/kernelx.rs` lines `1222-1242` | kernelx.rs: map_pages allows consecutive page numbers spanning two distinct PHYS_BLOCKS allocations to commit past allocation A's bounds | | 8 | `XCL-BT-008` | **P0** | `crates/xcl/src/hle/d3d12x/pso_async.rs, crates/xcl/src/hle/d3d12x/real.rs` lines `pso_async.rs:354-367, 376-394, 448-458; real.rs:1598-1606` | pso_async::resolve / resolve_wait Returns Unretained Raw ID3D12PipelineState\* Pointer Racing With released() (COM Use-After-Free) | | 9 | `XCL-BT-009` | **P0** | `crates/xcl/src/hle/d3d12x/sparse.rs` lines `587-601, 1355-1413, 1454-1456` | sparse::flush_parked Returns Unmapped VRAM Pool Tiles to self.free Without Waiting for In-Flight Title Queues (GPU UAF / Corruption) | | 10 | `XCL-BT-010` | **P1** | `crates/xcl/src/gpu/recomp/emit.rs` lines `1780, 1816` | FMT_INFO\[min(fmt, 77u)\] clamps out-of-range 7-bit format codes 78..127 to format 77 (32_32_32_32_FLOAT) instead of 0 (INVALID) | | 11 | `XCL-BT-011` | **P1** | `crates/xcl/src/hle/kernelx.rs` lines `1154-1199` | FreeTitlePhysicalPages double-free UAF of live sibling pages & monotonic NEXT_PAGE_INDEX 21-bit exhaustion | | 12 | `XCL-BT-012` | **P1** | `crates/xcl/src/gpu/recomp/emit.rs` lines `1919-1985` | Pixel shader export_graphics ignores VM (Valid Mask) bit and per-MRT color export masks | | 13 | `XCL-BT-013` | **P1** | `crates/xcl/src/hle/d3d12x/alloc_pool.rs` lines `89-102, 195-216` | TOCTOU Race Between alloc_pool::reset_list and Concurrent title_reset Allows Resetting an Actively Recording Command Allocator | | 14 | `XCL-BT-014` | **P1** | `crates/xcl/src/gpu/tiling.rs` lines `299-317` | Thick 3D mip-tail predicate in tiling.rs omits depth_of(i) <= td | | 15 | `XCL-BT-015` | **P1** | `crates/xcl/src/hle/xma2/mod.rs` lines `69-94` | XMA2 StreamConfig::from_xma2_wfx Miscomputes Stereo/Mono Channel Layout for Multi-Stream XMA2WAVEFORMATEX (e.g., 5.1 4-Stream, 4.0 3-Stream) | | 16 | `XCL-BT-016` | **P1** | `crates/xcl/src/hle/xma2/mod.rs` lines `1764-1780` | XMA2 advance_stream Decrements skip_packets == 255 (0xFF EOF Sentinel), Causing Finished Streams to Steal Packets After 255 Packets | | 17 | `XCL-BT-017` | **P1** | `crates/xcl/src/hle/xma2/mod.rs` lines `1566-1582` | XMA2 decode_packet_step Unconditionally Decodes Incomplete Reservoir on 3+-Packet Spanning Frames, Triggering packet_loss and Wiping Saved Bits | | 18 | `XCL-BT-018` | **P1** | `crates/xcl/src/hle/acphal.rs` lines `711-717, 775, 927-953` | acphal.rs: XApu ignores XAPU_CONNECT_OPTION_DEINTERLEAVED_OUTPUT (options & 4), corrupting stereo PCM layout | | 19 | `XCL-BT-019` | **P1** | `crates/xcl/src/hle/d3d12x/bind.rs` lines `175-182, 235-261` | bind::execute_indirect Uses Unretained Raw s.rs_gfx With SetGraphicsRootSignature Even on COMPUTE Lists (COM UAF + Invalid Compute Queue Call) | | 20 | `XCL-BT-020` | **P1** | `crates/xcl/src/gpu/recomp/emit.rs` lines `1787-1805` | buffer_load_format_d16\_\* / tbuffer_load_format_d16\_\* zeroes odd-channel high 16 bits, truncates UINT/SINT, and double-rounds UNORM/SNORM | | 21 | `XCL-BT-021` | **P1** | `crates/xcl/src/gpu/bvh.rs` lines `217-235` | bvh::world_to_object Divides by Unguarded det, Writing NaN/Inf Inverse Transforms for Zero-Scale or Degenerate TLAS Instances | | 22 | `XCL-BT-022` | **P1** | `crates/xcl/src/hle/d3d12x/console_list.rs` lines `377-393` | console_list::cl_release Immediately Frees UMA Argument/IO Blocks While Submitted GPU Work Is Still In Flight (GPU UAF Under XCL_CONSOLE_LISTS) | | 23 | `XCL-BT-023` | **P1** | `crates/xcl/src/hle/d3d12x/real.rs` lines `4660-4670` | dev_create_pipeline_state Bypasses device_x::create_graphics_pso_tracked, Breaking RSSetDepthBiasX and CreateDerivedPipelineStateX for All Stream-Created Graphics PSOs | | 24 | `XCL-BT-024` | **P1** | `crates/xcl/src/hle/d3d12x/list_x.rs` lines `3155-3219, 3341-3360` | draw_indexed_x Never Re-Syncs Mirrored Non-UMA Inline Index Buffers After Initial Bind, Rendering Stale Indices | | 25 | `XCL-BT-025` | **P1** | `crates/xcl/src/gpu/recomp/emit.rs` lines `5282-5284` | fmt_comp fills missing MUBUF typed buffer channels with (0,0,0,1) instead of c mod n and quiets 16_FLOAT sNaN payloads via f16tof32 | | 26 | `XCL-BT-026` | **P1** | `crates/xcl/src/gpu/recomp/emit.rs` lines `5344-5358` | fmt_encode typed buffer stores violate four measured RDNA2 hardware contracts (INT saturation, SCALED, float16/11/10 RTZ+max-finite, UNORM/SNORM rounding) | | 27 | `XCL-BT-027` | **P1** | `crates/xcl/src/hle/gameinput.rs` lines `815-842` | gameinput.rs: IGameInput::RegisterDeviceCallback completely ignores statusFilter (\_filter) | | 28 | `XCL-BT-028` | **P1** | `crates/xcl/src/gpu/recomp/emit.rs` lines `2217-2223, 2455-2459` | image_load / image_load_mip with D16=1 truncates 32-bit UINT/SINT texels and zeroes vdst\[31:16\] on odd-channel loads | | 29 | `XCL-BT-029` | **P1** | `crates/xcl/src/hle/kernelx.rs, crates/xcl/src/hle/kernelx/lazy.rs` lines `kernelx.rs:1169-1176; lazy.rs:47-59` | kernelx.rs: FreeTitlePhysicalPages removes away mappings without calling lazy::unmark(at), leaving stale VEH entries in LAZY | | 30 | `XCL-BT-030` | **P1** | `crates/xcl/src/hle/kernelx.rs` lines `453-467` | kernelx.rs: VirtualAllocEx(GetCurrentProcess(), ...) bypasses placeholders::alloc, UMA, sparse VRAM, and GRAPHICS_RESERVATIONS | | 31 | `XCL-BT-031` | **P1** | `crates/xcl/src/hle/d3d12x/list_x.rs` lines `3738-3753` | resolve_subresource_x and resolve_subresource_region_x Omit title_textures::note_gpu_write(dst) and Console DXGI Format Translation | | 32 | `XCL-BT-032` | **P1** | `crates/xcl/src/hle/d3d12x/list_x.rs` lines `3486-3517` | resource_barrier_x Records BEGIN_ONLY Split Transition Barriers as Completed StateAfter in title_textures::note_transitions | | 33 | `XCL-BT-033` | **P1** | `crates/xcl/src/hle/d3d12x/sparse.rs` lines `970-997, 1021-1038` | sparse::sync_sent_range Hashes Entire 64-Byte Chunks After Sub-64-Byte GPU Readbacks, Silently Dropping Un-Uploaded CPU Writes in Same Cacheline | | 34 | `XCL-BT-034` | **P1** | `crates/xcl/src/hle/d3d12x/real.rs` lines `4549-4577` | stream_pipeline Unconditionally Defaults DepthEnable=TRUE Even When DEPTH_STENCIL Subobject Is Omitted and DSVFormat Is UNKNOWN | | 35 | `XCL-BT-035` | **P1** | `crates/xcl/src/hle/d3d12x/title_textures.rs` lines `260-266, 426-451` | title_textures::recheck_gpu_view_sources Increments PENDING for Shadowed Textures, Permanently Leaking PENDING Counter and Breaking Fast-Path Skip | | 36 | `XCL-BT-036` | **P1** | `crates/xcl/src/hle/d3d12x/real.rs` lines `4347-4414` | translated_gs_pso Copies Raw Console RTV/DSV DXGI Formats Into StreamOut Pipeline Stream Without pc_target_format / pc_view_format Translation | | 37 | `XCL-BT-037` | **P1** | `crates/xcl/src/gpu/recomp/upper_lanes.rs` lines `549-555` | upper_lanes::step() misses S_MOVRELSD_2_B32 when invalidating SGPR abstract state | | 38 | `XCL-BT-038` | **P1** | `crates/xcl/src/gpu/recomp/emit.rs` lines `3304-3308` | v_pack_b32_f16 silently drops VOP3 abs and neg source modifiers | | 39 | `XCL-BT-039` | **P1** | `crates/xcl/src/gpu/recomp/emit.rs` lines `2960-2965, 3186-3191` | valu16 and valu64 apply VOP3 omod (mul:2/mul:4/div:2) to f16/f64 despite RDNA2 gating omod off under MODE.denorm_mode_16_64 = 3 | | 40 | `XCL-BT-040` | **P1** | `crates/xcl/src/hle/xgameruntime/api.rs` lines `366-379` | xgameruntime/api.rs: query_interface on all XGameRuntime COM objects refuses IID_IUnknown with E_NOINTERFACE | | 41 | `XCL-BT-041` | **P1** | `crates/xcl/src/hle/xgameruntime/mod.rs` lines `867-871, 891-910` | xgameruntime/mod.rs: association_call ignores canceled flag and XUserUnregisterForDeviceAssociationChanged ignores wait, causing UAF on caller context | | 42 | `XCL-BT-042` | **P2** | `crates/xcl/src/gpu/recomp/emit.rs` lines `5008-5011, 5059` | Float compare-and-swap atomics use bitwise InterlockedCompareExchange instead of IEEE float equality (-0.0 == +0.0, NaN != NaN) | | 43 | `XCL-BT-043` | **P2** | `crates/xcl/src/hle/acphal.rs` lines `955-962, 985-994` | acphal.rs: XApuEnqueueCommand and XApuGetResultCount report current queue length instead of cumulative enqueued/dequeued totals | | 44 | `XCL-BT-044` | **P2** | `crates/xcl/src/hle/kernelx.rs` lines `648-667` | kernelx.rs: XMemVirtualQuery writes only a 32-bit CPU-only flag at +48, leaving +52..+64 uninitialized and clearing GPU visibility | | 45 | `XCL-BT-045` | **P2** | `crates/xcl/src/hle/d3d12x/present.rs` lines `158-171` | present::note_rtv Retains ID3D12Resource COM References Indefinitely in RTVS Without Cleanup on Descriptor Heap Destruction (COM & VRAM Leak) | | 46 | `XCL-BT-046` | **P2** | `crates/xcl/src/gpu/recomp/emit.rs` lines `2564-2573, 3633-3638, 5851` | v_cmp_class_f32 applies abs/neg via float arithmetic (flushing denormals & quieting sNaNs) | | 47 | `XCL-BT-047` | **P2** | `crates/xcl/src/gpu/recomp/emit.rs` lines `3471-3472, 3547-3555, 5624` | v_div_scale_f32 / v_div_fmas_f32 / v_div_fixup_f32 drops pre/post-scaling and mishandles NaN q, sign, and underflow cutoff | | 48 | `XCL-BT-048` | **P2** | `crates/xcl/src/gpu/recomp/emit.rs` lines `2025-2031` | v_interp_p2_f16 double-rounds through binary32 instead of single-rounding to binary16 | | 49 | `XCL-BT-049` | **P2** | `crates/xcl/src/gpu/recomp/emit.rs` lines `2987-2992, 3362-3375` | v_min_f32 / v_max_f32 / v_min3_f32 / v_max3_f32 violate RDNA2 -0.0 < +0.0 signed-zero ordering on NVIDIA/WARP | | 50 | `XCL-BT-050` | **P2** | `crates/xcl/src/hle/xgameruntime/networking.rs` lines `421-442` | xgameruntime/networking.rs: check_thumbprints for XNetworkingThumbprintType::Issuer only inspects chain_sha1s.get(1), failing on 4+ cert chains | ### Technical Details for All Newly Identified Findings #### 1. `XCL-BT-001` — HEAP_UMA Frees Backing Sparse/UMA Block Immediately on ID3D12Heap::Release While Placed Buffers Remain Alive (CPU Crash / GPU UAF) (`P0`) * **Location:** `crates/xcl/src/hle/d3d12x/real.rs` lines `2713-2731, 3007-3021` * **Prior-Work Check:** Verified 0% overlap across 4,430 ivall_xcl records (issues_and_prs.json=1,035, pulls.json=849, issue_comments.json=3,395). Searched 'heap_uma', 'mem_heap_release', 'uma_buffers', 'create_placed_resource_x': only PR #40 (initial routing) and unrelated depth/format PRs (#163, #651, #1063) matched; zero issues or PRs cover premature HEAP_UMA deallocation on heap release. * **Root Cause:** In `dev_create_placed_resource_x` (`real.rs:2713-2731`), buffers placed into a `HEAP_UMA` heap are backed by `block + offset` (`UMA_BUFFERS.insert(res, (va, bytes, false))`) rather than being created inside the PC `ID3D12Heap`, so the PC placed buffer holds no COM reference on `heap`. In D3D12, titles routinely release an `ID3D12Heap` immediately after creating placed resources from it (expecting the runtime to keep the heap alive until all placed resources are destroyed). When `mem_heap_release` (`real.rs:3007-3021`) observes the heap refcount drop to `0`, it immediately calls `sparse::free(p)` or `u.free(p)` on the backing UMA/sparse block even though placed `ID3D12Resource` buffers inside that block are still alive and referenced by CPU pointers and in-flight GPU command lists. * **Edge-Case / Verification Note:** Checked whether placed buffers hold an explicit `AddRef` on `heap` anywhere in `dev_create_placed_resource_x` or `res_release`: `UMA_BUFFERS` stores only `(va, bytes, owns_block: false)` and never stores or `AddRef`s the parent `heap` pointer. Thus releasing `heap` while any placed buffer is live unconditionally frees the underlying memory. * **Synthetic Reproducer:** Create a buffer `ID3D12Heap` (routed to `HEAP_UMA`), call `CreatePlacedResource` for a buffer at offset 0, call `heap->Release()` (valid D3D12 lifetime), then read/write the placed buffer's GPU VA or CPU UMA address in a subsequent draw/dispatch. Observe immediate access violation or GPU page fault / corrupted reads after `sparse::free(p)` decommits or recycles the block. * **Proposed Fix & Risk:** - **Fix:** Track the parent `heap` pointer (with `AddRef` on placement and `Release` in `res_release`) or reference-count `HEAP_UMA` backing blocks via `Arc` shared between the heap entry and every placed buffer in `UMA_BUFFERS`, deferring `sparse::free(p)` / `u.free(p)` until both the heap and all placed buffers (and any `late_release` GPU holds) have released. * **Regression Risk:** Low; adds a lightweight `Arc` or heap `AddRef`/`Release` pair per placed buffer in `HEAP_UMA`, matching standard D3D12 placed-resource heap lifetime semantics. (Estimated size: `M`) #### 2. `XCL-BT-002` — MUBUF/MTBUF bounds checks ignore V# OOB_SELECT, omit SOFFSET in raw mode, wrap u32, and mischeck s_buffer_load (`P0`) * **Location:** `crates/xcl/src/gpu/recomp/emit.rs` lines `1704-1728, 3750-3769, 1495-1524` * **Prior-Work Check:** Searched all 4,430 XCL records for `OOB_SELECT`, `soffset` bounds, `s_buffer_load` partial-dword (`Issue #307` only discussed `num_records * stride`; 0 hits for `OOB_SELECT` or missing `SOFFSET`). * **Root Cause:** Native RDNA2 (`gfx1036`) & RDNA1 (`gfx1011`) measurements (`Leonida/docs/buffer_bounds.md`, 732 cases) prove hardware selects bounds checks by V# word 3 `OOB_SELECT` (`d3[29:28]`): mode 0 checks `index >= N || offset + bytes > stride`, mode 1 checks `index >= N`, mode 2 checks `N == 0`, mode 3 (raw) checks `offset + soffset + bytes > N`. XCL ignores `d3[29:28]` (using `stride == 0`), omits `soff` from `t_off` in raw mode (allowing OOB VRAM reads/writes whenever `SOFFSET != 0`), skips `offset + bytes <= stride` in mode 0, wraps 32-bit `uint` in single-window mode, and checks `t_off < t_lim` instead of `t_off + 4 <= t_lim` in `s_buffer_load`. * **Edge-Case / Verification Note:** Alternative hypothesis: most shaders might pass `SOFFSET = 0`. Falsification: AMD's LLVM backend routinely places constant/loop-invariant byte offsets in `SOFFSET`; synthetic raw `buffer_load_dword` with `N=18, voff=8, soff=8` proves OOB leak. * **Synthetic Reproducer:** Raw V# (`OOB_SELECT=3, NUM_RECORDS=18`), `buffer_load_dword` at `voff=8, soff=8` (`8+8+4=20 > 18`): RDNA2 hardware returns `0`; XCL reads out-of-bounds VRAM because `8+4 <= 18`. * **Proposed Fix & Risk:** - **Fix:** Decode `oob = (d3 >> 28) & 3u`, perform bounds checks in `uint64_t`, include `(uint64_t)soff` in mode 3, check `t_off + bytes <= stride` in mode 0, check `d2 != 0u` in mode 2, and fix `s_buffer_load` to `(uint64_t)t_off + 4ull <= (uint64_t)t_lim`. * **Regression Risk:** Low; strictly aligns with measured RDNA1/RDNA2 silicon. (Estimated size: `M`) #### 3. `XCL-BT-003` — Single global xcl-cpu-writes FIFO worker deadlocks/HOL-blocks across independent queues & tears 64-bit immediate writes (`P0`) * **Location:** `crates/xcl/src/hle/d3d12x/cpu_writes.rs` lines `56-104` * **Prior-Work Check:** Searched all 4,430 XCL records for `xcl-cpu-writes`, `cpu_writes`, `AtomicU32` torn writes (PR #1005/#1034 cover VirtualQuery/watch only; 0 hits for cross-queue FIFO deadlock or torn 64-bit writes). * **Root Cause:** (1) One global `xcl-cpu-writes` FIFO thread pops jobs from all command queues in enqueue order and blocks on `WaitForSingleObject(event, 10_000)`. If Queue A is waiting on a signal from Queue B's bottom-of-pipe write, Queue B's job is head-of-line blocked for 10 seconds until Queue A times out—and then Queue A's writes are prematurely committed before Queue A's GPU work completes. (2) `write_now()` (`101-103`) commits `Write::Immediate(va, vec![lo, hi])` as two non-atomic `AtomicU32::store` calls, exposing torn 64-bit fence values to polling title threads. * **Edge-Case / Verification Note:** Alternative hypothesis: titles might only use `Write64BitValueBottomOfPipeX` on a single Direct queue. Falsification: modern GDK engines (including the retail title) use separate Direct, Async Compute, and Copy queues with cross-queue fence dependencies; synthetic 2-queue test deterministically triggers the 10 s deadlock. * **Synthetic Reproducer:** Submit `Write64BitValueBottomOfPipeX` on Queue A waiting on Fence B, then submit `Write64BitValueBottomOfPipeX` on Queue B whose CPU poll unblocks Fence B -> `xcl-cpu-writes` stalls 10 s and fires Queue A's write prematurely. * **Proposed Fix & Risk:** - **Fix:** Dispatch one worker per queue (or `WaitForMultipleObjects` across per-queue queues) and add `Write::ImmediateU64(usize, u64)` committed via `AtomicU64::store(..., Ordering::Release)`. * **Regression Risk:** Low; preserves strict in-queue FIFO ordering while removing false cross-queue serialization. (Estimated size: `M`) #### 4. `XCL-BT-004` — Uncompressed DirectStorage requests with source_size < destination_size panic (physical) or heap-over-read UB (virtual) (`P0`) * **Location:** `crates/xcl/src/hle/dstorage.rs` lines `881-940` * **Prior-Work Check:** Searched all 4,430 XCL records; PR #21 fixed only compressed intermediate buffers (`d.len() < n` inside `if r.zlib()`), leaving the uncompressed raw path (`!r.zlib() && bc == 0`) unguarded. * **Root Cause:** When `!r.zlib() && bc == 0`, `payload` has length `r.source_size`. Line `935` indexes `&payload[..n]` (where `n = destination_size`), panicking if `source_size < destination_size`; line `939` calls `std::ptr::copy_nonoverlapping(payload.as_ptr(), dst, n)`, causing heap-buffer-over-read UB. * **Edge-Case / Verification Note:** Alternative hypothesis: GDK DirectStorage may reject `source_size < destination_size` on uncompressed requests as `E_INVALIDARG`. Either way, panicking or executing UB heap-over-read is a confirmed defect; whether to zero-pad or return `E_INVALIDARG` should be matched to GDK behavior. * **Synthetic Reproducer:** Unit test calling `execute_request` with uncompressed memory source (`source_size = 64, destination_size = 128`) -> panics on physical-page dest / over-reads 64 B on virtual dest. * **Proposed Fix & Risk:** - **Fix:** Validate `payload.len() >= n` (returning `E_INVALIDARG` if invalid per GDK spec, or zero-padding `payload.resize(n, 0)` if padded destinations are permitted) before lines `935`/`939`. * **Regression Risk:** Very low. (Estimated size: `XS`) #### 5. `XCL-BT-005` — Unretained Raw pRootSignature Pointer in device_x::Base::desc Causes COM Use-After-Free in RSSetDepthBiasX and CreateDerivedPipelineStateX (`P0`) * **Location:** `crates/xcl/src/hle/d3d12x/device_x.rs` lines `355-386, 446-500, 521-565` * **Prior-Work Check:** Verified 0% overlap across 4,430 ivall_xcl records. Searched 'note_base', 'depth_bias_pso', 'create_derived_pso_x', 'prootsignature', 'derivedpipelinestate': only PR #23 (initial implementation) and PR #144 (untranslated root sig binding) matched; zero issues or PRs report the unretained pRootSignature UAF in Base::desc. * **Root Cause:** `device_x::note_base` (`device_x.rs:355-386`) copies the raw bytes of `D3D12_GRAPHICS_PIPELINE_STATE_DESC`—including the raw `pRootSignature` COM pointer at offset `0x00`—into `Base::desc` without calling `AddRef` on `pRootSignature` (even though it carefully deep-copies `InputLayout` descriptors and shader bytecode). In D3D12, titles are allowed to call `root_sig->Release()` immediately after creating a PSO. Later, when `depth_bias_pso` (`device_x.rs:446-500`) or `create_derived_pso_x` (`device_x.rs:521-565`) clones `Base::desc` and passes it to `CreateGraphicsPipelineState`, the driver dereferences a freed/dangling `ID3D12RootSignature*`. * **Edge-Case / Verification Note:** Verified `Base` struct definition and `forget_base` in `device_x.rs`: `Base` owns `Vec<u8>` copies of input layout/semantics/shaders but stores `pRootSignature` solely as raw bytes inside `desc`, with no `Option<ID3D12RootSignature>` field and no `AddRef`/`Release` lifecycle management. * **Synthetic Reproducer:** Create a root signature `rs`, create a graphics PSO `pso` with `rs` (e.g. without dynamic depth bias or on Intel/bundle fallback), call `rs->Release()`, then trigger `RSSetDepthBiasX` or `CreateDerivedPipelineStateX` on `pso`. The driver crashes with an access violation dereferencing the freed `rs` vtable inside `CreateGraphicsPipelineState`. * **Proposed Fix & Risk:** - **Fix:** Extract `pRootSignature` in `note_base`, retain an `Option<ID3D12RootSignature>` via `from_raw_borrowed` + `.clone()` on `Base` (releasing automatically when `Base` is dropped in `forget_base`), and keep it alive for the lifetime of `Base`. * **Regression Risk:** Low; retains one COM reference per cached base PSO until `forget_base` runs on PSO destruction. (Estimated size: `S`) #### 6. `XCL-BT-006` — dstorage.rs: factory_create_status_array initializes slots to E_PENDING instead of S_OK, deadlocking ring-buffer callers (`P0`) * **Location:** `crates/xcl/src/hle/dstorage.rs` lines `615-627` * **Prior-Work Check:** Verified 0 hits across ivall_xcl issues_and_prs.json, pulls.json, issue_comments.json, and review_comments.json for createstatusarray / statusarray E_PENDING. * **Root Cause:** In dstorage.rs:622, `factory_create_status_array` initializes every slot with `AtomicI32::new(E_PENDING)`. Per Microsoft's DirectStorage specification (IDStorageStatusArray::IsComplete / GetHResult, and matching VIctory's dstorage.rs:165), newly created status array entries start in the completed state (`S_OK`, `IsComplete() == true`) until `EnqueueStatus` transitions a slot to `E_PENDING`. * **Edge-Case / Verification Note:** Titles that only call `IsComplete(i)` after calling `EnqueueStatus(array, i)` do not observe the initial state, which is why existing unit tests passed. However, standard DirectStorage ring-buffer patterns wait on `IsComplete(slot)` before recycling `slot` on its first pass. * **Synthetic Reproducer:** Call IDStorageFactoryX::CreateStatusArray(4, ...) and immediately call status->IsComplete(0) and status->GetHResult(0); returns false and E_PENDING instead of true and S_OK. * **Proposed Fix & Risk:** - **Fix:** Initialize slots in `factory_create_status_array` with `AtomicI32::new(S_OK)` at dstorage.rs:622. * **Regression Risk:** Low; matches DirectStorage specification and only affects pre-enqueue slot state. (Estimated size: `S`) #### 7. `XCL-BT-007` — kernelx.rs: map_pages allows consecutive page numbers spanning two distinct PHYS_BLOCKS allocations to commit past allocation A's bounds (`P0`) * **Location:** `crates/xcl/src/hle/kernelx.rs` lines `1222-1242` * **Prior-Work Check:** Verified 0 hits across ivall_xcl corpus for map_pages consecutive / cross-allocation PHYS_BLOCKS. * **Root Cause:** At kernelx.rs:1223-1225, `map_pages` checks `consecutive` on the numeric page IDs (`pages[0] + i * FRAMES == pages[i]`) and then sets `home = page_home(pages[0]).filter(|_| page_home(pages[n - 1]).is_some())`. Because `AllocateTitlePhysicalPages` assigns monotonically increasing page IDs across separate allocations, two independent allocations A (at virtual address `home_A`) and B (at unrelated virtual address `home_B`) have consecutive page IDs. `page_home(pages[n - 1]).is_some()` passes even though `page_home(pages[n - 1]) != Some(home_A + (n - 1) * PHYS_PAGE)`, causing `commit_homes(home_A, n)` to walk past block A's end. * **Edge-Case / Verification Note:** Single-allocation mappings always have contiguous homes, so single-block tests pass. The bug triggers whenever a title concatenates page IDs from two consecutive physical allocations into one MapTitlePhysicalPages call. * **Synthetic Reproducer:** Call AllocateTitlePhysicalPages twice (1 page each -> page IDs p0 and p0+16 with distinct non-adjacent home VAs), then call MapTitlePhysicalPages(NULL, 2, 0, PAGE_READWRITE, \[p0, p0+16\]); commits 128 KiB starting at home(p0) instead of returning ERROR_NOT_SUPPORTED. * **Proposed Fix & Risk:** - **Fix:** Verify that `pages[0]` and `pages[n - 1]` belong to the SAME `PHYS_BLOCKS` entry (or that `page_home(pages[n - 1]) == Some(home_0 + (n - 1) * PHYS_PAGE)` and all intermediate pages belong to the same block) before taking the contiguous home fast path. * **Regression Risk:** Low; strictly tightens safety validation on the home fast path. (Estimated size: `S`) #### 8. `XCL-BT-008` — pso_async::resolve / resolve_wait Returns Unretained Raw ID3D12PipelineState\* Pointer Racing With released() (COM Use-After-Free) (`P0`) * **Location:** `crates/xcl/src/hle/d3d12x/pso_async.rs, crates/xcl/src/hle/d3d12x/real.rs` lines `pso_async.rs:354-367, 376-394, 448-458; real.rs:1598-1606` * **Prior-Work Check:** Verified 0% overlap across 4,430 ivall_xcl records. Searched 'pso_async', 'resolve_wait', 'resolve_for_bind', 'pso_release': matches cover async compute registration (#102), wait logging (#899), preload worker priority inversion (#1007), and duplicate build experiment (#754); zero issues or PRs cover the raw-pointer UAF race between resolve/resolve_wait and released(). * **Root Cause:** `pso_async::resolve` (`pso_async.rs:354-367`) and `resolve_wait` (`pso_async.rs:376-394`) load `p.real.load(Ordering::Acquire)` and return the raw `usize` `ID3D12PipelineState*` pointer without incrementing its COM refcount. Concurrently, another thread releasing the stand-in PSO invokes `pso_release` (`real.rs:1598-1606`) -> `pso_async::released(standin)` (`pso_async.rs:448-458`), which atomically swaps `p.real` to `0` and calls `release(real)`, dropping the sole COM reference to the compiled PSO while the first thread is about to pass that raw pointer to `SetPipelineState`, `Reset`, or `CreateCommandList`. * **Edge-Case / Verification Note:** Confirmed that `p.real` holds the only COM reference to the compiled PSO (the title only owns a reference to `standin`). Neither `resolve` nor `resolve_wait` holds a lock or calls `AddRef` before returning the raw `usize` to callers in `list_x.rs`, `bind.rs`, and `real.rs`, creating a classic cross-thread COM UAF window whenever a streaming/GC thread releases a PSO concurrently with command-list recording. * **Synthetic Reproducer:** On thread A, bind a stand-in PSO via `SetPipelineState` (`resolve_for_bind` / `resolve_wait`); on thread B, concurrently call `standin->Release()` once the background compile finishes. Thread A receives the raw `real` pointer just before thread B's `released()` drops its refcount to 0, causing `SetPipelineState` to dereference a freed `ID3D12PipelineState`. * **Proposed Fix & Risk:** - **Fix:** Have `resolve` / `resolve_wait` return an owned `ID3D12PipelineState` (calling `AddRef` while holding the map/entry guard before `released()` can run `release(real)`), or route `released()` through `late_release` / a mutex-protected `Option<ID3D12PipelineState>` cloned before unlocking. * **Regression Risk:** Low; adds one atomic `AddRef`/`Release` pair per async-PSO resolution on the binding path. (Estimated size: `M`) #### 9. `XCL-BT-009` — sparse::flush_parked Returns Unmapped VRAM Pool Tiles to self.free Without Waiting for In-Flight Title Queues (GPU UAF / Corruption) (`P0`) * **Location:** `crates/xcl/src/hle/d3d12x/sparse.rs` lines `587-601, 1355-1413, 1454-1456` * **Prior-Work Check:** Verified 0% overlap across 4,430 ivall_xcl records. Searched 'flush_parked', 'decommit_range', 'take_tile', 'parked': PR #532 introduced parked tile batching to reduce UpdateTileMappings overhead, PR #923/#930 addressed retired 64 MiB pool reuse after unmap fence, and Issue #262 covers upload-vs-title simultaneous access on the same reserved buffer; zero issues or PRs cover flush_parked immediately recycling unmapped pool tiles to self.free before in-flight title queues finish. * **Root Cause:** In `sparse::flush_parked` (`sparse.rs:1355-1413`), called from `before_execute` (`sparse.rs:1454-1456`), decommitted tiles are unmapped via `UpdateTileMappings` on XCL's private `s.queue` and then **immediately** pushed back into `self.free` (`for tile in freed { self.free.push(tile); }`). `flush_parked` never waits for any title command queues (DIRECT/COMPUTE/COPY) that may still have GPU work in flight reading or writing those tiles, nor does it even wait for `s.queue`'s own unmap fence before `take_tile` (`sparse.rs:587-601`) pops the tile, remaps it to a different virtual address, and zeroes/overwrites it via `upload_zeros`/`upload_dirty`. * **Edge-Case / Verification Note:** Verified `Pool::retire_empty` vs `flush_parked`: PR #930 added a fence check for retired 64 MiB pools, but individual tiles freed by `decommit_range` -> `flush_parked` bypass any fence wait and are returned straight to `self.free` synchronously inside `flush_parked`, allowing immediate reuse on the very next commit while prior title submits are still executing on the GPU. * **Synthetic Reproducer:** Submit a GPU compute/graphics command list reading from sparse address `A`, immediately decommit `A` (`VirtualFree`/`FreeTitlePhysicalPages`) and commit new sparse address `B` (which pops `A`'s pool tile from `self.free` and uploads zeros/new data on `s.queue`). The in-flight title draw/dispatch reads zeroed or `B`'s data from the recycled physical tile. * **Proposed Fix & Risk:** - **Fix:** Place tiles unmapped by `flush_parked` into a per-fence retired tile quarantine (recording the current fence values of `s.queue` and active title queues, or reusing the existing `late_release` queue-fence drain), and only move them into `self.free` once all in-flight queue fences have completed. * **Regression Risk:** Medium; slightly increases transient VRAM pool watermark by one frame's worth of decommitted tiles, which is bounded and avoids silent GPU data corruption. (Estimated size: `M`) #### 10. `XCL-BT-010` — FMT_INFO\[min(fmt, 77u)\] clamps out-of-range 7-bit format codes 78..127 to format 77 (32_32_32_32_FLOAT) instead of 0 (INVALID) (`P1`) * **Location:** `crates/xcl/src/gpu/recomp/emit.rs` lines `1780, 1816` * **Prior-Work Check:** Searched all 4,430 XCL records for `FMT_INFO` and `min(fmt, 77` (0 hits). * **Root Cause:** Measured on RDNA2 silicon (`ProjectLeonidaL/leonida` `docs/buffer_formats.md:24`), 7-bit unified buffer format codes outside `1..=77` (specifically `0` and `78..=127`) are `INVALID`: loads decode to `0` and stores are no-ops. `emit.rs:1780` and `emit.rs:1816` index `FMT_INFO[min(fmt, 77u)]`, silently aliasing every invalid format code `78..=127` to format `77` (`32_32_32_32_FLOAT`), reading/writing 16 bytes of garbage memory instead of returning `0` / storing nothing. * **Edge-Case / Verification Note:** Alternative hypothesis: valid Xbox titles never bind descriptors with format codes `>= 78`. Falsification: null/uninitialized or dynamically-patched buffer descriptors (and `tbuffer` immediate format encodings) can carry format codes `>= 78`, causing out-of-bounds 16-byte writes instead of hardware no-ops. * **Synthetic Reproducer:** Bind a buffer V# with `FORMAT = 80` and execute `buffer_store_format_xyzw` or `buffer_load_format_xyzw`. Hardware performs a no-op / returns `0`; XCL indexes `FMT_INFO[77]` and reads/writes 16 bytes as `32_32_32_32_FLOAT`. * **Proposed Fix & Risk:** - **Fix:** Replace `min(fmt, 77u)` with `(fmt <= 77u ? fmt : 0u)` at `emit.rs:1780` and `emit.rs:1816` so out-of-range codes map to `FMT_INFO[0]` (`INVALID`). * **Regression Risk:** Very low; two one-line ternary guards. (Estimated size: `XS`) #### 11. `XCL-BT-011` — FreeTitlePhysicalPages double-free UAF of live sibling pages & monotonic NEXT_PAGE_INDEX 21-bit exhaustion (`P1`) * **Location:** `crates/xcl/src/hle/kernelx.rs` lines `1154-1199` * **Prior-Work Check:** Searched all 4,430 XCL records for `FreeTitlePhysicalPages` double-free and `NEXT_PAGE_INDEX` recycling (PR #40/#348 cover multi-window bounds and test lock ordering only; 0 hits for double-free UAF or index exhaustion). * **Root Cause:** `PHYS_BLOCKS` stores `(count, live_count, home)` per block. `FreeTitlePhysicalPages` decrements `e.1` without per-page liveness tracking, so freeing the same page twice drops `e.1` to `0` and releases `home` while sibling pages in the block are still live (UAF). Separately, `NEXT_PAGE_INDEX` monotonically increments and is never recycled. * **Edge-Case / Verification Note:** Alternative hypothesis: well-behaved titles never double-free physical pages. Falsification: duplicate free is a single-line reproducer in unit tests, and monotonic `NEXT_PAGE_INDEX` inevitably hits 21-bit exhaustion under long streaming churn. * **Synthetic Reproducer:** Allocate 2 pages `[p0, p1]` in one block; call `FreeTitlePhysicalPages(1, &[p0])` twice -> `e.1` hits `0` and `home` is freed while `p1` is still live. * **Proposed Fix & Risk:** - **Fix:** Store a per-block freed bitset (`Vec<u64>`) so duplicate frees are ignored, and recycle freed page indices via a free-list. * **Regression Risk:** Low. (Estimated size: `S`) #### 12. `XCL-BT-012` — Pixel shader export_graphics ignores VM (Valid Mask) bit and per-MRT color export masks (`P1`) * **Location:** `crates/xcl/src/gpu/recomp/emit.rs` lines `1919-1985` * **Prior-Work Check:** Searched all 4,430 XCL records for `export_graphics`, `xcl_live`, and `valid mask` (only #706 mentions `vm` in disassembler text formatting; 0 hits for `export_graphics` semantics). * **Root Cause:** Measured across 18 pixel shader programs on RDNA2 `gfx1036` (`ProjectLeonidaL/leonida` `docs/design.md:267`, `ps_oracle.py`), pixel survival is determined by the `EXEC` mask of the last `exp` with `VM=1` (overwriting earlier `VM` masks rather than OR-accumulating), and color target survival is masked per-MRT. `emit.rs:1919-1985` ignores the `VM` bit entirely and OR-accumulates `if (act) xcl_live = true;` on `DONE`, so a later `exp null done vm` under a narrower `EXEC` fails to kill lanes that were active during an earlier export. * **Edge-Case / Verification Note:** Alternative hypothesis: pixel shaders might only emit a single `DONE` export at exit. Falsification: multi-MRT and early-discard shaders emit `exp mrt0` before branching to `exp null done vm`, where OR-accumulating `xcl_live` on `DONE` leaks killed pixels into the framebuffer. * **Synthetic Reproducer:** Pixel shader executing `exp mrt0 ...` with `EXEC = 0xF`, then narrowing `EXEC = 0x3` and executing `exp null ... done vm`. Hardware kills lanes 2 and 3; XCL keeps them alive or mis-tracks survival when multiple exports carry `VM`/`DONE`. * **Proposed Fix & Risk:** - **Fix:** Decode the `VM` bit from the `EXP` instruction in `export_graphics`, assign `xcl_live = act;` (overwrite, not OR-accumulate) on every `VM=1` export, and guard final `discard` with `if (!xcl_live) discard;` while tracking per-MRT export masks. * **Regression Risk:** Low-medium; localized to pixel-shader `export_graphics`. (Estimated size: `M`) #### 13. `XCL-BT-013` — TOCTOU Race Between alloc_pool::reset_list and Concurrent title_reset Allows Resetting an Actively Recording Command Allocator (`P1`) * **Location:** `crates/xcl/src/hle/d3d12x/alloc_pool.rs` lines `89-102, 195-216` * **Prior-Work Check:** Verified 0% overlap across 4,430 ivall_xcl records. Searched 'alloc_pool', 'reset_list', 'title_reset', 'move_list': PR #1012 fixed released list cleanup, PR #1023 fixed moving recording only after successful Reset, PR #1051/#994 fixed failed replacement/aside handling, and PR #1071 fixed split/created list tracking; zero issues or PRs cover the lock-drop TOCTOU race between reset_list and title_reset. * **Root Cause:** In `alloc_pool::reset_list` (`alloc_pool.rs:89-102`), the function queries `let backing = current(alloc);` (releasing the `POOLS` mutex), invokes the native `list->Reset(backing)` callback **without** holding the `POOLS` mutex or pinning `backing`, and only acquires `POOLS` afterward to call `move_list(list, backing)`. If another thread concurrently calls `title_reset(alloc)` (`alloc_pool.rs:195-216`) during that window, `title_reset` sees `backing`'s `users` set as empty (`users.is_empty() == true`) and immediately calls `ID3D12CommandAllocator::Reset()` on `backing` while `list` is actively recording into `backing` (violating D3D12's requirement that no open command list use a resetting allocator, causing `E_FAIL` / driver crash / device removal). * **Edge-Case / Verification Note:** Verified `current(alloc)` drops the `POOLS` guard before returning `backing`, and `title_reset` checks `pool.users.get(&backing).is_none_or(|u| u.is_empty())` before resetting `backing` in place. While PR #1023 intentionally moved `move_list` after `reset(backing)` so failed `Reset` doesn't corrupt state, leaving `backing` unpinned across the unlocked native call opens a direct race with concurrent `title_reset`. * **Synthetic Reproducer:** On thread A, call `list->Reset(alloc, pso)` while `alloc` currently has 0 open lists; on thread B, concurrently call `alloc->Reset()` right after thread A reads `backing = current(alloc)` and enters native `list->Reset(backing)`. Thread B resets `backing` in place while thread A's list is now open on `backing`. * **Proposed Fix & Risk:** - **Fix:** Increment an in-flight pin/reservation count on `backing` (or insert a pending reservation entry in `POOLS`) while holding the `POOLS` lock before calling `reset(backing)`, have `title_reset` treat pinned backings as busy (swapping in a spare instead of resetting in place), and commit `move_list` or roll back the pin after `reset(backing)` returns. * **Regression Risk:** Low; purely internal synchronization inside `alloc_pool.rs` with negligible lock contention. (Estimated size: `S`) #### 14. `XCL-BT-014` — Thick 3D mip-tail predicate in tiling.rs omits depth_of(i) <= td (`P1`) * **Location:** `crates/xcl/src/gpu/tiling.rs` lines `299-317` * **Prior-Work Check:** Searched all 4,430 XCL records for `first_tail`, `GetMipTailDim`, `thick` tail depth (PR #1028 covers linear tile-mapping region on 3D mips; 0 hits for `tiling.rs:315` missing depth check). * **Root Cause:** `GetMipTailDim` halves `h`, `w`, or `d` by `blk % 3`, yet `tiling.rs:299-316` discards `td` and tests only `w <= tw && h <= th && mips - i <= max_tail`, forcing deep narrow thick 3D mips (e.g. `16x16x64`) into the single-block mip tail. * **Edge-Case / Verification Note:** Alternative hypothesis: retail volume textures tested so far had `w > tw` or `h > th` whenever `d > td`. Falsification: unit test `Chain::new_3d(Layout::new_3d(5, 2, cfg), 16, 16, 64, 1, 4)` places mip 0 into the mip tail. * **Synthetic Reproducer:** Unit test in `gpu/tiling.rs`: `16x16x64` thick 3D texture with 4 mips -> `levels[0].tail.is_some()` despite 64 depth slices exceeding block depth. * **Proposed Fix & Risk:** - **Fix:** Compute `td = if !thick { usize::MAX } else if blk % 3 == 2 { bd / 2 } else { bd }` and add `&& (!thick || depth_of(i) <= td)` at line `315`. * **Regression Risk:** Very low. (Estimated size: `XS`) #### 15. `XCL-BT-015` — XMA2 StreamConfig::from_xma2_wfx Miscomputes Stereo/Mono Channel Layout for Multi-Stream XMA2WAVEFORMATEX (e.g., 5.1 4-Stream, 4.0 3-Stream) (`P1`) * **Location:** `crates/xcl/src/hle/xma2/mod.rs` lines `69-94` * **Prior-Work Check:** Verified 0% overlap across 4,430 ivall_xcl records. Searched 'from_xma2_wfx', 'xma2waveformatex', 'num_streams': PR #20 introduced the XMA2 decoder and open PR #861 adds tests only without fixing the layout formula in from_xma2_wfx. * **Root Cause:** In `StreamConfig::from_xma2_wfx` (`xma2/mod.rs:69-94`), when `XMA2WAVEFORMATEX` specifies `channels` and `num_streams` (without per-stream descriptors), the loop assigns `2` channels to every stream where `(i + 1) * 2 <= channels` and `1` otherwise. For standard Xbox 5.1 (`channels = 6, num_streams = 4`, layout `[2, 2, 1, 1]` = FL/FR, BL/BR, C, LFE) or 4.0 (`channels = 4, num_streams = 3`, layout `[2, 1, 1]`), this loop assigns `2` to streams `0, 1, 2` and `1` to stream `3`, producing `[2, 2, 2, 1]` (sum = 7 != 6) or `[2, 2, 1]` (sum = 5 != 4), which then fails `Decoder::new`'s channel-sum check (`channel sum 7 != 6`) and completely breaks playback of valid multi-stream surround XMA2 assets. * **Edge-Case / Verification Note:** Verified algebraically: given `C` total channels across `S` streams where each stream has 1 or 2 channels (`S <= C <= 2*S`), the unique count of stereo (2-channel) streams is `stereo = C - S` and mono (1-channel) streams is `2*S - C`. For `C=6, S=4`, `stereo = 2` -> `[2, 2, 1, 1]` (sum 6); the existing code computes `i=0,1,2` as `2` because `(2+1)*2 <= 6`, producing `[2, 2, 2, 1]` (sum 7) and unconditionally failing. * **Synthetic Reproducer:** Call `StreamConfig::from_xma2_wfx` with a valid 5.1 `XMA2WAVEFORMATEX` header (`nChannels = 6`, `NumStreams = 4`, `nSamplesPerSec = 48000`) and pass the resulting config to `Decoder::new(cfg)`. `Decoder::new` returns `Err("channel sum 7 != 6")`. * **Proposed Fix & Risk:** - **Fix:** Validate `channels >= num_streams && channels <= num_streams * 2`, compute `let stereo = (channels - num_streams) as usize;`, and assign `if i < stereo { 2 } else { 1 }` for each stream `i in 0..num_streams`. * **Regression Risk:** Very low; preserves existing `[2, 2, 2]` (6ch/3-stream) and `[2, 1]` (3ch/2-stream) behavior while fixing all mixed stereo/mono multi-stream surround layouts. (Estimated size: `XS`) #### 16. `XCL-BT-016` — XMA2 advance_stream Decrements skip_packets == 255 (0xFF EOF Sentinel), Causing Finished Streams to Steal Packets After 255 Packets (`P1`) * **Location:** `crates/xcl/src/hle/xma2/mod.rs` lines `1764-1780` * **Prior-Work Check:** Verified 0% overlap across 4,430 ivall_xcl records. Searched 'advance_stream', 'skip_packets': only PR #20 (initial XMA2 decoder commit) matched; zero issues or PRs cover the skip_packets == 255 EOF sentinel bug. * **Root Cause:** In the XMA2 packet header, the 8-bit `PacketSkipCount` value `255` (`0xFF`) is the stream-finished sentinel indicating that no further packets belong to that stream. In `Decoder::advance_stream` (`xma2/mod.rs:1764-1780`), every stream's counter is unconditionally decremented via `s.skip_packets = s.skip_packets.saturating_sub(1);`. In multi-stream surround or multi-track XMA2 audio where one stream ends earlier than another by more than 255 packets, the finished stream's `skip_packets` counts down `255 -> 254 -> ... -> 0`, after which `advance_stream` selects the finished stream as `best` (`min_skip == 0`) and feeds another active stream's packets into it, corrupting both streams. * **Edge-Case / Verification Note:** Verified `xma2/mod.rs:1525-1535` parses `skip_packets` directly as an 8-bit `u8` (`0..=255`) from the 32-bit XMA2 packet header, and `advance_stream` (`1777-1779`) has no `if s.skip_packets != 255` guard. In FFmpeg `wmaprodec.c`, `skip_packets == 0xff` is explicitly treated as a pinned terminal state (never decremented). * **Synthetic Reproducer:** Decode a 2-stream (e.g. 4-channel) XMA2 asset where stream 0 finishes (`PacketSkipCount = 255`) while stream 1 has 260 more packets. After 255 packets of stream 1, stream 0's `skip_packets` reaches 0 and stream 0 steals stream 1's packet 256, causing bitstream decode errors or channel corruption. * **Proposed Fix & Risk:** - **Fix:** Guard the decrement in `advance_stream`: `if s.skip_packets != 255 { s.skip_packets = s.skip_packets.saturating_sub(1); }` (and mark or skip streams with `skip_packets == 255` unless all streams are 255). * **Regression Risk:** Very low; 1-line guard matching the XMA2 packet header specification and FFmpeg. (Estimated size: `XS`) #### 17. `XCL-BT-017` — XMA2 decode_packet_step Unconditionally Decodes Incomplete Reservoir on 3+-Packet Spanning Frames, Triggering packet_loss and Wiping Saved Bits (`P1`) * **Location:** `crates/xcl/src/hle/xma2/mod.rs` lines `1566-1582` * **Prior-Work Check:** Verified 0% overlap across 4,430 ivall_xcl records. Searched 'decode_packet_step', 'num_bits_prev_frame', 'packet_loss', 'num_saved_bits': only PR #20 (initial decoder commit) matched; zero issues or PRs report the 3+-packet spanning frame bug. * **Root Cause:** In `StreamDecoder::decode_packet_step` (`xma2/mod.rs:1566-1582`), when a frame spans across packets and the current packet's `num_bits_prev_frame >= remaining_packet_bits` (including the XMA2 continuation sentinel `0x7FFF` meaning no new frame starts in this packet), the code sets `self.packet_done = true`, clamps the bit count to `remaining_packet_bits`, appends those bits to the saved-bit reservoir via `save_bits`, and then **unconditionally** calls `self.decode_frame(out_frame)` on line 1575. When a large frame spans 3 or more packets (`num_bits_prev_frame > remaining_packet_bits`), the reservoir does not yet contain the end of the frame: `decode_frame` fails mid-frame, sets `self.packet_loss = true`, and line 1580 wipes `self.num_saved_bits = 0`, permanently corrupting the spanning frame and dropping audio. * **Edge-Case / Verification Note:** Compared directly against FFmpeg's `xma_decode_packet` / `decode_packet` in `libavcodec/wmaprodec.c`: when `num_bits_prev_frame > remaining_packet_bits` (e.g., `0x7FFF` continuation packet), FFmpeg appends all `remaining_packet_bits` to the saved reservoir and returns immediately (`got_frame = 0`) WITHOUT calling `decode_frame`, waiting for the subsequent packet that completes the frame. `xma2/mod.rs:1566-1582` conflates `>=` (exact completion vs strict continuation) and always calls `decode_frame`. * **Synthetic Reproducer:** Feed a valid XMA2 stream containing a high-bitrate frame spanning 3 consecutive 2048-byte packets (packet 1 starts the frame, packet 2 has `bit_offset == 0x7FFF` / `num_bits_prev_frame > 16352`, packet 3 finishes the frame). On packet 2, `decode_packet_step` calls `decode_frame` on the incomplete reservoir, fails with `packet_loss = true`, and zeroes `num_saved_bits`. * **Proposed Fix & Risk:** - **Fix:** Distinguish `num_bits_prev_frame > remaining_packet_bits`: append `remaining_packet_bits` via `save_bits`, set `self.packet_done = true`, and return `Ok((pgb.bits_count() >> 3, false))` without invoking `decode_frame` or clearing `num_saved_bits`. * **Regression Risk:** Low; matches FFmpeg `wmaprodec.c` behavior for multi-packet XMA2 continuation packets. (Estimated size: `S`) #### 18. `XCL-BT-018` — acphal.rs: XApu ignores XAPU_CONNECT_OPTION_DEINTERLEAVED_OUTPUT (options & 4), corrupting stereo PCM layout (`P1`) * **Location:** `crates/xcl/src/hle/acphal.rs` lines `711-717, 775, 927-953` * **Prior-Work Check:** Verified 0 hits across ivall_xcl corpus for deinterleaved. * **Root Cause:** XApu struct (acphal.rs:711-717) never stores `i.options` from XApuConnectInput, and XApuEnqueueCommand (lines 933-943) unconditionally copies interleaved `f32` samples from `decode_into` into `p.output` regardless of whether `options & 4` (DEINTERLEAVED_OUTPUT) was requested. * **Edge-Case / Verification Note:** Titles using interleaved output (options & 4 == 0) or mono streams (channels == 1) are unaffected, but stereo deinterleaved titles (explicitly supported in VIctory's apu.rs:46,345-348) receive garbled audio. * **Synthetic Reproducer:** Connect with XApuConnectInput { options: 4, ... }, activate a 2-channel Opus stream, enqueue XAPU_PROCESS, and inspect p.output; samples are interleaved \[L0, R0, L1, R1\] instead of \[L0..L(n-1), R0..R(n-1)\]. * **Proposed Fix & Risk:** - **Fix:** Store `options: u32` in `struct XApu` at XApuConnect, and when `x.options & 4 != 0 && channels == 2`, deinterleave `out` into `[L0..Ln, R0..Rn]` before copying to `p.output`. * **Regression Risk:** Low; only affects stereo streams with option bit 2 set. (Estimated size: `S`) #### 19. `XCL-BT-019` — bind::execute_indirect Uses Unretained Raw s.rs_gfx With SetGraphicsRootSignature Even on COMPUTE Lists (COM UAF + Invalid Compute Queue Call) (`P1`) * **Location:** `crates/xcl/src/hle/d3d12x/bind.rs` lines `175-182, 235-261` * **Prior-Work Check:** Verified 0% overlap across 4,430 ivall_xcl records. Searched 'rs_gfx', 'execute_indirect', 'setgraphicsrootsignature': PR #144 added rs_gfx binding, PR #267/#667/#1124 cover slow PSO waits, ABI caching, and two-pass mesh skip; zero issues or PRs cover unretained rs_gfx UAF or invalid SetGraphicsRootSignature on COMPUTE lists in execute_indirect. * **Root Cause:** Two compounded bugs in `bind.rs`: (1) `set_graphics_root_signature` (`bind.rs:175-182`) stores the title's root signature as a raw `usize` (`s.rs_gfx = rs as usize`) without `AddRef`ing it; if the title releases the root signature while the command list is still recording (valid in D3D12 while referenced by the command list, or across `inherit_for_split`), `execute_indirect` (`bind.rs:256-259`) borrows and calls `list.SetGraphicsRootSignature(r)` on a dangling pointer. (2) When `execute_indirect` runs with an untranslated PC compute pipeline on a `COMPUTE` command list, `if !gfx && !compute` (`bind.rs:241-260`) unconditionally attempts `list.SetGraphicsRootSignature(r)` if `s.rs_gfx != 0` (invalid on `D3D12_COMMAND_LIST_TYPE_COMPUTE`), and never restores a compute root signature (`rs_compute` is not even tracked). * **Edge-Case / Verification Note:** Verified `State` in `bind.rs:22-37`: `rs_gfx: usize` is a raw integer with no `Option<ID3D12RootSignature>` wrapper, and `execute_indirect` lines 256-259 do not check `list.GetType() == D3D12_COMMAND_LIST_TYPE_DIRECT` before calling `SetGraphicsRootSignature`. * **Synthetic Reproducer:** Bind a graphics root signature `rs`, release `rs` on CPU, then invoke `ExecuteIndirect` with an untranslated PC PSO (triggering COM UAF on `rs`); or execute an untranslated compute `ExecuteIndirect` after a translated dispatch without restoring the compute root signature. * **Proposed Fix & Risk:** - **Fix:** Store `rs_gfx: Option<ID3D12RootSignature>` (retained via `from_raw_borrowed` + `.clone()`, cleared on `reset`/`clear_state`/`forget`) and guard `list.SetGraphicsRootSignature` in `execute_indirect` to only run on `DIRECT`/`BUNDLE` command lists (tracking and restoring `rs_compute: Option<ID3D12RootSignature>` for compute lists). * **Regression Risk:** Low; retains at most two COM root-signature references per active command list until reset/release. (Estimated size: `S`) #### 20. `XCL-BT-020` — buffer_load_format_d16\_\* / tbuffer_load_format_d16\_\* zeroes odd-channel high 16 bits, truncates UINT/SINT, and double-rounds UNORM/SNORM (`P1`) * **Location:** `crates/xcl/src/gpu/recomp/emit.rs` lines `1787-1805` * **Prior-Work Check:** Searched all 4,430 XCL records for `mubuf_d16` and `buffer_load_format_d16` (only #159 opcode census; 0 hits for odd-channel high half, integer saturation, or UNORM/SNORM double-rounding). * **Root Cause:** Measured on RDNA2 `gfx1031` (`ProjectLeonidaL/leonida` `docs/shader_validation.md:1642,1658-1665`, `d16_format_probe.py`), `*_load_format_d16_*` has three contracts violated by `emit.rs:1787-1805`: (1) odd-channel loads (`d16_x`, `d16_xyz`) preserve `vdst[31:16]`, whereas XCL overwrites the full 32-bit VGPR with zeroed high 16 bits; (2) 32-bit `UINT`/`SINT` formats saturate to `[0, 65535]` / `[-32768, 32767]`, whereas XCL truncates via `& 0xFFFFu`; (3) `16_UNORM`/`16_SNORM` single-round directly to f16 RNE (`0xFFAF -> 0x3BFD`, `0xFFEF -> 0x3BFF`, `0x7FF7 -> 0x3BFF`, `0x8009 -> 0xBBFF`), whereas XCL widens to f32 and calls `f32tof16`, double-rounding boundary values. * **Edge-Case / Verification Note:** Alternative hypothesis: odd-channel `d16` destinations might not hold live high-half state. Falsification: RDNA2 16-bit register allocation packs two independent half-precision values into one VGPR, and integer truncation turns `65536` into `0`. * **Synthetic Reproducer:** Pre-load `v0 = 0x5A5A_0000`, run `buffer_load_format_d16_x v0, v1, s[0:3], 0 idxen` on a `32_UINT` value `70000`. Hardware produces `v0 = 0x5A5A_FFFF`; XCL produces `0x0000_1170`. * **Proposed Fix & Risk:** - **Fix:** Preserve `(vdst & 0xFFFF0000u)` on odd trailing channels, clamp `UINT`/`SINT` to 16-bit signed/unsigned ranges before masking, and perform direct single-rounded f16 RNE conversion for `UNORM`/`SNORM`. * **Regression Risk:** Low; localized to `mubuf_d16`. (Estimated size: `S`) #### 21. `XCL-BT-021` — bvh::world_to_object Divides by Unguarded det, Writing NaN/Inf Inverse Transforms for Zero-Scale or Degenerate TLAS Instances (`P1`) * **Location:** `crates/xcl/src/gpu/bvh.rs` lines `217-235` * **Prior-Work Check:** Verified 0% overlap across 4,430 ivall_xcl records. Searched 'world_to_object', 'bvh.rs', 'singular', 'det == 0': PR #26 (initial BVH) and PR #107 (triangle_hit det underflow/overflow) matched; zero issues or PRs cover singular/zero-scale instance matrices in world_to_object. * **Root Cause:** In `bvh::world_to_object` (`bvh.rs:217-235`), the 3x3 cofactor matrix of a TLAS instance's `object -> world` transform is unconditionally divided by `det` (`row.map(|x| x / det)`). Titles routinely disable or cull dynamic raytracing instances without rebuilding instance buffers by writing an all-zero or zero-scale 3x4 transform matrix (`det == 0.0`). Dividing by `0.0` populates all 12 `f32` words of the instance node's `world -> object` transform (offset `+64..+112`) with `NaN` or `±inf`. When a ray reaches the instance node, transforming the ray into object space produces `NaN` ray origin/direction, propagating `NaN` through BLAS traversal or causing undefined hit behavior. * **Edge-Case / Verification Note:** Verified `build_top` (`bvh.rs:98-121`) unconditionally calls `world_to_object(m)` for every `Instance` without checking `det == 0.0` or skipping singular transforms. While `transform_aabb` collapses a zero-scale instance to a point AABB `(t, t)`, rays grazing or originating at `t` still pass the box test and enter the `NaN` instance transform. * **Synthetic Reproducer:** Call `bvh::build_top` with an `Instance` whose `transform` is all zeros (or has a zero scale row/column). Inspect bytes `+64..+112` of the emitted 128-byte instance node: all 12 `f32` values are `NaN`. * **Proposed Fix & Risk:** - **Fix:** Guard `if det.abs() <= 1e-30` (or `!det.is_finite() || det == 0.0`) in `world_to_object` and return a safe zero/identity fallback (and in `build_top`, emit a NaN-disabled AABB for degenerate zero-area/singular instances with `det == 0.0` so rays cleanly skip them). * **Regression Risk:** Very low; preserves exact inverse matrices for all invertible transforms while preventing `NaN` propagation on disabled/degenerate instances. (Estimated size: `XS`) #### 22. `XCL-BT-022` — console_list::cl_release Immediately Frees UMA Argument/IO Blocks While Submitted GPU Work Is Still In Flight (GPU UAF Under XCL_CONSOLE_LISTS) (`P1`) * **Location:** `crates/xcl/src/hle/d3d12x/console_list.rs` lines `377-393` * **Prior-Work Check:** Verified 0% overlap across 4,430 ivall_xcl records. Searched 'console_list', 'cl_release', 'free_uma': PR #45 (initial sparse VRAM), PR #510 (reuse record chunk across Reset), and PR #806 (oversized chunks) do not mention cl_release freeing st.uma immediately instead of deferring to PENDING\[st.alloc\]. * **Root Cause:** In `console_list.rs`, `cl_reset` properly defers freeing the previous recording's UMA argument-table/IO blocks (`st.uma`) by moving them into `PENDING[old_alloc]` via `hold_until_reset`, so they stay alive until the title resets the command allocator after GPU completion. However, `cl_release` (`console_list.rs:377-393`) calls `free_uma(&st.uma)` **immediately** when the command list's refcount drops to 0. In D3D12, titles are allowed to release a closed command list right after calling `ExecuteCommandLists` while the GPU is still executing it (only the command allocator must stay alive). Calling `free_uma(&st.uma)` immediately frees and recycles the UMA argument tables and IO buffers out from under in-flight GPU shaders. * **Edge-Case / Verification Note:** Compared `bind::forget` (`bind.rs:125-129`, which correctly calls `console_list::hold_until_reset(s.allocator, s.uma)`) against `console_list::cl_release` (`console_list.rs:377-393`, which directly calls `free_uma(&st.uma)`). `bind::forget` already demonstrates the right allocator-scoped deferral; `cl_release` missed it. * **Synthetic Reproducer:** Under `XCL_CONSOLE_LISTS=1`, record a command list with translated dispatches/draws (allocating UMA blocks in `st.uma`), close it, submit it via `ExecuteCommandLists`, and immediately call `list->Release()` before the GPU finishes executing the list. `cl_release` frees `st.uma` immediately while the GPU still reads those argument tables. * **Proposed Fix & Risk:** - **Fix:** In `console_list::cl_release`, replace `free_uma(&st.uma)` with `hold_until_reset(st.alloc, st.uma)` (matching `cl_reset` and `bind::forget`). * **Regression Risk:** Very low; 1-line fix matching `cl_reset` and `bind::forget`. (Estimated size: `XS`) --- > **Continue Series:** **Part 1/3 (this issue)** | Part 2/3: `https://github.com/ivall/xcl/issues/1489` | Part 3/3: `https://github.com/ivall/xcl/issues/1490`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:55:22 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-24 18:10 UTC · original · edited 2026-11-24 18:17 UTC

Claimed and opened #1619 for XCL-BT-005 (\device_x::Base\ unretained \pRootSignature\ COM UAF in \crates/xcl/src/hle/d3d12x/device_x.rs).

  • Retains non-null \pRootSignature\ in \Base\ via \ID3D12RootSignature::from_raw_borrowed().cloned()\ and drops replaced/removed \Base\ entries outside the \BASES\ lock.
  • Added unit test \ase_retains_root_signature_until_forgotten\ (fails on \9e3831e, passes at \8cc8b6c).
  • Full workspace suite (\777 passed, 0 failed, 41 ignored, 1 \SKIPPED) and 60 s GTA6 smoke pair passed on RX 7800 XT.

AI use: T3 Code / Antigravity (Gemini 4 Neon) verified the code, wrote the fix and test, ran validation, and updated this comment.

**@⁠oni-swr** on GitHub · 2026-11-24 18:10 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7140253656) · edited 2026-11-24 18:17 UTC Claimed and opened **#1619** for **XCL-BT-005** (\device_x::Base\ unretained \pRootSignature\ COM UAF in \crates/xcl/src/hle/d3d12x/device_x.rs\). - Retains non-null \pRootSignature\ in \Base\ via \ID3D12RootSignature::from_raw_borrowed().cloned()\ and drops replaced/removed \Base\ entries outside the \BASES\ lock. - Added unit test \ase_retains_root_signature_until_forgotten\ (fails on \9e3831e\, passes at \8cc8b6c\). - Full workspace suite (\777 passed, 0 failed, 41 ignored\, 1 \SKIPPED\) and 60 s GTA6 smoke pair passed on RX 7800 XT. AI use: T3 Code / Antigravity (Gemini 4 Neon) verified the code, wrote the fix and test, ran validation, and updated this comment.
Author
Owner

@⁠ddaikodaiko on GitHub · 2026-11-24 18:57 UTC · original · edited 2026-11-24 19:37 UTC

Three items from this audit reproduced on current main and fixed locally. After the repo moved
to xcl-dev/xcl and PR #1426 merged the direct DXIL translator, everything was rebased onto
main c160d86; the full HLSL suite is 860 passed, 0 failed, 42 ignored, 2 SKIPPED
(no wave64) on an RTX 3060 Ti 8 GB / driver 32.0.16.1088, Ryzen 5 1600, Windows 10 22H2
19045.7846, Agility SDK 1.620.2, DXC 1.8.2502.11, rustc 1.100.0, release. BT-002 and BT-010
are ported to the opt-in direct translator too
: with XCL_DIRECT_DXIL=1 the same GPU tests
fail on main and pass with the port (gpu::dxil 80 passed). The patches are local, not
PRs
— XCL does not accept PRs written with DeepSeek models — and are ready for a human /
frontier-model contributor to submit under the project rules.

XCL-BT-002 (P0) — MUBUF/MTBUF bounds and OOB_SELECT

Measured rule used (Leonida/docs/buffer_bounds.md, 732 native cases on gfx1036, confirmed on
gfx1011; 729/732 match Mesa's GFX11 column):

OOB_SELECT In range when
0 index < N and offset + bytes <= STRIDE
1 index < N
2 N != 0
3 (raw) offset + soffset + bytes <= N; index * stride not checked

emit.rs now reads OOB_SELECT from the V# (word 3 [28:29]), selects the four rules
branch-free, includes SOFFSET in the raw check and uses 64-bit offsets/limits/addresses; the
old stride == 0 heuristic is gone. s_buffer_load checks offset + 4 <= limit per dword
(grouped loads check each of the four) with a 64-bit limit. Five synthetic tests that model raw
buffers now set OOB_SELECT = 3, as a real title does.

Test gpu_mubuf_oob_select_raw_soffset_and_structured_stride:

  • raw, N 18, voff 8, soffset 8: main reads 0xA0000004 (8+4 <= 18, soffset ignored); fix
    returns 0.
  • mode 0, stride 16, voff 13: main reads; fix returns 0 (13+4 > 16).
  • in-range mode 0 and raw cases still read the expected dwords.

Test gpu_s_buffer_load_limit_includes_the_dword: N 3, offset 0 — main reads
0xAAAA0001
(0 < 3); fix returns 0 (0+4 > 3). N 4 still reads 0xBBBB0002.

Direct DXIL (PR #1426, XCL_DIRECT_DXIL=1): the same rules are ported to
gpu/dxil/lower_mem.rs; with the opt-in direct translator the two tests fail on main and pass
with the port (gpu::dxil 80 passed).

XCL-BT-010 — invalid buffer format codes

FMT_INFO[min(fmt, 77u)] aliased format codes 78..127 to 32_32_32_32_FLOAT. They are INVALID
on RDNA2: loads return 0 and stores are no-ops. The fix maps them to FMT_INFO[0].

Test gpu_invalid_buffer_format_reads_zero_and_stores_nothing: on main a V# with FORMAT = 80
reads 0x3F800000..; with the fix the load returns 0 and the store leaves the target untouched.
The direct translator's fmt_info had the same min(fmt, 77); it is ported too, and with
XCL_DIRECT_DXIL=1 the test fails on main and passes with the port.

XCL-BT-038 — v_pack_b32_f16 abs/neg

The packed halves ignored the VOP3 f16 sign modifiers. abs now clears bit 15 and neg flips it
on the selected half (bit-exact, NaN included).

Test gpu_v_pack_b32_f16_honors_abs_neg (NEG on the low half, ABS on the high half): main gives
0xC0003C00 (+1.0, -2.0); the fix gives 0x4000BC00 (-1.0, |-2.0|).

Not tested: AMD / native wave64, a retail title / xcl-smoke, gfx1013 itself (the bounds
table is gfx1036 + gfx1011), and the direct DXIL path for BT-038 (not ported yet).

AI use: OpenCode with DeepSeek V4.1 Flash wrote the fixes and tests, ran them on the machine
above and drafted this comment. The measured bounds table is from Leonida's GPL-3.0
documentation (facts only; no Leonida code is used). The patches are available locally for a
human / frontier-model contributor to submit.

**@⁠ddaikodaiko** on GitHub · 2026-11-24 18:57 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7141394325) · edited 2026-11-24 19:37 UTC Three items from this audit reproduced on current `main` and fixed locally. After the repo moved to `xcl-dev/xcl` and PR #1426 merged the direct DXIL translator, everything was rebased onto `main` `c160d86`; the full HLSL suite is **860 passed, 0 failed, 42 ignored, 2 SKIPPED** (`no wave64`) on an RTX 3060 Ti 8 GB / driver 32.0.16.1088, Ryzen 5 1600, Windows 10 22H2 19045.7846, Agility SDK 1.620.2, DXC 1.8.2502.11, rustc 1.100.0, release. **BT-002 and BT-010 are ported to the opt-in direct translator too**: with `XCL_DIRECT_DXIL=1` the same GPU tests fail on `main` and pass with the port (`gpu::dxil` 80 passed). The patches are **local, not PRs** — XCL does not accept PRs written with DeepSeek models — and are ready for a human / frontier-model contributor to submit under the project rules. ### XCL-BT-002 (P0) — MUBUF/MTBUF bounds and `OOB_SELECT` Measured rule used (`Leonida/docs/buffer_bounds.md`, 732 native cases on gfx1036, confirmed on gfx1011; 729/732 match Mesa's GFX11 column): | `OOB_SELECT` | In range when | |---:|---| | 0 | `index < N` **and** `offset + bytes <= STRIDE` | | 1 | `index < N` | | 2 | `N != 0` | | 3 (raw) | `offset + soffset + bytes <= N`; `index * stride` not checked | `emit.rs` now reads `OOB_SELECT` from the V# (word 3 `[28:29]`), selects the four rules branch-free, includes `SOFFSET` in the raw check and uses 64-bit offsets/limits/addresses; the old `stride == 0` heuristic is gone. `s_buffer_load` checks `offset + 4 <= limit` per dword (grouped loads check each of the four) with a 64-bit limit. Five synthetic tests that model raw buffers now set `OOB_SELECT = 3`, as a real title does. Test `gpu_mubuf_oob_select_raw_soffset_and_structured_stride`: - raw, N 18, voff 8, soffset 8: **main reads `0xA0000004`** (8+4 <= 18, soffset ignored); fix returns **0**. - mode 0, stride 16, voff 13: main reads; fix returns **0** (13+4 > 16). - in-range mode 0 and raw cases still read the expected dwords. Test `gpu_s_buffer_load_limit_includes_the_dword`: N 3, offset 0 — **main reads `0xAAAA0001`** (0 < 3); fix returns **0** (0+4 > 3). N 4 still reads `0xBBBB0002`. Direct DXIL (PR #1426, `XCL_DIRECT_DXIL=1`): the same rules are ported to `gpu/dxil/lower_mem.rs`; with the opt-in direct translator the two tests fail on `main` and pass with the port (`gpu::dxil` 80 passed). ### XCL-BT-010 — invalid buffer format codes `FMT_INFO[min(fmt, 77u)]` aliased format codes 78..127 to `32_32_32_32_FLOAT`. They are INVALID on RDNA2: loads return 0 and stores are no-ops. The fix maps them to `FMT_INFO[0]`. Test `gpu_invalid_buffer_format_reads_zero_and_stores_nothing`: on `main` a V# with `FORMAT = 80` reads `0x3F800000`..; with the fix the load returns 0 and the store leaves the target untouched. The direct translator's `fmt_info` had the same `min(fmt, 77)`; it is ported too, and with `XCL_DIRECT_DXIL=1` the test fails on `main` and passes with the port. ### XCL-BT-038 — `v_pack_b32_f16` abs/neg The packed halves ignored the VOP3 f16 sign modifiers. `abs` now clears bit 15 and `neg` flips it on the selected half (bit-exact, NaN included). Test `gpu_v_pack_b32_f16_honors_abs_neg` (NEG on the low half, ABS on the high half): main gives `0xC0003C00` (`+1.0, -2.0`); the fix gives `0x4000BC00` (`-1.0, |-2.0|`). **Not tested:** AMD / native wave64, a retail title / `xcl-smoke`, gfx1013 itself (the bounds table is gfx1036 + gfx1011), and the direct DXIL path for BT-038 (not ported yet). AI use: OpenCode with DeepSeek V4.1 Flash wrote the fixes and tests, ran them on the machine above and drafted this comment. The measured bounds table is from Leonida's GPL-3.0 documentation (facts only; no Leonida code is used). The patches are available locally for a human / frontier-model contributor to submit.
Author
Owner

@⁠b3IKK on GitHub · 2026-11-24 19:37 UTC · original

Measured, not reading: XCL-BT-034 is not a bug on this stack — the host D3D12 runtime creates the pipeline with DepthEnable = TRUE and DSVFormat = DXGI_FORMAT_UNKNOWN without an error, and with no depth target the depth test has nothing to test against, so the console's state and the PC's are the same.

What I ran (throwaway test in crates/xcl/src/hle/d3d12x/real.rs, on the device from D3D12CreateDevice(None, D3D_FEATURE_LEVEL_12_0) of main@c160d86), building a graphics PSO from the module's own dummy VS/PS, an empty root signature from D3D12SerializeRootSignature, one R8G8B8A8_UNORM target, DSVFormat = UNKNOWN, and only DepthEnable differing:

PROBE: DepthEnable=true + UNKNOWN DSV -> Ok(ID3D12PipelineState(0x245fe10a0b0));
       DepthEnable=false -> Ok(ID3D12PipelineState(0x245fe3aa1b0))

An earlier attempt without a root signature returned 0x80070057 for both variants, which is what made the claim look plausible; with a valid root signature both are accepted.

So stream_pipeline's D3D12 defaults (DepthEnable = TRUE when a stream leaves the DEPTH_STENCIL subobject out) are also the PC's defaults (D3D12_DEPTH_STENCIL_DESC), and a pipeline with no depth target draws the same either way. The debug layer may still warn about it, but nothing in the runtime or the driver needs the translation, so there is nothing to fix (and I did not open a PR for it).

Hardware / software: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2609.5, debug build.

AI use: OpenCode, Gemini 4 Neon — wrote the throwaway probe, ran it, and removed it; the branch was dropped.

**@⁠b3IKK** on GitHub · 2026-11-24 19:37 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7142370498) Measured, not reading: **`XCL-BT-034` is not a bug on this stack** — the host D3D12 runtime creates the pipeline with `DepthEnable = TRUE` and `DSVFormat = DXGI_FORMAT_UNKNOWN` without an error, and with no depth target the depth test has nothing to test against, so the console's state and the PC's are the same. What I ran (throwaway test in `crates/xcl/src/hle/d3d12x/real.rs`, on the device from `D3D12CreateDevice(None, D3D_FEATURE_LEVEL_12_0)` of `main@c160d86`), building a graphics PSO from the module's own dummy VS/PS, an empty root signature from `D3D12SerializeRootSignature`, one R8G8B8A8_UNORM target, `DSVFormat = UNKNOWN`, and only `DepthEnable` differing: ``` PROBE: DepthEnable=true + UNKNOWN DSV -> Ok(ID3D12PipelineState(0x245fe10a0b0)); DepthEnable=false -> Ok(ID3D12PipelineState(0x245fe3aa1b0)) ``` An earlier attempt without a root signature returned `0x80070057` for **both** variants, which is what made the claim look plausible; with a valid root signature both are accepted. So `stream_pipeline`'s D3D12 defaults (`DepthEnable = TRUE` when a stream leaves the `DEPTH_STENCIL` subobject out) are also the PC's defaults (`D3D12_DEPTH_STENCIL_DESC`), and a pipeline with no depth target draws the same either way. The debug layer may still warn about it, but nothing in the runtime or the driver needs the translation, so there is nothing to fix (and I did not open a PR for it). Hardware / software: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2609.5, debug build. AI use: OpenCode, Gemini 4 Neon — wrote the throwaway probe, ran it, and removed it; the branch was dropped.
Author
Owner

@⁠AC-Storm-YT on GitHub · 2026-11-24 19:45 UTC · original

Independent hardware measurements for XCL-BT-002, -010 and -020. The instructions ran natively on RDNA2 silicon and were compared with XCL main c160d86. They agree with the rules given earlier in this thread, and they come from my own runs, not from Leonida's documents.

Setup

  • RDNA2: the Ryzen 7 9800X3D's integrated GPU (gfx1036), AMD driver 32.0.21045.29003, Windows 11 Pro 26200. These are OpenCL C kernels with inline RDNA assembly, built by the driver's OpenCL (3679.0, PAL, LC). Each lane loads with its own offen / idxen VGPR from a V# that the kernel builds in s[20:23] (RESOURCE_LEVEL = 1, identity DST_SEL).
  • XCL: a temporary local test, not committed, runs the same loads and memory through translate and runner::run (the default HLSL path, not XCL_DIRECT_DXIL) on an RX 9070 XT (driver 32.0.32029.2010), wave32.
  • This is desktop RDNA2, not the console GPU. No Leonida code, data or documents were used.

XCL-BT-020: buffer_load_format_d16_*: confirmed, all three parts

The test runs every 16-bit value (65,536). The 16-bit formats sit in the low half of each dword, with junk in the high half. vdst is preset to 0x5A5A0000, or 0x00005A5A for d16_hi_x.

hardware XCL
the other half of vdst, d16_x (16_UNORM / 16_SNORM / 16_FLOAT / 16_UINT / 32_UINT / 32_SINT) kept, 65,536 / 65,536 for each zeroed, 65,536 / 65,536
the other half, d16_hi_x kept kept
32_UINT above 0xFFFF (0x10000, 70000, 0x80000000) 0xFFFF (saturates) 0x0000, 0x1170, 0x0000 (truncates)
32_SINT (0x8000, 0x10000, 0x80000000, 0xFFFF7FFF) 0x7FFF, 0x7FFF, 0x8000, 0x8000 0x8000, 0x0000, 0x0000, 0x7FFF
16_UNORM → f16 the exact v / 65535 rounded once to nearest-even: 65,536 / 65,536 31,740 values differ (e.g. 0x0801: hw 0x2801, XCL 0x2800)
16_SNORM → f16 rounded once: 65,536 / 65,536 30,716 values differ
16_FLOAT signaling NaN (0x7C01..) kept bit for bit quieted (0x7E01..), 1,022 values: the f16 → f32 → f16 path of XCL-BT-025

On UNORM / SNORM: rounding once versus going through f32 differs for only 2 values in each format (0xFFAF, 0xFFEF for UNORM; 0x7FF7, 0x8009 for SNORM), exactly as the audit says. Most of XCL's differences on this adapter are instead 1 f16 ulp from the conversion itself.

XCL-BT-010: invalid format codes: confirmed

buffer_load_format_x with V# formats 78, 80, 100 and 127 returns 0 on the hardware. Format 77 reads the data, as a control. XCL reads the data for format 80, as 32_32_32_32_FLOAT.

Also: with V# format 0 (INVALID), even an untyped buffer_load_dword returns 0 on the hardware. XCL reads the data. I can't tell whether titles ever build raw buffer descriptors with format 0.

XCL-BT-002: bounds by OOB_SELECT: confirmed

buffer_load_dword, where a lane "loads" if it gets the data rather than 0:

OOB_SELECT case lanes that load rule
0 raw, stride 0 none offset + 4 <= stride
0 idxen, N 3, stride 16 index 0..2 index < N
0 idxen offen, N 3, stride 16 index < 3 and offset 0..12 and offset + 4 <= stride
0 idxen, soffset 8 or 16 index 0..2 soffset not checked
1 raw / idxen offen every offset / index < 3 index < N only
2 all every lane N != 0
3 raw, N 18, soffset 0 offsets 0..12 offset + soffset + 4 <= N
3 raw, N 18, soffset 8 offsets 0, 4 soffset counted
3 idxen, N 40, stride 16 every index index * stride not checked

XCL on the same raw N = 18, soffset 8 load reads offsets 0..12 (4 lanes); the hardware reads 2.

Not tested

  • Wave64. The RDNA2 runs used 32-lane waves.
  • Stores: buffer_store_format_d16_*, and stores with invalid formats.
  • tbuffer_load_format_d16_* (my tbuffer encoding returned 0 everywhere, so I've left it out), s_buffer_load, and formats other than those named.
  • The console GPU itself, and any retail shader.
  • I haven't written a fix: these are crates/xcl/src changes, which need a smoke run on a title I don't have.

AI use

  • Claude Code (Claude Opus 5.5) wrote the measuring scripts and the temporary XCL test, ran them on my machine, and drafted this comment.
**@⁠AC-Storm-YT** on GitHub · 2026-11-24 19:45 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7142540028) Independent hardware measurements for **XCL-BT-002, -010 and -020**. The instructions ran natively on RDNA2 silicon and were compared with XCL `main` `c160d86`. They agree with the rules given earlier in this thread, and they come from my own runs, not from Leonida's documents. **Setup** - **RDNA2:** the Ryzen 7 9800X3D's integrated GPU (`gfx1036`), AMD driver 32.0.21045.29003, Windows 11 Pro 26200. These are OpenCL C kernels with inline RDNA assembly, built by the driver's OpenCL (3679.0, PAL, LC). Each lane loads with its own `offen` / `idxen` VGPR from a V# that the kernel builds in `s[20:23]` (`RESOURCE_LEVEL` = 1, identity `DST_SEL`). - **XCL:** a temporary local test, not committed, runs the same loads and memory through `translate` and `runner::run` (the default HLSL path, not `XCL_DIRECT_DXIL`) on an RX 9070 XT (driver 32.0.32029.2010), wave32. - This is desktop RDNA2, not the console GPU. No Leonida code, data or documents were used. ### XCL-BT-020: `buffer_load_format_d16_*`: **confirmed, all three parts** The test runs every 16-bit value (65,536). The 16-bit formats sit in the low half of each dword, with junk in the high half. vdst is preset to `0x5A5A0000`, or `0x00005A5A` for `d16_hi_x`. | | hardware | XCL | |---|---|---| | the other half of vdst, `d16_x` (16_UNORM / 16_SNORM / 16_FLOAT / 16_UINT / 32_UINT / 32_SINT) | kept, 65,536 / 65,536 for each | zeroed, 65,536 / 65,536 | | the other half, `d16_hi_x` | kept | kept | | `32_UINT` above 0xFFFF (`0x10000`, `70000`, `0x80000000`) | `0xFFFF` (saturates) | `0x0000`, `0x1170`, `0x0000` (truncates) | | `32_SINT` (`0x8000`, `0x10000`, `0x80000000`, `0xFFFF7FFF`) | `0x7FFF`, `0x7FFF`, `0x8000`, `0x8000` | `0x8000`, `0x0000`, `0x0000`, `0x7FFF` | | `16_UNORM` → f16 | the exact `v / 65535` rounded once to nearest-even: 65,536 / 65,536 | **31,740 values differ** (e.g. `0x0801`: hw `0x2801`, XCL `0x2800`) | | `16_SNORM` → f16 | rounded once: 65,536 / 65,536 | **30,716 values differ** | | `16_FLOAT` signaling NaN (`0x7C01`..) | kept bit for bit | quieted (`0x7E01`..), 1,022 values: the f16 → f32 → f16 path of XCL-BT-025 | **On UNORM / SNORM:** rounding once versus going through f32 differs for only 2 values in each format (`0xFFAF`, `0xFFEF` for UNORM; `0x7FF7`, `0x8009` for SNORM), exactly as the audit says. Most of XCL's differences on this adapter are instead 1 f16 ulp from the conversion itself. ### XCL-BT-010: invalid format codes: **confirmed** `buffer_load_format_x` with V# formats 78, 80, 100 and 127 returns **0** on the hardware. Format 77 reads the data, as a control. XCL reads the data for format 80, as `32_32_32_32_FLOAT`. **Also:** with V# format **0** (INVALID), even an untyped `buffer_load_dword` returns 0 on the hardware. XCL reads the data. I can't tell whether titles ever build raw buffer descriptors with format 0. ### XCL-BT-002: bounds by `OOB_SELECT`: **confirmed** `buffer_load_dword`, where a lane "loads" if it gets the data rather than 0: | `OOB_SELECT` | case | lanes that load | rule | |---|---|---|---| | 0 | raw, stride 0 | none | `offset + 4 <= stride` | | 0 | `idxen`, N 3, stride 16 | index 0..2 | `index < N` | | 0 | `idxen offen`, N 3, stride 16 | index < 3 **and** offset 0..12 | and `offset + 4 <= stride` | | 0 | `idxen`, soffset 8 or 16 | index 0..2 | soffset not checked | | 1 | raw / `idxen offen` | every offset / index < 3 | `index < N` only | | 2 | all | every lane | `N != 0` | | 3 | raw, N 18, soffset 0 | offsets 0..12 | `offset + soffset + 4 <= N` | | 3 | raw, N 18, **soffset 8** | offsets 0, 4 | soffset counted | | 3 | `idxen`, N 40, stride 16 | every index | `index * stride` not checked | XCL on the same raw N = 18, soffset 8 load reads offsets 0..12 (4 lanes); the hardware reads 2. **Not tested** - Wave64. The RDNA2 runs used 32-lane waves. - Stores: `buffer_store_format_d16_*`, and stores with invalid formats. - `tbuffer_load_format_d16_*` (my `tbuffer` encoding returned 0 everywhere, so I've left it out), `s_buffer_load`, and formats other than those named. - The console GPU itself, and any retail shader. - I haven't written a fix: these are `crates/xcl/src` changes, which need a smoke run on a title I don't have. **AI use** - Claude Code (Claude Opus 5.5) wrote the measuring scripts and the temporary XCL test, ran them on my machine, and drafted this comment.
Author
Owner

@⁠ddaikodaiko on GitHub · 2026-11-24 20:15 UTC · original

finding: the direct DXIL translator still has the image_sample_o implicit-LOD bug that #229 fixed in the HLSL path. crates/xcl/src/gpu/dxil/lower_image.rs:482-520 rounds the implicit LOD, takes that mip's dimensions (get_dimensions(..., Some(level))), divides the 6-bit offset by them and adds the result to the coordinate before a single sample; a pixel shader with a linear mip filter blends two mips, so the second one is read with the offset in the rounded mip's texels — the same 0.5 texel error the HLSL fix describes.

The HLSL form (gpu/recomp/emit.rs, texel_offset / sample_coord / moved_coords, PR #229) samples each mip with SampleLevel at its own size and blends by the LOD fraction when it is exact (MIP_FILTER linear, not anisotropic, and LOD >= 1 or min = mag filter) and keeps the single sample otherwise. Porting that to the direct translator is not just moving the code: it needs the S# words first — lower_image.rs only reads S# word 3 (s3 & 0xFFF, the sampler heap index) and never reads XY_MIP_FILTER / XY_MAX_ANISOTROPY / XY_MIN_MAG filters from word 2, which the decision needs.

Test: gpu_ps_image_sample_offset_implicit_lod_between_mips (LOD 0.25 between 8x8 and 4x4, offset +1) with XCL_DIRECT_DXIL=1; the HLSL path passes it, the direct one should show the second mip a texel off. Needs a GPU, no game files. I have no port for this one yet.

**@⁠ddaikodaiko** on GitHub · 2026-11-24 20:15 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7143272839) finding: the direct DXIL translator still has the `image_sample_o` implicit-LOD bug that #229 fixed in the HLSL path. `crates/xcl/src/gpu/dxil/lower_image.rs:482-520` rounds the implicit LOD, takes **that** mip's dimensions (`get_dimensions(..., Some(level))`), divides the 6-bit offset by them and adds the result to the coordinate before a single `sample`; a pixel shader with a linear mip filter blends two mips, so the second one is read with the offset in the rounded mip's texels — the same `0.5 texel` error the HLSL fix describes. The HLSL form (`gpu/recomp/emit.rs`, `texel_offset` / `sample_coord` / `moved_coords`, PR #229) samples each mip with `SampleLevel` at its own size and blends by the LOD fraction when it is exact (MIP_FILTER linear, not anisotropic, and LOD >= 1 or min = mag filter) and keeps the single sample otherwise. Porting that to the direct translator is not just moving the code: it needs the S# words first — `lower_image.rs` only reads S# word 3 (`s3 & 0xFFF`, the sampler heap index) and never reads XY_MIP_FILTER / XY_MAX_ANISOTROPY / XY_MIN_MAG filters from word 2, which the decision needs. Test: `gpu_ps_image_sample_offset_implicit_lod_between_mips` (LOD 0.25 between 8x8 and 4x4, offset +1) with `XCL_DIRECT_DXIL=1`; the HLSL path passes it, the direct one should show the second mip a texel off. Needs a GPU, no game files. I have no port for this one yet.
Author
Owner

@⁠b3IKK on GitHub · 2026-11-24 20:20 UTC · original

Two more entries checked against the code at main@c160d86 — both already handled, so nobody needs to write a fix (and a reviewer does not need to re-derive it):

XCL-BT-004 (DirectStorage, source_size < destination_size on an uncompressed request): Request::check refuses it at enqueue — crates/xcl/src/hle/dstorage.rs:730-736:

// Uncompressed copy: source and destination sizes must match.
(false, 0) => {
    if self.destination_size != self.source_size || (self.intermediate_size != 0 && self.intermediate_size != self.destination_size) {
        return Err(E_DESTINATION_SIZE);
    }
}

and queue_enqueue_request runs check before anything is stored (dstorage.rs:1301), so execute never sees a request whose payload is shorter than destination_size on that path; the test at dstorage.rs:1540 pins it (check(false) == Err(E_DESTINATION_SIZE)). The panic / over-read would need a second entry point into execute; there is none.

XCL-BT-006 (status array slots start E_PENDING): they start S_OK — dstorage.rs:622-623:

// a slot nothing was enqueued into is complete (S_OK); EnqueueStatus makes it E_PENDING
let inner = Arc::new(StatusInner { slots: (0..capacity).map(|_| AtomicI32::new(S_OK)).collect() });

(XCL-BT-034 from the same list is also not a defect — measured on the host runtime, see my earlier comment.)

The rest of the list I have gone through so far turned up real bugs, and those have PRs: XCL-BT-035 #1733, XCL-BT-032 #1746, XCL-BT-033 #1740, XCL-BT-036 #1716, XCL-BT-037 #1726, XCL-BT-038 #1720, XCL-BT-040 #1610, XCL-BT-041 #1753.

Hardware / software: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2609.5.

AI use: OpenCode, Gemini 4 Neon — read the two paths and wrote this up.

**@⁠b3IKK** on GitHub · 2026-11-24 20:20 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7143382113) Two more entries checked against the code at `main@c160d86` — both already handled, so nobody needs to write a fix (and a reviewer does not need to re-derive it): **`XCL-BT-004`** (DirectStorage, `source_size < destination_size` on an uncompressed request): `Request::check` refuses it at enqueue — `crates/xcl/src/hle/dstorage.rs:730-736`: ```rust // Uncompressed copy: source and destination sizes must match. (false, 0) => { if self.destination_size != self.source_size || (self.intermediate_size != 0 && self.intermediate_size != self.destination_size) { return Err(E_DESTINATION_SIZE); } } ``` and `queue_enqueue_request` runs `check` before anything is stored (`dstorage.rs:1301`), so `execute` never sees a request whose payload is shorter than `destination_size` on that path; the test at `dstorage.rs:1540` pins it (`check(false) == Err(E_DESTINATION_SIZE)`). The panic / over-read would need a second entry point into `execute`; there is none. **`XCL-BT-006`** (status array slots start `E_PENDING`): they start `S_OK` — `dstorage.rs:622-623`: ```rust // a slot nothing was enqueued into is complete (S_OK); EnqueueStatus makes it E_PENDING let inner = Arc::new(StatusInner { slots: (0..capacity).map(|_| AtomicI32::new(S_OK)).collect() }); ``` (`XCL-BT-034` from the same list is also not a defect — measured on the host runtime, see my earlier comment.) The rest of the list I have gone through so far turned up real bugs, and those have PRs: `XCL-BT-035` #1733, `XCL-BT-032` #1746, `XCL-BT-033` #1740, `XCL-BT-036` #1716, `XCL-BT-037` #1726, `XCL-BT-038` #1720, `XCL-BT-040` #1610, `XCL-BT-041` #1753. Hardware / software: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2609.5. AI use: OpenCode, Gemini 4 Neon — read the two paths and wrote this up.
Author
Owner

@⁠b3IKK on GitHub · 2026-11-24 20:44 UTC · original

XCL-BT-024 is not a bug as written (checked at main@4178e88). The two index paths do different things, and neither renders stale indices:

  • draw_indexed_x (list_x.rs:3559-3578) calls gpu_va(..., "DrawIndexedX indices", false) — no mirror. For a title address outside unified memory and outside any window, gpu_va falls through mirrored() (skipped: mirror == false) to bind::allocate_upload_memory + copy_nonoverlapping (list_x.rs:3281-3293), i.e. a fresh copy into the list's arena at every draw, made from the title's memory as it is then. The arena is a per-list bump allocator (bind.rs, s.arena.take), so the next allocation does not reuse the block.
  • A bound index buffer (ia_set_index_buffer_x, list_x.rs:3539-3555) gets the mirror (mirror = true), and the PC-side indexed draws (bind.rs:404, draw_indexed_instanced) sync it per draw with sync_title_buffers(this, Some((first_index, indices, base_vertex)), …), which copies the range read from the title's memory into the mirror (list_x.rs:3349-3390).

The one place a mirror is not re-synced is the fallback copy when mirror_of has no room (2 GiB of mirrors, list_x.rs:3326-3332): that is logged as "bound as a copy made at the bind, which later writes do not reach", i.e. a stated limit of a full mirror table, not the DrawIndexedX path.

XCL-BT-031 from the same batch was real and is #1787.

Hardware / software: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2609.5.

AI use: OpenCode, Gemini 4 Neon — read both index paths and wrote this up.

**@⁠b3IKK** on GitHub · 2026-11-24 20:44 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7143997934) **`XCL-BT-024` is not a bug** as written (checked at `main@4178e88`). The two index paths do different things, and neither renders stale indices: - `draw_indexed_x` (`list_x.rs:3559-3578`) calls `gpu_va(..., "DrawIndexedX indices", false)` — **no mirror**. For a title address outside unified memory and outside any window, `gpu_va` falls through `mirrored()` (skipped: `mirror == false`) to `bind::allocate_upload_memory` + `copy_nonoverlapping` (`list_x.rs:3281-3293`), i.e. a *fresh* copy into the list's arena at every draw, made from the title's memory as it is then. The arena is a per-list bump allocator (`bind.rs`, `s.arena.take`), so the next allocation does not reuse the block. - A *bound* index buffer (`ia_set_index_buffer_x`, `list_x.rs:3539-3555`) gets the mirror (`mirror = true`), and the PC-side indexed draws (`bind.rs:404`, `draw_indexed_instanced`) sync it per draw with `sync_title_buffers(this, Some((first_index, indices, base_vertex)), …)`, which copies the range read from the title's memory into the mirror (`list_x.rs:3349-3390`). The one place a mirror is *not* re-synced is the fallback copy when `mirror_of` has no room (`2 GiB of mirrors`, `list_x.rs:3326-3332`): that is logged as "bound as a copy made at the bind, which later writes do not reach", i.e. a stated limit of a full mirror table, not the DrawIndexedX path. `XCL-BT-031` from the same batch was real and is #1787. Hardware / software: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2609.5. AI use: OpenCode, Gemini 4 Neon — read both index paths and wrote this up.
Author
Owner

@⁠ddaikodaiko on GitHub · 2026-11-24 23:48 UTC · original

Update on the direct-DXIL side of the three items in this report (RTX 3060 Ti, driver 32.0.16.1088, DXC 1.8.2502.11, branches rebased on main b9b6ea6):

  • BT-002 (MUBUF/MTBUF OOB_SELECT + s_buffer_load) and BT-010 (invalid buffer formats 78-127): verified before, in both translators.
  • BT-038 (v_pack_b32_f16 with abs/neg): now also verified in both. HLSL passes; XCL_DIRECT_DXIL=1 passes; with only the direct port (7610fa0) reverted the test fails with lane 0: -1.0, |-2.0|.

The earlier script's negative control (upstream/main + XCL_DIRECT_DXIL=1) was misleading: upstream/main has no such test, so cargo test <name> ran zero tests and exited 0. Reverting only the direct-port commit is the real control; it fails in both cases above.

No PRs from me (DeepSeek rule), but the branches and per-commit patches are ready for a person or another model to take upstream.

**@⁠ddaikodaiko** on GitHub · 2026-11-24 23:48 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7147822923) Update on the direct-DXIL side of the three items in this report (RTX 3060 Ti, driver 32.0.16.1088, DXC 1.8.2502.11, branches rebased on `main` `b9b6ea6`): - **BT-002** (MUBUF/MTBUF `OOB_SELECT` + `s_buffer_load`) and **BT-010** (invalid buffer formats 78-127): verified before, in both translators. - **BT-038** (`v_pack_b32_f16` with `abs`/`neg`): now also verified in both. HLSL passes; `XCL_DIRECT_DXIL=1` passes; with only the direct port (`7610fa0`) reverted the test fails with `lane 0: -1.0, |-2.0|`. The earlier script's negative control (`upstream/main` + `XCL_DIRECT_DXIL=1`) was misleading: `upstream/main` has no such test, so `cargo test <name>` ran zero tests and exited 0. Reverting only the direct-port commit is the real control; it fails in both cases above. No PRs from me (DeepSeek rule), but the branches and per-commit patches are ready for a person or another model to take upstream.
Author
Owner

@⁠Decodere on GitHub · 2026-11-25 00:13 UTC · original

Taking XCL-BT-012 (pixel shader EXP VM valid-mask handling in crates/xcl/src/gpu/recomp/emit.rs and crates/xcl/src/gpu/dxil/lower_gfx.rs):

  • Honor the ENC_EXP VM bit so VM=1 overwrites xcl_live / live_var with current EXEC and VM=0 leaves it unchanged whenever the pixel shader has any VM=1 export (preserving the DONE=1 fallback only when no VM=1 export exists), with HLSL + Direct DXIL GPU pixel-shader draw tests on RTX 4060.

AI use: Google Antigravity (Gemini 4 Neon).

**@⁠Decodere** on GitHub · 2026-11-25 00:13 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7148286884) Taking **`XCL-BT-012`** (pixel shader `EXP` `VM` valid-mask handling in `crates/xcl/src/gpu/recomp/emit.rs` and `crates/xcl/src/gpu/dxil/lower_gfx.rs`): - Honor the `ENC_EXP` `VM` bit so `VM=1` overwrites `xcl_live` / `live_var` with current `EXEC` and `VM=0` leaves it unchanged whenever the pixel shader has any `VM=1` export (preserving the `DONE=1` fallback only when no `VM=1` export exists), with HLSL + Direct DXIL GPU pixel-shader draw tests on RTX 4060. AI use: Google Antigravity (Gemini 4 Neon).
Author
Owner

@⁠Decodere on GitHub · 2026-11-25 01:02 UTC · original

Taking XCL-BT-015 (StreamConfig::from_xma2_wfx multi-stream stereo/mono layout formula in crates/xcl/src/hle/xma2/mod.rs):

  • Validate num_streams <= channels <= num_streams * MAX_CHANNELS_PER_STREAM and assign stereo = channels - num_streams 2-channel streams followed by 1-channel streams (fixing 5.1 4-stream [2, 2, 1, 1], 4.0 3-stream [2, 1, 1], 7.1 5/6-stream, etc.), with unit tests covering valid and invalid layouts.

AI use: Google Antigravity (Gemini 4 Neon).

**@⁠Decodere** on GitHub · 2026-11-25 01:02 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7149140186) Taking **`XCL-BT-015`** (`StreamConfig::from_xma2_wfx` multi-stream stereo/mono layout formula in `crates/xcl/src/hle/xma2/mod.rs`): - Validate `num_streams <= channels <= num_streams * MAX_CHANNELS_PER_STREAM` and assign `stereo = channels - num_streams` 2-channel streams followed by 1-channel streams (fixing 5.1 4-stream `[2, 2, 1, 1]`, 4.0 3-stream `[2, 1, 1]`, 7.1 5/6-stream, etc.), with unit tests covering valid and invalid layouts. AI use: Google Antigravity (Gemini 4 Neon).
Author
Owner

@⁠Decodere on GitHub · 2026-11-25 01:27 UTC · original

Taking the Direct DXIL parity follow-up for XCL-BT-026 (crates/xcl/src/gpu/dxil/lower_mem.rs and crates/xcl/src/gpu/recomp/tests.rs, following merged #1929 which updated HLSL emit.rs):

  • Saturate UINT (ty == 4) and SINT (ty == 5) for w < 32 in Lw::fmt_encode, switch 16_16_FLOAT / 11_11_10_FLOAT encoding to f16_rtz, and add Direct DXIL GPU regression tests on RTX 4060.

AI use: Google Antigravity (Gemini 4 Neon).

**@⁠Decodere** on GitHub · 2026-11-25 01:27 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7149566044) Taking the Direct DXIL parity follow-up for **`XCL-BT-026`** (`crates/xcl/src/gpu/dxil/lower_mem.rs` and `crates/xcl/src/gpu/recomp/tests.rs`, following merged `#1929` which updated HLSL `emit.rs`): - Saturate `UINT` (`ty == 4`) and `SINT` (`ty == 5`) for `w < 32` in `Lw::fmt_encode`, switch `16_16_FLOAT` / `11_11_10_FLOAT` encoding to `f16_rtz`, and add Direct DXIL GPU regression tests on RTX 4060. AI use: Google Antigravity (Gemini 4 Neon).
Author
Owner

@⁠fixgep on GitHub · 2026-11-25 18:12 UTC · original

XCL-BT-008 (async PSO COM lifetime retention across command lists and late_release retirement): opened PR #2417 with multi-threaded race and queue-retirement tests.

AI use: Antigravity (Gemini 4 Hydrogen).

**@⁠fixgep** on GitHub · 2026-11-25 18:12 UTC · [original](https://github.com/xcl-dev/xcl/issues/1488#issuecomment-7170597006) `XCL-BT-008` (async PSO COM lifetime retention across command lists and `late_release` retirement): opened PR #2417 with multi-threaded race and queue-retirement tests. AI use: Antigravity (Gemini 4 Hydrogen).
This discussion has been locked. Commenting is limited to contributors.
No description provided.