Direct DXIL: MSAA loads clamp out-of-range sample indices before loading #1898

Merged
bmjask merged 2 commits from upstream-pr/1908 into main 2026-11-28 13:24:33 +00:00
bmjask commented 2026-11-24 22:59:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-24T22:59:52Z.


Follow-up to #1679.

What is in it

  • Direct DXIL MSAA image loads now clamp an out-of-range sample index to sample 0 before the load. The result for such indices is still zeroed afterwards, so visible behavior for valid indices is unchanged, but the load itself never addresses a sample past the texture's count. - Based on main after #1900 and keeps its ordering: the sample count (getDimensions) is read in its own block, and the clamped textureLoads start a new block, so no textureLoad follows getDimensions in one basic block. direct_msaa_loads_precede_get_dimensions still passes. - TRANSLATOR_VERSION 7 -> 8 so cached direct containers re-key. - Patch as suggested by @imnicho in the #1679 review. Thanks!

Tested

  • RTX 4090, Windows 11, Rust stable - cargo test -p xcl --lib msaa -- --include-ignored: 6 passed, incl. gpu_direct_msaa_image_loads on the GPU and direct_msaa_loads_precede_get_dimensions - cargo test -p xcl --lib gpu::dxil: 101 passed, 0 failed, 3 ignored - XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp: 261 passed, 0 failed, 18 ignored - cargo build --workspace and cargo test --workspace -- --test-threads=4: 0 failed (xcl lib: 927 passed, 25 ignored)

Regression run
scripts/smoke.ps1, 60 s, release builds, run back to back with XCL_PREPARE=0 against the same unstaged hard-link/junction view of the title (the original game folder was not modified). Input schedule: XCL_PRESS_AT=2:B,4:B,6:B,8:B and XCL_PRESS_A_AT=10,15,20,25,30,40.

main:

xcl-smoke v1
commit: e429936c10a5b8aa09470ff99dfc8c8d3d8c56fd
gpu: NVIDIA GeForce RTX 4090
title: 679c71f7
seconds: 60
exit: 0x0
frames shown: 1325 (PresentX 1325)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 17168 MB

PR:

xcl-smoke v1
commit: 93ea614b216066b401cba8533c0108912c9f01c3
gpu: NVIDIA GeForce RTX 4090
title: 679c71f7
seconds: 60
exit: 0x0
frames shown: 1380 (PresentX 1380)
presents per 2 s (last 3): 54 60 60
device removals: 0
crashes: 0
peak commit: 16368 MB

Not tested

  • AMD (verification pending; the #1679 reporters are asked to re-test)

AI use

  • Claude Code (Claude Opus 5.5): applied the reviewer's patch on current main, ran tests and smoke, wrote this description 🤖 Generated with Claude Code
<!-- greyfinch-sync:ivall/xcl:issue:5481764543 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1908). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-24T22:59:52Z. --- Follow-up to #1679. **What is in it** - Direct DXIL MSAA image loads now clamp an out-of-range sample index to sample 0 before the load. The result for such indices is still zeroed afterwards, so visible behavior for valid indices is unchanged, but the load itself never addresses a sample past the texture's count. - Based on main after #1900 and keeps its ordering: the sample count (`getDimensions`) is read in its own block, and the clamped `textureLoad`s start a new block, so no `textureLoad` follows `getDimensions` in one basic block. `direct_msaa_loads_precede_get_dimensions` still passes. - `TRANSLATOR_VERSION` 7 -> 8 so cached direct containers re-key. - Patch as suggested by @imnicho in the #1679 review. Thanks! **Tested** - RTX 4090, Windows 11, Rust stable - `cargo test -p xcl --lib msaa -- --include-ignored`: 6 passed, incl. `gpu_direct_msaa_image_loads` on the GPU and `direct_msaa_loads_precede_get_dimensions` - `cargo test -p xcl --lib gpu::dxil`: 101 passed, 0 failed, 3 ignored - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp`: 261 passed, 0 failed, 18 ignored - `cargo build --workspace` and `cargo test --workspace -- --test-threads=4`: 0 failed (xcl lib: 927 passed, 25 ignored) **Regression run** `scripts/smoke.ps1`, 60 s, release builds, run back to back with `XCL_PREPARE=0` against the same unstaged hard-link/junction view of the title (the original game folder was not modified). Input schedule: `XCL_PRESS_AT=2:B,4:B,6:B,8:B` and `XCL_PRESS_A_AT=10,15,20,25,30,40`. main: ``` xcl-smoke v1 commit: e429936c10a5b8aa09470ff99dfc8c8d3d8c56fd gpu: NVIDIA GeForce RTX 4090 title: 679c71f7 seconds: 60 exit: 0x0 frames shown: 1325 (PresentX 1325) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 17168 MB ``` PR: ``` xcl-smoke v1 commit: 93ea614b216066b401cba8533c0108912c9f01c3 gpu: NVIDIA GeForce RTX 4090 title: 679c71f7 seconds: 60 exit: 0x0 frames shown: 1380 (PresentX 1380) presents per 2 s (last 3): 54 60 60 device removals: 0 crashes: 0 peak commit: 16368 MB ``` **Not tested** - AMD (verification pending; the #1679 reporters are asked to re-test) **AI use** - Claude Code (Claude Opus 5.5): applied the reviewer's patch on current main, ran tests and smoke, wrote this description 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Melow-code commented 2026-11-24 23:10:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Melow-code on 2026-11-24T23:10:10Z.

