DXIL: lower Lw::mul_hi to umul_wide and imul_wide #2172
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!2172
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2172"
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/mul-hi-wide→main· +84 −5 · 3 files · 1 commits · openLower RDNA2 32x32→high-32 multiplication (
Lw::mul_hi) directly to DXILdx.op.binaryWithTwoOuts.i32(umul_wide, op 42, andimul_wide, op 41) instead of widening operands toi64, multiplying in 64 bits, shifting right by 32, and truncating back toi32.This covers
s_mul_hi_u32,s_mul_hi_i32,v_mul_hi_u32,v_mul_hi_i32,v_mul_hi_u32_u24, andv_mul_hi_i32_i24and avoids unnecessary 64-bit integer operations andFeature::Int64Opsflags.Part of #1269
What is in it
crates/xcl/src/gpu/dxil/lower.rs: replaceLw::mul_hiwithif signed { self.s.imul_wide(a, b).0 } else { self.s.umul_wide(a, b).0 }(+1/-5 lines).crates/xcl/src/gpu/dxil/core_tests.rs: addmul_hi_lowers_to_dxil_wide_mulverifying DXIL validation and disassembly emitdx.op.binaryWithTwoOuts.i32opcodes 42 (UMul) and 41 (IMul) withoutmul i64orsext i32.crates/xcl/src/gpu/recomp/tests.rs: addgpu_mul_hi_edge_casestesting scalar and vectormul_hi(u32,i32,u24,i24with dirty upper 8 bits and sign/boundary inputs) against 64-bit CPU reference.(V_MUL_HI_U32, V_MUL_HI_I32)pairs, wave32):n = 1changes2272→2348bytes (firstdx.types.twoi32/binaryWithTwoOutsdeclarations);n = 64drops5748→5676bytes (-72bytes) and removes alli64arithmetic.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: 1156 passed, 0 failed, 46 ignored (24 SKIPPEDhardware-capability / policy checks: native wave64 unavailable on RTX 5080 and rejected direct-pathf16arithmetic), includingmul_hi_lowers_to_dxil_wide_mulandgpu_mul_hi_edge_cases.XCL_DIRECT_DXIL=1targeted GPU parity runs on RTX 5080 (gpu_mul_hi_edge_cases,gpu_scalar_sext_mulhi_and_vector_i24_sub_co_ci_u64_shifts): 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
Lw::mul_hito emitumul_wide/imul_wide, added the disassembly and GPU edge-case tests, and ran the test suite andscripts/smoke.ps1regression checks.@luckyteagirl on GitHub · 2026-11-25 07:12 UTC · original
Independent native Windows AMD check of exact PR head
3a599afdb71b1994ae09df4772a73c98d176bdf7. The PR description lists native wave64 as untested.Tested
30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5; debug tests.XCL_ADAPTER=6800M,XCL_REQUIRE_GPU=wave64,XCL_DIRECT_DXIL=1;cargo test --locked -p xcl --lib -j 2 gpu_mul_hi_edge_cases -- --test-threads=1 --show-output: 1 passed, 0 failed, 0 ignored, 0 SKIPPED. The fixture runs both wave64 and wave32 and checks scalar/vector signed and unsigned high-multiply cases, including 24-bit operands, against CPU reference values.XCL_DIRECT_DXIL=0: 1 passed, 0 failed, 0 ignored, 0 SKIPPED.mul_hi_lowers_to_dxil_wide_mulon this head: 1 passed, 0 failed, 0 ignored (DXIL intrinsic validation/disassembly unit test).This checks the focused GPU and DXIL tests. I did not run the full workspace suite or a paired title smoke on this PR. No claim about speed or title shader use follows from these tests.
AI-assisted checkout, testing, log verification, and report drafting with OpenAI Codex (GPT-6). No game data was used.
@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!
@Toons29 on GitHub · 2026-11-25 12:05 UTC · original
Regression run of
aeab3278on 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.@raylitebull on GitHub · 2026-11-25 18:24 UTC · original
Code review on 8f131d4 (Lw::mul_hi -> umul_wide/imul_wide in lower.rs + disassembly & GPU edge-case tests): diff is clean and CI is green. Only item needed before merge: an exact-head 8f131d4 AMD GPU pass of gpu_mul_hi_edge_cases with XCL_DIRECT_DXIL=1 (previous RX 6800M run was on 3a599af and the RX 9070 smoke on eab327 leaves XCL_DIRECT_DXIL unset).
@O5-7 on GitHub · 2026-11-26 02:51 UTC · original · reviewed
Rebased onto main (
b49be18) to resolve trailing conflicts in core_tests.rs and recomp/tests.rs (now at01c4d20), and re-verified mul_hi (default + XCL_DIRECT_DXIL=1), workspace suite, and 60s smoke. Ready for an AMD XCL_DIRECT_DXIL=1 check on01c4d20.@DavidM1911 on GitHub · 2026-11-26 08:15 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.