RX 5700 XT (RDNA 1): wrong integer result for the translated v_sub_co_ci_u32_sdwa chain with uniform operands (pixel_aot_sdwa_int_extra_hardware) #2723

Open
opened 2026-11-26 04:15:14 +00:00 by ColorMeBoom · 7 comments
ColorMeBoom commented 2026-11-26 04:15:14 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by ColorMeBoom on 2026-11-26T04:15:14Z.


Commit or build

2215c26d (main)

Reproduction

ctest --preset dev --no-tests=error -R '^pixel_aot_sdwa_int_extra_(warp|hardware)$' -V

Expected behavior

The co_ci draw matches the CPU reference in all three rows, as on WARP. Channel 1 is v_sub_co_ci_u32_sdwa v13, vcc_lo, s47, v18, vcc_lo dst_sel:WORD_0 ... src0_sel:WORD_1 src1_sel:WORD_1, with the borrow-in from the preceding v_add_co_ci_u32_sdwa. It should read 0000fffc, 00000005 and 0000ffff.

Observed behavior

WARP passes. On the RX 5700 XT, channel 1 of every row reads the subtrahend WORD_1(s45) (5, 4, 0) instead of the difference. Channels 0, 2 and 3 (including the final borrow) match:

case=0 channel=1 expected_bits=0000fffc actual_bits=00000005
case=1 channel=1 expected_bits=00000005 actual_bits=00000004
case=2 channel=1 expected_bits=0000ffff actual_bits=00000000

The emitted HLSL is plain integer arithmetic (uint cp26 = sa26 - sb26; uint co26 = cp26 - ci26; ... co26 & 0xffffu). It fails the same way after each of these edits, run through the test's own compile_shader and --check-pixel-batch: removing every precise, keeping alu20/alu21 as uint, computing the borrow-in directly, and folding the subtraction into one expression.

The inputs come from the constant buffer, so they are wave-uniform. In a DXC cs_6_0 probe (offscreen_check --raw-uav-dump), the same chain is correct with per-thread inputs. When the inputs are made uniform with WaveReadLaneFirst, row 2 (s44 = 0xff, s45 = 0x1000, s46 = s47 = 0) returns ffffffff instead of 0000ffff, so the final mask is lost. This is the shortest form that still fails:

p0w = WaveReadLaneFirst(p0w); p1x = WaveReadLaneFirst(p1x); p1y = WaveReadLaneFirst(p1y); p1z = WaveReadLaneFirst(p1z);
uint sa = asuint(asint(p0w << 24u) >> 24u); uint sb = p1y & 0xffffu;
uint cp = sa + sb; uint co = cp + (p0w < p1x ? 1u : 0u); bool c = cp < sa || co < cp;
r = (((p1z >> 16u) & 0xffffu) - ((p1x >> 16u) & 0xffffu) - (c ? 1u : 0u)) & 0xffffu;   // RX 5700 XT: ffffffff, WARP: 0000ffff

Giving the borrow as a run-time value instead of deriving it from the carry compare, or using per-thread inputs, gives 0000ffff on both. The pixel-stage symptom (the subtrahend) and the compute symptom (an unmasked -1) differ. Both have uniform operands and a carry-derived borrow; I tested the run-time borrow only in the compute probe. That points at the driver's handling of this uniform pattern rather than at the translation. I did not check other drivers, other RDNA 1 adapters or the debug layer. I'm reporting it so the hardware failure is known; the fixture and its reference look right.

Environment

Windows 11 Home build 26200.9974, VS 2022 Build Tools (MSVC 19.44.35230), Windows SDK 10.0.26100.0, DXC 1.9.2602.17 (-Gis -denorm preserve, ps_6_2, as in the test). AMD Radeon RX 5700 XT (RDNA 1, 1002:731f), driver 32.0.21045.29003, hardware backend; WARP 10.0.26100.9818. Debug layer unavailable.

AI-assisted with Claude Code (Claude Opus 5.5).

