Recompiler: fix Direct DXIL live double-ext scan and movrel VGPR range #3266

Merged
Foniass merged 1 commit from upstream-pr/3266 into main 2026-11-29 22:20:11 +00:00
Foniass commented 2026-11-29 02:18:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T02:18:34Z.


Note: the suite and smoke results below replace an earlier set that, by a test-setup mistake (shared cargo target directory), came from another PR's build. These were run with a forced rebuild of this head.

Overlaps #2037 and #2227 (movrel range / double-ext flags, both conflicting with main): this is amd-dev's version (aac43438, raylitebull). Maintainers, keep one.

Two direct DXIL fixes (#1894, #1890):

  • Module::uses_double_extensions looked at every instruction ever built, so f64 ops removed by the optimizer still set the DoubleExtensions shader flag. It now looks at the live ones (as insts_use_type does).
  • Outside kernel mode init.touched is empty, so Lw::top_vgpr missed VGPRs that a relative move can reach. It now includes max_vgpr over the whole program, and v_movrels / v_movreld / v_movrelsd mask M0 to M0[7:0] as RDNA2 does.

What is in it

  • crates/xcl/src/gpu/dxil/module.rs, kernel.rs, lower.rs, lower_wide.rs
  • crates/xcl/src/gpu/dxil/core_tests.rs: compute_movrel_uses_program_max_vgpr_and_masks_m0

Tested

  • RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 4a20b256: 2605 passed, 4 failed, 49 ignored. The 4 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3: E_OUTOFMEMORY from CreateComputePipelineState at seeds 70 / 545 / 1019 / 1507, the same as on main on this machine; they pass on Kalmarv's RTX 5070 Ti, so they come from this machine's driver / setup, not the code. SKIPPED GPU tests: 30, almost all no wave64.
  • Correction: in the first push the movrel test's shader stored nothing, so main's DCE removed what it checks (found by Kalmarv). It now stores the result, as in amd-dev's later f089a9df.
  • Retail title: 60 s smoke run below. The PR's run used -StartupTimeoutSeconds 3600 for the cold pipeline rebuild new DXIL needs.

Regression run

main:

xcl-smoke v1
commit: b10cc4c6766adc947c2054ada4a2af98be15108d
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1565 (PresentX 1565)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16026 MB

this PR:

xcl-smoke v1
commit: 4a20b256370c93cc5362467ea76e15cb2eae4e01
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1661 (PresentX 1661)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 17408 MB

Not tested

  • AMD GPUs; whether the image looks the same; titles other than this one

AI use

  • Claude Code with Claude Opus 5.5: ported the commit to main, resolved conflicts (noted in the commit message), ran the tests and the smoke run above and wrote this description.
  • Original commit: amd-dev aac43438 (raylitebull, from 2c33f9f2, written with Antigravity (Gemini 4 Neon High)); ported without the neighbouring test of fcbd0d14.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5546753864 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3266). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T02:18:34Z. --- **Note:** the suite and smoke results below replace an earlier set that, by a test-setup mistake (shared cargo target directory), came from another PR's build. These were run with a forced rebuild of this head. **Overlaps #2037 and #2227** (movrel range / double-ext flags, both conflicting with main): this is amd-dev's version (`aac43438`, raylitebull). Maintainers, keep one. Two direct DXIL fixes (#1894, #1890): - `Module::uses_double_extensions` looked at every instruction ever built, so f64 ops removed by the optimizer still set the `DoubleExtensions` shader flag. It now looks at the live ones (as `insts_use_type` does). - Outside kernel mode `init.touched` is empty, so `Lw::top_vgpr` missed VGPRs that a relative move can reach. It now includes `max_vgpr` over the whole program, and `v_movrels` / `v_movreld` / `v_movrelsd` mask M0 to M0[7:0] as RDNA2 does. **What is in it** - `crates/xcl/src/gpu/dxil/module.rs`, `kernel.rs`, `lower.rs`, `lower_wide.rs` - `crates/xcl/src/gpu/dxil/core_tests.rs`: `compute_movrel_uses_program_max_vgpr_and_masks_m0` **Tested** - RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke - `cargo test --workspace --no-fail-fast -- --test-threads=4` on 4a20b256: 2605 passed, 4 failed, 49 ignored. The 4 failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3`: `E_OUTOFMEMORY` from `CreateComputePipelineState` at seeds 70 / 545 / 1019 / 1507, the same as on main on this machine; they pass on Kalmarv's RTX 5070 Ti, so they come from this machine's driver / setup, not the code. SKIPPED GPU tests: 30, almost all `no wave64`. - Correction: in the first push the `movrel` test's shader stored nothing, so main's DCE removed what it checks (found by Kalmarv). It now stores the result, as in amd-dev's later `f089a9df`. - Retail title: 60 s smoke run below. The PR's run used `-StartupTimeoutSeconds 3600` for the cold pipeline rebuild new DXIL needs. **Regression run** main: ``` xcl-smoke v1 commit: b10cc4c6766adc947c2054ada4a2af98be15108d gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1565 (PresentX 1565) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16026 MB ``` this PR: ``` xcl-smoke v1 commit: 4a20b256370c93cc5362467ea76e15cb2eae4e01 gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1661 (PresentX 1661) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 17408 MB ``` **Not tested** - AMD GPUs; whether the image looks the same; titles other than this one **AI use** - Claude Code with Claude Opus 5.5: ported the commit to main, resolved conflicts (noted in the commit message), ran the tests and the smoke run above and wrote this description. - Original commit: amd-dev `aac43438` (raylitebull, from `2c33f9f2`, written with Antigravity (Gemini 4 Neon High)); ported without the neighbouring test of `fcbd0d14`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Kalmarv commented 2026-11-29 03:23:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T03:23:07Z.


merge-check
base: fa204595a4
head: 4a20b25637
merge: clean onto main and with the 7-PR stack.
build: cargo build --workspace -> ok; cargo build --release -p xcl -> ok.
tests: tested in the clean 7-PR stack (#3250+#3261+#3263+#3264+#3265+#3266+#3268) on main fa204595: cargo test --workspace --no-fail-fast -- --test-threads=4 (DXC 1.9.2609.5; -p xcl --lib rerun skipping the 2 known main #3187 uma_driver mixed-window tests a_refused_gpu_upload_segment_becomes_custom and mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment) -> 2620 passed, 0 failed, 49 ignored (2481 lib + 139 integration, 25 SKIPPED notices; all 4 fuzz_validate_and_gpu_0..3 passed); failing: none. compute_movrel_uses_program_max_vgpr_and_masks_m0 ran and passed. 150 s xcl-smoke (ea3b5e4d, XCL_PREPARE=0, RTX 5070 Ti) on the combined 8-PR stack: exit: 0x0, 2096 frames shown, 0 device removals, 0 crashes, 0 display System events, 32049 MB peak commit.
review: none (whole diff read: uses_double_extensions scans reachable self.blocks instead of dead self.insts; max_vgpr scanned up front in kernel.rs and m0 masked & 0xFF in lower_wide.rs for v_movrel* outside Entry::Kernel).
performance: negligible: one linear VGPR scan at translation time; no runtime frame-time or memory cost.
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (wave32 only), Windows 11, DXC 1.9.2609.5 via XCL_DXC_DIR; Antigravity (Gemini 3.5 Pro) ran the merges, builds, workspace test suites, 150 s title smokes, diff reviews, and drafted this check.

<!-- greyfinch-sync:ivall/xcl:comment:7250015187 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3266#issuecomment-7250015187). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T03:23:07Z. --- merge-check base: fa204595a488c60c6c5f905244f0172072c9c2a9 head: 4a20b256370c93cc5362467ea76e15cb2eae4e01 merge: clean onto main and with the 7-PR stack. build: cargo build --workspace -> ok; cargo build --release -p xcl -> ok. tests: tested in the clean 7-PR stack (#3250+#3261+#3263+#3264+#3265+#3266+#3268) on main `fa204595`: `cargo test --workspace --no-fail-fast -- --test-threads=4` (DXC 1.9.2609.5; `-p xcl --lib` rerun skipping the 2 known `main` #3187 `uma_driver` mixed-window tests `a_refused_gpu_upload_segment_becomes_custom` and `mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment`) -> 2620 passed, 0 failed, 49 ignored (2481 lib + 139 integration, 25 SKIPPED notices; all 4 `fuzz_validate_and_gpu_0..3` passed); failing: none. `compute_movrel_uses_program_max_vgpr_and_masks_m0` ran and passed. 150 s `xcl-smoke` (`ea3b5e4d`, `XCL_PREPARE=0`, RTX 5070 Ti) on the combined 8-PR stack: `exit: 0x0`, `2096` frames shown, `0` device removals, `0` crashes, `0` display System events, `32049 MB` peak commit. review: none (whole diff read: `uses_double_extensions` scans reachable `self.blocks` instead of dead `self.insts`; `max_vgpr` scanned up front in `kernel.rs` and `m0` masked `& 0xFF` in `lower_wide.rs` for `v_movrel*` outside `Entry::Kernel`). performance: negligible: one linear VGPR scan at translation time; no runtime frame-time or memory cost. verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (wave32 only), Windows 11, DXC 1.9.2609.5 via XCL_DXC_DIR; Antigravity (Gemini 3.5 Pro) ran the merges, builds, workspace test suites, 150 s title smokes, diff reviews, and drafted this check.
KOLESNiii commented 2026-11-29 22:39:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T22:39:24Z.

Review: COMMENTED


Static review of a343eafc for the stack in the #3041 comparison.

The relative-VGPR range fix still misses registers accessed only indirectly. The range is bounded by the largest register the program names directly. A relative write to v[0 + 7] followed by a relative read of that slot omits v7 if no instruction names it directly. This is an existing hole that remains in the measured revision and in the rebased copy under #3269. Tested lowering

Review assisted by Codex (GPT-6, exact variant unavailable). No new build or GPU run for this review.

<!-- greyfinch-sync:ivall/xcl:review:6105175219 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3266#pullrequestreview-6105175219). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-29T22:39:24Z. **Review:** COMMENTED --- Static review of `a343eafc` for the stack in the [#3041 comparison](https://github.com/xcl-dev/xcl/issues/3041#issuecomment-7263214809). **The relative-VGPR range fix still misses registers accessed only indirectly.** The range is bounded by the largest register the program names directly. A relative write to `v[0 + 7]` followed by a relative read of that slot omits `v7` if no instruction names it directly. This is an existing hole that remains in the measured revision and in the rebased copy under #3269. [Tested lowering](https://github.com/xcl-dev/xcl/blob/a343eafc/crates/xcl/src/gpu/dxil/lower_wide.rs#L281-L340) Review assisted by Codex (GPT-6, exact variant unavailable). No new build or GPU run for this review.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3266
No description provided.