Tracking & Static Audit: 50 New Source-Level Bugs + 150 Prioritized Backlog Items [Part 2/3] #1489
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#1489
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@hyperland956-lgtm on GitHub · 2026-11-24 16:51 UTC · original
23.
XCL-BT-023— dev_create_pipeline_state Bypasses device_x::create_graphics_pso_tracked, Breaking RSSetDepthBiasX and CreateDerivedPipelineStateX for All Stream-Created Graphics PSOs (P1)Location:
crates/xcl/src/hle/d3d12x/real.rslines4660-4670Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'create_graphics_pso_tracked', 'dev_create_pipeline_state', 'dynamic_depth_bias': PR #927 covers Intel Arc dynamic depth bias fallback and PR #170/#303/#743 cover mesh/untranslated streams; zero issues or PRs mention dev_create_pipeline_state bypassing create_graphics_pso_tracked.
Root Cause: When
dev_create_pipeline_state(real.rs:4660-4670) unpacks a graphics pipeline state stream viastream_pipeline, it callsgraphics_pso(this, &d, riid, out)directly instead of routing throughdevice_x::create_graphics_pso_tracked. As a result, stream-created graphics PSOs (1) never getD3D12_PIPELINE_STATE_FLAG_DYNAMIC_DEPTH_BIASadded on supported GPUs, and (2) are never registered withdevice_x::note_base. Any subsequentRSSetDepthBiasXorCreateDerivedPipelineStateXtargeting a stream-created graphics PSO silently fails or drops the depth bias (causing severe shadow-map acne / z-fighting on decals and shadows).Edge-Case / Verification Note: Verified
dev_create_graphics_psocallsdevice_x::create_graphics_pso_tracked(which injectsD3D12_PIPELINE_STATE_FLAG_DYNAMIC_DEPTH_BIASand callsnote_base), whereasdev_create_pipeline_stateatreal.rs:4665-4666callsgraphics_psodirectly, completely skipping both.Synthetic Reproducer: Create a graphics PSO using
ID3D12Device2::CreatePipelineState(pipeline stream API), bind it, and callRSSetDepthBiasX(e.g. for shadow maps or decals) orCreateDerivedPipelineStateX. Becausenote_basewas never called,device_x::base_depth_bias_inforeturnsNone,RSSetDepthBiasXcannot use native dynamic depth bias or patched-PSO fallback, andCreateDerivedPipelineStateXfails.Proposed Fix & Risk: - Fix: Route the unpacked graphics
D3D12_GRAPHICS_PIPELINE_STATE_DESCindev_create_pipeline_statethroughdevice_x::create_graphics_pso_tracked(passinggraphics_psoas the creation callback), matchingdev_create_graphics_pso.Regression Risk: Low; reuses the exact same tracked graphics PSO creation path already proven for
CreateGraphicsPipelineState. (Estimated size:S)24.
XCL-BT-024— draw_indexed_x Never Re-Syncs Mirrored Non-UMA Inline Index Buffers After Initial Bind, Rendering Stale Indices (P1)Location:
crates/xcl/src/hle/d3d12x/list_x.rslines3155-3219, 3341-3360Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'draw_indexed_x', 'sync_title_buffers', 'mirrored': PR #195 introduced mirroring, PR #222 fixed a test address collision, and PR #693 fixed skipping VirtualQuery on already-mirrored binds; zero issues or PRs report draw_indexed_x failing to re-sync updated CPU index data for mirrored inline index buffers.
Root Cause:
draw_indexed_x(list_x.rs:3341-3360) receives an inline index buffer VAvadirectly as a draw parameter (rather than viaIASetIndexBuffer). It callssync_title_buffers(this, None, 0, 0, 2)(which only syncs boundvertex_titles, ignoringvabecauseindexedisNone) and then resolves the GPU VA viagpu_va(this, va, len, "DrawIndexedX indices", false). Whenvalies outside unified memory,gpu_vacreates a mirror inMIRRORSand copies the initial bytes on the first draw; on every subsequent draw where the title updates the CPU index buffer atva,gpu_vahits the existing mirror inMIRRORSand returns it without copying the new index bytes, so the GPU permanently renders stale indices from the first draw.Edge-Case / Verification Note: Checked
gpu_vaandmirror(list_x.rs:3120-3151):mirrorcopies bytes only when creating a new mirror entry; subsequent lookups returnSome(m + (va - s))directly without copying. RegularDrawIndexedInstancedrelies onsync_title_buffers(this, Some((first, count, base)), ...)to refreshb.index_title's mirror, whereasdraw_indexed_xpassesindexed = Noneand never refreshes the mirror of its inlineva.Synthetic Reproducer: Allocate a dynamic index buffer outside unified memory (e.g., heap/stack memory), call
DrawIndexedX(va, DXGI_FORMAT_R16_UINT, 6, 0)with triangle A's indices, overwritevaon the CPU with triangle B's indices, and callDrawIndexedX(va, DXGI_FORMAT_R16_UINT, 6, 0)again. The second draw still renders triangle A's indices.Proposed Fix & Risk: - Fix: In
draw_indexed_x, after resolvinggpu_va(or beforeset_index_buffer), checkif let Some(m) = mirrored(va, len)and copy thelenbytes fromvatomwhen readable (and optionally passSome((0, count, 0))with the inline index range tosync_title_buffersfor tighter vertex sync).Regression Risk: Very low; only copies when
MIRROR_BYTES > 0and the inline index buffervais inMIRRORS. (Estimated size:S)25.
XCL-BT-025— 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 (P1)Location:
crates/xcl/src/gpu/recomp/emit.rslines5282-5284Prior-Work Check: Searched all 4,430 XCL records for
fmt_compandf16tof32NaN /c mod n(PR #875 only fixedtbufferDST_SEL; 0 hits for MUBUFc mod nchannel repetition or16_FLOATsNaN payload preservation).Root Cause: Measured on RDNA2
gfx1036(ProjectLeonidaL/leonidadocs/buffer_formats.md:50-52,docs/shader_validation.md:1671-1711f16_widen_probe.py),fmt_compinemit.rs:5282-5284has two hardware divergences: (1) for MUBUF typed buffer loads where channel indexc >= n(the format's channel count), RDNA2 hardware repeatsc % n(whereas TBUFFER returns0), while XCL returns(0, 0, 0, 1)(c == 3 ? 1.0 : 0.0); (2) for16_FLOATNaNs, hardware widens without quieting signaling NaNs (sign | 0x7F800000 | (payload << 13)), whereas XCL calls HLSLf16tof32, which quiets bit 22 and canonicalizes NaN payloads.Edge-Case / Verification Note: Alternative hypothesis:
DST_SELusually maps missing channels explicitly toSEL_0orSEL_1. Falsification: when a V# descriptor leavesDST_SEL = XYZWon a 1-, 2-, or 3-channel format (common forR32_FLOATorR16G16_FLOATbuffers),c >= nreachesfmt_compdirectly and exposes(0,0,0,1)vsc % n.Synthetic Reproducer: (1)
buffer_load_format_xyzwof a32_FLOATbuffer containing5.0fwithDST_SEL = XYZW-> hardware returns(5.0, 5.0, 5.0, 5.0), XCL returns(5.0, 0.0, 0.0, 1.0). (2)buffer_load_format_xof16_FLOAT0x7C01(sNaN) -> hardware returns0x7F802000, XCL returns quieted0x7FC02000.Proposed Fix & Risk: - Fix: Pass a
is_tbufferflag intofmt_compso MUBUF indexesc % nand TBUFFER returns0forc >= n(beforeDST_SEL), and widen f16 NaNs via bit-exact((h & 0x8000u) << 16) | 0x7F800000u | ((h & 0x03FFu) << 13)when(h & 0x7FFF) > 0x7C00.Regression Risk: Low; localized to
fmt_compHLSL helper. (Estimated size:S)26.
XCL-BT-026— fmt_encode typed buffer stores violate four measured RDNA2 hardware contracts (INT saturation, SCALED, float16/11/10 RTZ+max-finite, UNORM/SNORM rounding) (P1)Location:
crates/xcl/src/gpu/recomp/emit.rslines5344-5358Prior-Work Check: Searched all 4,430 XCL records for
fmt_encode,USCALED,SSCALED, andbuffer_store_formatrounding/saturation (0 hits).Root Cause: Measured across 1.55M elements on RDNA2
gfx1036and RDNA3.5gfx1150(ProjectLeonidaL/leonidadocs/buffer_formats.md:54-68,162-168),fmt_encodeinemit.rs:5344-5358violates four distinct typed-store rules: (1)UINT/SINT(ty == 4u || 5u) returns rawxandput_bitstruncates instead of saturating to[0, (1<<w)-1]/[-(1<<(w-1)), (1<<(w-1))-1]; (2)USCALED/SSCALED(ty == 2u / 3u) casts(uint)f/(int)finstead of converting asUNORM/SNORM(confirmed on RDNA2:SCALEDstores use normalized conversion, not raw int cast); (3) 16/11/10-bitFLOATusesf32tof16(RNE + overflows finite> 65504to+inf) instead of RTZ + saturating finite overflow to max finite (0x7BFFfor f16,0x7BFfor f11,0x3DFfor f10); (4)UNORM/SNORMdouble-rounds viaf32multiplication (0.3 * 65535 -> 19660vs hardware19661) and 2-bitSNORMrounds halves to even instead of away from zero.Edge-Case / Verification Note: Alternative hypothesis: 1-ULP UNORM rounding differences might be invisible. Falsification: integer truncation on
16_UINT/8_UINT/10_10_10_2_UINTwraps65536to0(catastrophic index/ID corruption), finite f16 overflow createsInf/NaNfireflies in HDR render buffers, andUSCALED/SSCALEDoff-by-scale factors corrupt vertex/buffer writes completely.Synthetic Reproducer: (1)
buffer_store_format_x16_UINTof70000-> hardware stores65535, XCL stores4464. (2)16_FLOATstore of65520.0-> hardware stores0x7BFF, XCL stores0x7C00(+inf). (3)16_UNORMstore of0.3f-> hardware stores19661, XCL stores19660.Proposed Fix & Risk: - Fix: Clamp
UINT/SINTto bit-width bounds beforeput_bits; routeUSCALED/SSCALEDthroughUNORM/SNORMstore logic; implement bit-exact RTZ + max-finite saturation for f16/f11/f10; usedouble(or exact integer) scaling for 16-bitUNORM/SNORMand round-half-away-from-zero for 2-bitSNORM.Regression Risk: Low; self-contained within
fmt_encodeHLSL helper. (Estimated size:M)27.
XCL-BT-027— gameinput.rs: IGameInput::RegisterDeviceCallback completely ignores statusFilter (_filter) (P1)Location:
crates/xcl/src/hle/gameinput.rslines815-842Prior-Work Check: Verified 0 overlap across ivall_xcl corpus (1 hit in #106 was unrelated loader/TLS issue).
Root Cause: In register_device_callback (gameinput.rs:815-842), the
statusFilterparameter is named_filter: u32and never stored or checked during initial enumeration or hotplug delivery.Edge-Case / Verification Note: Titles passing
GameInputDeviceAnyStatus(0xFFFFFFFF) orGameInputDeviceConnected(0x1) do not notice the missing filter, but titles registering separate callbacks for distinct status bits (e.g., audio-only or specific connect/disconnect masks) get duplicate/wrong invocations.Synthetic Reproducer: Call IGameInput::RegisterDeviceCallback with statusFilter = 0 (or GameInputDeviceAudioCapture) and GameInputBlockingEnumeration; callback fires for the connected gamepad despite non-matching filter.
Proposed Fix & Risk: - Fix: Store
status_filter: u32in the registered callback entry and only invoke the callback when(current_status & status_filter) != 0(for initial enumeration) or((previous_status ^ current_status) & status_filter) != 0(for transitions).Regression Risk: Low; directly enforces Microsoft GameInput callback filtering semantics. (Estimated size:
S)28.
XCL-BT-028— image_load / image_load_mip with D16=1 truncates 32-bit UINT/SINT texels and zeroes vdst[31:16] on odd-channel loads (P1)Location:
crates/xcl/src/gpu/recomp/emit.rslines2217-2223, 2455-2459Prior-Work Check: Searched all 4,430 XCL records for
image_loadd16saturation / high half (0 hits).Root Cause: Measured on RDNA2
gfx1036across 1D/2D/2D-array/3D textures (ProjectLeonidaL/leonidadocs/shader_validation.md:1767-1778,image_d16_probe.py),image_load/image_load_mipwithD16=1saturates 32-bitUINT/SINTtexels to[0, 65535]/[-32768, 32767]and preservesvdst[31:16]on odd-channeldmaskcounts (1 or 3 enabled channels).emit.rs:2217-2223, 2455-2459truncates integer texels with& 0xFFFFuand overwrites the entire 32-bitvdstwith high 16 bits zeroed on odd channel counts.Edge-Case / Verification Note: Alternative hypothesis: games might only use
image_load d16on 16-bit or 8-bit formats where truncation equals saturation. Falsification:R32_UINT/R32_SINTvisibility/ID/histogram buffers loaded viad16wrap on values> 65535or< -32768, and odd-channeldmask:0x1clobbers packed high-half VGPR registers.Synthetic Reproducer: Pre-load
v0 = 0xCAFE_0000, executeimage_load v0, v[1:2], s[0:7] dmask:0x1 d16on anR32_UINTtexel containing100000. Hardware producesv0 = 0xCAFE_FFFF; XCL produces0x0000_86A0.Proposed Fix & Risk: - Fix: Saturate
UINT/SINTtexels to 16-bit bounds whend16is set, and merge the final odd channel into(vdst & 0xFFFF0000u) | (lo & 0xFFFFu).Regression Risk: Low; localized to
mimgd16output packing. (Estimated size:S)29.
XCL-BT-029— kernelx.rs: FreeTitlePhysicalPages removes away mappings without calling lazy::unmark(at), leaving stale VEH entries in LAZY (P1)Location:
crates/xcl/src/hle/kernelx.rs, crates/xcl/src/hle/kernelx/lazy.rslineskernelx.rs:1169-1176; lazy.rs:47-59Prior-Work Check: Verified 0 hits across ivall_xcl corpus for lazy::unmark.
Root Cause: In FreeTitlePhysicalPages (kernelx.rs:1169-1176), removing an away mapping deletes it from
away.pageandaway.at, but never callslazy::unmark(at). Consequently, the 64 KiB VA remains in the globalLAZYBTreeSet (lazy.rs:29) indefinitely.Edge-Case / Verification Note: Titles that always call MapTitlePhysicalPages(va, n, ..., NULL) before FreeTitlePhysicalPages go through unmap_away which calls lazy::unmark; titles that free physical pages directly while still mapped away hit this leak.
Synthetic Reproducer: Allocate a physical page, map it lazily into a reserved VA (marked in LAZY), call FreeTitlePhysicalPages without unmapping, VirtualFree(MEM_RELEASE) the VA, re-reserve the same VA with PAGE_NOACCESS, and read it: lazy::handler commits it PAGE_READWRITE instead of raising an access violation.
Proposed Fix & Risk: - Fix: Call
lazy::unmark(at);inside theif let Some(at) = away.page.remove(&*arr.add(i))block at kernelx.rs:1171-1174.Regression Risk: Low; one-line cleanup matching unmap_away. (Estimated size:
S)30.
XCL-BT-030— kernelx.rs: VirtualAllocEx(GetCurrentProcess(), ...) bypasses placeholders::alloc, UMA, sparse VRAM, and GRAPHICS_RESERVATIONS (P1)Location:
crates/xcl/src/hle/kernelx.rslines453-467Prior-Work Check: Verified 0 hits across ivall_xcl corpus for virtualallocex.
Root Cause: VirtualFreeEx (kernelx.rs:453-463) checks
proc_ == GetCurrentProcess()and forwards UMA/sparse/graphics addresses toVirtualFree, whereas VirtualAllocEx (lines 465-467) unconditionally callsmem::VirtualAllocEx(proc_, addr, size, sanitize_alloc_type(t), sanitize_protect(p)), stripping Xbox flags and bypassingVirtualAlloc(includingplaceholders::alloc, UMA, sparse VRAM, andGRAPHICS_RESERVATIONS).Edge-Case / Verification Note: Titles that only use VirtualAlloc / VirtualAlloc2 / XMemVirtualAlloc are unaffected, but Win32/GDK allocators that route current-process allocations through VirtualAllocEx(GetCurrentProcess(), ...) silently lose GPU visibility and placeholder tracking.
Synthetic Reproducer: Call kernelx::VirtualAllocEx(GetCurrentProcess(), null, 0x10000, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, PAGE_NOACCESS); host VirtualAllocEx fails with ERROR_INVALID_PARAMETER instead of allocating a sparse placeholder via placeholders::alloc.
Proposed Fix & Risk: - Fix: In VirtualAllocEx, if
proc_ == thr::GetCurrentProcess(), delegate directly toVirtualAlloc(addr, size, t, p).Regression Risk: Low; mirrors VirtualFreeEx's current-process delegation. (Estimated size:
S)31.
XCL-BT-031— resolve_subresource_x and resolve_subresource_region_x Omit title_textures::note_gpu_write(dst) and Console DXGI Format Translation (P1)Location:
crates/xcl/src/hle/d3d12x/list_x.rslines3738-3753Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'resolve_subresource_x' and 'resolve_subresource_region_x': 0 matching records across all issues, PRs, and comments.
Root Cause: Unlike
copy_texture_region_x(list_x.rs:3612) andcopy_resource_x(list_x.rs:3759), neitherresolve_subresource_x(list_x.rs:3738-3742) norresolve_subresource_region_x(list_x.rs:3747-3753) callssuper::title_textures::note_gpu_write(dst). If a title resolves an MSAA render target into a placed texture tracked bytitle_textures,title_texturesnever marksdstas GPU-written and subsequently overwrites the resolved GPU image with stale CPU bytes on the next submit. Additionally, both functions forward the rawformat: i32directly to PCResolveSubresource/ResolveSubresourceRegionwithout translating console-only DXGI formats viareal::pc_target_format/real::pc_view_format(e.g.,R9G9B9E5_SHAREDEXPpromoted targets or console depth/color formats).Edge-Case / Verification Note: Verified
copy_texture_region_xandcopy_resource_xboth unconditionally callsuper::title_textures::note_gpu_write(dst)right next tosuper::present::note_use(dst, USE_COPY).resolve_subresource_xandresolve_subresource_region_xcallpresent::note_use(dst, USE_COPY)but omit bothtitle_textures::note_gpu_write(dst)and format translation.Synthetic Reproducer: Create a placed single-sample destination texture tracked by
title_textures(or with a promoted/console format) and executeResolveSubresourceorResolveSubresourceRegionfrom an MSAA target into it. Either the resolve fails format validation on PC ortitle_textures::upload_alloverwrites the resolved pixels with stale CPU memory.Proposed Fix & Risk: - Fix: Call
super::title_textures::note_gpu_write(dst);and translateformatwithreal::pc_target_format(DXGI_FORMAT(format)).0(orpc_view_formatfor depth) in bothresolve_subresource_xandresolve_subresource_region_x.Regression Risk: Very low; aligns MSAA resolve paths with
copy_texture_region_xandcopy_resource_x. (Estimated size:XS)32.
XCL-BT-032— resource_barrier_x Records BEGIN_ONLY Split Transition Barriers as Completed StateAfter in title_textures::note_transitions (P1)Location:
crates/xcl/src/hle/d3d12x/list_x.rslines3486-3517Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'note_transitions', 'begin_only', 'resource_barrier_x': PR #135 introduced note_transitions and PR #1025/#1027 cover enhanced barriers and depth-UAV counting; zero issues or PRs mention BEGIN_ONLY split barriers corrupting title_textures state tracking.
Root Cause: In
resource_barrier_x(list_x.rs:3513-3517), every transition barrier (b[0] == 0) inoutis forwarded totitle_textures::note_transitions(this, &t)withb[6](StateAfter), regardless ofb[1](D3D12_RESOURCE_BARRIER_FLAGS). For a split barrier withD3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY(b[1] == 1), the resource has not yet transitioned toStateAfter—it remains in a mid-transition split state until a matchingEND_ONLY(b[1] == 2) barrier executes (often in a later command list). RecordingStateAfteronBEGIN_ONLYcausestitle_textures::upload_allto emit an invalidStateAfter -> COPY_DESTbarrier if an upload runs beforeEND_ONLY, triggering D3D12 debug-layer state mismatch errors or GPU hazards.Edge-Case / Verification Note: Confirmed
b[1]holdsD3D12_RESOURCE_BARRIER_FLAGS(0 = NONE,1 = BEGIN_ONLY,2 = END_ONLY) andlist_x.rs:3515filters only onb[0] == 0without checkingb[1] != 1(D3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY).Synthetic Reproducer: On command list A, emit a
BEGIN_ONLYtransition on a tracked placed texture fromPIXEL_SHADER_RESOURCEtoRENDER_TARGET; close and submit list A, then trigger atitle_texturesupload before submitting list B'sEND_ONLY.title_texturestransitions fromRENDER_TARGET(never reached) instead of waiting/tracking the actual completed state.Proposed Fix & Risk: - Fix: Exclude
BEGIN_ONLYbarriers (b[1] != 1) when collecting transitions fortitle_textures::note_transitionsinresource_barrier_x(onlyNONEandEND_ONLYcomplete a state transition).Regression Risk: Very low; single predicate addition (
&& b[1] != 1) inresource_barrier_x. (Estimated size:XS)33.
XCL-BT-033— sparse::sync_sent_range Hashes Entire 64-Byte Chunks After Sub-64-Byte GPU Readbacks, Silently Dropping Un-Uploaded CPU Writes in Same Cacheline (P1)Location:
crates/xcl/src/hle/d3d12x/sparse.rslines970-997, 1021-1038Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'sync_sent_range', 'readback_ranges', 'readback_after_execute': PR #433 addresses CPU-wait deadlock in readback_after_execute, PR #99 fixed sub-tile reclaim, and Issue #262 covers simultaneous-access; zero issues or PRs mention sync_sent_range clobbering sibling bytes in a 64-byte hash chunk.
Root Cause: After a GPU
Write32BitValueXorWrite64BitValueX(4 or 8 bytes) is read back into the CPU view byreadback_after_execute(sparse.rs:1021-1038),sync_sent_range(dst, len)(sparse.rs:970-997) recomputeschunk_hashover the entire 64-byte chunk(s) covering[dst, dst + len)and writes those hashes intoentry.sent[k]. Becausebefore_executeskips uploading any 64-byte chunk whose current CPU hash matchesentry.sent[k], any pending CPU writes that occurred in the other 56–60 bytes of that same 64-byte cacheline (before the readback or concurrently on another CPU thread) are hashed intoentry.sent[k]as if already present in VRAM and are silently never uploaded to the GPU.Edge-Case / Verification Note: Confirmed
CHUNK = 64insparse.rsand thatsync_sent_rangeunconditionally hashes all 64 bytes of each touched chunk from live CPU memory rather than only whenlencovers the full 64-byte chunk or preserving dirty status for partial chunks. Because titles pack fence/counter words adjacent to CPU-written command/constant fields in the same 64-byte cacheline, this causes real data loss.Synthetic Reproducer: Place a CPU-written struct field at
base + 0x00and a GPUWrite64BitValueBottomOfPipeXtarget atbase + 0x08(same 64-byte chunk). Have the GPU writebase + 0x08while the CPU writesbase + 0x00beforereadback_after_executecompletes;sync_sent_range(base + 0x08, 8)hashes the full 64 bytes includingbase + 0x00intoentry.sent[0], causing the nextbefore_executeto skip uploadingbase + 0x00to VRAM.Proposed Fix & Risk: - Fix: Only update
entry.sent[k]insync_sent_rangefor chunks fully covered by[dst, dst + len)(chunk_start >= dst && chunk_end <= dst + len), or invalidate (entry.sent[k] = 0) partial chunks so any modified sibling bytes are safely re-uploaded (or use sub-chunk dirty tracking).Regression Risk: Low; at most triggers one 64-byte re-upload on the next submit for partially written readback cachelines (which is safe because CPU memory already holds the readback bytes too). (Estimated size:
S)34.
XCL-BT-034— stream_pipeline Unconditionally Defaults DepthEnable=TRUE Even When DEPTH_STENCIL Subobject Is Omitted and DSVFormat Is UNKNOWN (P1)Location:
crates/xcl/src/hle/d3d12x/real.rslines4549-4577Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'stream_pipeline', 'depthenable', 'dev_create_pipeline_state': PR #170 (mesh streams), PR #199 (rect list GS), PR #303 (console shader guard), and PR #743 (MS stand-in) do not mention DepthEnable defaulting in stream_pipeline.
Root Cause: When unpacking a
D3D12_PIPELINE_STATE_STREAM_DESCinto aD3D12_GRAPHICS_PIPELINE_STATE_DESC,stream_pipeline(real.rs:4549-4577) initializesd.DepthStencilState.DepthEnable = TRUEandDepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALLunconditionally before parsing subobjects. Per the D3D12CreatePipelineStatespecification, if a pipeline stream omitsD3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL(orDEPTH_STENCIL1/2) ANDDSVFormat == DXGI_FORMAT_UNKNOWN,DepthEnabledefaults toFALSE. LeavingDepthEnable = TRUEwhen no DSV is bound causes D3D12 validation errors or incorrect depth-test rejection on drivers that enforce strict stream defaults.Edge-Case / Verification Note: Verified
stream_pipelinelines 4549-4640: there is no post-parse check clearingDepthEnablewhen!has_ds && d.DSVFormat == DXGI_FORMAT_UNKNOWN. In contrast, Microsoft's D3D12CD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCILand runtime stream parser explicitly defaultDepthEnabletoFALSEwheneverDSVFormat == DXGI_FORMAT_UNKNOWNand no depth-stencil subobject was supplied.Synthetic Reproducer: Call
ID3D12Device2::CreatePipelineStatewith a graphics pipeline stream containing VS, PS, RTVFormats, and noDEPTH_STENCILorDEPTH_STENCIL_FORMATsubobject (a standard fullscreen/UI/post-process stream).stream_pipelineconstructs a desc withDepthEnable = TRUE, DSVFormat = UNKNOWN.Proposed Fix & Risk: - Fix: Track
let mut has_ds = false;while parsing stream subobjects instream_pipeline, and after the loop setif !has_ds && d.DSVFormat == DXGI_FORMAT_UNKNOWN { d.DepthStencilState.DepthEnable = FALSE; }.Regression Risk: Very low; strictly conforms to the D3D12 pipeline state stream default specification. (Estimated size:
XS)35.
XCL-BT-035— title_textures::recheck_gpu_view_sources Increments PENDING for Shadowed Textures, Permanently Leaking PENDING Counter and Breaking Fast-Path Skip (P1)Location:
crates/xcl/src/hle/d3d12x/title_textures.rslines260-266, 426-451Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'recheck_gpu_view_sources', 'recheck_source', 'shadowed': PR #288 introduced shadowed textures, PR #539/#1075/#1086/#1102 touch upload/GPU views; zero issues or PRs report PENDING counter corruption from shadowed textures in recheck_gpu_view_sources.
Root Cause: In
title_textures.rs, the globalPENDINGAtomicUsizestrictly counts entries int.by_resthat havepending == true(when an entry is moved tot.shadowed,PENDINGis decremented; when an entry is removed fromt.shadowed,PENDINGis not decremented; when uncovered back tot.by_res,PENDINGis incremented). However,recheck_gpu_view_sources(title_textures.rs:426-451) callsrecheck_sourceon botht.by_res.values_mut()andt.shadowed.values_mut(). Insiderecheck_source, when a shadowed texture's source address changes and!e.pending, it setse.pending = trueand executesPENDING.fetch_add(1, Ordering::Relaxed). Becauseupload_allonly drainst.by_res(nevert.shadowed), thatPENDINGincrement is never decremented while shadowed—and if the shadowed texture is later uncovered or destroyed,PENDINGleaks permanently (>= 1forever), disabling thePENDING == 0fast-path skip on everyExecuteCommandListsand causing double-counting if uncovered.Edge-Case / Verification Note: Traced all
PENDING.fetch_addandPENDING.fetch_subcall sites intitle_textures.rs:shadowedentries are deliberately excluded fromPENDINGeverywhere else (unmap_supersededdecrementsPENDINGwhen moving toshadowed;Table::removedoes not decrementPENDINGforshadowedremovals). Onlyrecheck_gpu_view_sourcesviolates this invariant by callingrecheck_source(which incrementsPENDING) ont.shadowed.values_mut().Synthetic Reproducer: Create two overlapping placed textures so texture A is moved to
t.shadowedwithpending == false. TriggerCopyPageMappingsBatchX->recheck_gpu_view_sources()that updates texture A'sgpu_view_src. ObservePENDINGincremented by 1 even thought.by_reshas 0 pending textures; destroy texture A and observePENDINGstays permanently non-zero.Proposed Fix & Risk: - Fix: Pass a
count_pending: boolparameter torecheck_source(true fort.by_res, false fort.shadowed), or only incrementPENDINGwhenrecheck_sourcemutates an entry int.by_res.Regression Risk: Very low; 2-line invariant fix with zero behavioral side effects. (Estimated size:
XS)36.
XCL-BT-036— translated_gs_pso Copies Raw Console RTV/DSV DXGI Formats Into StreamOut Pipeline Stream Without pc_target_format / pc_view_format Translation (P1)Location:
crates/xcl/src/hle/d3d12x/real.rslines4347-4414Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'translated_gs_pso', 'pc_target_format', 'rtvformats', 'dsvformat': PR #303 guards untranslated shaders, PR #541/#605/#242/#651 cover MS-in-AS and R9G9B9E5 formats in other paths, and PR #977 adds tests; zero issues or PRs report missing pc_target_format/pc_view_format translation in translated_gs_pso.
Root Cause: Unlike
translated_mesh_stream(real.rs:4330-4338) andpc_graphics_desc,translated_gs_pso(real.rs:4347-4414) copiesd.RTVFormatsandd.DSVFormatverbatim from the consoleD3D12_GRAPHICS_PIPELINE_STATE_DESCinto theD3D12_PIPELINE_STATE_STREAM_DESC(StreamOut/ mesh-emulated GS stream) without callingpc_target_formaton each RTV format orpc_view_formatonDSVFormat. Any geometry-shader pipeline targeting console-only formats (such as Xbox D16S8116..=120,DXGI_FORMAT_B4G4R4A4_UNORM115,DXGI_FORMAT_B5G5R5A1_UNORM86, orR9G9B9E5_SHAREDEXPpromoted toR11G11B10_FLOAT) failsCreatePipelineStatewithE_INVALIDARG.Edge-Case / Verification Note: Compared
translated_gs_pso(real.rs:4375-4395) directly againsttranslated_mesh_stream(real.rs:4330-4338):translated_mesh_streamexplicitly maps everyRTVFormats[i]throughpc_target_formatandDSVFormatthroughpc_view_format, whereastranslated_gs_psopassesd.RTVFormatsandd.DSVFormatraw.Synthetic Reproducer: Create a console graphics PSO containing a geometry shader (routed to
translated_gs_pso) withDSVFormat = 118(XboxD16_UNORM_S8_UINT) orRTVFormats[0] = DXGI_FORMAT_R9G9B9E5_SHAREDEXP.CreatePipelineStatefails withE_INVALIDARGinstead of compiling the translated pipeline.Proposed Fix & Risk: - Fix: Translate
rtv_formats.RTFormats[i] = pc_target_format(d.RTVFormats[i])fori in 0..d.NumRenderTargets.min(8)anddsv_format = pc_view_format(d.DSVFormat)insidetranslated_gs_pso, matchingtranslated_mesh_stream.Regression Risk: Very low; 4-line fix aligning
translated_gs_psowithtranslated_mesh_stream. (Estimated size:XS)37.
XCL-BT-037— upper_lanes::step() misses S_MOVRELSD_2_B32 when invalidating SGPR abstract state (P1)Location:
crates/xcl/src/gpu/recomp/upper_lanes.rslines549-555Prior-Work Check: Searched all 4,430 XCL records for
S_MOVRELSD_2_B32andupper_lanes(PR #94 fixedx64_masks.rs, NOTupper_lanes.rs:549-555; 0 hits forupper_lanes.rs).Root Cause:
upper_lanes.rs:549-555checksif name.starts_with("S_MOVRELD")to conservatively invalidate all SGPR abstract values (st.s.fill(SVal::Unknown)) becauses_movreld_b32writes to anM0-indexed SGPRs[dst + m0]. However,S_MOVRELSD_2_B32(s[dst + (m0 >> 16)] = s[src + (m0 & 0xFFFF)]) does NOT start with"S_MOVRELD", soupper_lanes::step()fails to invalidatest.s. Subsequent Wave64-on-Wave32 upper-lane analysis uses stale SGPR abstract state (e.g. staleEXEC/VCC/mask values) acrosss_movrelsd_2_b32.Edge-Case / Verification Note: Alternative hypothesis:
s_movrelsd_2_b32might rarely appear in Wave64 shaders that run throughupper_lanes. Falsification: PR #94 already hitS_MOVRELSD_2_B32in real shaders insidex64_masks.rs, proving it occurs in practice and was simply missed inupper_lanes.rs.Synthetic Reproducer: Wave64 shader setting an SGPR mask in
s4, overwritings4indirectly vias_movrelsd_2_b32 s0, s8withm0 = 4 << 16, then usings4in a mask operation analyzed byupper_lanes.upper_lanesretains the pre-writeSValfors4.Proposed Fix & Risk: - Fix: Change the condition at
upper_lanes.rs:549toif name.starts_with("S_MOVRELD") || name.starts_with("S_MOVRELSD").Regression Risk: Very low; conservative invalidation identical to
S_MOVRELD. (Estimated size:XS)38.
XCL-BT-038— v_pack_b32_f16 silently drops VOP3 abs and neg source modifiers (P1)Location:
crates/xcl/src/gpu/recomp/emit.rslines3304-3308Prior-Work Check: Searched all 4,430 XCL records (1,035 issues/PRs + 3,395 issue comments) for
v_pack_b32_f16(only #159 opcode census mentions it; 0 hits forabs/negbug).Root Cause: Verified on RDNA2 silicon (
ProjectLeonidaL/leonidadocs/design.md:306,309),v_pack_b32_f16supports VOP3abs(clearing bit 15) andneg(flipping bit 15) on both 16-bit sources in addition toop_sel.emit.rs:3304-3308extracts the half viam.opsel((a >> (m.opsel & 1) * 16) & 0xFFFF) and packs them without ever applyingm.abs[0..2](& 0x7FFF) orm.neg[0..2](^ 0x8000).Edge-Case / Verification Note: Alternative hypothesis: DXC might fold
abs/neginto earlier f16 ALU ops instead ofv_pack_b32_f16. Falsification: DXC routinely packs negated or absolute-value f16 scalars (e.g., flipped normal/UV components or half2 construction) directly inv_pack_b32_f16_e64 v0, -v1, |v2|.Synthetic Reproducer: Assemble
v_pack_b32_f16 v0, -v1, |v2|withv1 = 0x3C00(+1.0h),v2 = 0xBC00(-1.0h). Hardware producesv0 = 0x3C00_BC00; XCL produces0xBC00_3C00.Proposed Fix & Risk: - Fix: Apply
if m.abs[i] { h &= 0x7FFF }andif m.neg[i] { h ^= 0x8000 }to both extracted 16-bit operands inemit.rs:3304-3308.Regression Risk: Very low; two bitwise ops gated on
m.abs/m.neg. (Estimated size:XS)39.
XCL-BT-039— 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 (P1)Location:
crates/xcl/src/gpu/recomp/emit.rslines2960-2965, 3186-3191Prior-Work Check: Searched all 4,430 XCL records for
denorm_mode_16_64andomodonvalu16/valu64(0 hits).Root Cause: Measured on RDNA2
gfx1036(ProjectLeonidaL/leonidadocs/shader_validation.md:1503-1509f64_omod_probe.py,1964-1971SHADER-135), whenMODE.denorm_mode_16_64 == 3(preserve denorms on both input and output, which is the default console mode for f16 and f64), RDNA2 hardware silently ignoresomod(mul:2,mul:4,div:2) on all f16 and f64 VOP3 instructions (while still honoringclamp).emit.rs:2960-2965(valu16) andemit.rs:3186-3191(valu64) unconditionally multiply the result by2.0/4.0/0.5wheneverm.omod != 0.Edge-Case / Verification Note: Alternative hypothesis: shaders compiled for
denorm_mode_16_64 = 3might never encode non-zeroomodon f16/f64 ops. Falsification: hardware probes (f64_omod_probe.py, SHADER-135) explicitly document that non-zeroomodbits in f16/f64 VOP3 encodings are ignored by silicon underdenorm_mode_16_64 = 3(and shaders that toggles_setregmode or carry leftoveromodbits diverge by 2x/4x).Synthetic Reproducer: Under default
MODE.denorm_mode_16_64 = 3, executev_add_f16_e64 v0, v1, v2 mul:2(v1 = 1.0h, v2 = 1.0h) orv_add_f64 v[0:1], v[2:3], v[4:5] mul:2. Hardware returns2.0(omodignored); XCL returns4.0.Proposed Fix & Risk: - Fix: Gate
omodapplication invalu16andvalu64on the shader'sdenorm_mode_16_64(disableomodwhendenorm_mode_16_64 == 3, the default, while preservingclamp).Regression Risk: Very low; gated strictly on f16/f64
omodunder default denorm preservation. (Estimated size:XS)40.
XCL-BT-040— xgameruntime/api.rs: query_interface on all XGameRuntime COM objects refuses IID_IUnknown with E_NOINTERFACE (P1)Location:
crates/xcl/src/hle/xgameruntime/api.rslines366-379Prior-Work Check: Verified 0 hits across ivall_xcl corpus for query_interface E_NOINTERFACE / IID_IUnknown in xgameruntime.
Root Cause: At xgameruntime/api.rs:371,
query_interfaceonly accepts*iid == f.clsid,f.iids.contains(&*iid), orown(&f.clsid, &*iid). It never checks forIID_IUnknown(00000000-0000-0000-C000-000000000046), refusing it withE_NOINTERFACE.Edge-Case / Verification Note: Direct GDK C thunks call QueryApiImpl with the specific provider IID and do not QI for IID_IUnknown, but generic COM helpers and debug wrappers require IID_IUnknown to succeed on every COM object.
Synthetic Reproducer: Call slot 0 (QueryInterface) on any object returned by QueryApiImpl with IID_IUnknown; returns E_NOINTERFACE and sets *out = null.
Proposed Fix & Risk: - Fix: Add
*iid == IID_IUNKNOWNto the accepted condition at api.rs:371 (returning S_OK and*out = this as *mut c_void).Regression Risk: Low; fundamental COM rule. (Estimated size:
S)41.
XCL-BT-041— xgameruntime/mod.rs: association_call ignores canceled flag and XUserUnregisterForDeviceAssociationChanged ignores wait, causing UAF on caller context (P1)Location:
crates/xcl/src/hle/xgameruntime/mod.rslines867-871, 891-910Prior-Work Check: Verified 0 hits across ivall_xcl corpus for association_call / XUserUnregisterForDeviceAssociationChanged.
Root Cause: 1)
association_call(mod.rs:867-871) ignores_canceled: booland invokesr.cb(r.ctx, &r.change)even when the XTaskQueue was terminated (canceled == true). 2)XUserUnregisterForDeviceAssociationChanged(lines 907-910) removes the token fromASSOCIATION_CALLBACKSand ignores_wait, never cancelling or waiting for in-flight/queuedassociation_callcallbacks submitted on line 900 or 921.Edge-Case / Verification Note: Because association callbacks are typically only queued once at sign-in, titles that keep their input manager alive until process exit may not hit the race, but titles that tear down and recreate UI/input subsystems or terminate task queues during shutdown hit a deterministic UAF.
Synthetic Reproducer: After XUserAddResult, call XUserRegisterForDeviceAssociationChanged on a manual-dispatch queue, immediately call XUserUnregisterForDeviceAssociationChanged(token, true), free ctx, then dispatch or terminate the queue; association_call dereferences freed ctx.
Proposed Fix & Risk: - Fix: Check
if canceled { return; }inassociation_call, tag each queuedAssociationCallwith a sharedArc<AtomicBool>/Condvaractive flag (matching gameinput.rs's CallbackEntry pattern), skip invocation if unregistered, and block whenwait == trueuntil any in-flight invocation finishes.Regression Risk: Low; standard callback-unregistration synchronization. (Estimated size:
M)42.
XCL-BT-042— Float compare-and-swap atomics use bitwise InterlockedCompareExchange instead of IEEE float equality (-0.0 == +0.0, NaN != NaN) (P2)Location:
crates/xcl/src/gpu/recomp/emit.rslines5008-5011, 5059Prior-Work Check: Searched all 4,430 XCL records for
fcmpswap,ds_cmpst_f32, andInterlockedCompareExchangefloat equality (0 hits).Root Cause: Documented in RDNA2 ISA and verified in hardware shader contracts (
Kajcsi/G6Recompdocs/shaders.md:927-932,ProjectLeonidaL/leonidadocs/design.md:404), float CAS atomics (ds_cmpst_f32,buffer_atomic_fcmpswap,global_atomic_fcmpswap,image_atomic_fcmpswap, and_x264-bit variants) compare using IEEE-754 float equality where-0.0 == +0.0succeeds andNaN == NaNfails.emit.rs:5008-5011and5059lower all float CAS ops to raw bitwiseInterlockedCompareExchange, which fails on-0.0vs+0.0and spuriously succeeds on identicalNaNbit patterns.Edge-Case / Verification Note: Alternative hypothesis: CAS retry loops for float atomic add/min/max use the exact bit pattern returned by the previous load, so
-0.0vs+0.0only diverges on initial expected values. Falsification: directds_cmpst_f32/*_fcmpswapwith an expected0.0fagainst stored-0.0f(or sentinelNaN) immediately diverges from hardware.Synthetic Reproducer: Store
-0.0f(0x80000000) in LDS/buffer, executeds_cmpst_f32/buffer_atomic_fcmpswapcomparing against+0.0f(0x00000000) and swapping to1.0f. Hardware succeeds and stores1.0f; XCL fails bitwise CAS and leaves-0.0f.Proposed Fix & Risk: - Fix: Wrap float CAS ops in a short CAS loop that loads
cur, checksasfloat(cur) == asfloat(cmp)(handles-0.0 == +0.0andNaN != NaN), and executes bitwiseInterlockedCompareExchange(addr, cur, new_val, orig)untilorig == curor float equality is false.Regression Risk: Low; only affects explicit
*_fcmpswap/ds_cmpst_f32instructions. (Estimated size:S)43.
XCL-BT-043— acphal.rs: XApuEnqueueCommand and XApuGetResultCount report current queue length instead of cumulative enqueued/dequeued totals (P2)Location:
crates/xcl/src/hle/acphal.rslines955-962, 985-994Prior-Work Check: Verified 0 hits across ivall_xcl corpus for XApuGetResultCount.
Root Cause: In acphal.rs:955-962, XApuEnqueueCommand writes
q.len() as u32into*countinstead of a cumulative count of enqueued commands, and in acphal.rs:985-994, XApuGetResultCount writesq.len() as u32(the same value as its return value) into*totalinstead of the cumulative count of dequeued results (compare VIctory apu.rs:302-307, 367, 379-383).Edge-Case / Verification Note: Callers passing NULL for the optional
totalout-parameter or only inspecting the return value of XApuGetResultCount are unaffected.Synthetic Reproducer: Enqueue 2 commands, dequeue 2 results, and call XApuGetResultCount(h, &mut total); returns 0 and sets total = 0 instead of total = 2.
Proposed Fix & Risk: - Fix: Add
enqueued_total: u32anddequeued_total: u32counters (wrapping_add(1)) toXApustate and write them to the respective optional out-parameters.Regression Risk: Low; aligns XApu counter semantics with Xbox XApu ABI. (Estimated size:
S)44.
XCL-BT-044— kernelx.rs: XMemVirtualQuery writes only a 32-bit CPU-only flag at +48, leaving +52..+64 uninitialized and clearing GPU visibility (P2)Location:
crates/xcl/src/hle/kernelx.rslines648-667Prior-Work Check: Verified 0 overlap with ivall_xcl #650/#656 (test buffer alignment) and #1005 (coherent UMA VirtualQuery fast-path).
Root Cause: At kernelx.rs:665, XMemVirtualQuery writes only a 4-byte u32 (
cpu as u32, bit 0 only) at offset +48 and explicitly assumes 'The caller zeroes the rest' (line 647). It neither zeroes bytes +52..+64 nor sets the GPU-accessible bit for addresses inside UMA / sparse VRAM.Edge-Case / Verification Note: XboxBvhBuilder.dll zeroes the buffer and checks bit 0, so that specific caller works, but other GDK/middleware callers inspecting full 64-bit flags or GPU accessibility get stale stack bytes or wrong flags.
Synthetic Reproducer: Fill a 64-byte aligned buffer with 0xCC and call XMemVirtualQuery on a committed UMA buffer; bytes 52..64 remain 0xCC and bit 1 (GPU) is 0.
Proposed Fix & Risk: - Fix: Zero bytes +48..+64 before writing the flags field, and set the GPU-accessible bit when the queried address falls within UMA / sparse VRAM.
Regression Risk: Low; eliminates uninitialized output bytes. (Estimated size:
S)45.
XCL-BT-045— present::note_rtv Retains ID3D12Resource COM References Indefinitely in RTVS Without Cleanup on Descriptor Heap Destruction (COM & VRAM Leak) (P2)Location:
crates/xcl/src/hle/d3d12x/present.rslines158-171Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'note_rtv', 'rtvs': only PR #555 (area-filter window shrink) and unrelated format comments (#150, #242, #605) matched; zero issues or PRs report the permanent COM resource leak in present::RTVS.
Root Cause:
present::note_rtv(present.rs:158-171) inserts(rtv_cpu_handle, res.clone())into the globalRTVS: Mutex<Option<HashMap<usize, ID3D12Resource>>>map on everyCreateRenderTargetViewcall, incrementing the COM reference count of every render target texture. Entries are only overwritten if the exact same CPU descriptor handle address is later reused by anotherCreateRenderTargetViewcall—there is no cleanup hook when anID3D12DescriptorHeap(RTV heap) is released or when a render target is destroyed. Titles that recreate RTV descriptor heaps (e.g., on resolution change, level load, or per-scene transient render target pools) permanently leakID3D12ResourceCOM objects and their underlying VRAM allocations.Edge-Case / Verification Note: Searched the entire
present.rsfile forRTVS: entries are inserted innote_rtvand read onOMSetRenderTargets/Present, and never removed on descriptor heap destruction or resource release. Even a single transient RTV heap with 1080p/4K render targets leaks tens to hundreds of megabytes of VRAM for the rest of the process lifetime.Synthetic Reproducer: Create an RTV descriptor heap, create an
ID3D12Resourcerender target and RTV in that heap, then callrt->Release()andrtv_heap->Release(). Observert's COM refcount never reaches 0 becausepresent::RTVSstill holds anID3D12Resourceclone keyed by the freed heap's CPU descriptor handle.Proposed Fix & Risk: - Fix: Track RTV heap address ranges
(heap_start_handle..heap_end_handle)and purge matching keys fromRTVSwhen an RTVID3D12DescriptorHeapis released (or store raw/weak resource pointers cleaned up onres_releaseinstead of strongID3D12Resourceclones).Regression Risk: Low; prevents unbounded VRAM retention on 6 GB GPUs during level transitions and resize events. (Estimated size:
S)46.
XCL-BT-046— v_cmp_class_f32 applies abs/neg via float arithmetic (flushing denormals & quieting sNaNs) (P2)Location:
crates/xcl/src/gpu/recomp/emit.rslines2564-2573, 3633-3638, 5851Prior-Work Check: PR #107 fixed
v_cmp_class_f16bitwise (& 0x7FFF/^ 0x8000), leavingv_cmp_class_f32still usingSelf::fsrc.Root Cause:
v_cmp_class_f32routessrc0throughSelf::fsrc(abs(asfloat(...))/-asfloat(...)) beforefpclass_f32. Under HLSL/DXIL float semantics, floatabs/negcan flush denormals to zero and quiet sNaNs before classification, whereasf64v(3075) andv_cmp_class_f16(3607) manipulate the sign bit bitwise.Edge-Case / Verification Note: Alternative hypothesis: DXC/driver might lower
abs(asfloat(x))to a bitwise AND on some GPUs. Falsification: HLSL does not guarantee preserving sNaN/denorm bit patterns across floatabs/neg; bitwise& 0x7FFF_FFFFu/^ 0x8000_0000uis guaranteed across all drivers.Synthetic Reproducer: Synthetic GPU test:
v_cmp_class_f32 vcc, |v0|, 0x001(sNaN bit) withv0 = 0x7F800001and|v0|withv0 = 0x00000001(denorm).Proposed Fix & Risk: - Fix: Apply
abs(& 0x7FFF_FFFFu) andneg(^ 0x8000_0000u) bitwise on the rawuintbits ofsrc0, matchingv_cmp_class_f16.Regression Risk: Very low. (Estimated size:
XS)47.
XCL-BT-047— v_div_scale_f32 / v_div_fmas_f32 / v_div_fixup_f32 drops pre/post-scaling and mishandles NaN q, sign, and underflow cutoff (P2)Location:
crates/xcl/src/gpu/recomp/emit.rslines3471-3472, 3547-3555, 5624Prior-Work Check: Searched all 4,430 XCL records; PR #823 covers
f64division ops only;f32v_div_scale/v_div_fmas/v_div_fixupremain broken.Root Cause:
v_div_scale_f32never pre-scales (2^32/2^-32) and always setssdst = false;v_div_fmas_f32ignores VCC; anddiv_fixup(q, d, n)(5624) returnsqunchanged whendandnare finite non-zero even ifqisNaN(hardware returns±infwithsign(d)^sign(n)), omits theexp(n) - exp(d) <= -151underflow cutoff, and fails to enforcesign(d) ^ sign(n).Edge-Case / Verification Note: Alternative hypothesis: normal mid-range divisions do not hit exponent scaling. Falsification: shaders dividing tiny/huge world/lighting values (
1e35 / 1e-10) produceNaNinstead of±inf.Synthetic Reproducer: Synthetic GPU test:
div_fixup(NaN, 1.0f, 2.0f)-> expected+inf, observedNaN;1e35f / 1e-10fvia fullv_div_scale/rcp/fmas/fixupsequence -> expected+inf, observedNaN.Proposed Fix & Risk: - Fix: Implement AMD ISA scaling predicates in
v_div_scale_f32, conditionalldexp(..., ±32)inv_div_fmas_f32, and full NaN/cutoff/sign rules indiv_fixup.Regression Risk: Low; isolated to explicit division helper sequence. (Estimated size:
M)48.
XCL-BT-048— v_interp_p2_f16 double-rounds through binary32 instead of single-rounding to binary16 (P2)Location:
crates/xcl/src/gpu/recomp/emit.rslines2025-2031Prior-Work Check: Searched all 4,430 XCL records for
v_interp_p2_f16(0 hits).Root Cause:
v_interp_p2_f16computes the interpolation FMA in binary32 and then narrows viato_f16_expr(...). Native RDNA2 (gfx1036) hardware measurements (Leonida/tools/interp_hw_probe.py, 30/30 ties) confirm hardware roundsfma(h20, J, p1ll)once, directly to binary16.Edge-Case / Verification Note: Alternative hypothesis: 1 f16 ULP interpolation difference is rarely visible. Falsification: exact tie inputs from
interp_hw_probe.pydiverge bit-for-bit on all 30/30 ties.Synthetic Reproducer: Synthetic shader executing
v_interp_p1ll_f16+v_interp_p2_f16on binary16 midpoint tie inputs.Proposed Fix & Risk: - Fix: Apply round-to-odd in binary32 (exact
fma+ error sticky bit) before callingto_f16_expr.Regression Risk: Very low. (Estimated size:
S)49.
XCL-BT-049— v_min_f32 / v_max_f32 / v_min3_f32 / v_max3_f32 violate RDNA2 -0.0 < +0.0 signed-zero ordering on NVIDIA/WARP (P2)Location:
crates/xcl/src/gpu/recomp/emit.rslines2987-2992, 3362-3375Prior-Work Check: PR #719 and PR #739 are test-only PRs checking NaN propagation; neither fixes nor raw-bit-tests
-0.0vs+0.0sign ordering.Root Cause: XCL emits plain HLSL
min(a, b)/max(a, b). In HLSL/DXIL, the sign ofmin(-0.0, +0.0)andmax(-0.0, +0.0)is unspecified and driver-dependent (NVIDIA/WARP differ by operand order), whereas RDNA2 strictly orders-0.0 < +0.0.Edge-Case / Verification Note: Alternative hypothesis: most shaders treat
-0.0 == +0.0. Falsification: shaders that inspect sign bits (asuint,copysign, oct-normal encoding) diverge whenmin(-0.0, +0.0)returns+0.0.Synthetic Reproducer: Synthetic GPU test comparing raw
asuintofv_min_f32(+0.0, -0.0)(expected0x80000000) andv_max_f32(-0.0, +0.0)(expected0x00000000) on NVIDIA/WARP.Proposed Fix & Risk: - Fix: Wrap
min/maxinfmin_rdna/fmax_rdnahelpers that resolve two-zero inputs viaasuint(a) | asuint(b)(min) andasuint(a) & asuint(b)(max).Regression Risk: Very low. (Estimated size:
S)50.
XCL-BT-050— xgameruntime/networking.rs: check_thumbprints for XNetworkingThumbprintType::Issuer only inspects chain_sha1s.get(1), failing on 4+ cert chains (P2)Location:
crates/xcl/src/hle/xgameruntime/networking.rslines421-442Prior-Work Check: Verified 0 hits across ivall_xcl corpus for chain_sha1s; PR #77 only hardened malformed pin metadata and did not fix multi-intermediate issuer matching.
Root Cause: At networking.rs:433,
check_thumbprintshandles thumbprint_type == 1 (XNetworkingThumbprintType::Issuer) withchain_sha1s.get(1).is_some_and(|c| c.as_slice() == expected). In chains with 2+ intermediate certificates (length >= 4), intermediate issuers at indices2..chain_sha1s.len()-1are never checked.Edge-Case / Verification Note: Standard 3-cert chains (Leaf -> Intermediate -> Root) only have index 1 as an intermediate and pass, so the bug only affects deeper PKI hierarchies (common in enterprise/cross-signed chains).
Synthetic Reproducer: Call check_thumbprints with a 4-cert chain [leaf, sub1, sub2, root] and an Issuer (type 1) pin matching sub2; returns PinCheck::Mismatch instead of PinCheck::Matched.
Proposed Fix & Risk: - Fix: For
tp.thumbprint_type == 1, check all intermediate certificates:chain_sha1s.len() >= 3 && chain_sha1s[1..chain_sha1s.len() - 1].iter().any(|c| c.as_slice() == expected)(orchain_sha1s.get(1..).is_some_and(...)if root-as-issuer in 2-cert chains should also match).Regression Risk: Low; strictly expands valid intermediate CA pin matching without weakening leaf/root checks. (Estimated size:
S)@coenflict on GitHub · 2026-11-24 18:10 UTC · original
XCL-BT-033
I reproduced the partial sparse readback issue on
9e3831e1f570d3646e53ab753b19ec07eb8f1485. In the existing D3D12 readback fixture, I changed CPU byte 0, copied 8 GPU bytes back at offset 8, and scanned the page. The scan returned no upload ranges. With the local fix it returns the 64-byte chunk.The fix hashes a complete copy-back from the GPU staging bytes and updates a clean partial chunk from its pre-copy snapshot. A partial chunk with a pending CPU write stays marked for upload, even if a later CPU write happens to restore the old chunk hash. A separate fixture exercises dirty partial, fully overwritten, and clean partial chunks in one request.
Tested
32.0.16.2140, Rust 1.97.1 MSVC, DXC and DXIL 1.9.2602.17, debug.cargo test -p xcl --lib hle::d3d12x::sparse::tests -- --nocapture: 15 passed, 0 failed, 1 ignored, 0 skips with the local patch.scripts/test.ps1 --nocaptureon the uncommitted patch at the base above: 777 reported passed, 0 failed, 41 ignored. The pass count includes three GPU skips (two no wave64, one no heap windows).XCL_SAMPLE_*inputs were unset.Not tested
AI use
gpt-6.2-sol) wrote the local patch and tests, ran them, and drafted this report.@coenflict on GitHub · 2026-11-24 18:17 UTC · original
XCL-BT-027
I reproduced the GameInput v0 status-filter bug on
9e3831e1f570d3646e53ab753b19ec07eb8f1485. A blocking registration filtered for audio capture still got the synthetic gamepad callback. The local fix checks for an overlapping bit before either initial enumeration path. In the fixture, the audio-only and zero masks yield no callback, and a combined audio-capture/connected mask yields one callback with the full current status. Microsoft GameInput v0 documentationTested
32.0.16.2140, Rust 1.97.1 MSVC, DXC and DXIL 1.9.2602.17, debug.cargo test -p xcl --lib hle::gameinput::tests -- --nocapturewith the patch: 10 passed, 0 failed, 0 ignored, 0 skips.scripts/test.ps1 --nocapturewith the uncommitted patch at the base above: 777 reported passed, 0 failed, 41 ignored. The pass count includes three GPU skips (two no wave64, one no heap windows).XCL_SAMPLE_*inputs were unset.Not tested
AI use
gpt-6.2-sol) wrote the local fix and regression test, ran the tests, and drafted this report.@AC-Storm-YT on GitHub · 2026-11-24 19:45 UTC · original
Hardware measurements for three recompiler items of this audit: XCL-BT-039, -042 and -047. The instructions ran natively on RDNA2 silicon and were compared with XCL
mainc160d86.Setup
gfx1036), AMD driver 32.0.21045.29003, Windows 11 Pro 26200. These are OpenCL C kernels with inline RDNA assembly, so the GPU runs the exact instruction, built by the driver's OpenCL (3679.0, PAL, LC). MODE is set withs_setregaround each instruction.translateandrunner::runon an RX 9070 XT (driver 32.0.32029.2010), wave32.XCL-BT-042: float compare-and-swap: confirmed
RDNA2 compares the floats, not the bits. In each case below the new value is 1.0, and the instructions are
ds_cmpst_rtn_f32,global_atomic_fcmpswapandglobal_atomic_fcmpswap_x2. The integerds_cmpst_rtn_b32andglobal_atomic_cmpswapbehave as XCL does, as a control.InterlockedCompareExchange)-0.0+0.0+0.0-0.00x7fc000000x7f8000010x00000001+0.0, f32 denormals flushed (MODE.FP_DENORM f32 = 0)0x00000001+0.0, f32 denormals kept (= 3)In f64,
±0and NaN behave the same way. With f32 denormals flushed, ±denormals also compare equal to ±0.XCL-BT-047: f32 division: confirmed, for quotients near the ends of the range
This is the standard sequence
v_div_scale×2,v_rcp, 5 ×v_fma,v_div_fmas,v_div_fixup, over 65,491 (n, d) pairs: edge values, random words and random normal floats.n / d, including all 8,051 quotients that overflow. Those come out ±inf.3.4e38 / 1.18e-38.1 / 3.4e38gives0x00200000on the hardware.1.4e-45 / 1e-10.1 / 1.18e-38gives0x7e800001.-0 / 1gives+0.1.4e-45 / 1.4e-45gives 1.0 on the hardware.v_div_fixup_f32alone: 521 of 1,728 special (q, d, n) triples differ. For finite d and n, the hardware returns ±inf for a NaN q, ±0 for n = ±0, and|q|with the signsign(d) ^ sign(n). XCL'sdiv_fixupreturns q unchanged.XCL-BT-025: 16_FLOAT signaling NaN: confirmed, for
buffer_load_format_d16_xFor all 1,022 f16 signaling NaNs (
0x7C01..), the hardware returns the payload bit for bit, and XCL returns it quieted (0x7E01..). I only measured the d16 form. The setup and the other d16 results are in my comment on #1488.XCL-BT-039: omod on f16 / f64: true, but the rule is broader than the audit says
v_add/v_mul/v_fmain f16, f32 and f64 withmul:2,mul:4anddiv:2, under every IEEE and FP_DENORM setting:XCL always applies omod and doesn't track MODE (
s_denorm_modeis a no-op). In practice it matters only if a console compiler emits omod in a mode where the hardware ignores it. LLVM's AMDGPU backend folds omod only when IEEE is off and denormals are flushed, so this may not happen in real code. I haven't checked any console shaders. Note thatgpu_clamp_and_omod_per_instructionexpects omod to apply on f64.Not tested
buffer_atomic_fcmpswap,image_atomic_fcmpswapand the LDS_x2form. I measured only the global and LDS f32 forms and the global f64 form.crates/xcl/src, which needs a smoke run on a title I don't have.AI use
@Decodere on GitHub · 2026-11-25 00:02 UTC · original
Taking
XCL-BT-042(float compare-and-swap atomics IEEE-754 equality acrossemit.rs,dxil/lower_mem.rs, anddxil/lower_image.rs):fcmpswap/cmpst_f32(32-bit and 64-bit) with bounded CAS loops using bitwise IEEE-754 ordered equality so-0.0 == +0.0swaps andNaN == NaNdoes not swap (without touchingPRELUDE_MEMor requiringDoubleExtensions), verified with HLSL + Direct DXIL GPU regression tests on RTX 4060.AI use: Google Antigravity (Gemini 4 Neon).
@Decodere on GitHub · 2026-11-25 01:02 UTC · original
Taking
XCL-BT-043(XApuEnqueueCommand/XApuGetResultCountcumulative counters incrates/xcl/src/hle/acphal.rs):enqueuedanddequeuedcounters alongside the result queue underXApu.resultsso*countreports total enqueued commands and*totalreports total dequeued results whileXApuGetResultCountkeeps returning current pending length, with regression unit tests.AI use: Google Antigravity (Gemini 4 Neon).