Checklist

  • I reproduced this on a source-built input.
  • I did not include game files, dumps, distribution links or credentials.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6619369018 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2731). Originally posted by [ColorMeBoom](https://github.com/ColorMeBoom) on 2026-11-26T04:15:14Z. --- ### Commit or build 2215c26d (main) ### Reproduction ```shell ctest --preset dev --no-tests=error -R '^pixel_aot_sdwa_int_extra_(warp|hardware)$' -V ``` ### Expected behavior The `co_ci` draw matches the CPU reference in all three rows, as on WARP. Channel 1 is `v_sub_co_ci_u32_sdwa v13, vcc_lo, s47, v18, vcc_lo dst_sel:WORD_0 ... src0_sel:WORD_1 src1_sel:WORD_1`, with the borrow-in from the preceding `v_add_co_ci_u32_sdwa`. It should read `0000fffc`, `00000005` and `0000ffff`. ### Observed behavior WARP passes. On the RX 5700 XT, channel 1 of every row reads the subtrahend `WORD_1(s45)` (5, 4, 0) instead of the difference. Channels 0, 2 and 3 (including the final borrow) match: ``` case=0 channel=1 expected_bits=0000fffc actual_bits=00000005 case=1 channel=1 expected_bits=00000005 actual_bits=00000004 case=2 channel=1 expected_bits=0000ffff actual_bits=00000000 ``` The emitted HLSL is plain integer arithmetic (`uint cp26 = sa26 - sb26; uint co26 = cp26 - ci26; ... co26 & 0xffffu`). It fails the same way after each of these edits, run through the test's own `compile_shader` and `--check-pixel-batch`: removing every `precise`, keeping `alu20`/`alu21` as `uint`, computing the borrow-in directly, and folding the subtraction into one expression. The inputs come from the constant buffer, so they are wave-uniform. In a DXC `cs_6_0` probe (`offscreen_check --raw-uav-dump`), the same chain is correct with per-thread inputs. When the inputs are made uniform with `WaveReadLaneFirst`, row 2 (s44 = 0xff, s45 = 0x1000, s46 = s47 = 0) returns `ffffffff` instead of `0000ffff`, so the final mask is lost. This is the shortest form that still fails: ```hlsl p0w = WaveReadLaneFirst(p0w); p1x = WaveReadLaneFirst(p1x); p1y = WaveReadLaneFirst(p1y); p1z = WaveReadLaneFirst(p1z); uint sa = asuint(asint(p0w << 24u) >> 24u); uint sb = p1y & 0xffffu; uint cp = sa + sb; uint co = cp + (p0w < p1x ? 1u : 0u); bool c = cp < sa || co < cp; r = (((p1z >> 16u) & 0xffffu) - ((p1x >> 16u) & 0xffffu) - (c ? 1u : 0u)) & 0xffffu; // RX 5700 XT: ffffffff, WARP: 0000ffff ``` Giving the borrow as a run-time value instead of deriving it from the carry compare, or using per-thread inputs, gives `0000ffff` on both. The pixel-stage symptom (the subtrahend) and the compute symptom (an unmasked `-1`) differ. Both have uniform operands and a carry-derived borrow; I tested the run-time borrow only in the compute probe. That points at the driver's handling of this uniform pattern rather than at the translation. I did not check other drivers, other RDNA 1 adapters or the debug layer. I'm reporting it so the hardware failure is known; the fixture and its reference look right. ### Environment Windows 11 Home build 26200.9974, VS 2022 Build Tools (MSVC 19.44.35230), Windows SDK 10.0.26100.0, DXC 1.9.2602.17 (`-Gis -denorm preserve`, `ps_6_2`, as in the test). AMD Radeon RX 5700 XT (RDNA 1, 1002:731f), driver 32.0.21045.29003, hardware backend; WARP 10.0.26100.9818. Debug layer unavailable. AI-assisted with Claude Code (Claude Opus 5.5). ### Checklist - [x] I reproduced this on a source-built input. - [x] I did not include game files, dumps, distribution links or credentials.
RonLogic commented 2026-11-26 05:02:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-26T04:24:38Z.


Windows x64 Release comparison against 2215c26d using DXC 1.9.2602.17. I used the #2728 build after verifying its only differences from that base were GPU package tooling and CMake registration for the package recorder. Both adapter paths ran, with no skips. WARP driver 10.0.26100.10068; physical NVIDIA RTX 4070 driver 32.0.16.2124. Both pixel_aot_sdwa_int_extra tests passed, including the three co_ci reference rows and all mutation checks. The reported wrong channel 1 result did not reproduce on the RTX 4070.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7182569928 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2731#issuecomment-7182569928). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-26T04:24:38Z. --- Windows x64 Release comparison against `2215c26d` using DXC `1.9.2602.17`. I used the #2728 build after verifying its only differences from that base were GPU package tooling and CMake registration for the package recorder. Both adapter paths ran, with no skips. WARP driver `10.0.26100.10068`; physical NVIDIA RTX 4070 driver `32.0.16.2124`. Both `pixel_aot_sdwa_int_extra` tests passed, including the three `co_ci` reference rows and all mutation checks. The reported wrong channel 1 result did not reproduce on the RTX 4070.
R0Y00 commented 2026-11-26 05:02:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T04:38:10Z.


The pixel mismatch and the uniform compute probe are useful separate results. Keep the integer pixel expectations and all mutation checks strict. For the next RDNA 1 run, please isolate this in the same ps_6_2 pipeline: use the original uniform derived-borrow input, then supply the same 0/1 borrow as a runtime uniform, and record the three destination words and final borrow for both. Include the driver and DXC versions. A newer AMD driver or a second RDNA 1 adapter would help distinguish the compiler path. The WARP and RTX 4070 checks establish the current cross-adapter baseline.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7182767263 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2731#issuecomment-7182767263). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T04:38:10Z. --- The pixel mismatch and the uniform compute probe are useful separate results. Keep the integer pixel expectations and all mutation checks strict. For the next RDNA 1 run, please isolate this in the same ps_6_2 pipeline: use the original uniform derived-borrow input, then supply the same 0/1 borrow as a runtime uniform, and record the three destination words and final borrow for both. Include the driver and DXC versions. A newer AMD driver or a second RDNA 1 adapter would help distinguish the compiler path. The WARP and RTX 4070 checks establish the current cross-adapter baseline.
RavenCurseBurg commented 2026-11-26 07:00:28 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-26T06:38:53Z.


I will prepare a reproducible ps_6_2 comparison for the requested next RDNA 1 run. It will keep the original derived-borrow path, supply the same borrow through a runtime uniform in the same pixel fixture, and report destination and final-borrow words for all three rows. I can validate the probe on Intel UHD 770, RTX 4060 and WARP and leave the exact command for the RX 5700 XT reporter.

AI-assisted with Codex.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7184638154 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2731#issuecomment-7184638154). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-26T06:38:53Z. --- I will prepare a reproducible ps_6_2 comparison for the requested next RDNA 1 run. It will keep the original derived-borrow path, supply the same borrow through a runtime uniform in the same pixel fixture, and report destination and final-borrow words for all three rows. I can validate the probe on Intel UHD 770, RTX 4060 and WARP and leave the exact command for the RX 5700 XT reporter. AI-assisted with Codex.
RavenCurseBurg commented 2026-11-26 07:00:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-26T06:51:25Z.


I ran the original translated ps_6_2 shader and a second build with the subtraction's borrow-in supplied through the constant buffer. Both builds matched all four channels in all three rows on Intel UHD 770, RTX 4060 and WARP. The RX 5700 XT result for the second build is still open.

The standalone probe at 5e50c3fa uses the original fixture, compiler flags and integer target. Its only HLSL edit changes uint ci26 = cmp25 ? 1u : 0u; to uint ci26 = params[1].w;. Each row runs three draws. The first uses the original shader, the second supplies the matched borrow (1, 0, 1), and the third flips it in the same compiled uniform shader. Each draw checks all 4,096 readback pixels.

Row Original and matched uniform (RGBA hex) Flipped uniform (RGBA hex)
0 00000005 0000fffc 000b1337 00000001 00000005 0000fffd 000b1337 00000001
1 0000000a 00000005 fffd1337 00000001 0000000a 00000004 fffd1337 00000001
2 00000000 0000ffff ffff1337 00000001 00000000 00000000 00001337 00000000

To run on RDNA 1, put the linked script next to tests/pixel_aot_check.py in a checkout of e3cf6a91 (or use the fork commit), and pass the paths to DXC and the repository's built offscreen_check:

$env:XBOX2WINDOWS_ADAPTER = '5700'
python -B tests/pixel_sdwa_borrow_probe.py path/to/dxc.exe path/to/offscreen_check.exe hardware

It reports every row before returning a mismatch. On the three local backends I also ran the unmodified draw-sdwa-int-extra suite. The baseline passed and each of its 13 mutants was detected, including all four carry-chain mutants. Windows build 26100.9711, DXC 1.9.2609.5, Intel 32.0.101.5973, NVIDIA 32.0.15.9579, WARP 10.0.26100.9711. The reporter used a different DXC and AMD driver, so the RDNA 1 comparison should use their original versions first.

AI-assisted with Codex (GPT-6.2 Astra, xhigh).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7184851035 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2731#issuecomment-7184851035). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-26T06:51:25Z. --- I ran the original translated `ps_6_2` shader and a second build with the subtraction's borrow-in supplied through the constant buffer. Both builds matched all four channels in all three rows on Intel UHD 770, RTX 4060 and WARP. The RX 5700 XT result for the second build is still open. The [standalone probe at 5e50c3fa](https://github.com/RavenCurseBurg/Xbox2Windows/blob/5e50c3fa49e73c0378cc3cca00521d56ff840085/tests/pixel_sdwa_borrow_probe.py) uses the original fixture, compiler flags and integer target. Its only HLSL edit changes `uint ci26 = cmp25 ? 1u : 0u;` to `uint ci26 = params[1].w;`. Each row runs three draws. The first uses the original shader, the second supplies the matched borrow (1, 0, 1), and the third flips it in the same compiled uniform shader. Each draw checks all 4,096 readback pixels. | Row | Original and matched uniform (RGBA hex) | Flipped uniform (RGBA hex) | | --- | --- | --- | | 0 | `00000005 0000fffc 000b1337 00000001` | `00000005 0000fffd 000b1337 00000001` | | 1 | `0000000a 00000005 fffd1337 00000001` | `0000000a 00000004 fffd1337 00000001` | | 2 | `00000000 0000ffff ffff1337 00000001` | `00000000 00000000 00001337 00000000` | To run on RDNA 1, put the linked script next to `tests/pixel_aot_check.py` in a checkout of `e3cf6a91` (or use the fork commit), and pass the paths to DXC and the repository's built `offscreen_check`: ```powershell $env:XBOX2WINDOWS_ADAPTER = '5700' python -B tests/pixel_sdwa_borrow_probe.py path/to/dxc.exe path/to/offscreen_check.exe hardware ``` It reports every row before returning a mismatch. On the three local backends I also ran the unmodified `draw-sdwa-int-extra` suite. The baseline passed and each of its 13 mutants was detected, including all four carry-chain mutants. Windows build 26100.9711, DXC 1.9.2609.5, Intel 32.0.101.5973, NVIDIA 32.0.15.9579, WARP 10.0.26100.9711. The reporter used a different DXC and AMD driver, so the RDNA 1 comparison should use their original versions first. AI-assisted with Codex (GPT-6.2 Astra, xhigh).
thepatrickworld commented 2026-11-26 09:04:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-26T08:05:46Z.


On RDNA 4 (1002:7550, driver 32.0.32029.2010) at b457f7ff the SDWA co_ci mismatch reported here does not reproduce: the fixture passes and the borrow probe matches on every row. Not a code change; measurements only.

Environment

  • Windows 11 25H2 build 10.0.26200.9974; MSVC 19.44.35230 (BuildTools 14.44.35207), preset dev.
  • DXC 1.9.2602.17 (dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17)), the same version the report above used, so the compiler is not what differs between the two runs; the adapter and its driver are.
  • The renderer's own lines: backend=hardware debug_layer=unavailable, adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550, driver=32.0.32029.2010.
  • Head b457f7ff (b457f7ffa48fe4adb87e6b7d58a21a179dfee221), git status --porcelain --untracked-files=no empty.
  • tests/pixel_aot_check.py carries both the lowering (translate_int) and the co_ci program. The copy at 2215c26d and the one at b457f7ff are identical after LF normalisation (sha256 fcb94345…, 1 620 580 bytes, identical_lf=True). The HLSL this tree emits for co_ci is 206 lines, sha256 c6d00c57….
  • The adapter filter is strict: the same command with a trailing space in XBOX2WINDOWS_ADAPTER fails with No D3D12 hardware adapter matches, so the passing run selects the card by its DXGI name.

