Direct DXIL: skip SDWA VSRC1 before S1-selected operand read #2068
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!2068
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2068"
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?
@Decodere on GitHub · 2026-11-25 02:43 UTC · original
Decodere:fix-1269-dxil-sdwa-vsrc1→main· +110 −1 · 1 files · 1 commits · openFixes
Lw::sourcesincrates/xcl/src/gpu/dxil/lower_valu.rsso SDWAVSRC1operands are skipped during the initial operand-read loop before the SDWA arm selects the real operand usingS1(bringing direct DXIL into parity with merged HLSL PR #191). Part of #1269.Previously,
Lw::sourcesskippedSRC0for non-plain variants (SDWA/DPP) but did not skipVSRC1forVariant::Sdwa. On any SDWAVOP2orVOPCinstruction, the initial loop calledself.read->self.vreg(vsrc1)on the raw 8-bitVSRC1encoding before the SDWA arm overwroteu[1]. WhenS1 == 1(scalar SGPR or inline constant such as242=1.0for138=10), that inserted bogus VGPRs (v242,v138,v4) intoself.init.touchedand inflatedLw::top_vgpr(), causingv_movrel*/v_swaprel_b32select chains in the same shader to emit hundreds of unnecessary select instructions.What is in it
crates/xcl/src/gpu/dxil/lower_valu.rs:Lw::sources, skipo.field == Some("VSRC1")whend.variant == Variant::Sdwa(matchingrecomp/emit.rsafter #191), while keeping implicit operands (o.field == None, e.g.,VCConV_CNDMASK_B32/V_ADD_CO_CI_U32) andVDSTread normally.sdwa_tests::direct_sdwa_scalar_vsrc1_does_not_touch_bogus_vgprverifying viatranslate_compute+ DXIL disassembly that SDWAS1 == 1V_ADD_F32(VSRC1=242),V_CMP_LT_U32(VSRC1=138), andV_ADD_NC_U32(VSRC1=4) do not inflatetop_vgpr()with bogus VGPRs, plussdwa_tests::gpu_direct_sdwa_scalar_vsrc1(guarded byrunner::wave32_supported() == Ok(true)so non-wave32 adapters like WARP skip cleanly while DXIL validation still runs on CPU) verifying HLSL and direct DXIL runtime parity on the GPU across scalar SGPR and inline-constantVSRC1operands.Tested
0ef1bc386), DXC 1.9.2609.5 (01b62ad4), release build.direct_sdwa_scalar_vsrc1_does_not_touch_bogus_vgprfails before the fix (v_add_f32_sdwa_inline_242: bogus VGPR v242 polluted top_vgpr() in direct DXIL, emitting >1000 SSA instructions for a 5-instruction compute shader).cargo test --release -p xcl --lib gpu::dxil::lower_valu::sdwa_tests -- --nocapture(RTX 4060): 2 passed, 0 failed, 0 ignored, 0 skipped (DXIL disassembly + HLSL/direct DXIL wave32 GPU parity).XCL_ADAPTER="Microsoft Basic Render Driver"cargo test --release -p xcl --lib gpu::dxil::lower_valu::sdwa_tests -- --nocapture(WARP): 2 passed, 0 failed, 0 ignored (gpu_direct_sdwa_scalar_vsrc1skips cleanly after DXIL validation without attempting a wave32 PSO on 4-lane WARP).cargo build --release --workspace+cargo test --release --workspace -- --test-threads=4: 1156 passed, 0 failed, 46 ignored across 21 test binaries.SKIPPEDGPU/runtime tests on this adapter (25 lines on stderr; D3D12 debug-layer tests also skip withoutd3d12SDKLayers.dll):no wave64subcases acrossgpu::recomp::lower::tests(4),gpu::recomp::lower_dxil::tests(14), andgpu::recomp::tests(2)#1426refusals (V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32) ingpu::recomp::lower_dxil::testsshaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required)heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsRegression run
scripts/smoke.ps1onmain(cbc296ab65a2661a61e3e2da109134bcd5319f60) and on this PR's head commit (b6bf898254cd059c64999b962fde7f136c710ee9):Not tested
rdna2::vgpr_usesSDWA extension-dword analysis (covered separately by open PR #811).d3d12SDKLayers.dllnot installed), and debug-profile full workspace test run (the full suite ran in--release).AI use
Lw::sourcesagainst HLSL#191, implemented the SDWAVSRC1guard, DXIL disassembly and GPU parity regression tests (including thewave32_supported()WARP guard), and PR description; all tests and paired 60s smoke runs were executed and verified locally on RTX 4060 and WARP.@Decodere on GitHub · 2026-11-25 03:00 UTC · original
Fixed the
Build and test (Windows, no GPU)failure ingpu_direct_sdwa_scalar_vsrc1(CreateComputePipelineState (0x80070057)on 4-lane WARP) atb6bf8982by guarding GPU execution withrunner::wave32_supported() == Ok(true)instead ofrunner::adapter().Re-verified locally (release):
sdwa_testspasses2/2on RTX 4060 (0 skips) and2/2onXCL_ADAPTER="Microsoft Basic Render Driver"(CPU DXIL validation runs; GPU dispatch skips cleanly), full workspace1,156 passed, 0 failed, 46 ignored, and paired 60 sscripts/smoke.ps1(1,577 -> 1,597frames,0crashes/removals). Ready for CI!AI use: Google Antigravity (Gemini 4 Neon).
@JJAutoCompare on GitHub · 2026-11-25 03:07 UTC · original
PR #2068 — Intel Arc A770 compatibility test
Tested GitHub PR xcl-dev/xcl #2068 at
b6bf898254cd059c64999b962fde7f136c710ee9in the assigned clean checkout. The original observed head was4398ee3b1bfd7e1391eb33743c40b3156d010686. The force-push retained the SDWA VSRC1 fixtures and added a wave32 guard for GPU execution.Tested
0ef1bc386),x86_64-pc-windows-msvc, Cargo 1.100.0 (3acc79c0c), DXC and DXIL 1.9.2609.5.CARGO_BUILD_JOBS=2,CARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0,CARGO_PROFILE_TEST_DEBUG=0,XCL_ADAPTER=A770.CARGO_TARGET_DIR=L:/XclTooling/pr1844-71f2ceb-t3-737e5ee5/target,TEMPandTMPset toL:/XclTooling/pr2068, andXCL_DXC_DIR=C:/Users/ljensen/AppData/Local/XclTooling/dxc-1.9.2609/bin/x64.The initial GPU invocation stopped at PowerShell script loading. The wrapper ran on retry with
RemoteSignedscoped to the retry process.direct_sdwa_scalar_vsrc1_does_not_touch_bogus_vgprgpu_direct_sdwa_scalar_vsrc1Cargo prebuilt the test binary outside the GPU mutex in 1 min 08 s. Each exact invocation filtered out 1,125 tests. The GPU wrapper printed lock acquisition and release, and the invoked test exited 0. The enclosing PowerShell command returned 1 because its post-run check looked for the
Write-Hostlock marker in theTee-Objectfile. The marker appeared in the console output. The separate exit log and captured harness results verified both passes and zeroSKIPPEDmarkers.gpu::dxil::kernel::translate_computeemitted direct DXIL for three cases. DXC/DXIL validated and disassembled the output, and the test checked that the relative-register selection chains omitted the unintended VGPR indices.runner::direct_kernel_full→gpu::dxil::kernel::translate_fulland validated that DXIL. The HLSL path calledrecomp::translatein kernel mode, then compiledmainascs_6_6through DXC. In that execution,runner::run_with_staticsdispatched both binaries on the selected A770. Readback on each path verified the floating-point inline constant, the scalar-register byte, the inline-integer comparison mask in VCC, and the scalar comparison mask in s8. Both arithmetic results were checked for every lane of the 32-lane wave.At the post-run check (2026-11-25 03:05 UTC), GitHub still displayed the PR as open and
git ls-remotereturned the tested SHA. The public conversation contained the author's wave32 guard update and had no Intel Arc result.Not tested
Coverage was limited to the isolated wave32 fixture and the three CPU DXIL cases on this exact PR commit. Retail titles, whole-workspace tests, other adapters, WARP, wave64, the D3D12 debug layer, and production PSO backend selection were outside the run.
Evidence
Logs in this directory share prefix
pr2068-b6bf898-20261125T030127318Z. The build log and Cargo JSON record the prebuild and artifact, and the CPU and GPU retry logs record the individual harness totals.AI use
T3 Code / Codex (
gpt-6.2-sol) ran the tests, checked the PR head and fixture paths, and wrote this report.@JoaoPauluu on GitHub · 2026-11-25 03:14 UTC · original
A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, a different compiler from a native-Windows run: this PR's 2 new tests pass.
Tested
x86_64-pc-windows-gnu.b6bf898as it is (merge base withmaincbc296a), no uncommitted changes. The lib test binary runs under Wine, one test per process.direct_sdwa_scalar_vsrc1_does_not_touch_bogus_vgpr: ok, not skippedgpu_direct_sdwa_scalar_vsrc1: ok, not skippedNot tested
AI use
@DarkPanda69 on GitHub · 2026-11-25 03:28 UTC · original
Native-wave64 AMD run on Windows, which this PR lists as not tested (the reports above are Intel and NVIDIA).
Tested: pass, head
b6bf898applied on its basemaincbc296a, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.cargo test -p xcl --lib -- gpu:: --test-threads=4:gpu_direct_sdwa_scalar_vsrc1ok. The 2 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1and_3, the same as onmaincbc296awithout this PR on this card.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@Parakeet-Wheat on GitHub · 2026-11-25 04:00 UTC · original
NVIDIA RTX 3070 on native Windows, head
b6bf898on its basecbc296a(currentmain): the DXIL-disassembly test fails without the fix and passes with it, the GPU test passes either way, the whole suite passes, and the smoke pair is within the limits. This adds the fail-before run, the whole-suite counts and the smoke pair to the test runs above.Tested
610.88, 32-lane waves), Ryzen 5 5600X, 32 GB, Windows 11 26300, Rust 1.95.0stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11, retail 1.0.2.1. Headb6bf898(one commit onmaincbc296a), checked out clean. Tests in the debug profile, smoke in release.cargo test -p xcl --lib sdwa_tests -- --nocapture --test-threads=1:cbc296awith the PR'slower_valu.rsbut itsLw::sourceshunk (the fix) reverted: 1 failed, 1 passed.direct_sdwa_scalar_vsrc1_does_not_touch_bogus_vgprfails at its first case,v_add_f32_sdwa_inline_242: bogus VGPR v242 polluted top_vgpr() in direct DXIL.gpu_direct_sdwa_scalar_vsrc1passes there too: on this card the bogus VGPR does not change the lane results, so only the disassembly test tells the two apart;b6bf898: 2 passed, 0 failed, not skipped..\scripts\test.ps1(cargo build --workspace, thencargo test --workspace -- --test-threads=4) onb6bf898: 1156 passed, 0 failed, 46 ignored, exit 0. SKIPPED, 25: 20 ×no wave64, 3 × per-lane form refused (V_CVT_F16_F32,V_PK_MUL_F16,V_MUL_F16: "its #1426 semantics differ from the console's"), 1 ×no heap windows, 1 × cannot disable the driver cache (Windows Developer Mode required).Regression run (
scripts/smoke.ps1 -Game <folder> -Seconds 60, the same title, back to back, menus, no input; unedited).maincbc296a:PR head
b6bf898:That is 103 % of
main's frames and 96 % of its peak commit. One run each; the60 51 10tail ofmain's run (against60 61 60on the head) is not something I repeated.Not tested
no wave64skips above), AMD, a world run (the smoke stays in the menus, so it does not show whether the title reaches an SDWA instruction withS1 == 1), the tests on game data (XCL_SAMPLE_*not set).AI use
@DavidM1911 on GitHub · 2026-11-25 04:55 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!
@ClosetPie107 on GitHub · 2026-11-25 20:46 UTC · original
Independent AMD RDNA4 / Linux (RADV, native wave64) test report for head
b6bf898254cd059c64999b962fde7f136c710ee9(merged cleanly ontomain6d12f58).Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnu(debug for tests, release for retail)Unit / GPU tests (
XCL_REQUIRE_GPU=wave64,XCL_DXC_DIR,VKD3D_CONFIG=ignore_shared_fence,--test-threads=1 --nocapture)gpu::dxil::lower_valu::sdwa_tests: 2 passed, 0 failed, 0 ignored (0 skipped)Combined retail sanity run (
main6d12f58+#2068,#1771,#1740,#1256merged together;XCL_DIRECT_DXIL=1,XCL_TEXTURE_LEVEL_PAGES=1,XCL_PSO_WAIT_MS=50,XCL_SPLIT_MIDLIST_WAIT=0,XCL_COHERENT_MB=1024,VKD3D_CONFIG=ignore_shared_fence,XCL_PSO_PRELOAD=0,XCL_NETWORK=0)exit=0) with 0 crashes and 0 device removals (11.55 GiBpeak VRAM / 0 GTT spill,13.35 GiBpeak RSS,1,800+frames presented,16,442translated draws,4,499dispatches,11,257Opus packets,105split compute programs /1,205pieces built cleanly).Not tested
AI use
main, ran the tests and combined retail run under Proton on this machine, and drafted this report.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.