Recompiler: emit direct quad ops for quad-local PS swizzles and DPP #2316
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!2316
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2316"
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?
@saintwolf on GitHub · 2026-11-25 13:40 UTC · original
saintwolf:dxil/ps-quad-lane-reads→main· +470 −41 · 4 files · 1 commits · openDirect DXIL pixel shaders previously routed every quad-local
ds_swizzle_b32,DPP16, andDPP8read throughLw::rla(), emitting 5WaveReadLaneAt, 1WaveActiveBallot, 4QuadReadLaneAt, and ~40 bit/select ops only to discard the cross-wave path viasame_quad. Because wave intrinsics are notReadNone,opt.rsDCE could not remove the unused cross-wave calls.DPP16also emitted non-foldableROW_MASK/BANK_MASKshifts even for0xF/0x0andSGe/imaxchecks for always-valid controls.This lowers quad-local reads in pixel shaders directly to
dx.op.quadOp(ReadAcrossX/Y/Diagonal), singledx.op.quadReadLaneAtbroadcasts, identity pass-through, or minimal distinctdx.op.quadReadLaneAtselects (keepingWaveReadLaneAtin non-pixel stages), and folds constantDPP16mask/validity checks across all stages. Part of #1269.What is in it
crates/xcl/src/gpu/dxil/lanes.rs: addLw::quad_laneandLw::read_lane_quad.crates/xcl/src/gpu/dxil/lower_mem.rs: addswizzle_quad_map(quad permute0x8000..=0xBFFFand quad-preserving bit-mode< 0x8000) and routeds_swizzle_b32throughread_lane_quad/quad_lane.crates/xcl/src/gpu/dxil/lower_valu.rs: adddpp16_quad_map(0x000..=0x0FF,0x160..=0x163) anddpp8_quad_map, route quad-local DPP16/DPP8 throughread_lane_quad, and specialize constantROW_MASK/BANK_MASK,FI=1, and always-validDPP16controls.crates/xcl/src/gpu/dxil/core_tests.rs: addps_quad_local_swizzle_and_dpp_emit_direct_quad_ops(validation + intrinsic counts for PS wave32/wave64 and VS),gpu_ps_direct_quad_swizzle_and_dpp_match_hlsl(fullscreen + diagonal helper-lane GPU parity vs HLSL), andgpu_direct_dpp16_row_bank_masks_and_fi_zero.Tested
32.0.16.2140, wave32), AMD Ryzen 7 7800X3D, Windows 1126300,rustc 1.100.0 (0ef1bc386 2026-11-09), DXC/DXIL1.8.2502.11(Windows SDK10.0.26100.0)..\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4, debug): 1,253 passed, 0 failed, 46 ignored across 23 test binaries.SKIPPEDon this adapter: 20no wave64, 3 per-lane#1426refusals (V_CVT_F16_F32,V_PK_MUL_F16,V_MUL_F16), 1no heap windows, 1no xgameruntime.dll, 1cannot disable the driver cache (0x887A002D). All 3 new tests passed with 0 skips.xcl shaders <pack> --direct --sample 500 --seed 7 --max-bytes 100000 --validate --threads 8, release): 498 / 498 translated anddxil.dll-validated (0errors; 158 shrunk, 0 grew).45,499,896 -> 44,775,836 B(-724,060 B,-1.59%).21,949,800 -> 21,230,816 B(-718,984 B,-3.28%, up to-8.2%).WaveReadLaneAt/QuadReadLaneAt/QuadOp):11441aa968b462c5:512,956 -> 476,504 B (-7.1%),71,004 -> 66,688 (-6.1%),wrla 996 -> 191,qrla 481 -> 290,qop 0 -> 28fd955a83b812406b:596,476 -> 562,964 B (-5.6%),77,221 -> 72,929 (-5.6%),wrla 1,181 -> 506,qrla 545 -> 414,qop 0 -> 7774552a952e99a89:402,548 -> 374,256 B (-7.0%),57,024 -> 53,737 (-5.8%),wrla 891 -> 231,qrla 473 -> 209,qop 0 -> 112529d8f27da1a3874:344,304 -> 316,136 B (-8.2%),49,239 -> 45,962 (-6.7%),wrla 826 -> 166,qrla 421 -> 157,qop 0 -> 112237c90ea491571f1:249,228 -> 232,848 B (-6.6%),35,525 -> 33,279 (-6.3%),wrla 316 -> 0,qrla 165 -> 58,qop 0 -> 7CreateGraphicsPipelineStateon the 6 largest affected pixel shaders (2 alternating cold trials each with fresh exe basename; warm 2nd calls0.1-0.2 ms): sum41,387.9 ms -> 41,509.5 ms(+0.3%, neutral within noise on NVIDIA).Regression run
main:PR head:
Not tested
XCL_DIRECT_DXIL=all.XCL_SAMPLE_*env vars unset during.\scripts\test.ps1).AI use
@luckyteagirl on GitHub · 2026-11-25 13:49 UTC · original
Independent RX 6800M (RDNA2 native wave64) verification of exact PR head
ea02576f497d5fe9f269ba78a32c9dee725d9501.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.XCL_ADAPTER=6800M,XCL_REQUIRE_GPU=wave64,XCL_DIRECT_DXIL=1; debug tests in an isolated Cargo target.Clean exact-head tests: Each of the three added
gpu::dxil::core_testscases passed 1/0/0 with noSKIPPEDline:ps_quad_local_swizzle_and_dpp_emit_direct_quad_opsvalidated the pixel-shader wave32 and wave64 DXIL/intrinsic shape (and the vertex-shader control).gpu_ps_direct_quad_swizzle_and_dpp_match_hlslmatched direct DXIL, HLSL, and analytical fullscreen results, plus direct/HLSL diagonal-edge helper-lane output. Its checked-in fixture executes wave32.gpu_direct_dpp16_row_bank_masks_and_fi_zeromatched direct and HLSL GPU readback under partial EXEC. Its checked-in fixture executes wave32.Local native-wave64 extension: On the same PR production code, I changed only the pixel-shader parity fixture: asserted
runner::wave64_supported() == Ok(true), set itsKernelOptionstowave64: true, and set the two HLSL pixel-shaderOptionstowave64: true. The fullscreen and diagonal-edge direct-vs-HLSL GPU draw test passed 1/0/0, no skips. I restored the clean PR worktree afterward. This is local fixture-only evidence, not a result from the unchanged test source.Limits: Focused synthetic tests only. I did not run the full workspace suite, an owned-title smoke pair, runtime pixel-shader timing, Intel, or Linux/Wine on this head.
AI use: OpenAI Codex (GPT-6; exact variant not exposed in this session) ran the native Windows tests, made and restored the fixture-only wave64 diagnostic, checked the clean exact head, and drafted this report. No game data was used.
@saintwolf on GitHub · 2026-11-25 14:02 UTC · original
Force-pushed the same commit as my username and e-mail was not correct for this GH account
@upipibi on GitHub · 2026-11-25 14:05 UTC · original
NVIDIA run, to go with luckyteagirl's RDNA2 one. Exact head
83fc1bd(the re-authored commit), as-is on its base1a0bbe3a: RTX 3070 8 GB, driver 616.56, Windows 11, debug.XCL_DIRECT_DXIL=0XCL_DIRECT_DXIL=1quadfilter (this PR's 12 tests, incl.gpu_ps_direct_quad_swizzle_and_dpp_match_hlsl,gpu_direct_dpp16_row_bank_masks_and_fi_zero)gpu_suite (--skip gpu_sparse_vram, single-threaded)main1a0bbe3aThe two extra passes are this PR's new GPU tests. The only
SKIPPEDlines are two wave64-only tests that are skipped onmaintoo (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware: no wave64 on this card).Not tested: a title, the whole workspace.
AI-assisted (Claude Code). Synthetic tests only.
@nnonno91 on GitHub · 2026-11-25 14:44 UTC · original
Independent Radeon iGPU and RTX 5090 verification on exact head
83fc1bdb1ffd39641a428eab31e6f099d0017168.Tested
cargo test --locked -p xcl --lib quad -- --nocapture --test-threads=1and the same command with filtergpu_direct_dpp16_row_bank_masks_and_fi_zero. SetXCL_DIRECT_DXIL=1and selected each adapter withXCL_ADAPTERin separate processes. Each adapter gave 12 passed forquadand 1 passed for the DPP16 filter, with 0 failed, 0 ignored and no skips.Not tested
Shader-size or compile-time measurements, a retail title and the full workspace suite.
AI use
OpenAI Codex (GPT-6.2 Sol) ran the tests, checked the logs and wrote this report.
@oni-swr on GitHub · 2026-11-25 15:26 UTC · original
Independent AMD report for
83fc1bdb1ffd39641a428eab31e6f099d0017168.Tested
main).ps_quad_local1 passed,gpu_ps_direct_quad1 passed,gpu_direct_dpp161 passed (the two GPU tests ran, no SKIPPED line).cargo test --workspace --no-fail-fast -- --test-threads=4: 1252 passed, 1 failed, 46 ignored. The one failure isgpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722:res[30] = 0x1, CPU 0x7fffffff). It fails identically onmain06c9f550on this adapter (cargo test -p xcl --lib fuzz_validate_and_gpu_1), so it is not caused by this PR.f16_programs_on_the_gpu/f32_programs_on_the_gpuper-lane cases refused forV_MUL_F16,V_PK_MUL_F16orV_CVT_F16_F32, plusheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).scripts/smoke.ps1 -Seconds 60on a real title (same title, same time), release build. main06c9f550: 1531 frames, last presents per 2 s 60 36 38, peak commit 17752 MB, no device removal, no crash. PR head83fc1bdb: 1586 frames, last presents per 2 s 60 60 60, peak commit 14847 MB, no device removal, no crash. Both exit 0x0.Not tested
Wave64-only hardware, other adapters, a title whose shaders use these quad swizzles/DPP forms (the smoke run only shows no regression).
AI use
Claude Code (Claude Sonnet 5.5) ran the tests and the smoke runs and wrote this report. No game files, dumps or shader names are included.
@DavidM1911 on GitHub · 2026-11-25 17:52 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!
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.