Commands

set "XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT"
ctest --preset dev --no-tests=error -R "^(pixel_aot_sdwa_int_extra_(warp|hardware))$" -V

The probe is tests/pixel_sdwa_borrow_probe.py from @RavenCurseBurg at 5e50c3fa, copied unchanged into tests/ of the b457f7ff checkout:

python -B tests\pixel_sdwa_borrow_probe.py "<sdk>\bin\10.0.26100.0\x64\dxc.exe" "out\build\dev\offscreen_check.exe" hardware

Observed

1/2 Test #1922: pixel_aot_sdwa_int_extra_hardware ...   Passed    6.01 sec
2/2 Test #2170: pixel_aot_sdwa_int_extra_warp .......   Passed    3.86 sec
100% tests passed out of 2

Nine probe lines, three per row. The channel-1 words the report expects (0000fffc, 00000005, 0000ffff) are what the derived and matched draws return:

row 0 derived expected 00000005 0000fffc 000b1337 00000001  observed 00000005 0000fffc 000b1337 00000001  mismatched pixels 0/4096
row 0 matched expected 00000005 0000fffc 000b1337 00000001  observed 00000005 0000fffc 000b1337 00000001  mismatched pixels 0/4096
row 0 flipped expected 00000005 0000fffd 000b1337 00000001  observed 00000005 0000fffd 000b1337 00000001  mismatched pixels 0/4096
row 1 derived expected 0000000a 00000005 fffd1337 00000001  observed 0000000a 00000005 fffd1337 00000001  mismatched pixels 0/4096
row 1 matched expected 0000000a 00000005 fffd1337 00000001  observed 0000000a 00000005 fffd1337 00000001  mismatched pixels 0/4096
row 1 flipped expected 0000000a 00000004 fffd1337 00000001  observed 0000000a 00000004 fffd1337 00000001  mismatched pixels 0/4096
row 2 derived expected 00000000 0000ffff ffff1337 00000001  observed 00000000 0000ffff ffff1337 00000001  mismatched pixels 0/4096
row 2 matched expected 00000000 0000ffff ffff1337 00000001  observed 00000000 0000ffff ffff1337 00000001  mismatched pixels 0/4096
row 2 flipped expected 00000000 00000000 00001337 00000000  observed 00000000 00000000 00001337 00000000  mismatched pixels 0/4096

