Shaders: infer double extensions from emitted instructions #1534

Open
Roroca-1 wants to merge 1 commit from upstream-pr/1544 into main
Roroca-1 commented 2026-11-24 17:28:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Roroca-1 on 2026-11-24T17:28:25Z.


Part of #1269. After the optimizer removes an unreachable block, its instructions still exist in the arena. A discarded int-to-double conversion could therefore set DoubleExtensions in the shader flags. Based on main after #1426.

What is in it

  • Scan instructions in the surviving blocks in module.rs. Exercise the production optimizer on an unreachable conversion. Bump the direct translator cache version to 5 in kernel.rs.

Tested

  • Ryzen 7 7800X3D, Linux x86-64, Windows MSVC debug target via cargo-xwin. CPU-side test under Wine on 593c65b.
  • TARGET_CFLAGS=/FIstring.h cargo xwin build --tests -p xcl --target x86_64-pc-windows-msvc succeeded.
  • wine xcl-67594ede252ac8b9.exe unreachable_conversion_does_not_require_double_extensions --nocapture ran 1 passed, 0 failed, 0 ignored, 0 skipped. With the test alone on c160d86, the post-optimization assertion failed.

Regression run
Pending paired clean main/head retail-title runs.

Not tested
Native Windows GPU workspace suite, DXIL validation, retail title.

AI use
T3 Code (Codex, gpt-6.2-astra) rebuilt the original scan fix against main, wrote the regression test and ran it under Wine. The initial fix was prepared with T3 Code (Antigravity, gemini-pro-orchestrator-neon).

<!-- greyfinch-sync:ivall/xcl:issue:5477109565 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1544). Originally posted by [Roroca-1](https://github.com/Roroca-1) on 2026-11-24T17:28:25Z. --- Part of #1269. After the optimizer removes an unreachable block, its instructions still exist in the arena. A discarded int-to-double conversion could therefore set DoubleExtensions in the shader flags. Based on main after #1426. **What is in it** - Scan instructions in the surviving blocks in `module.rs`. Exercise the production optimizer on an unreachable conversion. Bump the direct translator cache version to 5 in `kernel.rs`. **Tested** - Ryzen 7 7800X3D, Linux x86-64, Windows MSVC debug target via cargo-xwin. CPU-side test under Wine on `593c65b`. - `TARGET_CFLAGS=/FIstring.h cargo xwin build --tests -p xcl --target x86_64-pc-windows-msvc` succeeded. - `wine xcl-67594ede252ac8b9.exe unreachable_conversion_does_not_require_double_extensions --nocapture` ran 1 passed, 0 failed, 0 ignored, 0 skipped. With the test alone on `c160d86`, the post-optimization assertion failed. **Regression run** Pending paired clean main/head retail-title runs. **Not tested** Native Windows GPU workspace suite, DXIL validation, retail title. **AI use** T3 Code (Codex, gpt-6.2-astra) rebuilt the original scan fix against main, wrote the regression test and ran it under Wine. The initial fix was prepared with T3 Code (Antigravity, gemini-pro-orchestrator-neon).
gut0to commented 2026-11-24 18:42:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:42:38Z.

Review: COMMENTED


The targeted Wine tests are useful, but CONTRIBUTING.md requires the full workspace GPU suite on Windows. Since this changes runtime code in crates/xcl/src, it also requires paired scripts/smoke.ps1 runs on a real title for main and this head; the guide says even a title that does not reach the changed path counts if documented. Both are listed as not tested here. Please add these results before merge. AI-assisted review; I checked the requirements and current description against the guide.

<!-- greyfinch-sync:ivall/xcl:review:6045239498 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1544#pullrequestreview-6045239498). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-24T18:42:38Z. **Review:** COMMENTED --- The targeted Wine tests are useful, but CONTRIBUTING.md requires the full workspace GPU suite on Windows. Since this changes runtime code in `crates/xcl/src`, it also requires paired `scripts/smoke.ps1` runs on a real title for `main` and this head; the guide says even a title that does not reach the changed path counts if documented. Both are listed as not tested here. Please add these results before merge. AI-assisted review; I checked the requirements and current description against the guide.
upstream-sync changed title from [PR #1544] Shaders: expose DXIL module IR internals and fix f64 extension scan to [PR #1544] Shaders: infer double extensions from emitted instructions 2026-11-24 21:06:32 +00:00
DavidM1911 commented 2026-11-24 21:08:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T19:12:52Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main in crates/xcl/src/gpu/recomp/tests.rs — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7141766128 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1544#issuecomment-7141766128). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T19:12:52Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** in `crates/xcl/src/gpu/recomp/tests.rs` — needs a rebase before it can be tested.
Toons29 commented 2026-11-25 04:10:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T03:33:34Z.


Regression run of 593c65bf on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 593c65bf0695ab22055266816531f9d5c44ed278
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1631 (PresentX 1631)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14816 MB

Against the limits in CONTRIBUTING.md: 101 % 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; I checked the blocks before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7152026864 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1544#issuecomment-7152026864). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-25T03:33:34Z. --- Regression run of `593c65bf` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 593c65bf0695ab22055266816531f9d5c44ed278 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1631 (PresentX 1631) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14816 MB ``` Against the limits in CONTRIBUTING.md: 101 % 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`; I checked the blocks before posting.
DavidM1911 commented 2026-11-26 01:05:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:26:43Z.


Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7178763774 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1544#issuecomment-7178763774). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T00:26:43Z. --- Re-verification on RTX 3060 Ti (Windows 11): still a **merge conflict with current `main`** on the new head — needs another rebase before it can be tested.
Foniass commented 2026-12-01 06:03:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:03:41Z.


Triage (#1607) – head 593c65b

The change to dxil/module.rs:uses_double_extensions (scan only the instructions still in self.blocks) is already on main through #3266 (commit 4a20b25), with the same code. The TRANSLATOR_VERSION bump to 5 is behind main (12).
Main has no test for this; unreachable_conversion_does_not_require_double_extensions could still go in as a test-only PR.
Recommendation: close (superseded by #3266 / main commit 4a20b25).

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7302433317 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1544#issuecomment-7302433317). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:03:41Z. --- **Triage (#1607)** – head 593c65b The change to `dxil/module.rs:uses_double_extensions` (scan only the instructions still in `self.blocks`) is already on main through #3266 (commit 4a20b25), with the same code. The `TRANSLATOR_VERSION` bump to 5 is behind main (12). Main has no test for this; `unreachable_conversion_does_not_require_double_extensions` could still go in as a test-only PR. Recommendation: close (superseded by #3266 / main commit 4a20b25). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1544:upstream-pr/1544'
git switch 'upstream-pr/1544'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1544'
git switch 'upstream-pr/1544'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1544'
git switch 'upstream-pr/1544'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1544'
git switch 'main'
git merge --squash 'upstream-pr/1544'
git switch 'main'
git merge --ff-only 'upstream-pr/1544'
git switch 'main'
git merge 'upstream-pr/1544'
git push origin 'main'
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!1534
No description provided.