dxil: support 64-bit typed image_atomic_* via SM 6.6 heap atomics #1948

Manually merged
github merged 1 commit from gh-pr/1948/head into gh-pr/1948/base 2026-11-26 05:11:03 +00:00
Owner

@⁠raylitebull on GitHub · 2026-11-24 23:47 UTC · original
raylitebull:feat/image-atomic-64 → main · +218 −3 · 3 files · 1 commits · merged 2026-11-25 18:13 UTC

Supports 64-bit typed image_atomic_* instructions in the direct RDNA2 -> DXIL translator using SM 6.6 Int64Ops + AtomicInt64Typed + AtomicInt64Heap descriptor-heap atomics (RWTexture*<U64|I64>), instead of silently lowering DMASK=0x3 (or 0xF for cmpswap/fcmpswap) 64-bit typed image atomics as 32-bit RWTexture*<uint> atomics.

Part of #1269 and #1833.

What is in it

  • crates/xcl/src/gpu/dxil/lower_image.rs & lower_mem.rs: detect 64-bit typed image atomics via DMASK (comps.len() == 4 for cmpswap/fcmpswap, comps.len() == 2 for all other atomic_* variants) while keeping 32-bit cmpswap (DMASK=0x3) untouched; add mimg_atomic64, texel_cas64, and IEEE-754 f64 texel_fcas64 (via pub(super) fn feq_bits64 in lower_mem.rs, matching #2011), passing #1969's OOB-guarded run predicate into mimg_atomic64 (self.guarded(run, ...)) and supporting all 16 ops (add, sub, smin, umin, smax, umax, and, or, xor, swap, cmpswap, fcmpswap, inc, dec, fmin, fmax) with CompType::I64/CompType::U64 resources, heap_typed_atomic64(), and GLC 2-VGPR writeback.
  • crates/xcl/src/gpu/dxil/ops_tests.rs: add direct_image_atomic_64bit_validates compiling and validating all 16 64-bit variants with dxil.dll 1.8 and verifying 32-bit IMAGE_ATOMIC_CMPSWAP (DMASK=0x3) remains atomicCompareExchange.i32.

Tested

  • Toolchain: Windows 11 x64, rustc 1.99.1 (58cf8f9c3 2026-10-13), rebased cleanly onto aaa0936 (d88bf95).
  • d88bf95 was rebased cleanly onto aaa0936 (resolving the ops_tests.rs EOF append conflict via pure git during a local test hold) and is queued for GitHub Actions Build and test + fresh AMD / NVIDIA verification (gpu::dxil::ops_tests::direct_image_atomic_64bit_validates).
  • Earlier pre-rebase head 1e4f2bd (onto 62265d3) passed cargo check --workspace --tests, gpu::dxil::ops_tests (21/21 on AMD RX 9070 XT), XCL_REQUIRE_GPU=mesh cargo test --workspace (977/0/43 on NVIDIA RTX 5070 Ti, @futurepro62), and 60 s scripts/smoke.ps1 (1622/1629 frames on RTX 3060, @Anon64).
  • Exact-head community verification on d88bf95:
    • @futurepro62: NVIDIA RTX 5070 Ti (1140 passed, 0 failed, 44 ignored) and AMD Radeon RDNA2 iGPU (1151 passed, 0 failed, 46 ignored), direct_image_atomic_64bit_validates passed on both.
    • @WebIdentity1 (NVIDIA RTX 3090): gpu_image_fcas64_preserves_ieee_and_guards passed (1/0/0, 3 dispatches).
    • @JJAutoCompare: direct_image_atomic_64bit_validates passed (1/0/0, 2 DXIL containers validated).
    • @Toons29: AMD Radeon RX 9070 60 s scripts/smoke.ps1 pair passed (1629 vs 1628 frames, 0 device removals, 0 crashes).

Regression run
60 s scripts/smoke.ps1 pair on exact head d88bf95 vs main 1a0bbe3a (AMD Radeon RX 9070, driver 32.0.32029.2010, Windows 11 26300, release, XCL_NETWORK=0 on a retail title), contributed by @Toons29:

main:

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1628 (PresentX 1628)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14561 MB

this PR:

xcl-smoke v1
commit: d88bf95a8260fe4ab0e6f53f3ecb8add576459f4
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1629 (PresentX 1629)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14595 MB

Not tested

  • cargo check / gpu::dxil::ops_tests and scripts/smoke.ps1 on rebased head d88bf95, independent AMD GPU runtime verification of 64-bit typed image atomics (XCL_DIRECT_DXIL=1), wave32-only AMD adapters, and Linux/Wine/vkd3d-proton.

AI use

  • Antigravity assisted with implementation, rebase, and DXIL validation tests; the author reviewed the diff.
**@⁠raylitebull** on GitHub · 2026-11-24 23:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948) `raylitebull:feat/image-atomic-64` → `main` · +218 −3 · 3 files · 1 commits · merged 2026-11-25 18:13 UTC Supports 64-bit typed `image_atomic_*` instructions in the direct RDNA2 -> DXIL translator using SM 6.6 `Int64Ops` + `AtomicInt64Typed` + `AtomicInt64Heap` descriptor-heap atomics (`RWTexture*<U64|I64>`), instead of silently lowering `DMASK=0x3` (or `0xF` for `cmpswap`/`fcmpswap`) 64-bit typed image atomics as 32-bit `RWTexture*<uint>` atomics. Part of #1269 and #1833. **What is in it** - `crates/xcl/src/gpu/dxil/lower_image.rs` & `lower_mem.rs`: detect 64-bit typed image atomics via `DMASK` (`comps.len() == 4` for `cmpswap`/`fcmpswap`, `comps.len() == 2` for all other `atomic_*` variants) while keeping 32-bit `cmpswap` (`DMASK=0x3`) untouched; add `mimg_atomic64`, `texel_cas64`, and IEEE-754 `f64` `texel_fcas64` (via `pub(super) fn feq_bits64` in `lower_mem.rs`, matching `#2011`), passing `#1969`'s OOB-guarded `run` predicate into `mimg_atomic64` (`self.guarded(run, ...)`) and supporting all 16 ops (`add`, `sub`, `smin`, `umin`, `smax`, `umax`, `and`, `or`, `xor`, `swap`, `cmpswap`, `fcmpswap`, `inc`, `dec`, `fmin`, `fmax`) with `CompType::I64`/`CompType::U64` resources, `heap_typed_atomic64()`, and `GLC` 2-VGPR writeback. - `crates/xcl/src/gpu/dxil/ops_tests.rs`: add `direct_image_atomic_64bit_validates` compiling and validating all 16 64-bit variants with `dxil.dll 1.8` and verifying 32-bit `IMAGE_ATOMIC_CMPSWAP` (`DMASK=0x3`) remains `atomicCompareExchange.i32`. **Tested** - Toolchain: Windows 11 x64, `rustc 1.99.1 (58cf8f9c3 2026-10-13)`, rebased cleanly onto `aaa0936` (`d88bf95`). - `d88bf95` was rebased cleanly onto `aaa0936` (resolving the `ops_tests.rs` EOF append conflict via pure git during a local test hold) and is queued for GitHub Actions `Build and test` + fresh AMD / NVIDIA verification (`gpu::dxil::ops_tests::direct_image_atomic_64bit_validates`). - Earlier pre-rebase head `1e4f2bd` (onto `62265d3`) passed `cargo check --workspace --tests`, `gpu::dxil::ops_tests` (`21/21` on AMD RX 9070 XT), `XCL_REQUIRE_GPU=mesh cargo test --workspace` (`977/0/43` on NVIDIA RTX 5070 Ti, `@futurepro62`), and 60 s `scripts/smoke.ps1` (`1622/1629` frames on RTX 3060, `@Anon64`). - Exact-head community verification on `d88bf95`: - `@futurepro62`: NVIDIA RTX 5070 Ti (`1140 passed, 0 failed, 44 ignored`) and AMD Radeon RDNA2 iGPU (`1151 passed, 0 failed, 46 ignored`), `direct_image_atomic_64bit_validates` passed on both. - `@WebIdentity1` (NVIDIA RTX 3090): `gpu_image_fcas64_preserves_ieee_and_guards` passed (`1/0/0`, 3 dispatches). - `@JJAutoCompare`: `direct_image_atomic_64bit_validates` passed (`1/0/0`, 2 DXIL containers validated). - `@Toons29`: AMD Radeon RX 9070 60 s `scripts/smoke.ps1` pair passed (`1629` vs `1628` frames, `0` device removals, `0` crashes). **Regression run** 60 s `scripts/smoke.ps1` pair on exact head `d88bf95` vs `main` `1a0bbe3a` (AMD Radeon RX 9070, driver 32.0.32029.2010, Windows 11 26300, release, `XCL_NETWORK=0` on a retail title), contributed by `@Toons29`: main: ``` xcl-smoke v1 commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6 gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1628 (PresentX 1628) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14561 MB ``` this PR: ``` xcl-smoke v1 commit: d88bf95a8260fe4ab0e6f53f3ecb8add576459f4 gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1629 (PresentX 1629) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14595 MB ``` **Not tested** - `cargo check` / `gpu::dxil::ops_tests` and `scripts/smoke.ps1` on rebased head `d88bf95`, independent AMD GPU runtime verification of 64-bit typed image atomics (`XCL_DIRECT_DXIL=1`), wave32-only AMD adapters, and Linux/Wine/vkd3d-proton. **AI use** - Antigravity assisted with implementation, rebase, and DXIL validation tests; the author reviewed the diff.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:11:01 +00:00
github manually merged commit d88bf95a82 into gh-pr/1948/base 2026-11-26 05:11:03 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 23:57 UTC · original · edited 2026-11-25 00:04 UTC