The same pipeline drawn through the renderer directly reports pixels=4096 channels=16384 max_absolute_error=0 with readback_first=00000000 0000ffff ffff1337 00000001.

What the readback says

  • The derived-borrow path returns the expected channel-1 words on all three rows, in the original shader and in the constant-buffer variant.
  • The flipped column changes channel 1 by one unit on rows 0 and 1, and moves 0000ffff to 00000000 on row 2, so the GPU output tracks the supplied carry-in and the readback is sensitive to it on this adapter.
  • Row 2 is the case whose expected channel-1 word is 0000ffff; the report's observed word there was 00000000. The flipped draw also reads 00000000 on that row, so row 2 alone does not separate "read the subtrahend" from "lost the mask". Rows 0 and 1 carry that distinction (0000fffc against the reported 00000005, and 00000005 against 00000004).
  • The hardware run prints thirteen mutation status lines before passing. Five of them contain a pass on one row; tests/pixel_aot_check.py:11351 only requires a mismatch somewhere in the three-row list, so a per-row pass is not examined. Both co_ci mutations print ['mismatch', 'mismatch', 'pass'].

Limits

  • One adapter and one driver. This does not separate "RDNA 1" from "driver 32.0.21045.29003"; it shows the report does not extend to RDNA 4 on 32.0.32029.2010, which is neither the reporter's adapter nor his driver.
  • The compute-side WaveReadLaneFirst probe in the report is not reproduced here; only the pixel fixture and the pixel borrow probe ran.
  • No debug layer (d3d12SDKLayers.dll absent), so no API validation; one preset.
  • The probe and the fixture share the project's sdwa_int_extra_reference. The probe does cross-check its expectations with a second computation of its own (forced_reference) and asserts equality on all three rows before drawing, so the run reaching its draws means both agreed — an internal cross-check, not an external oracle.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7186180222 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2731#issuecomment-7186180222). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-26T08:05:46Z. --- **On RDNA 4 (`1002:7550`, driver `32.0.32029.2010`) at `b457f7ff` the SDWA `co_ci` mismatch reported here does not reproduce: the fixture passes and the borrow probe matches on every row.** Not a code change; measurements only. ### Environment - Windows 11 25H2 build `10.0.26200.9974`; MSVC `19.44.35230` (BuildTools `14.44.35207`), preset `dev`. - DXC `1.9.2602.17` (`dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17)`), the same version the report above used, so the compiler is not what differs between the two runs; the adapter and its driver are. - The renderer's own lines: `backend=hardware debug_layer=unavailable`, `adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550`, `driver=32.0.32029.2010`. - Head `b457f7ff` (`b457f7ffa48fe4adb87e6b7d58a21a179dfee221`), `git status --porcelain --untracked-files=no` empty. - `tests/pixel_aot_check.py` carries both the lowering (`translate_int`) and the `co_ci` program. The copy at `2215c26d` and the one at `b457f7ff` are identical after LF normalisation (`sha256 fcb94345…`, `1 620 580` bytes, `identical_lf=True`). The HLSL this tree emits for `co_ci` is 206 lines, `sha256 c6d00c57…`. - The adapter filter is strict: the same command with a trailing space in `XBOX2WINDOWS_ADAPTER` fails with `No D3D12 hardware adapter matches`, so the passing run selects the card by its DXGI name. ### Commands ``` set "XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT" ctest --preset dev --no-tests=error -R "^(pixel_aot_sdwa_int_extra_(warp|hardware))$" -V ``` The probe is `tests/pixel_sdwa_borrow_probe.py` from @RavenCurseBurg at `5e50c3fa`, copied unchanged into `tests/` of the `b457f7ff` checkout: ``` python -B tests\pixel_sdwa_borrow_probe.py "<sdk>\bin\10.0.26100.0\x64\dxc.exe" "out\build\dev\offscreen_check.exe" hardware ``` ### Observed ``` 1/2 Test #1922: pixel_aot_sdwa_int_extra_hardware ... Passed 6.01 sec 2/2 Test #2170: pixel_aot_sdwa_int_extra_warp ....... Passed 3.86 sec 100% tests passed out of 2 ``` Nine probe lines, three per row. The channel-1 words the report expects (`0000fffc`, `00000005`, `0000ffff`) are what the `derived` and `matched` draws return: ``` row 0 derived expected 00000005 0000fffc 000b1337 00000001 observed 00000005 0000fffc 000b1337 00000001 mismatched pixels 0/4096 row 0 matched expected 00000005 0000fffc 000b1337 00000001 observed 00000005 0000fffc 000b1337 00000001 mismatched pixels 0/4096 row 0 flipped expected 00000005 0000fffd 000b1337 00000001 observed 00000005 0000fffd 000b1337 00000001 mismatched pixels 0/4096 row 1 derived expected 0000000a 00000005 fffd1337 00000001 observed 0000000a 00000005 fffd1337 00000001 mismatched pixels 0/4096 row 1 matched expected 0000000a 00000005 fffd1337 00000001 observed 0000000a 00000005 fffd1337 00000001 mismatched pixels 0/4096 row 1 flipped expected 0000000a 00000004 fffd1337 00000001 observed 0000000a 00000004 fffd1337 00000001 mismatched pixels 0/4096 row 2 derived expected 00000000 0000ffff ffff1337 00000001 observed 00000000 0000ffff ffff1337 00000001 mismatched pixels 0/4096 row 2 matched expected 00000000 0000ffff ffff1337 00000001 observed 00000000 0000ffff ffff1337 00000001 mismatched pixels 0/4096 row 2 flipped expected 00000000 00000000 00001337 00000000 observed 00000000 00000000 00001337 00000000 mismatched pixels 0/4096 ``` The same pipeline drawn through the renderer directly reports `pixels=4096 channels=16384 max_absolute_error=0` with `readback_first=00000000 0000ffff ffff1337 00000001`. ### What the readback says - The derived-borrow path returns the expected channel-1 words on all three rows, in the original shader and in the constant-buffer variant. - The `flipped` column changes channel 1 by one unit on rows 0 and 1, and moves `0000ffff` to `00000000` on row 2, so the GPU output tracks the supplied carry-in and the readback is sensitive to it on this adapter. - Row 2 is the case whose expected channel-1 word is `0000ffff`; the report's observed word there was `00000000`. The `flipped` draw also reads `00000000` on that row, so row 2 alone does not separate "read the subtrahend" from "lost the mask". Rows 0 and 1 carry that distinction (`0000fffc` against the reported `00000005`, and `00000005` against `00000004`). - The hardware run prints thirteen mutation status lines before passing. Five of them contain a `pass` on one row; `tests/pixel_aot_check.py:11351` only requires a `mismatch` somewhere in the three-row list, so a per-row `pass` is not examined. Both `co_ci` mutations print `['mismatch', 'mismatch', 'pass']`. ### Limits - One adapter and one driver. This does not separate "RDNA 1" from "driver `32.0.21045.29003`"; it shows the report does not extend to RDNA 4 on `32.0.32029.2010`, which is neither the reporter's adapter nor his driver. - The compute-side `WaveReadLaneFirst` probe in the report is not reproduced here; only the pixel fixture and the pixel borrow probe ran. - No debug layer (`d3d12SDKLayers.dll` absent), so no API validation; one preset. - The probe and the fixture share the project's `sdwa_int_extra_reference`. The probe does cross-check its expectations with a second computation of its own (`forced_reference`) and asserts equality on all three rows before drawing, so the run reaching its draws means both agreed — an internal cross-check, not an external oracle. _AI-assisted._