Review: COMMENTED


The clamp-to-0 approach is reasonable, but the RX 9070 crash report from HKEY-Funk-Machine suggests the access violation is not caused by the sample index alone. Agree with imnicho that this should wait for #1900 and an RDNA4 investigation.

<!-- greyfinch-sync:ivall/xcl:review:6048869156 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1908#pullrequestreview-6048869156). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-24T23:10:10Z. **Review:** COMMENTED --- The clamp-to-0 approach is reasonable, but the RX 9070 crash report from HKEY-Funk-Machine suggests the access violation is not caused by the sample index alone. Agree with imnicho that this should wait for #1900 and an RDNA4 investigation.
HKEY-Funk-Machine commented 2026-11-25 00:08:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by HKEY-Funk-Machine on 2026-11-24T23:09:32Z.


@bmjask @imnicho retested as asked: on the RX 9070, gpu_direct_msaa_image_loads still ends the process with 0xc0000005 on #1908 at b5cfa8c. It's the same as on 758e341, in debug and in release. I also split the test to find which instruction does it: every load from a multisampled texture crashes, including a plain IMAGE_LOAD with an in-range sample index. So the out-of-range clamp can't be the fix on this card.

The test's program reduced to one MIMG instruction at a time (local change only: S_ENDPGM after the one instruction, same T#s and VGPRs as the test):

# instruction result
0 IMAGE_LOAD 2D MSAA, DMASK 0xF (sample = fragment 0..3, count 4) 0xc0000005
1 IMAGE_MSAA_LOAD 2D MSAA 0xc0000005
2 IMAGE_GET_RESINFO 2D MSAA passes
3 IMAGE_LOAD 2D MSAA array, DMASK 0x1 (sample 0..1, count 2) 0xc0000005
4 IMAGE_MSAA_LOAD 2D MSAA array 0xc0000005
5 IMAGE_GET_RESINFO 2D MSAA array passes
6 IMAGE_MSAA_LOAD D16 0xc0000005

In every crashing case, translation and check() (validation) finish, and the access violation comes inside runner::run_with_statics, so at pipeline creation or dispatch. The size queries on the same two textures (same descriptors) run fine. So it looks like the direct path's Texture2DMS / Texture2DMSArray load itself (dx.op.textureLoad with a sample index) that the AMD driver doesn't take. It doesn't look like texture creation or binding. A compare that might help: the same multisampled load through the HLSL path on this card, to see whether DXC's form of Texture2DMS.Load differs from ours (the sample-index operand, or the offsets / unused coordinate). I haven't done that.

Tested

  • Clean PR head b5cfa8c (on main 689f2db). XCL_REQUIRE_GPU=1 cargo test -p xcl --lib gpu::dxil::msaa_tests -- --test-threads=1: direct_msaa_store_is_rejected ... ok, gpu_direct_msaa_image_loads exits 0xc0000005. Release, the test alone: same.
  • The per-instruction table: the same test with a local, uncommitted change that keeps only one MIMG instruction, debug.
  • AMD Radeon RX 9070 (RDNA4, native wave64), driver 32.0.32015.7029, Ryzen 9 7945HX3D, 32 GB, Windows 11 Pro 26300, Rust 1.100.0, DXC 1.9.2602.17.

Not tested: which module faults (no dump), pipeline creation vs dispatch, the HLSL-path compare above, other AMD generations.

AI use: Claude Code (Claude Opus 5.5) ran the tests, made the local bisect change and wrote this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7147080319 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1908#issuecomment-7147080319). Originally posted by [HKEY-Funk-Machine](https://github.com/HKEY-Funk-Machine) on 2026-11-24T23:09:32Z. --- @bmjask @imnicho retested as asked: **on the RX 9070, `gpu_direct_msaa_image_loads` still ends the process with `0xc0000005` on #1908 at `b5cfa8c`.** It's the same as on `758e341`, in debug and in release. I also split the test to find which instruction does it: **every load from a multisampled texture crashes, including a plain `IMAGE_LOAD` with an in-range sample index.** So the out-of-range clamp can't be the fix on this card. The test's program reduced to one MIMG instruction at a time (local change only: `S_ENDPGM` after the one instruction, same T#s and VGPRs as the test): | # | instruction | result | |---|---|---| | 0 | `IMAGE_LOAD` 2D MSAA, DMASK 0xF (sample = fragment 0..3, count 4) | `0xc0000005` | | 1 | `IMAGE_MSAA_LOAD` 2D MSAA | `0xc0000005` | | 2 | `IMAGE_GET_RESINFO` 2D MSAA | passes | | 3 | `IMAGE_LOAD` 2D MSAA array, DMASK 0x1 (sample 0..1, count 2) | `0xc0000005` | | 4 | `IMAGE_MSAA_LOAD` 2D MSAA array | `0xc0000005` | | 5 | `IMAGE_GET_RESINFO` 2D MSAA array | passes | | 6 | `IMAGE_MSAA_LOAD` D16 | `0xc0000005` | In every crashing case, translation and `check()` (validation) finish, and the access violation comes inside `runner::run_with_statics`, so at pipeline creation or dispatch. The size queries on the same two textures (same descriptors) run fine. So it looks like the direct path's `Texture2DMS` / `Texture2DMSArray` load itself (`dx.op.textureLoad` with a sample index) that the AMD driver doesn't take. It doesn't look like texture creation or binding. A compare that might help: the same multisampled load through the HLSL path on this card, to see whether DXC's form of `Texture2DMS.Load` differs from ours (the sample-index operand, or the offsets / unused coordinate). I haven't done that. **Tested** - Clean PR head `b5cfa8c` (on `main` `689f2db`). `XCL_REQUIRE_GPU=1 cargo test -p xcl --lib gpu::dxil::msaa_tests -- --test-threads=1`: `direct_msaa_store_is_rejected ... ok`, `gpu_direct_msaa_image_loads` exits `0xc0000005`. Release, the test alone: same. - The per-instruction table: the same test with a local, uncommitted change that keeps only one MIMG instruction, debug. - AMD Radeon RX 9070 (RDNA4, native wave64), driver 32.0.32015.7029, Ryzen 9 7945HX3D, 32 GB, Windows 11 Pro 26300, Rust 1.100.0, DXC 1.9.2602.17. **Not tested:** which module faults (no dump), pipeline creation vs dispatch, the HLSL-path compare above, other AMD generations. AI use: Claude Code (Claude Opus 5.5) ran the tests, made the local bisect change and wrote this comment.
imnicho commented 2026-11-25 00:08:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by imnicho on 2026-11-24T23:09:53Z.


