Repository navigation
Recompiler: saturate packed unsigned dot8 without i64 - #2221
luckyteagirl wants to merge 2 commits into
Conversation
|
|
4830018 to
d528390
Compare
Add Shader::dot4_add_u8_packed (dx.op.dot4AddPacked, opcode 164) and lower unclamped v_dot8_u32_u4 by splitting even and odd 4-bit nibbles into two packed byte quads and chaining two Dot4AddU8Packed calls. Leave clamped v_dot8_u32_u4 on the 64-bit saturating dot_n path. Part of xcl-dev#1269 Assisted-by: Antigravity (Gemini 4 Neon)
The unsigned four-bit dot products total at most 1800. The clamped path can accumulate that bounded sum with Dot4AddU8Packed and saturate c + sum using a 32-bit carry check. This avoids the old wide-sum DXIL that suspends the RX 6800M device in the focused GPU fixture. Add an isolated clamped overflow regression alongside the existing combined edge cases.
d528390 to
404cde3
Compare
|
Test report: AMD Radeon RX 7800 XT (RDNA3, native wave64) for head Setup: RX 7800 XT, driver 32.0.31035.1003, Windows 11 Pro 10.0.26200, rustc/cargo 1.100.0, debug build, DXC 1.9.0.5512 ( Targeted (
I also ran Full suite (
Not tested: retail title or AI use: this report was run and written by Claude Code (Claude Sonnet 5.5). I read the diff but did not change any code. |
|
NVIDIA run on this rebased head (requested by the reviewer), plus AMD with native wave64: both new tests pass on both cards. Head
Not tested: other NVIDIA generations, a title. |
|
NVIDIA run on this head (requested in Not tested). Setup: RTX 3060 12 GB (32-lane waves, driver 32.0.16.2101), Ryzen 5 5600X, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2609.5, debug build. Head 404cde3. Result: cargo test --workspace -- --test-threads=4: 1254 passed, 0 failed, 46 ignored. The dot8 tests pass: dot8_u32_u4_lowers_to_dot4_add_u8_packed, gpu_v_dot8_u32_u4_clamped_overflow, gpu_v_dot8_u32_u4_edge_cases. SKIPPED: 18 GPU tests for no wave64 (expected on this card). One note, likely unrelated to this PR: the first full run aborted in hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels with misaligned pointer dereference: address must be a multiple of 0x8 but is 0x74100001 (windows-core interface.rs:41, STATUS_STACK_BUFFER_OVERRUN). It did not reproduce in three title_textures reruns or in the full rerun above. AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report. |
Part of #1269. This is stacked on #2173: rebased parent commit
5ca41ebretains Normal1919's authorship; this PR's change is404cde36a101d3502504f679db7e6528b08dc19a. Both commits are rebased onto main1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6so CI can run. The latest conflicts incrates/xcl/src/gpu/dxil/core_tests.rsandcrates/xcl/src/gpu/recomp/tests.rswere test additions; all tests are retained.On the RX 6800M, the previous clamped
v_dot8_u32_u4direct-DXIL path suspended the device at compute PSO creation, while #2173's unclamped path ran in isolation. The eight unsigned nibble products sum to at most 1,800, so the clamped form can accumulate them in 32 bits and saturate the addition to the accumulator without the old 64-bit sum.What changed
crates/xcl/src/gpu/dxil/lower_wide.rs: use packed dot calls for clamped and unclamped unsigned dot8; for clamped, add the bounded product sum tocand selectu32::MAXon unsigned overflow.crates/xcl/src/gpu/recomp/tests.rs: add an isolated clamped GPU regression for zero, exact maximum, and overflow.core_tests.rsexpects the clamped form to emit the packed calls.Tested
30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5.cargo build --locked --workspace -j 2andcargo build --locked --release --workspace -j 2passed on the clean head.git diff --checkpassed.XCL_ADAPTER=6800M,XCL_REQUIRE_GPU=wave64,cargo test --locked -p xcl --lib -j 2 dot8_u32_u4 -- --test-threads=1 --show-outputpassed 3/0/0, no skips, forXCL_DIRECT_DXIL=1; the same filter passed 3/0/0, no skips, forXCL_DIRECT_DXIL=0. The GPU fixtures cover native wave64 and wave32; the third test checks emitted DXIL.cargo test --locked --workspace --no-fail-fast -j 2 -- --test-threads=4 --show-output, withXCL_ADAPTER=6800M,XCL_DIRECT_DXIL=1: current main1a0bbe3had 1012 passed, 169 failed, 26 ignored in the library; this head had 1013 passed, 172 failed, 26 ignored. Both also failed the sameoffline_compute_pipeline_is_reused_by_a_second_processintegration test. Isolated Cargo targets were used. Three library failure names were added: the parent'sdot4_add_u8_packed_matches_cpuand the two dot8 GPU fixtures. All three failed atCreateComputePipelineStateafter device suspension0x887A0005, while the dot8 fixtures passed in the focused runs. This broad run is not green on this driver.CreateComputePipelineStateon this RX 6800M. With local test-only isolation, the old clamped shader failed and DXIL: lower unclamped v_dot8_u32_u4 using Dot4AddU8Packed #2173's unclamped shader passed both wave sizes. Those diagnostic edits were restored before the PR was published.Regression run
Same owned title, 12 seconds each, default translation mode, separate data/cache directories. Both completed without the external memory guard firing. The title run did not show a dot8 dispatch, so the focused GPU fixture is the direct opcode check.
Main:
This PR:
Not tested
AI use
OpenAI Codex (GPT-6; exact variant not exposed in this session) investigated the RX 6800M failure, wrote the 32-bit clamp and regression test, rebased both commits while preserving the parent author's attribution, ran the native Windows builds, GPU tests, workspace comparison and guarded smoke run, and drafted this description. No game data was committed.