ColorMeBoom commented 2026-11-26 14:00:36 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by ColorMeBoom on 2026-11-26T13:11:09Z.


RDNA 1 run of the requested comparison, in the same ps_6_2 pipeline. The derived borrow is wrong on the RX 5700 XT; the same borrow supplied as a run-time uniform is exact.

Setup: main 4992a46e, dev preset. DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), compiled with the fixture's own compile_shader (-Gis -denorm preserve, ps_6_2). AMD Radeon RX 5700 XT (1002:731f), driver 32.0.21045.29003; WARP 10.0.26100.9818. Windows 11 build 26200.9974. Debug layer unavailable.

Method: the same comparison as @RavenCurseBurg's probe, from a local script that uses only the repository's helpers (uncompressed_export, translate_int, compile_shader, SDWA_INT_EXTRA_*, sdwa_int_extra_reference) and offscreen_check --check-pixel-case. The only HLSL edit replaces uint ci26 = cmp25 ? 1u : 0u; with uint ci26 = params[1].w;, and that word is supplied after the four row words. Each draw reads back all 4,096 pixels. Words are channels 0–3 of pixel (0, 0); "pixels" counts pixels that differ from the reference for the matched borrow.

RX 5700 XT

Row Draw Borrow into ch1 Words Pixels off
0 derived 1 (from the carry) 00000005 00000005 000b1337 00000001 4096
0 uniform, matched 1 00000005 0000fffc 000b1337 00000001 0
0 uniform, flipped 0 00000005 0000fffd 000b1337 00000001 (flipped)
1 derived 0 (from the carry) 0000000a 00000004 fffd1337 00000001 4096
1 uniform, matched 0 0000000a 00000005 fffd1337 00000001 0
1 uniform, flipped 1 0000000a 00000004 fffd1337 00000001 (flipped)
2 derived 1 (from the carry) 00000000 00000000 ffff1337 00000001 4096
2 uniform, matched 1 00000000 0000ffff ffff1337 00000001 0
2 uniform, flipped 0 00000000 00000000 00001337 00000000 (flipped)

WARP: derived and matched both read the reference on every row (0/4096). The flipped draws read 0000fffd, 00000004 and 00000000 00001337 00000000, the same as the RX 5700 XT and as the Intel/RTX/WARP flipped column above.

What this shows on this adapter and driver:

  • With the borrow supplied as a run-time uniform, all four channels match on every row (0/4096), and flipping it moves channel 1 exactly as the arithmetic predicts. So the subtract with a uniform borrow and the 16-bit mask are exact here.
  • Only the derived-borrow path is wrong, and only in channel 1. Channels 0 and 2, and the final borrow in channel 3, are exact in the derived draws too. So the carry itself reaches the later instructions correctly, and the wrong value is confined to the channel-1 subtraction when its borrow comes from cmp25.
  • The derived channel-1 words (5, 4, 0) are not simply the flipped-borrow results: row 0 would be 0000fffd with the opposite borrow, not 00000005. That fits a miscompile of the derived pattern better than a wrong borrow value.

Limits: one RDNA 1 adapter and one driver. I did not try a newer AMD driver for this pattern, so RDNA 1 versus this driver is still unseparated. @thepatrickworld's RX 9070 XT on 32.0.32029.2010 passes, which differs in both at once. The pixel draws only, not the compute probe. One run per draw.

AI-assisted with Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7192990776 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2731#issuecomment-7192990776). Originally posted by [ColorMeBoom](https://github.com/ColorMeBoom) on 2026-11-26T13:11:09Z. --- RDNA 1 run of the requested comparison, in the same `ps_6_2` pipeline. The derived borrow is wrong on the RX 5700 XT; the same borrow supplied as a run-time uniform is exact. Setup: main `4992a46e`, dev preset. DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), compiled with the fixture's own `compile_shader` (`-Gis -denorm preserve`, `ps_6_2`). AMD Radeon RX 5700 XT (1002:731f), driver 32.0.21045.29003; WARP 10.0.26100.9818. Windows 11 build 26200.9974. Debug layer unavailable. Method: the same comparison as @RavenCurseBurg's probe, from a local script that uses only the repository's helpers (`uncompressed_export`, `translate_int`, `compile_shader`, `SDWA_INT_EXTRA_*`, `sdwa_int_extra_reference`) and `offscreen_check --check-pixel-case`. The only HLSL edit replaces `uint ci26 = cmp25 ? 1u : 0u;` with `uint ci26 = params[1].w;`, and that word is supplied after the four row words. Each draw reads back all 4,096 pixels. Words are channels 0–3 of pixel (0, 0); "pixels" counts pixels that differ from the reference for the matched borrow. **RX 5700 XT** | Row | Draw | Borrow into ch1 | Words | Pixels off | |---|---|---|---|---| | 0 | derived | 1 (from the carry) | `00000005 00000005 000b1337 00000001` | 4096 | | 0 | uniform, matched | 1 | `00000005 0000fffc 000b1337 00000001` | 0 | | 0 | uniform, flipped | 0 | `00000005 0000fffd 000b1337 00000001` | (flipped) | | 1 | derived | 0 (from the carry) | `0000000a 00000004 fffd1337 00000001` | 4096 | | 1 | uniform, matched | 0 | `0000000a 00000005 fffd1337 00000001` | 0 | | 1 | uniform, flipped | 1 | `0000000a 00000004 fffd1337 00000001` | (flipped) | | 2 | derived | 1 (from the carry) | `00000000 00000000 ffff1337 00000001` | 4096 | | 2 | uniform, matched | 1 | `00000000 0000ffff ffff1337 00000001` | 0 | | 2 | uniform, flipped | 0 | `00000000 00000000 00001337 00000000` | (flipped) | **WARP:** derived and matched both read the reference on every row (0/4096). The flipped draws read `0000fffd`, `00000004` and `00000000 00001337 00000000`, the same as the RX 5700 XT and as the Intel/RTX/WARP flipped column above. What this shows on this adapter and driver: - With the borrow supplied as a run-time uniform, all four channels match on every row (0/4096), and flipping it moves channel 1 exactly as the arithmetic predicts. So the subtract with a uniform borrow and the 16-bit mask are exact here. - Only the derived-borrow path is wrong, and only in channel 1. Channels 0 and 2, and the final borrow in channel 3, are exact in the derived draws too. So the carry itself reaches the later instructions correctly, and the wrong value is confined to the channel-1 subtraction when its borrow comes from `cmp25`. - The derived channel-1 words (5, 4, 0) are not simply the flipped-borrow results: row 0 would be `0000fffd` with the opposite borrow, not `00000005`. That fits a miscompile of the derived pattern better than a wrong borrow value. Limits: one RDNA 1 adapter and one driver. I did not try a newer AMD driver for this pattern, so RDNA 1 versus this driver is still unseparated. @thepatrickworld's RX 9070 XT on 32.0.32029.2010 passes, which differs in both at once. The pixel draws only, not the compute probe. One run per draw. AI-assisted with Claude Code (Claude Opus 5.5).
xiaoqi72665 commented 2026-11-27 03:23:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by xiaoqi72665 on 2026-11-27T03:23:11Z.


RDNA3 post-#2850 SDWA borrow comparison (RX 7900 XT)

Source-built public fixtures at a4fae199517158fd443bfdd450f476b2c7b5f4c1, clean main, Debug (dev preset), Windows 10 build 19045.6466, Windows SDK 10.0.26100.0 DXC 1.8.2502.11. RX 7900 XT (1002:744c), driver 32.0.32029.2010; in-box WARP 10.0.19041.5794. D3D12 debug layer unavailable. SPIRV-Tools 262bdab4 / Headers b824a462, SPIRV-Cross 57e4efc with the repository MinLod patch.

The previously captured stock pixel_aot_sdwa_int_extra_(hardware|warp) entries passed on the preceding README-only branch 89a821d5; the relevant source files did not change between that revision and current main. On the current main revision I also ran the derived-borrow / matched runtime-uniform / flipped-uniform comparison from @RavenCurseBurg's public probe at 5e50c3fa, adapted for the merged #2850 lowering.

Important reproducibility detail: #2850 (1940788) now uses cmp25 directly to select the completed difference. The original probe replaces only ci26, so its flipped-borrow controls no longer inject the same bit into both consumers. I observed that stale-probe discrepancy on both backends. The local diagnostic adaptation asserts both original lines occur exactly once and makes both replacements in the uniform variant:

// Original translated lines:
uint ci26 = cmp25 ? 1u : 0u;
uint co26 = cmp25 ? ~(sb26 - sa26) : cp26;
// Uniform diagnostic variant:
uint ci26 = params[1].w;
uint co26 = (ci26 != 0u) ? ~(sb26 - sa26) : cp26;

No changes to production translation or the CPU reference. The adapted probe passed 9/9 draws on each adapter (three rows x three variants); all 4,096 pixels per draw matched the independent expected RGBA words. Derived and matched uniform were identical. Flipped uniform correctly produced these distinct words:

Row Derived / matched Flipped
0 00000005 0000fffc 000b1337 00000001 00000005 0000fffd 000b1337 00000001
1 0000000a 00000005 fffd1337 00000001 0000000a 00000004 fffd1337 00000001
2 00000000 0000ffff ffff1337 00000001 00000000 00000000 00001337 00000000

The probe was run with the repository tests directory on PYTHONPATH, using python -B <adapted-probe.py> <SDK-dxc.exe> out/build/dev/offscreen_check.exe hardware and the same command with warp, with XBOX2WINDOWS_ADAPTER set to RX 7900 XT. Both exited 0. Original and adapted probe and logs retained locally.

This is additional RDNA3 coverage after the merged fix, not a claim to have reproduced or fixed the RDNA1 RX 5700 XT failure.

Buhe (@xiaoqi72665). AI-assisted; tests executed on local hardware.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7208944214 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2731#issuecomment-7208944214). Originally posted by [xiaoqi72665](https://github.com/xiaoqi72665) on 2026-11-27T03:23:11Z. --- ### RDNA3 post-#2850 SDWA borrow comparison (RX 7900 XT) Source-built public fixtures at `a4fae199517158fd443bfdd450f476b2c7b5f4c1`, clean `main`, Debug (`dev` preset), Windows 10 build 19045.6466, Windows SDK 10.0.26100.0 DXC 1.8.2502.11. RX 7900 XT (1002:744c), driver 32.0.32029.2010; in-box WARP 10.0.19041.5794. D3D12 debug layer unavailable. SPIRV-Tools `262bdab4` / Headers `b824a462`, SPIRV-Cross `57e4efc` with the repository MinLod patch. The previously captured stock `pixel_aot_sdwa_int_extra_(hardware|warp)` entries passed on the preceding README-only branch `89a821d5`; the relevant source files did not change between that revision and current main. On the current main revision I also ran the derived-borrow / matched runtime-uniform / flipped-uniform comparison from @RavenCurseBurg's [public probe at 5e50c3fa](https://github.com/RavenCurseBurg/Xbox2Windows/blob/5e50c3fa49e73c0378cc3cca00521d56ff840085/tests/pixel_sdwa_borrow_probe.py), adapted for the merged #2850 lowering. Important reproducibility detail: #2850 (1940788) now uses `cmp25` directly to select the completed difference. The original probe replaces only `ci26`, so its flipped-borrow controls no longer inject the same bit into both consumers. I observed that stale-probe discrepancy on both backends. The local diagnostic adaptation asserts both original lines occur exactly once and makes both replacements in the uniform variant: ```hlsl // Original translated lines: uint ci26 = cmp25 ? 1u : 0u; uint co26 = cmp25 ? ~(sb26 - sa26) : cp26; // Uniform diagnostic variant: uint ci26 = params[1].w; uint co26 = (ci26 != 0u) ? ~(sb26 - sa26) : cp26; ``` No changes to production translation or the CPU reference. The adapted probe passed 9/9 draws on each adapter (three rows x three variants); all 4,096 pixels per draw matched the independent expected RGBA words. Derived and matched uniform were identical. Flipped uniform correctly produced these distinct words: | Row | Derived / matched | Flipped | |---|---|---| | 0 | 00000005 0000fffc 000b1337 00000001 | 00000005 0000fffd 000b1337 00000001 | | 1 | 0000000a 00000005 fffd1337 00000001 | 0000000a 00000004 fffd1337 00000001 | | 2 | 00000000 0000ffff ffff1337 00000001 | 00000000 00000000 00001337 00000000 | The probe was run with the repository tests directory on PYTHONPATH, using `python -B <adapted-probe.py> <SDK-dxc.exe> out/build/dev/offscreen_check.exe hardware` and the same command with `warp`, with XBOX2WINDOWS_ADAPTER set to RX 7900 XT. Both exited 0. Original and adapted probe and logs retained locally. This is additional RDNA3 coverage after the merged fix, not a claim to have reproduced or fixed the RDNA1 RX 5700 XT failure. Buhe (@xiaoqi72665). AI-assisted; tests executed on local hardware.
Sign in to join this conversation.
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
R0Y00/Xbox2Windows#2723
No description provided.