Full-suite run, since this PR has no test report yet. Tested exact head 1e4f2bd (on its base 62265d3).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::dxil::fuzz_tests: 977 passed, 0 failed, 43 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_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, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: direct_image_atomic_64bit_validates.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 986 passed, 0 failed, 45 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 62265d3 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (#1651) and the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 23:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7147988790) · edited 2026-11-25 00:04 UTC Full-suite run, since this PR has no test report yet. Tested exact head `1e4f2bd` (on its base `62265d3`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::dxil::fuzz_tests`: **977 passed, 0 failed, 43 ignored**. SKIPPED (no wave64): `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `a_per_lane_2d_or_3d_group_runs_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`, `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu`. - The new tests ran and passed: `direct_image_atomic_64bit_validates`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`: **986 passed, 0 failed, 45 ignored**. SKIPPED: `f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `--skip` leaves out tests that fail on main `62265d3` too, not because of this PR. On NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651) and the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests ([follow-up on #1651](https://git.gtahub.st/github/xcl-dev--xcl/issues/1651)) fail because `runner::skip_test` turns their skips into failures under `XCL_REQUIRE_GPU=mesh`, and `gpu::dxil::fuzz_tests` seeds 70, 545, 1019 and 1507 fail `CreateComputePipelineState` with `E_OUTOFMEMORY` on this card (drivers 616.64 and 621.40). On AMD: `fuzz_validate_and_gpu_1` fails on seed 540 (`res[833]` 0x7 vs CPU 0x6). The AMD run does not set `XCL_REQUIRE_GPU`. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠Anon64 on GitHub · 2026-11-25 00:18 UTC · original

Regression run for this PR: head 1e4f2bd, based on main 62265d3. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s, in one batch with the main run.

main 62265d3:

xcl-smoke v1
commit: 62265d3bbde2255f849fb650cc29872df91a4cf0
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1629 (PresentX 1629)
presents per 2 s (last 3): 60 60 47
device removals: 0
crashes: 0
peak commit: 23489 MB

this PR:

xcl-smoke v1
commit: 1e4f2bdaddd438a31c778d43dc992c8a0455f6a9
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1622 (PresentX 1623)
presents per 2 s (last 3): 60 46 54
device removals: 0
crashes: 0
peak commit: 23407 MB

No device removals or crashes; 99 % of main's frames, 99 % of its peak commit.

Not tested: the whole suite; the direct DXIL path this PR changes (these runs use the default HLSL path, XCL_DIRECT_DXIL unset).

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-25 00:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7148373830) Regression run for this PR: head `1e4f2bd`, based on `main` `62265d3`. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s, `scripts/smoke.ps1` on a retail title for 60 s, in one batch with the `main` run. main `62265d3`: ``` xcl-smoke v1 commit: 62265d3bbde2255f849fb650cc29872df91a4cf0 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1629 (PresentX 1629) presents per 2 s (last 3): 60 60 47 device removals: 0 crashes: 0 peak commit: 23489 MB ``` this PR: ``` xcl-smoke v1 commit: 1e4f2bdaddd438a31c778d43dc992c8a0455f6a9 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1622 (PresentX 1623) presents per 2 s (last 3): 60 46 54 device removals: 0 crashes: 0 peak commit: 23407 MB ``` No device removals or crashes; 99 % of main's frames, 99 % of its peak commit. **Not tested:** the whole suite; the direct DXIL path this PR changes (these runs use the default HLSL path, `XCL_DIRECT_DXIL` unset). Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 00:20 UTC · original

@⁠Anon64 Thank you for the RTX 3060 60 s regression pair on 1e4f2bd (1622/1629 frames, 0 removals/crashes) — absorbed into the PR description! Also thanks @⁠futurepro62 for the RTX 5070 Ti full-suite pass (977/0/43). Independent AMD verification is still invited before merging.

**@⁠raylitebull** on GitHub · 2026-11-25 00:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7148411390) @⁠Anon64 Thank you for the RTX 3060 60 s regression pair on 1e4f2bd (1622/1629 frames, 0 removals/crashes) — absorbed into the PR description! Also thanks @⁠futurepro62 for the RTX 5070 Ti full-suite pass (977/0/43). Independent AMD verification is still invited before merging.
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 00:25 UTC · original

Ran the 64-bit typed image atomics on a GPU, which the description lists as untested: RTX 3070 (Ampere, driver 616.56, 32-lane waves), Windows 11, debug, at 1e4f2bd.

The local test is a wave64 compute program through runner::run_code_with, with 64 lanes per op on one R32G32_UINT texel (T# format 62, 2D, UNORM=1):

op per lane expected XCL_DIRECT_DXIL=1
image_atomic_add DMASK=0x3 0x1_FFFF_FFFF (carry between the halves) 0x7F_FFFF_FFC0 0x7f_ffff_ffc0 ✓
image_atomic_umax DMASK=0x3 l << 32 | (64 - l) 0x3F_0000_0001 0x3f_0000_0001 ✓
image_atomic_smin DMASK=0x3 -((l << 32) | l) -(0x3F_0000_003F) 0xffffffc0_ffffffc1 ✓
image_atomic_cmpswap DMASK=0xF GLC cmp 0, swap (0x8000_0000 | l) << 32 | (l + 1) one winner; the others return the final value lane 0 wins, the 63 others return 0x80000000_00000001 ✓

So the heap RWTexture2D<uint64_t> path works on NVIDIA. The batch run also matches main: dxil::/bvh:: units (124 passed) and the gpu_ tests with XCL_DIRECT_DXIL=0/1 (110 passed each).

The same program on the HLSL path (XCL_DIRECT_DXIL=0) still runs them as 32-bit atomics: add 0xffffffc0, umax 0x40, and no cmpswap winner. That's the HLSL side of #1485, which #1533 and #1541 fix. Both passed this kind of test here earlier.

AI-assisted (Claude Code). Synthetic tests only.

**@⁠upipibi** on GitHub · 2026-11-25 00:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7148492318) Ran the 64-bit typed image atomics on a GPU, which the description lists as untested: RTX 3070 (Ampere, driver 616.56, 32-lane waves), Windows 11, debug, at `1e4f2bd`. The local test is a wave64 compute program through `runner::run_code_with`, with 64 lanes per op on one `R32G32_UINT` texel (T# format 62, 2D, `UNORM=1`): | op | per lane | expected | `XCL_DIRECT_DXIL=1` | |---|---|---|---| | `image_atomic_add` `DMASK=0x3` | `0x1_FFFF_FFFF` (carry between the halves) | `0x7F_FFFF_FFC0` | `0x7f_ffff_ffc0` ✓ | | `image_atomic_umax` `DMASK=0x3` | `l << 32 \| (64 - l)` | `0x3F_0000_0001` | `0x3f_0000_0001` ✓ | | `image_atomic_smin` `DMASK=0x3` | `-((l << 32) \| l)` | `-(0x3F_0000_003F)` | `0xffffffc0_ffffffc1` ✓ | | `image_atomic_cmpswap` `DMASK=0xF` `GLC` | cmp 0, swap `(0x8000_0000 \| l) << 32 \| (l + 1)` | one winner; the others return the final value | lane 0 wins, the 63 others return `0x80000000_00000001` ✓ | So the heap `RWTexture2D<uint64_t>` path works on NVIDIA. The batch run also matches `main`: `dxil::`/`bvh::` units (124 passed) and the `gpu_` tests with `XCL_DIRECT_DXIL=0`/`1` (110 passed each). The same program on the HLSL path (`XCL_DIRECT_DXIL=0`) still runs them as 32-bit atomics: add `0xffffffc0`, umax `0x40`, and no cmpswap winner. That's the HLSL side of #1485, which #1533 and #1541 fix. Both passed this kind of test here earlier. AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 01:54 UTC · original

Rebased #1948 cleanly onto 0e45b97 in commit 5dc9a0f:

  • Resolved conflicts with #2011 (990b9d4) and #1969 (5195e27) by exposing pub(super) fn feq_bits64 in crates/xcl/src/gpu/dxil/lower_mem.rs, adding IEEE-754 f64 texel_fcas64 for 64-bit image_atomic_fcmpswap (DMASK = 0xF, matching #2011's texel_fcas), and passing #1969's OOB-guarded run predicate into mimg_atomic64 (self.guarded(run, ...)).
  • Pushed 5dc9a0f for GitHub Actions Build and test and fresh AMD + NVIDIA verification.
**@⁠raylitebull** on GitHub · 2026-11-25 01:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7150090312) Rebased `#1948` cleanly onto `0e45b97` in commit `5dc9a0f`: - Resolved conflicts with `#2011` (`990b9d4`) and `#1969` (`5195e27`) by exposing `pub(super) fn feq_bits64` in `crates/xcl/src/gpu/dxil/lower_mem.rs`, adding IEEE-754 `f64` `texel_fcas64` for 64-bit `image_atomic_fcmpswap` (`DMASK = 0xF`, matching `#2011`'s `texel_fcas`), and passing `#1969`'s OOB-guarded `run` predicate into `mimg_atomic64` (`self.guarded(run, ...)`). - Pushed `5dc9a0f` for GitHub Actions `Build and test` and fresh AMD + NVIDIA verification.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 02:09 UTC · original

Rebased #1948 cleanly onto aaa0936 in commit d88bf95, resolving the crates/xcl/src/gpu/dxil/ops_tests.rs EOF append conflict while preserving #2011 (texel_fcas64 + feq_bits64) and #1969 (self.guarded(run, ...)).

Pushed d88bf95 for GitHub Actions Build and test and fresh verification.

**@⁠raylitebull** on GitHub · 2026-11-25 02:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7150394886) Rebased `#1948` cleanly onto `aaa0936` in commit `d88bf95`, resolving the `crates/xcl/src/gpu/dxil/ops_tests.rs` EOF append conflict while preserving `#2011` (`texel_fcas64` + `feq_bits64`) and `#1969` (`self.guarded(run, ...)`). Pushed `d88bf95` for GitHub Actions `Build and test` and fresh verification.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 02:50 UTC · original

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-25 02:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7151259520) Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 03:16 UTC · original

PR #1948 CPU validation of typed image atomics

Tested

At d88bf95a8260fe4ab0e6f53f3ecb8add576459f4, the checked-in direct_image_atomic_64bit_validates test passed. The checkout was clean before and after the run.

  • Rust test harness: 1 passed, 0 failed, 0 ignored, 0 measured, and 1,124 filtered out. Cargo exited 0. The test took 0.02 s after a 43.33 s unoptimized build.
  • DXIL validation: 2 containers accepted, 0 rejected, 0 validation skips. The same checked-in test disassembled both containers and all 6 disassembly assertions passed. The first container holds 16 built-in 64-bit typed image-atomic cases, including add/subtract, signed and unsigned min/max, bitwise operations, swap, increment/decrement, and the built-in floating-point and compare-swap cases. The assertions check atomicBinOp.i64, atomicCompareExchange.i64, and signed/unsigned 64-bit RWTexture2D and RWTexture2DArray annotations. The second container is the DMASK=0x3 32-bit compare-swap control, which emitted atomicCompareExchange.i32 and no atomicCompareExchange.i64.
  • Skips: 0 SKIPPED lines in the combined log. The validator skip path emits SKIPPED on the test thread. The one selected test exercised CPU translation, validation, and disassembly.
  • Environment: AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation 25H2 build 26200.9974, Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), Cargo 1.100.0. XCL reported loading dxcompiler.dll 1.9.2609.5 (01b62ad4) and dxil.dll 1.9.2609.5 from XCL_DXC_DIR.

Commands

$env:Path = "C:/Users/ljensen/.cargo/bin;$env:Path"
$env:RUSTUP_TOOLCHAIN = 'stable-x86_64-pc-windows-msvc'
$env:TEMP = 'L:/XclTooling/pr1948/d88bf95-20261125T031309552Z/temp'
$env:TMP = $env:TEMP
$env:CARGO_TARGET_DIR = 'L:/XclTooling/pr1844-71f2ceb-t3-737e5ee5/target'
$env:CARGO_BUILD_JOBS = '2'
$env:CARGO_INCREMENTAL = '0'
$env:CARGO_PROFILE_DEV_DEBUG = '0'
$env:CARGO_PROFILE_TEST_DEBUG = '0'
$env:XCL_DXC_DIR = 'C:/Users/ljensen/AppData/Local/XclTooling/dxc-1.9.2609/bin/x64'
cargo test -p xcl --lib --jobs 2 gpu::dxil::ops_tests::direct_image_atomic_64bit_validates -- --exact --nocapture

The test command ran via cmd.exe /d /c with stdout and stderr redirected to cargo-test.log. The toolchain, environment, and exit code are in environment.log. The revision was fetched with git fetch --no-tags origin refs/pull/1948/head and selected with git switch --detach d88bf95a8260fe4ab0e6f53f3ecb8add576459f4 in the assigned checkout. git rev-parse HEAD, git status --porcelain=v1, and git ls-remote origin refs/pull/1948/head confirmed the clean local revision and exact remote head.

Live PR and deduplication

At the final check around 2026-11-25 03:14 UTC, PR #1948 was open, GitHub returned mergeable=true, and the pull ref still matched the tested SHA. The PR description and 7 discussion entries showed no matching empirical report for this head and toolchain. The prior test reports name 1e4f2bd, the author’s d88bf95 comment announces a rebase, and the RTX 3060 Ti comment reports a merge conflict without a test run. Related work links to issue #1485 and HLSL PRs #1533 and #1541. The report was saved locally for the coordinator. PR #1948 discussion

Not tested

GPU dispatch and readback, device support for 64-bit typed atomics, runtime arithmetic results, compatibility on specific GPU drivers, extra input variations, other Cargo tests, and retail-title smoke runs were outside this CPU-only run.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the checked-in test and wrote this report.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 03:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7151754636) # PR #1948 CPU validation of typed image atomics **Tested** At `d88bf95a8260fe4ab0e6f53f3ecb8add576459f4`, the checked-in `direct_image_atomic_64bit_validates` test passed. The checkout was clean before and after the run. - **Rust test harness:** 1 passed, 0 failed, 0 ignored, 0 measured, and 1,124 filtered out. Cargo exited 0. The test took 0.02 s after a 43.33 s unoptimized build. - **DXIL validation:** 2 containers accepted, 0 rejected, 0 validation skips. The same checked-in test disassembled both containers and all 6 disassembly assertions passed. The first container holds 16 built-in 64-bit typed image-atomic cases, including add/subtract, signed and unsigned min/max, bitwise operations, swap, increment/decrement, and the built-in floating-point and compare-swap cases. The assertions check `atomicBinOp.i64`, `atomicCompareExchange.i64`, and signed/unsigned 64-bit `RWTexture2D` and `RWTexture2DArray` annotations. The second container is the `DMASK=0x3` 32-bit compare-swap control, which emitted `atomicCompareExchange.i32` and no `atomicCompareExchange.i64`. - **Skips:** 0 `SKIPPED` lines in the combined log. The validator skip path emits `SKIPPED` on the test thread. The one selected test exercised CPU translation, validation, and disassembly. - **Environment:** AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation 25H2 build `26200.9974`, Rust `1.100.0` (`0ef1bc386`, `x86_64-pc-windows-msvc`), Cargo `1.100.0`. XCL reported loading `dxcompiler.dll` `1.9.2609.5` (`01b62ad4`) and `dxil.dll` `1.9.2609.5` from `XCL_DXC_DIR`. **Commands** ```powershell $env:Path = "C:/Users/ljensen/.cargo/bin;$env:Path" $env:RUSTUP_TOOLCHAIN = 'stable-x86_64-pc-windows-msvc' $env:TEMP = 'L:/XclTooling/pr1948/d88bf95-20261125T031309552Z/temp' $env:TMP = $env:TEMP $env:CARGO_TARGET_DIR = 'L:/XclTooling/pr1844-71f2ceb-t3-737e5ee5/target' $env:CARGO_BUILD_JOBS = '2' $env:CARGO_INCREMENTAL = '0' $env:CARGO_PROFILE_DEV_DEBUG = '0' $env:CARGO_PROFILE_TEST_DEBUG = '0' $env:XCL_DXC_DIR = 'C:/Users/ljensen/AppData/Local/XclTooling/dxc-1.9.2609/bin/x64' cargo test -p xcl --lib --jobs 2 gpu::dxil::ops_tests::direct_image_atomic_64bit_validates -- --exact --nocapture ``` The test command ran via `cmd.exe /d /c` with stdout and stderr redirected to [cargo-test.log](L:/XclTooling/pr1948/d88bf95-20261125T031309552Z/cargo-test.log). The toolchain, environment, and exit code are in [environment.log](L:/XclTooling/pr1948/d88bf95-20261125T031309552Z/environment.log). The revision was fetched with `git fetch --no-tags origin refs/pull/1948/head` and selected with `git switch --detach d88bf95a8260fe4ab0e6f53f3ecb8add576459f4` in the assigned checkout. `git rev-parse HEAD`, `git status --porcelain=v1`, and `git ls-remote origin refs/pull/1948/head` confirmed the clean local revision and exact remote head. **Live PR and deduplication** At the final check around `2026-11-25 03:14 UTC`, PR #1948 was open, GitHub returned `mergeable=true`, and the pull ref still matched the tested SHA. The PR description and 7 discussion entries showed no matching empirical report for this head and toolchain. The prior test reports name `1e4f2bd`, the author’s `d88bf95` comment announces a rebase, and the RTX 3060 Ti comment reports a merge conflict without a test run. Related work links to issue #1485 and HLSL PRs #1533 and #1541. The report was saved locally for the coordinator. [PR #1948 discussion](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1948) **Not tested** GPU dispatch and readback, device support for 64-bit typed atomics, runtime arithmetic results, compatibility on specific GPU drivers, extra input variations, other Cargo tests, and retail-title smoke runs were outside this CPU-only run. **AI use** T3 Code / Codex (`gpt-6.2-sol`) ran the checked-in test and wrote this report.
Author
Owner

@⁠WebIdentity1 on GitHub · 2026-11-25 04:11 UTC · original · edited 2026-11-25 04:14 UTC

Verified the rebased 64-bit image floating compare-exchange path on d88bf95a8260fe4ab0e6f53f3ecb8add576459f4, including its EXEC and null-descriptor guards. This complements the older Ampere integer-atomic report above. The attached synthetic regression passes on the PR and fails on its parent aaa093657bd96a146c05c0c1a9b61149fe761453; no new runtime defect found in these cases.

Tested

  • Native Windows 10 Home 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74 (32.0.15.9174), Rust/Cargo 1.98.1 MSVC, DXC/DXIL 1.8.2502.11, debug. The test prints the selected adapter. Direct kernel translation is called explicitly; wave64 runs as two wave32 halves, with no HLSL fallback.
  • cargo test --locked -p xcl --lib -- gpu::recomp::tests::gpu_image_fcas64_preserves_ieee_and_guards --exact --test-threads=1 --nocapture
  • Same test on parent/head: 0 passed / 1 failed / 0 ignored → 1 passed / 0 failed / 0 ignored, zero skips, Cargo 101 → 0. Both snapshots rebuilt; all 321 source hashes match before/after and the local snapshots.
  • Head executes three dispatches: full EXEC with valid descriptors, different masks in the two half-waves, and full EXEC with null descriptors. Each checks 160 64-bit texture values (including 16 tail guards per texture), 128 64-bit returned values, and 128 unchanged 64-bit compare operands. Zero mismatches.
  • The floating CAS and integer-CAS control use separate R32G32_UINT UAVs and independent texels per lane. Cases: both signs of zero, quiet/signaling NaN payloads, smallest positive subnormal vs zero, equal/different finite numbers, and negative infinity. Expected floating equality is computed with host f64 ==; integer equality uses exact bits. Both GLC words are checked. Inactive lanes retain destination registers; null descriptors leave both textures unchanged and return zero to active GLC destinations.
  • Parent reaches the GPU, then fails in the first dispatch because a compare operand changes from 0x8000000000000000 to 0. Its later cases do not run; the head checks all three.

Not tested: contention/retry-loop bounds, coordinate-out-of-range accesses, AMD/native wave64/Intel, full workspace, newer-main integration, other wide atomics, performance/peak memory, retail shaders or title smoke. No merge-readiness claim.

AI use: Codex (GPT-6), source investigation, regression-test preparation, native Windows verification and this report. Test-only patch; no competing implementation.

Portable test-only patch on d88bf95 (also applies to its parent)
diff --git a/crates/xcl/src/gpu/recomp/tests.rs b/crates/xcl/src/gpu/recomp/tests.rs
index 527dc4e..914f47e 100644
--- a/crates/xcl/src/gpu/recomp/tests.rs
+++ b/crates/xcl/src/gpu/recomp/tests.rs
@@ -9027,3 +9027,75 @@ fn gpu_scalar_sext_mulhi_and_vector_i24_sub_co_ci_u64_shifts() {
         assert_eq!(v[22], subrev, "lane {l} v_subrev_co_ci_u32");
     }
 }
+
+
+/// The wide image float CAS added by #1948 uses ordered f64 equality, including
+/// signed zero and NaN, while integer CAS remains bitwise. GLC returns both words.
+#[test]
+fn gpu_image_fcas64_preserves_ieee_and_guards() {
+    if !gpu_ready() { return; }
+    use runner::{TestTexture, TexDim};
+    use windows::Win32::Graphics::Dxgi::Common::DXGI_FORMAT_R32G32_UINT;
+    const CASES: [(u64, u64); 8] = [
+        (0x8000_0000_0000_0000, 0),
+        (0, 0x8000_0000_0000_0000),
+        (0x7FF8_0000_0000_1234, 0x7FF8_0000_0000_1234),
+        (0x7FF0_0000_0000_1234, 0x7FF0_0000_0000_1234),
+        (1, 0),
+        (0x3FF8_0000_0000_0000, 0x3FF8_0000_0000_0000),
+        (0x3FF8_0000_0000_0000, 0x4004_0000_0000_0000),
+        (0xFFF0_0000_0000_0000, 0xFFF0_0000_0000_0000),
+    ];
+    const GUARD: u64 = 0xdead_beef_1234_abcd;
+    let mut code = Vec::new();
+    for (name, dst, srsrc) in [("IMAGE_ATOMIC_FCMPSWAP", 10, 4), ("IMAGE_ATOMIC_CMPSWAP", 20, 6)] {
+        code.extend(encode(name, "ENC_MIMG", &[("VDATA", dst), ("VADDR", 0), ("SRSRC", srsrc), ("DMASK", 15), ("DIM", 1), ("UNORM", 1), ("GLC", 1)], None).unwrap());
+    }
+    code.extend(encode("S_ENDPGM", "ENC_SOPP", &[], None).unwrap());
+    let split = !runner::wave64_supported().unwrap();
+    let dxil = crate::gpu::dxil::kernel::translate(&code, crate::gpu::dxil::kernel::KernelOptions { wave64: true, split, mem_windows: 1, sampler_base: 0 }).unwrap();
+    crate::gpu::dxil::validate::validate(&dxil).unwrap();
+    println!("IMAGE_FCAS64 adapter={} split={split} dxil_bytes={}", runner::adapter().unwrap(), dxil.len());
+    for (mask, valid) in [(u64::MAX, true), (0xF0F0_F0F0_0F0F_0F0Fu64, true), (u64::MAX, false)] {
+        let mut st = KernelState::default();
+        st.sgpr[126] = mask as u32;
+        st.sgpr[127] = (mask >> 32) as u32;
+        if valid {
+            st.sgpr[16..24].copy_from_slice(&tsharp(0, 62, 9));
+            st.sgpr[24..32].copy_from_slice(&tsharp(2, 62, 9));
+        }
+        for (lane, v) in st.vgpr.iter_mut().enumerate() {
+            v[0] = lane as u32;
+            let new = (1000.0 + lane as f64).to_bits();
+            let cmp = CASES[lane % 8].1;
+            for base in [10, 20] {
+                v[base] = new as u32; v[base + 1] = (new >> 32) as u32;
+                v[base + 2] = cmp as u32; v[base + 3] = (cmp >> 32) as u32;
+            }
+        }
+        let initial: Vec<u64> = (0..80).map(|lane| if lane < 64 { CASES[lane % 8].0 } else { GUARD }).collect();
+        let tex = || TestTexture { dim: TexDim::D2, format: DXGI_FORMAT_R32G32_UINT, width: 80, height: 1, depth: 1, texel_bytes: 8, data: initial.iter().flat_map(|v| v.to_le_bytes()).collect(), uav: true };
+        let r = runner::run_with(&dxil, &st, &[0; 64], &[tex(), tex()], &[]).unwrap();
+        let word = |v: &[u32], k: usize| v[k] as u64 | (v[k + 1] as u64) << 32;
+        let mut failures = Vec::new();
+        for (ti, base) in [(0, 10), (1, 20)] {
+            let got: Vec<u64> = r.textures[ti].chunks_exact(8).map(|b| u64::from_le_bytes(b.try_into().unwrap())).collect();
+            assert_eq!(got.len(), 80);
+            for lane in 0..80 {
+                let (old, cmp) = CASES[lane % 8];
+                let active = lane < 64 && mask & (1u64 << (lane % 64)) != 0;
+                let new = (1000.0 + lane as f64).to_bits();
+                let equal = if ti == 0 { f64::from_bits(old) == f64::from_bits(cmp) } else { old == cmp };
+                let want = if lane >= 64 { GUARD } else if active && valid && equal { new } else { old };
+                if got[lane] != want { failures.push(format!("tex{ti} lane{lane}: {:016x} != {want:016x}", got[lane])); }
+                if lane < 64 {
+                    let returned = if !active { new } else if valid { old } else { 0 };
+                    if word(&r.vgpr[lane], base) != returned { failures.push(format!("return{ti} lane{lane}: {:016x} != {returned:016x}", word(&r.vgpr[lane], base))); }
+                    assert_eq!(word(&r.vgpr[lane], base + 2), cmp, "compare operands are unchanged");
+                }
+            }
+        }
+        println!("IMAGE_FCAS64 mask={mask:016x} valid={valid} mismatches={} textures=160 returns=128 compare_pairs=128", failures.len());
+        assert!(failures.is_empty(), "{}", failures.join("\n"));
+    }
+}
**@⁠WebIdentity1** on GitHub · 2026-11-25 04:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7152616296) · edited 2026-11-25 04:14 UTC Verified the rebased 64-bit image floating compare-exchange path on **`d88bf95a8260fe4ab0e6f53f3ecb8add576459f4`**, including its EXEC and null-descriptor guards. This complements the older Ampere integer-atomic report above. The attached synthetic regression passes on the PR and fails on its parent `aaa093657bd96a146c05c0c1a9b61149fe761453`; no new runtime defect found in these cases. **Tested** - Native Windows 10 Home 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74 (`32.0.15.9174`), Rust/Cargo 1.98.1 MSVC, DXC/DXIL 1.8.2502.11, debug. The test prints the selected adapter. Direct kernel translation is called explicitly; wave64 runs as two wave32 halves, with no HLSL fallback. - `cargo test --locked -p xcl --lib -- gpu::recomp::tests::gpu_image_fcas64_preserves_ieee_and_guards --exact --test-threads=1 --nocapture` - Same test on parent/head: **0 passed / 1 failed / 0 ignored → 1 passed / 0 failed / 0 ignored**, zero skips, Cargo 101 → 0. Both snapshots rebuilt; all 321 source hashes match before/after and the local snapshots. - Head executes **three dispatches**: full EXEC with valid descriptors, different masks in the two half-waves, and full EXEC with null descriptors. Each checks **160 64-bit texture values** (including 16 tail guards per texture), **128 64-bit returned values**, and **128 unchanged 64-bit compare operands**. Zero mismatches. - The floating CAS and integer-CAS control use separate `R32G32_UINT` UAVs and independent texels per lane. Cases: both signs of zero, quiet/signaling NaN payloads, smallest positive subnormal vs zero, equal/different finite numbers, and negative infinity. Expected floating equality is computed with host `f64 ==`; integer equality uses exact bits. Both GLC words are checked. Inactive lanes retain destination registers; null descriptors leave both textures unchanged and return zero to active GLC destinations. - Parent reaches the GPU, then fails in the first dispatch because a compare operand changes from `0x8000000000000000` to 0. Its later cases do not run; the head checks all three. **Not tested:** contention/retry-loop bounds, coordinate-out-of-range accesses, AMD/native wave64/Intel, full workspace, newer-main integration, other wide atomics, performance/peak memory, retail shaders or title smoke. No merge-readiness claim. **AI use:** Codex (GPT-6), source investigation, regression-test preparation, native Windows verification and this report. Test-only patch; no competing implementation. <details><summary>Portable test-only patch on d88bf95 (also applies to its parent)</summary> ```diff diff --git a/crates/xcl/src/gpu/recomp/tests.rs b/crates/xcl/src/gpu/recomp/tests.rs index 527dc4e..914f47e 100644 --- a/crates/xcl/src/gpu/recomp/tests.rs +++ b/crates/xcl/src/gpu/recomp/tests.rs @@ -9027,3 +9027,75 @@ fn gpu_scalar_sext_mulhi_and_vector_i24_sub_co_ci_u64_shifts() { assert_eq!(v[22], subrev, "lane {l} v_subrev_co_ci_u32"); } } + + +/// The wide image float CAS added by #1948 uses ordered f64 equality, including +/// signed zero and NaN, while integer CAS remains bitwise. GLC returns both words. +#[test] +fn gpu_image_fcas64_preserves_ieee_and_guards() { + if !gpu_ready() { return; } + use runner::{TestTexture, TexDim}; + use windows::Win32::Graphics::Dxgi::Common::DXGI_FORMAT_R32G32_UINT; + const CASES: [(u64, u64); 8] = [ + (0x8000_0000_0000_0000, 0), + (0, 0x8000_0000_0000_0000), + (0x7FF8_0000_0000_1234, 0x7FF8_0000_0000_1234), + (0x7FF0_0000_0000_1234, 0x7FF0_0000_0000_1234), + (1, 0), + (0x3FF8_0000_0000_0000, 0x3FF8_0000_0000_0000), + (0x3FF8_0000_0000_0000, 0x4004_0000_0000_0000), + (0xFFF0_0000_0000_0000, 0xFFF0_0000_0000_0000), + ]; + const GUARD: u64 = 0xdead_beef_1234_abcd; + let mut code = Vec::new(); + for (name, dst, srsrc) in [("IMAGE_ATOMIC_FCMPSWAP", 10, 4), ("IMAGE_ATOMIC_CMPSWAP", 20, 6)] { + code.extend(encode(name, "ENC_MIMG", &[("VDATA", dst), ("VADDR", 0), ("SRSRC", srsrc), ("DMASK", 15), ("DIM", 1), ("UNORM", 1), ("GLC", 1)], None).unwrap()); + } + code.extend(encode("S_ENDPGM", "ENC_SOPP", &[], None).unwrap()); + let split = !runner::wave64_supported().unwrap(); + let dxil = crate::gpu::dxil::kernel::translate(&code, crate::gpu::dxil::kernel::KernelOptions { wave64: true, split, mem_windows: 1, sampler_base: 0 }).unwrap(); + crate::gpu::dxil::validate::validate(&dxil).unwrap(); + println!("IMAGE_FCAS64 adapter={} split={split} dxil_bytes={}", runner::adapter().unwrap(), dxil.len()); + for (mask, valid) in [(u64::MAX, true), (0xF0F0_F0F0_0F0F_0F0Fu64, true), (u64::MAX, false)] { + let mut st = KernelState::default(); + st.sgpr[126] = mask as u32; + st.sgpr[127] = (mask >> 32) as u32; + if valid { + st.sgpr[16..24].copy_from_slice(&tsharp(0, 62, 9)); + st.sgpr[24..32].copy_from_slice(&tsharp(2, 62, 9)); + } + for (lane, v) in st.vgpr.iter_mut().enumerate() { + v[0] = lane as u32; + let new = (1000.0 + lane as f64).to_bits(); + let cmp = CASES[lane % 8].1; + for base in [10, 20] { + v[base] = new as u32; v[base + 1] = (new >> 32) as u32; + v[base + 2] = cmp as u32; v[base + 3] = (cmp >> 32) as u32; + } + } + let initial: Vec<u64> = (0..80).map(|lane| if lane < 64 { CASES[lane % 8].0 } else { GUARD }).collect(); + let tex = || TestTexture { dim: TexDim::D2, format: DXGI_FORMAT_R32G32_UINT, width: 80, height: 1, depth: 1, texel_bytes: 8, data: initial.iter().flat_map(|v| v.to_le_bytes()).collect(), uav: true }; + let r = runner::run_with(&dxil, &st, &[0; 64], &[tex(), tex()], &[]).unwrap(); + let word = |v: &[u32], k: usize| v[k] as u64 | (v[k + 1] as u64) << 32; + let mut failures = Vec::new(); + for (ti, base) in [(0, 10), (1, 20)] { + let got: Vec<u64> = r.textures[ti].chunks_exact(8).map(|b| u64::from_le_bytes(b.try_into().unwrap())).collect(); + assert_eq!(got.len(), 80); + for lane in 0..80 { + let (old, cmp) = CASES[lane % 8]; + let active = lane < 64 && mask & (1u64 << (lane % 64)) != 0; + let new = (1000.0 + lane as f64).to_bits(); + let equal = if ti == 0 { f64::from_bits(old) == f64::from_bits(cmp) } else { old == cmp }; + let want = if lane >= 64 { GUARD } else if active && valid && equal { new } else { old }; + if got[lane] != want { failures.push(format!("tex{ti} lane{lane}: {:016x} != {want:016x}", got[lane])); } + if lane < 64 { + let returned = if !active { new } else if valid { old } else { 0 }; + if word(&r.vgpr[lane], base) != returned { failures.push(format!("return{ti} lane{lane}: {:016x} != {returned:016x}", word(&r.vgpr[lane], base))); } + assert_eq!(word(&r.vgpr[lane], base + 2), cmp, "compare operands are unchanged"); + } + } + } + println!("IMAGE_FCAS64 mask={mask:016x} valid={valid} mismatches={} textures=160 returns=128 compare_pairs=128", failures.len()); + assert!(failures.is_empty(), "{}", failures.join("\n")); + } +} ``` </details>
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 13:04 UTC · original

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

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1628 (PresentX 1628)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14561 MB
xcl-smoke v1
commit: d88bf95a8260fe4ab0e6f53f3ecb8add576459f4
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1629 (PresentX 1629)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14595 MB

Against the limits in CONTRIBUTING.md: 100 % 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; a script posted this right after the run, with both blocks exactly as printed.

**@⁠Toons29** on GitHub · 2026-11-25 13:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7163257737) Regression run of `d88bf95a` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `1a0bbe3a`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6 gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1628 (PresentX 1628) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14561 MB ``` ``` xcl-smoke v1 commit: d88bf95a8260fe4ab0e6f53f3ecb8add576459f4 gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1629 (PresentX 1629) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14595 MB ``` Against the limits in CONTRIBUTING.md: 100 % 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`; a script posted this right after the run, with both blocks exactly as printed.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-25 16:47 UTC · original

Retest on the rebased head d88bf95 (on aaa0936), following up on my earlier report on 1e4f2bd, since the description invites fresh AMD and NVIDIA runs. Full suite, same setup as before.

Tested

  • NVIDIA RTX 5070 Ti (Blackwell, driver 621.40), XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 with the same main-failing --skips as the earlier report: 1140 passed, 0 failed, 44 ignored.
  • AMD Radeon iGPU of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1151 passed, 0 failed, 46 ignored.
  • gpu::dxil::ops_tests::direct_image_atomic_64bit_validates passed on both.
  • Main 06c9f55 on this machine fails the same skipped tests (NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form, six lower_dxil GPU tests, four fuzz_validate_and_gpu seeds; AMD: fuzz_validate_and_gpu_1), not because of this PR.

Not tested

  • Wave64 AMD hardware (this iGPU is RDNA2 wave32), a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-25 16:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7168537268) Retest on the rebased head `d88bf95` (on `aaa0936`), following up on [my earlier report](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1948) on `1e4f2bd`, since the description invites fresh AMD and NVIDIA runs. Full suite, same setup as before. **Tested** - NVIDIA RTX 5070 Ti (Blackwell, driver 621.40), `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4` with the same main-failing `--skip`s as the earlier report: **1140 passed, 0 failed, 44 ignored**. - AMD Radeon iGPU of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`: **1151 passed, 0 failed, 46 ignored**. - `gpu::dxil::ops_tests::direct_image_atomic_64bit_validates` passed on both. - Main `06c9f55` on this machine fails the same skipped tests (NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form`, six `lower_dxil` GPU tests, four `fuzz_validate_and_gpu` seeds; AMD: `fuzz_validate_and_gpu_1`), not because of this PR. **Not tested** - Wave64 AMD hardware (this iGPU is RDNA2 wave32), a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 18:12 UTC · original

Thanks @⁠Toons29 for the exact-head RX 9070 60 s scripts/smoke.ps1 pair on d88bf95 (1629 vs 1628 frames, 0 device removals, 0 crashes) — added to the PR description! Thanks also to @⁠futurepro62 (RTX 5070 Ti + AMD Radeon RDNA2 iGPU full-suite retest), @⁠WebIdentity1 (RTX 3090 fcas64 verification), and @⁠JJAutoCompare for verifying d88bf95.

**@⁠raylitebull** on GitHub · 2026-11-25 18:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7170602038) Thanks @⁠Toons29 for the exact-head RX 9070 60 s `scripts/smoke.ps1` pair on `d88bf95` (`1629` vs `1628` frames, `0` device removals, `0` crashes) — added to the PR description! Thanks also to @⁠futurepro62 (RTX 5070 Ti + AMD Radeon RDNA2 iGPU full-suite retest), @⁠WebIdentity1 (RTX 3090 fcas64 verification), and @⁠JJAutoCompare for verifying `d88bf95`.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 00:42 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 00:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/1948#issuecomment-7179039742) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
This discussion has been locked. Commenting is limited to contributors.
No description provided.