Direct DXIL: bound relative moves by max_vgpr and refuse in per-lane bridge #2027
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2037"
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?
Imported from ivall/xcl. Originally posted by IAmTheSween on 2026-11-25T01:29:35Z.
Fixes #1890. In direct DXIL,
Lw::top_vgpr()computed the upper bound forv_movrel*andv_swaprel_b32select loops fromself.init.touched, which starts empty outsideEntry::Kerneland is cleared before each instruction inXCL_PER_LANE=1. Any relative move withm0 > 0targeting a VGPR not statically touched earlier in RPO order was silently truncated.Lw::max_vgprnow scansinstsinLw::newmatching the HLSL emitter, andtop_vgpr()returnsself.max_vgpr. In the per-lane recompiler,bridge()refuses dynamically indexed relative moves upfront to route them through the fallback.What is in it
crates/xcl/src/gpu/dxil/lower.rs:max_vgprfield onLwcrates/xcl/src/gpu/dxil/kernel.rs: scanmax_vgpracross program instructions inLw::newcrates/xcl/src/gpu/dxil/lower_wide.rs:top_vgpr()returnsself.max_vgprcrates/xcl/src/gpu/recomp/lower.rs: refuseV_MOVREL*andV_SWAPREL_B32inbridge()crates/xcl/src/gpu/dxil/core_tests.rs: tests forv_movrel*andv_swaprel_b32with non-static target VGPRscrates/xcl/src/gpu/recomp/lower.rs: test verifying refusal of dynamic moves in per-lane loweringTested
cargo test -p xcl --lib gpu::dxil::core_tests: 17 passed, 0 failed, 1 ignoredcargo test -p xcl --lib gpu_packed_math_dots_movrel: passedcargo test -p xcl --lib dynamically_indexed_vgpr_moves_are_refused_in_per_lane: passedpython scripts/test_pr_check.py: 13 passed, 0 failedRegression run
scripts/smoke.ps1onmain(8e87fc7b62a87ea589ccb9ea6182f514016cf7db) and on this PR's head commit (4fc971951041a6adf2f423633306049eadc9be53):Not tested
AI use
lower_wide.rs,kernel.rs, andlower.rs, authored regression tests, verified against D3D12 DXIL runner, and executed 60-second retail regression smoke runs on main and PR head.Imported from ivall/xcl. Originally posted by WebIdentity1 on 2026-11-25T01:32:09Z.
Coordination: this overlaps the existing #1961 (
4b4c111098a3b22e21dce00d41bc95ab3c11da8e), also addressing #1890. I inspected this head1c0407a40e38a10cb5b585243efd8d5d3145e692; I have not run it and am not reporting test results for it.Both changes replace the lowering-order-dependent
init.touchedbound with a program-widemax_vgpr. #1961 additionally initializes register gaps and transfers the possible relative range through the per-lane bridge, retaining inactive lanes, rather than refusing relative instructions. It only scans operands for programs using relative indexing, and is based on main after the automatic Direct DXIL source-cache hash change.The existing #1961 compute-entry regression and native results are available for consolidation: four move forms plus inactive lanes, Direct DXIL and per-lane, 20 RTX 3090 dispatches and 30 AMD iGPU dispatches including native wave64, all 64 words per dispatch. Its identical test-only baseline fails on both GPUs. The current full-suite comparison and remaining CLAMP failure are documented there; retail smoke is still absent, so #1961 remains draft.
The two new tests here call
translate, which uses the test-kernel entry; #1961's regression callstranslate_compute/compute_withand writes output to memory, covering the compute-entry initialization issue directly. These are different coverage claims. I suggest consolidating around the existing compute regression and making the per-lane support-versus-fallback choice explicitly, rather than maintaining parallel fixes. Separate swaprel destination semantics remain tracked in #803.No new implementation or duplicate test run from this coordination check. AI-assisted source comparison/report: Codex (GPT-6); the linked historical measurements retain their original attribution.
Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:34:47Z.
Diff audit passed (
kernel.rsmax_vgprscan,lower_wide.rstop_vgpr(),recomp/lower.rsper-laneV_MOVREL*/V_SWAPREL_B32refusal, and tests) and CI has been approved.Note that
#1961also targets#1890(with full per-lane dynamic VGPR range transfer verified across RTX 3090 + AMD iGPU, currently draft pending retail smoke). For#2037, remaining items before merge are pairedxcl-smoke v1blocks (PR descriptionfailed), an independent AMD GPU verification pass on1c0407a, and confirming whether#2037(per-lane refusal) or#1961(per-lane transfer) should land.Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-25T01:58:46Z.
Independent AMD check of
1c0407a40e38a10cb5b585243efd8d5d3145e692. The two new direct-DXIL GPU fixtures also pass against the parent, so those fixtures give AMD execution coverage but don't reproduce the earlier register-bound behavior.Tested
XCL_ADAPTER=AMD RadeonandXCL_REQUIRE_GPU=wave64.cargo test --locked -p xcl --lib gpu::dxil::core_tests -- --nocapture --test-threads=1gave 15 passed, 0 failed and 1 ignored (dump_dxc_lowering). Both new relative move/swap fixtures executed in wave32. I also ran the same command with the exact filtersgpu::recomp::tests::gpu_packed_math_dots_movrelandgpu::recomp::lower::tests::dynamically_indexed_vgpr_moves_are_refused_in_per_lane, adding--exactafter--. Each gave 1 passed, 0 failed and 0 ignored. The packed math/relative move test ran withXCL_DIRECT_DXIL=1and checked all 64 lanes. NoSKIPPEDlines.8e87fc7b62a87ea589ccb9ea6182f514016cf7db, I copied only the new test code and used the same command with the filterswith_non_static_target_vgpranddynamically_indexed_vgpr_moves_are_refused_in_per_lanewithout--exact. The GPU tests gave 2 passed and 0 failed. The per-lane test gave 0 passed and 1 failed because the parent already returnedunsupported V_MOVRELD_B32, while the PR returned the reason specific to dynamic indexing. Both runs had 0 ignored and no skips.Not tested
Full workspace suite, retail smoke, or a before/after shader that reproduces the original register-bound issue.
AI use
OpenAI Codex (GPT-6.2 Sol) ran the tests, checked the logs and drafted this report.
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-25T02:20:34Z.
A run with vkd3d-proton as the host D3D12 (DXIL → SPIR-V through dxil-spirv, then the NVIDIA Vulkan driver), so the DXIL goes through a different compiler than the native-Windows runs here: this PR's 3 tests pass.
Tested
x86_64-pc-windows-gnu.1c0407aas it is (merge base withmain8e87fc7), no uncommitted changes. The lib test binary runs under Wine, one test per process.v_movrel_with_non_static_target_vgpr: ok, not skippedv_swaprel_with_non_static_target_vgpr: ok, not skippeddynamically_indexed_vgpr_moves_are_refused_in_per_lane: ok, not skippedNot tested
AI use
Imported from ivall/xcl. Originally posted by IAmTheSween on 2026-11-25T02:25:00Z.
Thanks for reaching out!
The choice here to refuse V_MOVREL* and V_SWAPREL_B32 in bridge() was intentional: bridging (0..=max_vgpr) transfers the entire register file across every dynamically indexed move, which inflates SSA inputs and outputs for instructions that usually only touch a small runtime offset. Routing these moves to the fallback keeps the per-lane bridge minimal and bounded to statically known operands.
That said, your synthetic multi-dispatch compute regression in #1961 is very comprehensive. If the maintainers prefer retaining per-lane execution by bridging the whole range over falling back, I am glad to either pull in that bridging approach and compute test here, or help land #1961 with these retail smoke numbers.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T04:28:38Z.
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!
Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:43:34Z.
This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:13:47Z.
Triage (#1607) – head
4fc9719The direct DXIL half is already on main: #3266 (
4a20b25) addedLw::max_vgpr(computed over the program inkernel.rs) andtop_vgpr()now returnstouched.max(self.max_vgpr). After a rebase only the per-lane refusal inrecomp/lower.rsbridge()and the tests remain, which is still not on main. #1961 fixes the per-lane side the other way, transferring the whole VGPR range around a relative move instead of refusing the program.No problems found in the diff. The branch conflicts with main.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.