Skip to content

Shaders: infer double extensions from emitted instructions - #1544

Draft
Roroca-1 wants to merge 1 commit into
xcl-dev:mainfrom
Roroca-1:dxil-opt-1-prep
Draft

Roroca-1 wants to merge 1 commit into
xcl-dev:mainfrom
Roroca-1:dxil-opt-1-prep

Conversation

@Roroca-1

@Roroca-1 Roroca-1 commented Nov 24, 2026 •

Copy link
Copy Markdown

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 gut0to left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@DavidM1911

Copy link
Copy Markdown
Contributor

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.

An unreachable conversion survives in the instruction arena after optimization. Scan block instructions when inferring flags and invalidate cached containers.
@Toons29

Toons29 commented Nov 25, 2026

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

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

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants