Repository navigation
Console UAV barriers for all resources; v_fract_f32 of ±inf / NaN gives NaN (NVIDIA) - #68
Conversation
fract_f clamped x - floor(x) with min(), and HLSL min returns its non-NaN operand: fract(±inf) and fract(NaN) came out 0.99999994 (measured on an RTX 5070 Ti). RDNA (GFX8 and later) computes x - floor(x) and keeps it below 1.0, so ±inf gives NaN and NaN passes through; a compare-and-select does the same. Test: gpu_fract_f32_edges (fails with the old helper). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Translated shaders reach title memory through XCL's memory window buffers, other D3D12 resources over the same memory as the title's buffers and textures. A UAV barrier the title gives for its own resource, or a transition out of / into UNORDERED_ACCESS, therefore did not order the shaders' window accesses on the PC: AMD drivers wait and flush for any UAV barrier, NVIDIA's need not – a possible cause of NVIDIA-only flicker (a pass reading what the previous one is still writing). Such a batch now carries one UAV barrier with no resource (all UAV accesses), which costs about the same as one per resource. Not reproduced without a game; the test title's lists go through this path and pass. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Note for merging: this conflicts with #46 only in |
|
Tested PR #68 (
(Note for after #71 merges: switching |
|
Merged. Checked on an RX 9070 (RDNA4): |
…cl-dev#104) On newer GDK runtimes (QUEUE_SHIFTED), 20 command list console methods shift up by +2 via NEWER_LIST_SLOTS, leaving 11 older slots (xcl-dev#59, xcl-dev#60, xcl-dev#68, xcl-dev#69, xcl-dev#78, xcl-dev#81, xcl-dev#84, xcl-dev#88, xcl-dev#89, xcl-dev#93, xcl-dev#94) without another shifted method taking their old index. Those slots remained wired directly to the older layout's handlers, so a newer-layout call hit the wrong method. Wrap those orphaned slots in make_layout_split so newer-layout title calls go to a logged stub while older-layout titles keep the handler and non-title callers keep their PC target (including cl_execute_indirect at xcl-dev#59 and the original base-table stub for slots >= scanned). Slot xcl-dev#10 (Reset) stays Reset on both layouts and is not orphaned. Assisted-by: Antigravity (Gemini 4 Neon)
…vall#104) On newer GDK runtimes (QUEUE_SHIFTED), 20 command list console methods shift up by +2 via NEWER_LIST_SLOTS, leaving 11 older slots (ivall#59, ivall#60, ivall#68, ivall#69, ivall#78, ivall#81, ivall#84, ivall#88, ivall#89, ivall#93, ivall#94) without another shifted method taking their old index. Those slots remained wired directly to the older layout's handlers, so a newer-layout call hit the wrong method. Wrap those orphaned slots in make_layout_split so newer-layout title calls go to a logged stub while older-layout titles keep the handler and non-title callers keep their PC target (including cl_execute_indirect at ivall#59 and the original base-table stub for slots >= scanned). Slot ivall#10 (Reset) stays Reset on both layouts and is not orphaned. Assisted-by: Antigravity (Gemini 4 Neon)
v_floor, v_ceil, v_trunc, v_rndne and v_fract in f32 and f16 had no edge-value GPU test (v_fract_f32 only for +-inf / NaN, xcl-dev#68). 16 inputs each: halves of both signs (rndne to the even neighbour), the sign of a zero result, infinities, NaN, values past the last fraction bit, and fract of a small negative value, which the ISA clamps to the largest value below 1.0 (0x3F7FFFFF / 0x3BFF). v_fract_f16 passes today only because the default f16 result goes through the legacy f32tof16, which rounds toward zero: x - floor(x) for x = -2^-14 is 1 - 2^-14 in f32, and rounding that to nearest gives 1.0. With to_f16_expr changed to round to nearest (the default-mode fix xcl-dev#111 asks for), v_fract_f16(-6.1e-5) returns 0x3c00 and this test fails, so the fract clamp has to move after the f16 rounding then. Measured: RTX 4060 (wave32), Windows 11 Pro 26300, Rust 1.100, debug. cargo test --workspace -- --test-threads=4: 678 passed, 0 failed, 41 ignored; SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware. Removing fract_f's clamp in emit.rs fails the test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WsgnReN2iZK9RUNckZAhrv
Add standalone host-driver parity and contract tests for D3D12.X's memory-layout and copy-footprint query hooks (Part of xcl-dev#480): GetResourceAllocationInfo (xcl-dev#25), GetResourceAllocationInfo2 (console xcl-dev#108 vs PC ID3D12Device8 xcl-dev#68), GetCustomHeapProperties (xcl-dev#26), and GetCopyableFootprints (xcl-dev#38). No runtime files outside crates/xcl/tests/ are modified. Full suite (.\scripts\test.ps1) passed 895 passed, 0 failed, 42 ignored (1 GPU test skipped: heap_window_out_of_memory_falls_back_to_the_switch_form). Part of xcl-dev#480 Assisted-by: Antigravity
Two small fixes for NVIDIA found while working on wave64 programs on 32-lane GPUs (#67). They are independent of it.
Console UAV barriers apply to all resources
Translated shaders reach title memory through XCL's memory-window buffers, which are different D3D12 resources over the same memory as the title's buffers and textures. A UAV barrier the title issues for its own resource, or a transition into or out of
UNORDERED_ACCESS, therefore did not order the shaders' window accesses. AMD drivers wait and flush on any UAV barrier, but NVIDIA's need not, so a pass could read what the previous one is still writing. That is a possible cause of NVIDIA-only flicker.resource_barrier_xnow sends one UAV barrier with no resource (all UAV accesses) per batch that has a UAV barrier or a transition from or toUNORDERED_ACCESS. That costs about the same as one barrier per resource. Not reproduced without a game; the test title's command lists go through this path and pass.v_fract_f32of ±inf / NaN gives NaN, as on RDNAfract_fclampedx - floor(x)withmin(). HLSLminreturns its non-NaN operand, sofract(±inf)andfract(NaN)came out as 0.99999994 on an RTX 5070 Ti. RDNA computesx - floor(x)kept below 1.0, so ±inf gives NaN and NaN passes through. A compare-and-select does the same now. The new testgpu_fract_f32_edgesfails with the old helper. It needs wave64 like the other recompiler GPU tests, so on NVIDIA it runs only together with #67, where it was verified. Pixel and vertex shaders, which do run on NVIDIA today, use the same helper.Tests
RTX 5070 Ti: workspace, release: 373 passed, 0 failed, 34 ignored; the 39
SKIPPED …: no wave64lines are the same as on main. AMD not run: the machine's AMD iGPU is disabled.🤖 Generated with Claude Code