@HKEY-Funk-Machine thank you for the retest and for splitting the program - that settles it. @bmjask the patch I suggested on #1679 does not fix the crash, and my heads-up there that main "will still crash" for want of it had the cause wrong. #1900 (merged at 23:08 UTC) has it: AMD's compiler fails when dx.op.getDimensions comes before dx.op.textureLoad on a dynamically indexed heap Texture2DMS in the same block, whatever the sample index.

Two consequences for this PR:

  • It now conflicts with #1900 in mimg_msaa, and the two changes pull in opposite directions: the clamp needs the sample count before the load, which is exactly the getDimensions in front of textureLoad that #1900 moved away. A plain rebase that keeps the clamp would bring the access violation back on the RDNA4 cards (the new direct_msaa_loads_precede_get_dimensions test on main should catch that).
  • What is left of the patch is hardening against an out-of-range sample index, which D3D leaves undefined but which no card in these threads has shown to misbehave (the test passes with and without the clamp on my RTX 5080, and on main after #1900 on the RX 9070 XT). If you still want it, the count would have to come from a block before the one with the loads (#1900 lists "different blocks" as not crashing). Otherwise I would close this one; sorry for the detour.

Not tested: anything on AMD (I have no such card); the "different blocks" form is taken from #1900's description, not run by me.

AI use: Claude Code with Claude Fable 5.2 read #1900 and this thread and wrote this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7147086980 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1908#issuecomment-7147086980). Originally posted by [imnicho](https://github.com/imnicho) on 2026-11-24T23:09:53Z. --- @HKEY-Funk-Machine thank you for the retest and for splitting the program - that settles it. @bmjask the patch I suggested on #1679 does not fix the crash, and my heads-up there that `main` "will still crash" for want of it had the cause wrong. #1900 (merged at 23:08 UTC) has it: AMD's compiler fails when `dx.op.getDimensions` comes before `dx.op.textureLoad` on a dynamically indexed heap `Texture2DMS` in the same block, whatever the sample index. Two consequences for this PR: - It now conflicts with #1900 in `mimg_msaa`, and the two changes pull in opposite directions: the clamp needs the sample count before the load, which is exactly the `getDimensions` in front of `textureLoad` that #1900 moved away. A plain rebase that keeps the clamp would bring the access violation back on the RDNA4 cards (the new `direct_msaa_loads_precede_get_dimensions` test on `main` should catch that). - What is left of the patch is hardening against an out-of-range sample index, which D3D leaves undefined but which no card in these threads has shown to misbehave (the test passes with and without the clamp on my RTX 5080, and on `main` after #1900 on the RX 9070 XT). If you still want it, the count would have to come from a block before the one with the loads (#1900 lists "different blocks" as not crashing). Otherwise I would close this one; sorry for the detour. Not tested: anything on AMD (I have no such card); the "different blocks" form is taken from #1900's description, not run by me. AI use: Claude Code with Claude Fable 5.2 read #1900 and this thread and wrote this comment.
HKEY-Funk-Machine commented 2026-11-25 00:08:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by HKEY-Funk-Machine on 2026-11-24T23:10:41Z.


Update: on main 20cf130 (with #1900), msaa_tests passes on the RX 9070: 5 passed, 0 failed, including gpu_direct_msaa_image_loads (debug, XCL_REQUIRE_GPU=1 cargo test -p xcl --lib gpu::dxil::msaa_tests -- --test-threads=1). That fits #1900's root cause (getDimensions before textureLoad in one block), and the single-instruction loads above likely still emitted the sample-count query. So #1908's clamp isn't needed for the crash here.

AI use: Claude Code (Claude Opus 5.5) ran the test and wrote this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7147102550 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1908#issuecomment-7147102550). Originally posted by [HKEY-Funk-Machine](https://github.com/HKEY-Funk-Machine) on 2026-11-24T23:10:41Z. --- Update: on `main` `20cf130` (with #1900), `msaa_tests` passes on the RX 9070: 5 passed, 0 failed, including `gpu_direct_msaa_image_loads` (debug, `XCL_REQUIRE_GPU=1 cargo test -p xcl --lib gpu::dxil::msaa_tests -- --test-threads=1`). That fits #1900's root cause (`getDimensions` before `textureLoad` in one block), and the single-instruction loads above likely still emitted the sample-count query. So #1908's clamp isn't needed for the crash here. AI use: Claude Code (Claude Opus 5.5) ran the test and wrote this comment.
eizispark commented 2026-11-25 00:09:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by eizispark on 2026-11-24T23:10:32Z.


Hardware test report — commit 215528e

Re-verified 215528eefe24c75cd336197e909393749fc15220 (rebased onto main 20cf13022f764208384c610c2ae6a3f4eed201a2): pass — splitting dx.op.getDimensions into its own block before br(loads_block) avoids the amdxc64.dll 0xc0000005 crash on AMD RDNA4 while clamping out-of-range MSAA sample indices (gpu_direct_msaa_image_loads and direct_msaa_loads_precede_get_dimensions both pass).

Tested

  • Hardware: Windows 11 x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver 32.0.32015.16001), 32 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) (stable-x86_64-pc-windows-msvc), debug tests + release smoke
  • cargo test -p xcl --lib msaa -- --include-ignored --test-threads=1: 6 passed, 0 failed, 0 ignored (0 skipped: gpu::dxil::msaa_tests::gpu_direct_msaa_image_loads, direct_msaa_loads_precede_get_dimensions, msaa_texture_ops_run, render_target_sample_ops_validate, direct_msaa_store_is_rejected, and hle::d3d12x::vram::tests::reserved_needs_tiled_format_and_tiled_msaa)
  • Unfiltered cargo test --workspace --no-fail-fast -- --test-threads=4: 974 passed, 2 failed, 45 ignored (8 skipped), matching main 20cf130 (0 new failures; the 2 failures are the pre-existing #1679 AMD fuzz seeds gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and fuzz_validate_and_gpu_3; 8 skipped = 6 lower_dxil f16/f32 #1426-semantics sub-cases, pso_measurement_compiles_an_exact_synthetic_record 0x887A002D, and heap_window_out_of_memory_falls_back_to_the_switch_form)
  • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp -- --test-threads=4: 261 passed, 0 failed, 18 ignored (6 skipped)

Regression run
main (20cf13022f764208384c610c2ae6a3f4eed201a2):

xcl-smoke v1
commit: 20cf13022f764208384c610c2ae6a3f4eed201a2
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1678 (PresentX 1678)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14859 MB

PR (215528eefe24c75cd336197e909393749fc15220):

xcl-smoke v1
commit: 215528eefe24c75cd336197e909393749fc15220
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1679 (PresentX 1679)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14858 MB

Not tested

  • retail run with XCL_SHADER_BACKEND=dxil / XCL_DIRECT_DXIL=1, NVIDIA/Intel GPUs, Wine/vkd3d-proton, gameplay past the menus

AI use

  • Antigravity (Google DeepMind, Gemini 4 Carbon) ran the MSAA tests, workspace test suite, and 60-second retail smoke pair and updated this report.

(Updated from earlier check on b5cfa8c)

<!-- greyfinch-sync:ivall/xcl:comment:7147099872 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1908#issuecomment-7147099872). Originally posted by [eizispark](https://github.com/eizispark) on 2026-11-24T23:10:32Z. --- ### Hardware test report — commit `215528e` Re-verified `215528eefe24c75cd336197e909393749fc15220` (rebased onto `main` `20cf13022f764208384c610c2ae6a3f4eed201a2`): **pass** — splitting `dx.op.getDimensions` into its own block before `br(loads_block)` avoids the `amdxc64.dll` `0xc0000005` crash on AMD RDNA4 while clamping out-of-range MSAA sample indices (`gpu_direct_msaa_image_loads` and `direct_msaa_loads_precede_get_dimensions` both pass). **Tested** - Hardware: Windows 11 x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver `32.0.32015.16001`), 32 GB RAM, `rustc 1.100.0 (0ef1bc386 2026-11-09)` (`stable-x86_64-pc-windows-msvc`), debug tests + release smoke - `cargo test -p xcl --lib msaa -- --include-ignored --test-threads=1`: `6 passed, 0 failed, 0 ignored` (`0 skipped`: `gpu::dxil::msaa_tests::gpu_direct_msaa_image_loads`, `direct_msaa_loads_precede_get_dimensions`, `msaa_texture_ops_run`, `render_target_sample_ops_validate`, `direct_msaa_store_is_rejected`, and `hle::d3d12x::vram::tests::reserved_needs_tiled_format_and_tiled_msaa`) - Unfiltered `cargo test --workspace --no-fail-fast -- --test-threads=4`: `974 passed, 2 failed, 45 ignored` (`8 skipped`), matching `main` `20cf130` (`0` new failures; the 2 failures are the pre-existing `#1679` AMD fuzz seeds `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` and `fuzz_validate_and_gpu_3`; `8 skipped` = 6 `lower_dxil` f16/f32 `#1426`-semantics sub-cases, `pso_measurement_compiles_an_exact_synthetic_record` `0x887A002D`, and `heap_window_out_of_memory_falls_back_to_the_switch_form`) - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp -- --test-threads=4`: `261 passed, 0 failed, 18 ignored` (`6 skipped`) **Regression run** `main` (`20cf13022f764208384c610c2ae6a3f4eed201a2`): ``` xcl-smoke v1 commit: 20cf13022f764208384c610c2ae6a3f4eed201a2 gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1678 (PresentX 1678) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14859 MB ``` PR (`215528eefe24c75cd336197e909393749fc15220`): ``` xcl-smoke v1 commit: 215528eefe24c75cd336197e909393749fc15220 gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1679 (PresentX 1679) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14858 MB ``` **Not tested** - retail run with `XCL_SHADER_BACKEND=dxil` / `XCL_DIRECT_DXIL=1`, NVIDIA/Intel GPUs, Wine/vkd3d-proton, gameplay past the menus **AI use** - Antigravity (Google DeepMind, Gemini 4 Carbon) ran the MSAA tests, workspace test suite, and 60-second retail smoke pair and updated this report. *(Updated from earlier check on `b5cfa8c`)*
lewisnic94-max commented 2026-11-25 00:18:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lewisnic94-max on 2026-11-25T00:18:42Z.

Review: COMMENTED


[P3, high confidence] A v8 cache from the previous PR head still returns its old MSAA bytecode.

I tested 215528eefe24c75cd336197e909393749fc15220 with XCL_DIRECT_DXIL=1. I seeded a dynamically indexed Texture2DMS shader on pre-#1900 commit 689f2db. In three independent upgrades, this head selected a new v8 entry. Its DXIL matched a fresh translation byte for byte. All three format branches placed the texture load in a separate block after the dimensions query.

There is one narrower case for PR testers. Earlier head b5cfa8c9944e2ff1650b0e708d4b7c4cefc21ec1 already wrote v8 entries. Across three upgrades from that head, the cached DXIL kept the old same-block order in all three branches. Fresh output had it in none. Please consider a new version for this revised emitter if caches from the earlier PR head are supported. A regression can seed that exact head and inspect the bytes returned by console_to_dxil_in(). Cache version

The targeted gpu::dxil::msaa_tests suite on this head reported 5 passed, 0 failed, 0 ignored and 0 skip notices. Windows 11 build 26200.9974, Ryzen 7 5800X, RTX 3080 driver 616.92, debug Rust 1.100.0 MSVC and DXC 1.9.2602.17. The upgrade test checked bytecode. AMD driver execution was outside this run.

Follow-up on main 8c4a46a. I applied this exact PR locally after #1898. In three upgrades per shader, v7 seeds returned fresh DXIL for both directed rounding and MSAA. With stale v8 seeds, the rounding shader still returned NaN and the MSAA shader kept the old instruction order. Adding #1947 at 1831ec4 to the same local build regenerated both shaders from v8 in all three trials per shader. Related source-hash change

Codex (GPT-6) assisted with the synthetic cache tests, disassembly checks and analysis.

<!-- greyfinch-sync:ivall/xcl:review:6049585290 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1908#pullrequestreview-6049585290). Originally posted by [lewisnic94-max](https://github.com/lewisnic94-max) on 2026-11-25T00:18:42Z. **Review:** COMMENTED --- **[P3, high confidence] A v8 cache from the previous PR head still returns its old MSAA bytecode.** I tested `215528eefe24c75cd336197e909393749fc15220` with `XCL_DIRECT_DXIL=1`. I seeded a dynamically indexed `Texture2DMS` shader on pre-#1900 commit `689f2db`. In three independent upgrades, this head selected a new v8 entry. Its DXIL matched a fresh translation byte for byte. All three format branches placed the texture load in a separate block after the dimensions query. There is one narrower case for PR testers. Earlier head `b5cfa8c9944e2ff1650b0e708d4b7c4cefc21ec1` already wrote v8 entries. Across three upgrades from that head, the cached DXIL kept the old same-block order in all three branches. Fresh output had it in none. Please consider a new version for this revised emitter if caches from the earlier PR head are supported. A regression can seed that exact head and inspect the bytes returned by `console_to_dxil_in()`. [Cache version](https://github.com/xcl-dev/xcl/blob/215528eefe24c75cd336197e909393749fc15220/crates/xcl/src/gpu/dxil/kernel.rs#L40) The targeted `gpu::dxil::msaa_tests` suite on this head reported 5 passed, 0 failed, 0 ignored and 0 skip notices. Windows 11 build 26200.9974, Ryzen 7 5800X, RTX 3080 driver 616.92, debug Rust 1.100.0 MSVC and DXC 1.9.2602.17. The upgrade test checked bytecode. AMD driver execution was outside this run. Follow-up on main `8c4a46a`. I applied this exact PR locally after #1898. In three upgrades per shader, v7 seeds returned fresh DXIL for both directed rounding and MSAA. With stale v8 seeds, the rounding shader still returned NaN and the MSAA shader kept the old instruction order. Adding #1947 at `1831ec4` to the same local build regenerated both shaders from v8 in all three trials per shader. [Related source-hash change](https://github.com/xcl-dev/xcl/pull/1947) Codex (GPT-6) assisted with the synthetic cache tests, disassembly checks and analysis.
raylitebull commented 2026-11-25 01:11:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:08:10Z.


Status check: #1900 (20cf130) already landed the MSAA textureLoad-before-getDimensions ordering fix, #1950 took TRANSLATOR_VERSION = 8, and #1947 now hashes gpu/dxil sources automatically. There is also an open [P3] review note from @lewisnic94-max on cache key safety.

Please let us know whether this PR can be closed as superseded by #1900, or rebased (without the kernel.rs version bump) if there are still separate blocks you want hardened.

<!-- greyfinch-sync:ivall/xcl:comment:7149241269 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1908#issuecomment-7149241269). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T01:08:10Z. --- Status check: `#1900` (`20cf130`) already landed the MSAA `textureLoad`-before-`getDimensions` ordering fix, `#1950` took `TRANSLATOR_VERSION = 8`, and `#1947` now hashes `gpu/dxil` sources automatically. There is also an open `[P3]` review note from @lewisnic94-max on cache key safety. Please let us know whether this PR can be closed as superseded by `#1900`, or rebased (without the `kernel.rs` version bump) if there are still separate blocks you want hardened.
JJAutoCompare commented 2026-11-25 02:08:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T01:22:26Z.


Empirical test report — PR #1908 (215528eefe24c75cd336197e909393749fc15220)

  • PR head commit: 215528eefe24c75cd336197e909393749fc15220 (refs/pull/1908/head)
  • origin/main commit: 5796cc467d80e3dac5d7d231ec34f1b0bebce169
  • Merge check (git merge-tree --write-tree origin/main HEAD): clean (exit 0, tree d39b01dfdf46a7ee75a82572dd7e3f94d1dd545b)
  • Diff scope (origin/main...HEAD): crates/xcl/src/gpu/dxil/kernel.rs (+1/-1), crates/xcl/src/gpu/dxil/lower_image.rs (+15/-7)

Tested

  • Hardware & OS: Intel Arc A770 Graphics (16258 MiB VRAM, driver 32.0.101.9175, XCL_ADAPTER=A770, wave32 / 8–32 lanes), AMD Ryzen 7 3800X (6 cores / 12 logical processors), Windows 11 Enterprise Evaluation 10.0.26200 (build 26200)
  • Toolchain & profile: rustc 1.100.0 (0ef1bc386 2026-11-09), cargo 1.100.0 (3acc79c0c 2026-11-05), debug (dev/test) profile, DXC 1.9.2609.5 (01b62ad4) (dxcompiler.dll + dxil.dll)
  • Build: cargo test --workspace --no-run and cargo build --workspace both exited 0.
  • Targeted MSAA / Direct DXIL tests:
    • cargo test -p xcl --lib gpu::dxil::msaa_tests -- --test-threads=4 --show-output: 5 passed, 0 failed, 0 ignored, 0 skipped (all 5 ran on the Arc A770 / validator):
      • gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions (ok)
      • gpu::dxil::msaa_tests::direct_msaa_store_is_rejected (ok)
      • gpu::dxil::msaa_tests::gpu_direct_msaa_image_loads (ok)
      • gpu::dxil::msaa_tests::msaa_texture_ops_run (ok)
      • gpu::dxil::msaa_tests::render_target_sample_ops_validate (ok)
  • Full workspace suite:
    • cargo test --workspace -- --test-threads=4 --show-output: stopped after xcl --lib (903 passed, 24 failed, 25 ignored, 22 SKIPPED lines)
    • cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output: 951 passed, 25 failed, 45 ignored across all 20 workspace test targets (exit 101):
      • xcl (--lib): 903 passed, 24 failed, 25 ignored
      • tests/e2e.rs: 2 passed, 1 failed, 0 ignored
      • Remaining 18 test targets (src/main.rs, bcpack_parity, console_dlls_e2e, console_shaders, disasm_e2e, gpu_compute_e2e, gpu_pso_e2e, heap_probe, low_va, pls_quota, predication_e2e, rpf_e2e, shaders_e2e, sparse_reinit, texture_states, xg_oracle, xcl-testtitle, doc-tests): 46 passed, 0 failed, 20 ignored
    • Failures (25 total, all Arc A770 / host-specific, none in MSAA):
      • 20× CreateComputePipelineState: The parameter is incorrect. (0x80070057) on Arc A770 (no native FP64 / rejected shader ops): gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0,1,2,3}, gpu::dxil::ops_tests::{doubles_match_cpu,groupshared_barrier_and_atomics_run}, gpu::dxil::round_tests::{gpu_direct_f32_round_modes_dynamic_and_denormals,gpu_direct_f32_round_modes_static}, gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu, gpu::recomp::tests::{gpu_clamp_and_omod_per_instruction,gpu_f64_class_compare,gpu_f64_compares_with_nan,gpu_f64_literal_high_word,gpu_f64_math_random,gpu_f64_roots,gpu_f64_rounding_and_conversions,gpu_float_compares_random,gpu_frexp_f64_exp_and_mant,gpu_ldexp_f64,gpu_rndne_f64}
      • 4× Arc A770 shader/driver value differences: gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction, gpu::recomp::tests::gpu_ps_image_sample_offset_implicit_lod_between_mips, gpu::recomp::tests::gpu_valu_16_and_64_bit, gpu::recomp::tests::gpu_wave64_ps_whole_wave_reductions
      • 1× tests/e2e.rs (test_title_runs_and_game_folder_is_untouched): D3D12.X: dynamic depth bias via RSSetDepthBiasX (#94) (top-right [0, 0, 255, 255], expected green)
  • SKIPPED GPU tests (25 SKIPPED lines across 15 distinct tests — reported ok by Cargo, not counted as coverage):
    • no wave64 (18 lines across 10 tests): gpu::recomp::lower::tests::{a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu}, gpu::recomp::lower_dxil::tests::{a_per_lane_2d_or_3d_group_runs_on_the_gpu,f16_programs_on_the_gpu (2),f32_programs_on_the_gpu (6),integer_programs_on_the_gpu (2)}, gpu::recomp::tests::{gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware}
    • wave32, per-lane form: refused (#1426 semantics, 3 sub-cases inside 2 tests above): gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu (V_MUL_F16, V_PK_MUL_F16: VOP3 modifiers), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (V_CVT_F16_F32)
    • Host / adapter feature skips (5 tests):
      • shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable driver cache (Windows Developer Mode required, 0x887A002D)
      • placed_title_textures_share_vram_and_preserve_pixels: tiled tier < 2
      • test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dll
      • heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
      • uploads_start_from_each_subresources_state: no D3D12 debug layer (0x887A002D)

Not tested

  • AMD GPUs (in particular RDNA4 out-of-range ld2dms fault behavior and amdxc64.dll basic-block compilation) and NVIDIA GPUs
  • Native wave64 hardware (all wave64-only GPU test cases skipped on Arc A770)
  • Retail title / scripts/smoke.ps1 regression run (no retail game package on this test host)
  • D3D12 debug-layer, Windows Developer Mode driver-cache, tiled tier 2, and heap-window test paths (skipped on this host)
  • Release build profile

AI use

  • T3 Code / Antigravity (gemini-4-neon) checked out PR #1908, built the workspace, ran the targeted and full-workspace test suites on the Intel Arc A770 host above, parsed the logs, and posted this test report.
<!-- greyfinch-sync:ivall/xcl:comment:7149478947 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1908#issuecomment-7149478947). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T01:22:26Z. --- ### Empirical test report — PR #1908 (`215528eefe24c75cd336197e909393749fc15220`) - **PR head commit:** `215528eefe24c75cd336197e909393749fc15220` (`refs/pull/1908/head`) - **`origin/main` commit:** `5796cc467d80e3dac5d7d231ec34f1b0bebce169` - **Merge check (`git merge-tree --write-tree origin/main HEAD`):** clean (exit `0`, tree `d39b01dfdf46a7ee75a82572dd7e3f94d1dd545b`) - **Diff scope (`origin/main...HEAD`):** `crates/xcl/src/gpu/dxil/kernel.rs` (+1/-1), `crates/xcl/src/gpu/dxil/lower_image.rs` (+15/-7) **Tested** - **Hardware & OS:** Intel Arc A770 Graphics (`16258 MiB` VRAM, driver `32.0.101.9175`, `XCL_ADAPTER=A770`, wave32 / 8–32 lanes), AMD Ryzen 7 3800X (6 cores / 12 logical processors), Windows 11 Enterprise Evaluation `10.0.26200` (build `26200`) - **Toolchain & profile:** `rustc 1.100.0 (0ef1bc386 2026-11-09)`, `cargo 1.100.0 (3acc79c0c 2026-11-05)`, debug (`dev`/`test`) profile, DXC `1.9.2609.5 (01b62ad4)` (`dxcompiler.dll` + `dxil.dll`) - **Build:** `cargo test --workspace --no-run` and `cargo build --workspace` both exited `0`. - **Targeted MSAA / Direct DXIL tests:** - `cargo test -p xcl --lib gpu::dxil::msaa_tests -- --test-threads=4 --show-output`: **5 passed, 0 failed, 0 ignored, 0 skipped** (all 5 ran on the Arc A770 / validator): - `gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions` (ok) - `gpu::dxil::msaa_tests::direct_msaa_store_is_rejected` (ok) - `gpu::dxil::msaa_tests::gpu_direct_msaa_image_loads` (ok) - `gpu::dxil::msaa_tests::msaa_texture_ops_run` (ok) - `gpu::dxil::msaa_tests::render_target_sample_ops_validate` (ok) - **Full workspace suite:** - `cargo test --workspace -- --test-threads=4 --show-output`: stopped after `xcl --lib` (`903 passed, 24 failed, 25 ignored`, 22 `SKIPPED` lines) - `cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output`: **951 passed, 25 failed, 45 ignored** across all 20 workspace test targets (exit `101`): - `xcl` (`--lib`): 903 passed, 24 failed, 25 ignored - `tests/e2e.rs`: 2 passed, 1 failed, 0 ignored - Remaining 18 test targets (`src/main.rs`, `bcpack_parity`, `console_dlls_e2e`, `console_shaders`, `disasm_e2e`, `gpu_compute_e2e`, `gpu_pso_e2e`, `heap_probe`, `low_va`, `pls_quota`, `predication_e2e`, `rpf_e2e`, `shaders_e2e`, `sparse_reinit`, `texture_states`, `xg_oracle`, `xcl-testtitle`, doc-tests): 46 passed, 0 failed, 20 ignored - **Failures (25 total, all Arc A770 / host-specific, none in MSAA):** - 20× `CreateComputePipelineState: The parameter is incorrect. (0x80070057)` on Arc A770 (no native FP64 / rejected shader ops): `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0,1,2,3}`, `gpu::dxil::ops_tests::{doubles_match_cpu,groupshared_barrier_and_atomics_run}`, `gpu::dxil::round_tests::{gpu_direct_f32_round_modes_dynamic_and_denormals,gpu_direct_f32_round_modes_static}`, `gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu`, `gpu::recomp::tests::{gpu_clamp_and_omod_per_instruction,gpu_f64_class_compare,gpu_f64_compares_with_nan,gpu_f64_literal_high_word,gpu_f64_math_random,gpu_f64_roots,gpu_f64_rounding_and_conversions,gpu_float_compares_random,gpu_frexp_f64_exp_and_mant,gpu_ldexp_f64,gpu_rndne_f64}` - 4× Arc A770 shader/driver value differences: `gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction`, `gpu::recomp::tests::gpu_ps_image_sample_offset_implicit_lod_between_mips`, `gpu::recomp::tests::gpu_valu_16_and_64_bit`, `gpu::recomp::tests::gpu_wave64_ps_whole_wave_reductions` - 1× `tests/e2e.rs` (`test_title_runs_and_game_folder_is_untouched`): `D3D12.X: dynamic depth bias via RSSetDepthBiasX (#94)` (`top-right [0, 0, 255, 255]`, expected green) - **`SKIPPED` GPU tests (25 `SKIPPED` lines across 15 distinct tests — reported `ok` by Cargo, not counted as coverage):** - `no wave64` (18 lines across 10 tests): `gpu::recomp::lower::tests::{a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu}`, `gpu::recomp::lower_dxil::tests::{a_per_lane_2d_or_3d_group_runs_on_the_gpu,f16_programs_on_the_gpu (2),f32_programs_on_the_gpu (6),integer_programs_on_the_gpu (2)}`, `gpu::recomp::tests::{gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware}` - `wave32, per-lane form: refused` (`#1426` semantics, 3 sub-cases inside 2 tests above): `gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu` (`V_MUL_F16`, `V_PK_MUL_F16: VOP3 modifiers`), `gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu` (`V_CVT_F16_F32`) - Host / adapter feature skips (5 tests): - `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record`: cannot disable driver cache (Windows Developer Mode required, `0x887A002D`) - `placed_title_textures_share_vram_and_preserve_pixels`: `tiled tier < 2` - `test_title_draws_with_a_root_signature_under_the_debug_layer`: `no d3d12SDKLayers.dll` - `heap_window_out_of_memory_falls_back_to_the_switch_form`: `no heap windows` - `uploads_start_from_each_subresources_state`: `no D3D12 debug layer (0x887A002D)` **Not tested** - AMD GPUs (in particular RDNA4 out-of-range `ld2dms` fault behavior and `amdxc64.dll` basic-block compilation) and NVIDIA GPUs - Native wave64 hardware (all wave64-only GPU test cases skipped on Arc A770) - Retail title / `scripts/smoke.ps1` regression run (no retail game package on this test host) - D3D12 debug-layer, Windows Developer Mode driver-cache, tiled tier 2, and heap-window test paths (skipped on this host) - Release build profile **AI use** - `T3 Code / Antigravity (gemini-4-neon)` checked out PR #1908, built the workspace, ran the targeted and full-workspace test suites on the Intel Arc A770 host above, parsed the logs, and posted this test report.
DavidM1911 commented 2026-11-25 03:05:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T02:16:00Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7150510850 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1908#issuecomment-7150510850). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T02:16:00Z. --- 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!
lewisnic94-max commented 2026-11-25 03:05:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lewisnic94-max on 2026-11-25T02:27:19Z.


@raylitebull, I’m withdrawing my P3 cache objection for a rebase onto current main. It reproduced on the standalone 215528e head because the earlier preview and revised emitter both used v8. After #1947 merged, all 12 populated-cache upgrades on b8428c5 returned DXIL byte-for-byte identical to fresh translation. We tested v7 and v8 seeds with both the rounding and MSAA shaders, three runs per combination.

On main cbc296a, applying only the MSAA emitter change altered the direct source fingerprint with TRANSLATOR_VERSION held at 9. I’d drop the kernel.rs bump on rebase.

#1900 addressed the reported RDNA4 instruction-ordering crash. The remaining hardening is a separate decision. Main zeroes the result after the load. #1908 also redirects an out-of-range sample index to 0 before loading, while keeping getDimensions and textureLoad in separate blocks.

OpenAI Codex (GPT-6) assisted with the cache tests, source comparison and this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7150743954 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1908#issuecomment-7150743954). Originally posted by [lewisnic94-max](https://github.com/lewisnic94-max) on 2026-11-25T02:27:19Z. --- @raylitebull, I’m withdrawing my P3 cache objection for a rebase onto current main. It reproduced on the standalone `215528e` head because the earlier preview and revised emitter both used v8. After #1947 merged, all 12 populated-cache upgrades on `b8428c5` returned DXIL byte-for-byte identical to fresh translation. We tested v7 and v8 seeds with both the rounding and MSAA shaders, three runs per combination. On main `cbc296a`, applying only the MSAA emitter change altered the direct source fingerprint with `TRANSLATOR_VERSION` held at 9. I’d drop the `kernel.rs` bump on rebase. #1900 addressed the reported RDNA4 instruction-ordering crash. The remaining hardening is a separate decision. Main zeroes the result after the load. #1908 also redirects an out-of-range sample index to 0 before loading, while keeping `getDimensions` and `textureLoad` in separate blocks. OpenAI Codex (GPT-6) assisted with the cache tests, source comparison and this reply.
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!1898
No description provided.