Skip to content

Recompiler: saturate packed unsigned dot8 without i64 - #2221

Open
luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/dot8-clamp-32
Open

luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/dot8-clamp-32

Conversation

@luckyteagirl

@luckyteagirl luckyteagirl commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1269. #2173’s unclamped packed lowering is now on main, so this rebased PR contains only the clamped unsigned dot8 saturation change. The eight unsigned nibble products sum to at most 1,800; the clamped form can accumulate them with packed 32-bit dot calls and saturate the addition to the incoming accumulator without the old 64-bit sum. That old clamped path suspended the RX 6800M device during compute PSO creation in focused testing.

What is in it

  • crates/xcl/src/gpu/dxil/lower_wide.rs: extend the packed dot lowering on main to clamped v_dot8_u32_u4; detect unsigned overflow in c + product_sum and select u32::MAX.
  • crates/xcl/src/gpu/dxil/core_tests.rs and crates/xcl/src/gpu/recomp/tests.rs: check clamped packed-call codegen and GPU zero, boundary, and overflow cases.

Tested

  • Clean rebased head 89d71f2d3c8c941dc992dd916517b4267043ecc1 on main 6d12f58a229bc73889878a448c64dc3af25eeba0. Windows 11 Home build 26200, Ryzen 9 5980HX, AMD Radeon RX 6800M (driver 30.0.13002.13003), Rust 1.99.0 MSVC, DXC/DXIL 1.8.2502.11.
  • cargo test -p xcl --lib dot8_u32_u4 -- --test-threads=2 --show-output with CARGO_BUILD_JOBS=2 and an isolated target: 3 passed, 0 failed, 0 ignored, 0 skipped (1,322 filtered). The compiler/disassembly check and both GPU edge/clamp fixtures ran.
  • cargo build --locked --release -p xcl --bins -j 2: passed on the rebased head.
  • cargo test --locked --workspace --no-fail-fast -j 2 -- --test-threads=4 --show-output was attempted on this head. The library target exited 0xc0000005 before a test summary. Across 36 targets that did finish, Cargo reported 124 passed, 1 failed, 20 ignored, with 4 explicit skips; these are partial counts, not whole-suite totals. The one reported failure was the warm driver-cache expectation in offline_split_compute_pipeline_is_reused_by_a_second_process.
  • Failure controls on clean current main and this branch: raw_loads_in_root_windows_respect_exec_and_bounds exited 0xc0000005 individually on both (no test summary); the warm-cache test failed on main (0 passed, 1 failed; expected 5 cached pieces, saw 0) and passed on this branch (1 passed, 0 failed). The full library rerun with one test thread still exited at the raw-load test. These checks do not identify a branch-specific failure.
  • Independent exact-head report: the clamped and edge dot8 tests passed on an RTX 3060 and RX 9070 XT. The reporter's GPU filter counted 701 passed / 0 failed / 24 SKIPPED on RTX 3060 and 699 passed / 2 failed / 6 SKIPPED on RX 9070 XT; the two AMD fuzz failures are tracked in DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115 and the skip counts match main.
  • An independent RTX 3080 Ti run on Windows 11 build 26300 (driver 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11) ran cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4. The clean exact PR head 89d71f2 reported 1,424 passed, 0 failed, 46 ignored. A separate local, uncommitted merge of that head into main at b49be18 reported 1,436 passed, 0 failed, 47 ignored. Each run logged 25 explicit SKIPPED notices, and the focused dot8 filter passed all three tests with no skips on both trees. Independent report
  • The same reporter repeated the workspace suite on the exact PR head and clean main b49be18 separately. The PR head reported 1,423 passed, 1 failed, 46 ignored and clean main reported 1,434 passed, 1 failed, 47 ignored, with 25 explicit SKIPPED notices per run. Both failed console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk with cached_only console_mesh hit: "DXIL not compiled yet". The three focused dot8 tests still passed on the PR head. Repeat run and main control
  • git diff --check: clean.

Regression run

The committed release binaries for main at 6d12f58 and this PR ran scripts/smoke.ps1 on the same owned title for seven seconds each, with separate fresh data and DXIL caches. Both ended normally with no crash, device removal, or memory-guard trigger. These runs reached intro frames but did not show a dot8 dispatch; the focused GPU fixtures exercise that opcode.

Main at 6d12f58:

xcl-smoke v1
commit: 6d12f58a229bc73889878a448c64dc3af25eeba0
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 11 (PresentX 11)
presents per 2 s (last 3): 0 0 1
device removals: 0
crashes: 0
peak commit: 6926 MB

This PR:

xcl-smoke v1
commit: 89d71f2d3c8c941dc992dd916517b4267043ecc1
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 14 (PresentX 14)
presents per 2 s (last 3): 0 0 1
device removals: 0
crashes: 0
peak commit: 6958 MB

Not tested

  • A completed green GPU workspace suite on this RX 6800M or retail title behavior beyond its seven-second run. The independent RTX 3080 Ti report includes a separate 60-second run and leaves dot8 dispatch coverage unverified. Independent report

AI use

OpenAI Codex (GPT-6; exact variant unavailable) investigated the RX 6800M failure, wrote the 32-bit clamp and regression tests, rebased the remaining commit after #2173 merged, ran the GPU checks, failure controls and guarded smoke pair, and drafted this description.

OpenAI Codex (GPT-6.2 Sol) verified the independent report against the current PR head and drafted this description update.

@luckyteagirl
luckyteagirl marked this pull request as ready for review November 25, 2026 10:19
@raylitebull

Copy link
Copy Markdown
Member

4830018 currently conflicts in tests.rs against recent main merges. Please rebase onto main (and add dual-vendor GPU test runs on the rebased head) before CI runs.

@luckyteagirl
luckyteagirl force-pushed the codex/dot8-clamp-32 branch 2 times, most recently from d528390 to 404cde3 Compare November 25, 2026 12:08
@oni-swr

oni-swr commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Test report: AMD Radeon RX 7800 XT (RDNA3, native wave64) for head 404cde36a101d3502504f679db7e6528b08dc19a.

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 (dxc on PATH). Detached checkout of the PR head, which includes ea088a5. I did not merge it with current main. I read the diff before running it.

Targeted (cargo test -p xcl --lib -- dot --nocapture --test-threads=1, XCL_DIRECT_DXIL unset): 6 passed, 0 failed, 0 ignored.

  • dxil::core_tests::dot8_u32_u4_lowers_to_dot4_add_u8_packed
  • dxil::ops_tests::dot4_add_u8_packed_matches_cpu
  • recomp::tests::gpu_v_dot8_u32_u4_edge_cases
  • recomp::tests::gpu_v_dot8_u32_u4_clamped_overflow
  • recomp::tests::gpu_packed_math_dots_movrel
  • one unrelated resolver test matched by the filter

I also ran -- dot8 with XCL_DIRECT_DXIL=1: 3 passed, 0 failed (the two gpu_v_dot8_u32_u4_* tests plus the DXIL lowering test).

Full suite (cargo test --workspace --no-fail-fast -- --test-threads=4, env unset): 1253 passed, 1 failed, 46 ignored.

  • The failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, the known RDNA3 failure on main. The PR does not touch it.
  • 7 SKIPPED lines: 6 in lower_dxil::tests (f16 / f32 conversion programs refused) and heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows). These are not coverage.

Not tested: retail title or scripts/smoke.ps1, NVIDIA, Intel, Wine/vkd3d, this PR merged with current main.

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.

@DarkPanda69

DarkPanda69 commented Nov 25, 2026 •

Copy link
Copy Markdown

Update for head 89d71f2: rerun on main 6d12f58, same command and cards. gpu_v_dot8_u32_u4_clamped_overflow and gpu_v_dot8_u32_u4_edge_cases (now on main) ok on both. RTX 3060: 701 passed, 0 failed, 24 SKIPPED. RX 9070 XT: 699 passed, 2 failed (the #2115 fuzz seeds), 6 SKIPPED. Both skip counts are the same as on main.

NVIDIA run on this rebased head (requested by the reviewer), plus AMD with native wave64: both new tests pass on both cards.

Head 404cde3 applied on main 379725a, debug, Windows 11 Pro 26200, cargo test -p xcl --lib -- gpu:: --test-threads=4:

Not tested: other NVIDIA generations, a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@jennydeth

Copy link
Copy Markdown

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.

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
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.
@thehollowedone

thehollowedone commented Nov 26, 2026 •

Copy link
Copy Markdown

Independent Windows/NVIDIA check of #2221 head 89d71f2 and a clean current-main b49be18 control. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / driver 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11.

Tested

  • Exact clean PR head: cargo test --offline --locked -p xcl --lib dot8_u32_u4 -- --nocapture --test-threads=1 passed 3/0/0, no skips. cargo build --offline --locked --workspace passed. cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 passed 1,424/0/46, with 25 SKIPPED notices.
  • The exact head merged without conflict into current main locally, without a commit. The same build passed; dot8 filter 3/0/0 with no skips; full suite 1,436/0/47, with 25 SKIPPED notices. The Invalid bitcode signature line is from a passing malformed-container test.
  • I built separate release executables from clean main and clean head and verified their hashes differ. Each ran the same owned retail title for 60 seconds with XCL_NETWORK=0, XCL_RUN_SECONDS=60, XCL_ACTIVITY=1, the RTX 3080 Ti selected, no injected input, and a separate fresh XCL data root. A Windows Job Object capped each process at 16 GiB committed; an external guard required 8 GiB system commit headroom and had a 100-second timeout. Both reached XCL's 60-second end marker and exited normally. I extracted the standard smoke counters from their logs; this was a guarded equivalent run, not an invocation of scripts/smoke.ps1.

Main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3080 Ti
title: retail-title
seconds: 60
exit: 0x0
frames shown: 841 (PresentX 842)
presents per 2 s (last 3): 46 60 60
device removals: 0
crashes: 0
peak commit: 15215 MB

PR:

xcl-smoke v1
commit: 89d71f2d3c8c941dc992dd916517b4267043ecc1
gpu: NVIDIA GeForce RTX 3080 Ti
title: retail-title
seconds: 60
exit: 0x0
frames shown: 886 (PresentX 886)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15178 MB

Not tested

  • Whether this 60-second run reached world load or dispatched the changed dot8 opcode; the focused GPU fixtures cover that opcode. NVIDIA implicit caches were not disabled, so the frame totals do not establish a performance difference. AMD/native wave64 and long-running stability were not tested here.

AI use

  • Codex (GPT-6.2 Sol) ran the checks and guarded pair, verified the logs and drafted this report. AI-assisted.

Repeat workspace suite on current baseline (26 Nov 2026)

I reran the exact PR head 89d71f2 and latest main b49be18. The PR still targets main at base 6d12f58; it has not been rebased onto the latest main.

  • On the PR head, the focused lowering test and two focused GPU tests passed. cargo build --offline --locked --workspace passed. The full suite reported 1,423 passed, 1 failed, 46 ignored, with 25 SKIPPED notices.
  • The sole failure was gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, with cached_only console_mesh hit: "DXIL not compiled yet".
  • On latest main, the same build passed and the full suite reported 1,434 passed, 1 failed, 47 ignored, with 25 SKIPPED notices. The same test failed with the same message.

This repeat was not fully green, unlike the earlier full-suite run recorded above. The same failure on latest main means this run does not identify a PR-specific regression. No retail smoke was run in this repeat.

AI use: Codex (GPT-6.2 Sol) reran and compared these tests and drafted this update. AI-assisted.

@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
…2221)

Shared test vector: v_dot8_u32_u4 with CLAMP=1 saturates instead of
wrapping (eight nibble products sum to at most 1800, so only c + t can
overflow). The DXIL-emit half stays out; the rule is for the SPIR-V
lowering of clamped VOP3P dot (no Int64 capability needed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants