recomp: add XCL_HLSL_CS to force compute shaders onto HLSL path #3060

Open
rdj415 wants to merge 1 commit from upstream-pr/3060 into main
rdj415 commented 2026-11-27 18:34:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by rdj415 on 2026-11-27T18:34:45Z.


Add XCL_HLSL_CS=<hash>,<hash>... (split out from #2114 per D95 triage) so specific compute shaders can stay on the HLSL translation path when running with XCL_DIRECT_DXIL or triggering enormous direct-DXIL rerouting, while keeping HLSL translated disk cache entries separated.

What is in it

  • crates/xcl/src/gpu/recomp/pso.rs: parse XCL_HLSL_CS comma-separated shader dump hashes (with optional 0x/0X prefix), skip XCL_DIRECT_DXIL and enormous direct-DXIL rerouting for matching Stage::Compute shaders, store/load their translated disk cache via translated::hlsl_identity() + translated::cached_hlsl() (cached_in), and add unit test hlsl_cs_hashes_parse_and_separate_cache_identity.

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 5060 Ti (driver 32.0.16.1664), 12th Gen Intel(R) Core(TM) i5-12400F
  • cargo test --workspace -- --test-threads=4 on b7be7b02: 1453 passed, 0 failed, 47 ignored (SKIPPED GPU tests on adapter: 19)

Regression run
PR changes crates/xcl/src/gpu/recomp/pso.rs outside tests — add scripts/smoke.ps1 runs from main and b7be7b02 before removing Draft / running scripts/pr_check.py.

main:

  • pending Windows .\scripts\smoke.ps1 run

PR:

  • pending Windows .\scripts\smoke.ps1 run on b7be7b025a7473a0bfd16d5f4fd5864a71f186e4

Not tested

  • Dedicated scripts/smoke.ps1 regression run for b7be7b02 alone (previously exercised combined in #2114 at a4cb014c)

AI use

  • Gemini 4 Hydrogen: drafted/tested XCL_HLSL_CS implementation and separated PR summary from #2114.
<!-- greyfinch-sync:ivall/xcl:issue:5531443335 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3060). Originally posted by [rdj415](https://github.com/rdj415) on 2026-11-27T18:34:45Z. --- Add `XCL_HLSL_CS=<hash>,<hash>...` (split out from `#2114` per D95 triage) so specific compute shaders can stay on the HLSL translation path when running with `XCL_DIRECT_DXIL` or triggering `enormous` direct-DXIL rerouting, while keeping HLSL translated disk cache entries separated. **What is in it** - `crates/xcl/src/gpu/recomp/pso.rs`: parse `XCL_HLSL_CS` comma-separated shader dump hashes (with optional `0x`/`0X` prefix), skip `XCL_DIRECT_DXIL` and `enormous` direct-DXIL rerouting for matching `Stage::Compute` shaders, store/load their translated disk cache via `translated::hlsl_identity()` + `translated::cached_hlsl()` (`cached_in`), and add unit test `hlsl_cs_hashes_parse_and_separate_cache_identity`. **Tested** - hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 5060 Ti (driver 32.0.16.1664), 12th Gen Intel(R) Core(TM) i5-12400F - `cargo test --workspace -- --test-threads=4` on `b7be7b02`: 1453 passed, 0 failed, 47 ignored (SKIPPED GPU tests on adapter: 19) **Regression run** PR changes `crates/xcl/src/gpu/recomp/pso.rs` outside tests — add `scripts/smoke.ps1` runs from `main` and `b7be7b02` before removing Draft / running `scripts/pr_check.py`. main: - pending Windows `.\scripts\smoke.ps1` run PR: - pending Windows `.\scripts\smoke.ps1` run on `b7be7b025a7473a0bfd16d5f4fd5864a71f186e4` **Not tested** - Dedicated `scripts/smoke.ps1` regression run for `b7be7b02` alone (previously exercised combined in `#2114` at `a4cb014c`) **AI use** - Gemini 4 Hydrogen: drafted/tested `XCL_HLSL_CS` implementation and separated PR summary from `#2114`.
Saksukella commented 2026-11-28 10:37:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Saksukella on 2026-11-28T10:37:52Z.


Tested XCL_HLSL_CS on AMD Radeon RX 9070 XT (RDNA4, 16 GB VRAM, driver 32.0.32029.2010, DXC 1.9.2609.5, ReBAR enabled, release build on amd-dev with XCL_DIRECT_DXIL=1 XCL_PER_LANE=1 XCL_GPU_PROFILE=1):

  • Massive real-world RDNA4 GPU win via XCL_HLSL_CS: Compute shader 344335e52c4be50e (8x4x1 wave32, 34,712 B RDNA2, ExecuteIndirect, 22 loops / 203 texture ops / 133 Interlocked ops) took 342.5 ms/call longest (825.2 ms over 3 calls) on the Direct DXIL path (232 KB DXIL), stalling the GPU and triggering TDRs.
  • Routing just XCL_HLSL_CS=344335e52c4be50e,4097cf4856634349 onto the HLSL+DXC path dropped 344335e52c4be50e to 5.4–8.3 ms/call (16.5 ms over 2 calls — 41.3x faster / -97.6% GPU time) and 4097cf4856634349 from 10.9 ms to 6.5–8.3 ms, bringing total profiled 2 s GPU time down from 448.1 ms (12,897 ops) to 292.4 ms (20,763 ops) and enabling clean exit 0x0 sustained 3D runs (3.53 FPS avg, 5.0 FPS peak, 0 device removals, 0 slabs lost) while keeping the warm .plib cache intact (478/0 hits).
  • Cache separation (hlsl_identity / cached_hlsl) worked cleanly alongside existing Direct DXIL entries.

Strong +1 for landing XCL_HLSL_CS — it is immediately useful for both perf A/Bs and shader bug isolation on RDNA4.

AI use: analysis and comment drafted with AI assistance; all runs executed locally on the RX 9070 XT above.

<!-- greyfinch-sync:ivall/xcl:comment:7238020628 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3060#issuecomment-7238020628). Originally posted by [Saksukella](https://github.com/Saksukella) on 2026-11-28T10:37:52Z. --- Tested `XCL_HLSL_CS` on AMD Radeon RX 9070 XT (RDNA4, 16 GB VRAM, driver `32.0.32029.2010`, DXC `1.9.2609.5`, ReBAR enabled, release build on `amd-dev` with `XCL_DIRECT_DXIL=1 XCL_PER_LANE=1 XCL_GPU_PROFILE=1`): - **Massive real-world RDNA4 GPU win via `XCL_HLSL_CS`:** Compute shader `344335e52c4be50e` (`8x4x1` wave32, `34,712 B` RDNA2, `ExecuteIndirect`, 22 loops / 203 texture ops / 133 Interlocked ops) took **`342.5 ms/call`** longest (`825.2 ms` over 3 calls) on the Direct DXIL path (`232 KB` DXIL), stalling the GPU and triggering TDRs. - Routing just `XCL_HLSL_CS=344335e52c4be50e,4097cf4856634349` onto the HLSL+DXC path dropped `344335e52c4be50e` to **`5.4–8.3 ms/call`** (`16.5 ms` over 2 calls — **41.3x faster / -97.6% GPU time**) and `4097cf4856634349` from `10.9 ms` to `6.5–8.3 ms`, bringing total profiled 2 s GPU time down from `448.1 ms` (12,897 ops) to `292.4 ms` (20,763 ops) and enabling clean `exit 0x0` sustained 3D runs (`3.53 FPS` avg, `5.0 FPS` peak, 0 device removals, 0 slabs lost) while keeping the warm `.plib` cache intact (`478/0` hits). - Cache separation (`hlsl_identity` / `cached_hlsl`) worked cleanly alongside existing Direct DXIL entries. Strong +1 for landing `XCL_HLSL_CS` — it is immediately useful for both perf A/Bs and shader bug isolation on RDNA4. *AI use: analysis and comment drafted with AI assistance; all runs executed locally on the RX 9070 XT above.*
JJAutoCompare commented 2026-11-28 10:53:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-28T10:53:39Z.


Tested

Exact b7be7b025a7473a0bfd16d5f4fd5864a71f186e4 on Windows 11 x64 build 26200.9974, Ryzen 7 3800X, Rust 1.100.1 MSVC. I verified byte-for-byte Git source ranges for Stage, parse_hlsl_cs_hashes, cs_hlsl_forced and fnv64 in the pinned standalone CPU harness.

I ran hlsl_override.exe --nocapture --test-threads=1 in five fresh processes with isolated XCL_HLSL_CS settings. The synthetic inputs hashed to A=a430d84680aabd0b and B=85944171f73967e8.

Setting Compute A Compute B
Unset false false
Invalid entries only false false
A among invalid entries true false
B only false true
Both true true

Vertex, Pixel, and Mesh returned false for both inputs in every process. 5 passed, 0 failed, 0 ignored, 0 runtime skips. All five native exits were 0.

Not tested

Shader translation, runtime routing, cache use or performance, GPU or DXC execution, CI, retail smoke, and the workspace suite.

AI use

T3 Code through the Codex harness (gpt-6.2-sol) verified the source and executable, reran the five cases, and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7238190805 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3060#issuecomment-7238190805). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-28T10:53:39Z. --- **Tested** Exact `b7be7b025a7473a0bfd16d5f4fd5864a71f186e4` on Windows 11 x64 build 26200.9974, Ryzen 7 3800X, Rust 1.100.1 MSVC. I verified byte-for-byte Git source ranges for `Stage`, `parse_hlsl_cs_hashes`, `cs_hlsl_forced` and `fnv64` in the pinned standalone CPU harness. I ran `hlsl_override.exe --nocapture --test-threads=1` in five fresh processes with isolated `XCL_HLSL_CS` settings. The synthetic inputs hashed to A=`a430d84680aabd0b` and B=`85944171f73967e8`. | Setting | Compute A | Compute B | |---|---|---| | Unset | false | false | | Invalid entries only | false | false | | A among invalid entries | true | false | | B only | false | true | | Both | true | true | Vertex, Pixel, and Mesh returned false for both inputs in every process. **5 passed, 0 failed, 0 ignored, 0 runtime skips.** All five native exits were 0. **Not tested** Shader translation, runtime routing, cache use or performance, GPU or DXC execution, CI, retail smoke, and the workspace suite. **AI use** T3 Code through the Codex harness (`gpt-6.2-sol`) verified the source and executable, reran the five cases, and wrote this report.
Foniass commented 2026-12-01 09:25:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:25:31Z.


Triage (#1607) – head b7be7b0

No open or merged PR adds a per-hash switch that routes compute shaders to HLSL. Main has no XCL_HLSL_CS.
Problem in the diff: translated::hlsl_identity in pso.rs rebuilds the HLSL disk-cache identity by hand. On current main, identity() also tags XCL_X_LDS_ORDER=0 (xcl-x-lds-order-0), and hlsl_identity does not, so after a rebase a forced shader could reuse an entry made with different settings. Deriving it from identity() with Backend::Hlsl would avoid that. The commit subject prefix recomp: is not one of the repository's areas. 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.

<!-- greyfinch-sync:ivall/xcl:comment:7306680844 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3060#issuecomment-7306680844). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:25:31Z. --- **Triage (#1607)** – head b7be7b0 No open or merged PR adds a per-hash switch that routes compute shaders to HLSL. Main has no `XCL_HLSL_CS`. Problem in the diff: `translated::hlsl_identity` in `pso.rs` rebuilds the HLSL disk-cache identity by hand. On current main, `identity()` also tags `XCL_X_LDS_ORDER=0` (`xcl-x-lds-order-0`), and `hlsl_identity` does not, so after a rebase a forced shader could reuse an entry made with different settings. Deriving it from `identity()` with `Backend::Hlsl` would avoid that. The commit subject prefix `recomp:` is not one of the repository's areas. 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.
Foniass commented 2026-12-01 10:51:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:51:17Z.


Review (head b7be7b02, diff read, not a merge-check; draft, conflicts with main, PR description red: no smoke blocks):

  • Main has partly overtaken it. Main gained XCL_DEBUG_CS_SUB=<hash>: (pso.rs ~793-796, ~916-923), which already sends one compute shader to the HLSL path, uncached. Main also restructured this code (console_to_dxil_in_with, rt32_mask, cached_for), so the conflict in pso.rs needs a rework rather than a mechanical rebase.
  • Cache identity. hlsl_identity (~253) is rebuilt by hand, and after a rebase it would miss main's xcl-x-lds-order-0 tag, so a forced shader could reuse an entry built with other settings. Deriving it from identity() with Backend::Hlsl avoids that. With XCL_DIRECT_DXIL=0, a large forced shader's HLSL entry is looked up first and keeps being used after the switch is removed (cached_rerouted). XCL_HLSL_CS isn't in the settings that key the warm pipeline library (shaders.rs ~31); whether that matters is unverified.
  • The test doesn't test the change. Its identity assertions hold trivially (different source strings); it checks neither the routing nor where entries are cached.
  • The commit prefix recomp: should be Recompiler:.

Fine: off by default and limited to compute shaders, and per-shader HLSL fallback already exists in direct mode, so mixing the two paths is supported. The 41x figure is backed by Saksukella's RDNA4 run.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7308822745 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3060#issuecomment-7308822745). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T10:51:17Z. --- Review (head b7be7b02, diff read, not a merge-check; draft, conflicts with main, `PR description` red: no smoke blocks): - **Main has partly overtaken it.** Main gained `XCL_DEBUG_CS_SUB=<hash>:` (`pso.rs` ~793-796, ~916-923), which already sends one compute shader to the HLSL path, uncached. Main also restructured this code (`console_to_dxil_in_with`, `rt32_mask`, `cached_for`), so the conflict in `pso.rs` needs a rework rather than a mechanical rebase. - **Cache identity.** `hlsl_identity` (~253) is rebuilt by hand, and after a rebase it would miss main's `xcl-x-lds-order-0` tag, so a forced shader could reuse an entry built with other settings. Deriving it from `identity()` with `Backend::Hlsl` avoids that. With `XCL_DIRECT_DXIL=0`, a large forced shader's HLSL entry is looked up first and keeps being used after the switch is removed (`cached_rerouted`). `XCL_HLSL_CS` isn't in the settings that key the warm pipeline library (`shaders.rs` ~31); whether that matters is unverified. - **The test doesn't test the change.** Its identity assertions hold trivially (different source strings); it checks neither the routing nor where entries are cached. - The commit prefix `recomp:` should be `Recompiler:`. Fine: off by default and limited to compute shaders, and per-shader HLSL fallback already exists in direct mode, so mixing the two paths is supported. The 41x figure is backed by Saksukella's RDNA4 run. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
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/3060:upstream-pr/3060'
git switch 'upstream-pr/3060'

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