DXIL: lower unclamped v_dot8_u32_u4 using Dot4AddU8Packed #2173
No reviewers
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!2173
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2173/head"
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?
@O5-7 on GitHub · 2026-11-25 07:04 UTC · original
O5-7:dxil/dot8-u32-u4-packed→main· +107 −0 · 6 files · 1 commits · merged 2026-11-25 18:18 UTCLower unclamped RDNA2
v_dot8_u32_u4in the direct DXIL translator using two SM 6.4+dx.op.dot4AddPacked.i32(Dot4AddU8Packed, opcode 164) intrinsics instead of unpacking all 8 nibbles into 8 scalar shifts, 16 masks, 8 multiplies, and 8 adds.Each 32-bit operand is split into two packed byte quads: even nibbles (
x & 0x0F0F_0F0F) and odd nibbles ((x >> 4) & 0x0F0F_0F0F), then accumulated withdot4_add_u8_packed(dot4_add_u8_packed(c, a_lo, b_lo), a_hi, b_hi)(mod2^{32}). Clampedv_dot8_u32_u4remains on the 64-bit saturatingdot_npath becauseDot4AddU8Packedwraps modulo2^{32}.Part of #1269
What is in it
crates/xcl/src/gpu/dxil/ops.rs: addShader::dot4_add_u8_packed(acc, a, b)emittingdx.op.dot4AddPacked.i32(i32 164, acc, a, b).crates/xcl/src/gpu/dxil/shader.rs: register opcode164 => ReadNoneindxc_fn_attrs.crates/xcl/src/gpu/dxil/lower_wide.rs: lower unclampedv_dot8_u32_u4via two chaineddot4_add_u8_packedcalls; keepclamp == trueondot_n.crates/xcl/src/gpu/dxil/ops_tests.rs: adddot4_add_u8_packed_matches_cputesting the intrinsic on GPU including wrappingu32overflow (dx_op_attrs_match_dxcalso verifiesdxc_fn_attrs(164)).crates/xcl/src/gpu/dxil/core_tests.rs: adddot8_u32_u4_unclamped_lowers_to_dot4_add_u8_packedverifying DXIL validation and disassembly (2dx.op.dot4AddPacked.i32(i32 164,calls for unclamped, none for clamped).crates/xcl/src/gpu/recomp/tests.rs: addgpu_v_dot8_u32_u4_edge_casestesting 16 edge cases (even/odd nibbles,0x0F/0xF0isolation,u32::MAXexact threshold and wrapping overflow vs clamped saturation) against CPU reference.V_DOT8_U32_U4instructions, wave32):n = 1drops2464→2336bytes (-128bytes);n = 64drops3564→3460bytes (-104bytes).Tested
32.0.15.9579, wave32), AMD Ryzen 7 9700X, Windows 11 Pro10.0.26100,rustc 1.100.0, DXC1.8.2502.11(XCL_DXC_DIR=D:\Windows Kits\10\bin\10.0.26100.0\x64), debug & release builds.cargo test --workspace -- --test-threads=4: 1157 passed, 0 failed, 46 ignored (24 SKIPPEDhardware-capability / policy checks: native wave64 unavailable on RTX 5080 and rejected direct-pathf16arithmetic), includingdot4_add_u8_packed_matches_cpu,dx_op_attrs_match_dxc,dot8_u32_u4_unclamped_lowers_to_dot4_add_u8_packed, andgpu_v_dot8_u32_u4_edge_cases.XCL_DIRECT_DXIL=1targeted GPU parity runs on RTX 5080 (gpu_v_dot8_u32_u4_edge_cases,gpu_clamp_and_omod_per_instruction): both passed.Regression run
main:
PR:
Not tested
XCL_DIRECT_DXIL=1in thesmoke.ps1launch (because on unmergedmainwithout PR #2101,D:\Windows Kits\...inXCL_DXC_DIRis intercepted by the{game}D-drive VFS mount inside the host process;XCL_DIRECT_DXIL=1was verified in unit/GPU tests).AI use
Shader::dot4_add_u8_packed(opcode 164), lowered unclampedv_dot8_u32_u4to twoDot4AddU8Packedcalls, wrote the unit/disassembly/GPU parity tests, and ran the test suite andscripts/smoke.ps1regression checks.@DavidM1911 on GitHub · 2026-11-25 07:28 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@luckyteagirl on GitHub · 2026-11-25 09:56 UTC · original
Independent native Windows RX 6800M check of exact PR head
07addfbf6046c4f857ae194c2b7601ef98bd6085(parentcbc296ab65a2661a61e3e2da109134bcd5319f60). The final worktree is clean; all diagnostic test edits were restored.Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M, driver
30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5. Debug tests withXCL_ADAPTER=6800M,XCL_REQUIRE_GPU=wave64; focusedcargo test --locked -p xcl --lib -j 2 <filter> -- --test-threads=1 --show-outputruns.Exact PR head:
gpu_v_dot8_u32_u4_edge_caseswithXCL_DIRECT_DXIL=0passed 1/0/0, no skip. WithXCL_DIRECT_DXIL=1it failed 0/1/0 twice atCreateComputePipelineStatewith device suspension0x887A0005, before any edge-case output comparison.dot4_add_u8_packed_matches_cpupassed 1/0/0 on the GPU;dot8_u32_u4_unclamped_lowers_to_dot4_add_u8_packedpassed 1/0/0 (DXIL validation/disassembly).Test-only isolation: The fixture normally tries native wave64 first. Forcing its wave list to wave32 only still failed at
CreateComputePipelineState(0/1/0). Keeping the new test but restoring onlylower_wide.rsfrom the parent (the old scalar lowering for unclamped dot8) also failed 0/1/0 in the original combined fixture. This does not show a regression caused by the new lowering.I then kept the PR lowering and locally split the fixture's two instructions. Unclamped-only passed 1/0/0, no skip, across the test's 16 edge-case triples and both wave64 and wave32. Clamped-only failed 0/1/0 at
CreateComputePipelineStatebefore comparison. Those local fixture changes were not committed. On this card/driver the combined test's failure is associated with its existing clamped path, while the new unclamped path ran successfully in isolation.Scope: Focused debug-build synthetic tests only. I did not run the full workspace suite, a paired retail-title smoke, or driver PSO timing. This report does not establish the cause of the clamped-path device suspension.
AI use: OpenAI Codex (GPT-6; exact variant not exposed in this session) ran the native Windows tests and local controls, checked the logs, restored the clean PR head, and drafted this report. No game data was used.
@raylitebull on GitHub · 2026-11-25 10:47 UTC · original
07addfbhas dual-vendor verification (RX 9070 XT + RX 6800M + RTX 3060 + RTX 3060 Ti), and now conflicts intests.rsagainst recentmainmerges.Please rebase onto
mainso CI can run and get this ready to merge.@Toons29 on GitHub · 2026-11-25 12:03 UTC · original
Regression run of
6243e733on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon568e7db7, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 104 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.@DarkPanda69 on GitHub · 2026-11-25 07:34 UTC · original · edited 2026-11-25 16:54 UTC
Update for head
7648fe1: same result. Applied onmain50a9fde,gpu_v_dot8_u32_u4_edge_casespasses on the RX 9070 XT (native wave64) and the RTX 3060. Wholegpu::filter: RX 9070 XT 650 passed, 3 failed; RTX 3060 652 passed, 1 failed. All failures are onmainwithout this PR:a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrieron both cards (since #2074's merge, noted there), and on the RX 9070 XT the #2115 fuzz seeds.Tested:
gpu_v_dot8_u32_u4_edge_casespasses on AMD with native 64-lane waves (the case the PR lists as untested), and on an RTX 3060.gpu::filter: 587 passed, 2 failed, 22 ignored. The 2 failures are the AMD fuzz seeds 722 and 1599 tracked in #2115, which fail the same way onmain.Head
07addfbapplied onmain568e7db, debug,cargo test -p xcl --lib -- gpu:: --test-threads=4withXCL_ADAPTERset to each card.Not tested: a title with
XCL_DIRECT_DXIL=1.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@O5-7 on GitHub · 2026-11-25 11:47 UTC · original · reviewed
@raylitebull Rebased onto
main(1a0bbe3, after#2180landed) to resolve the trailing conflicts incrates/xcl/src/gpu/recomp/tests.rsandcrates/xcl/src/gpu/dxil/core_tests.rs(now at6243e73), and re-verifieddot8/dot4_add_u8_packed(both default andXCL_DIRECT_DXIL=1) pluscargo test --workspace -- --test-threads=4(1184 passed, 0 failed, 26 ignoredin--lib, all integration suites green). Ready for CI / merge.@DavidM1911 on GitHub · 2026-11-26 08:15 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: 1 failure under parallel scheduling; clean on--test-threads=1rerun (1312 passed, 0 failed, 27 ignored, 82s). Intermittent single-test flake — tracked in #1978.Thanks!
— Devin