Repository navigation
Description
Commit or build
2215c26 (main)
Reproduction
ctest --preset dev --no-tests=error -R '^(startup_gfx2hlsl_f32_med3|compute_store_aot_mac_f32)_(warp|hardware)$' -VExpected behavior
Each test's negative control produces a mismatch on hardware. The translated results themselves are correct on the RX 5700 XT in both tests, so only the controls fail.
Observed behavior
Both tests pass on WARP and fail on the RX 5700 XT, each at its negative control. In both, the control is non-precise (or FMad) code whose result HLSL does not pin down, and this driver resolves it the same way as the correct lowering.
startup_gfx2hlsl_f32_med3_hardware. The translated med3_32 draws the ISA words 3f800000,40000000,3fc00000,3f800000 with FXC and DXC, also after #2044. The restored branchless helper max(min(a, b), min(max(a, b), c)) also draws 3f800000 on the NaN lane, so the check reports fxc/dxc branchless lowering on hardware was accepted: the draw does not catch the defect. In the fixture b and c are the literals 2.0 and 1.0. In a DXC cs_6_0 probe with inputs read at run time (offscreen_check --raw-uav-dump):
| Expression, a = NaN | RX 5700 XT | WARP |
|---|---|---|
| branchless with b, c read at run time | 40000000 |
40000000 |
| branchless with literals 2.0, 1.0 (the fixture) | 3f800000 |
40000000 |
same, precise float o = ... |
40000000 |
40000000 |
clamp(a, 1.0, 2.0) |
3f800000 |
3f800000 |
With constant bounds, the non-precise median folds to a clamp, whose NaN result is not fixed (WARP returns 1.0 for clamp too). Through the fixture's own --startup-entry-words draw at 2215c26, a precise branchless helper restores the control:
float med3_32(float a, float b, float c) {
precise float r = max(min(a, b), min(max(a, b), c));
return r;
}With it, the NaN lane draws 40000000 and the other three lanes match. That holds on the RX 5700 XT and WARP, with FXC ps_5_1 and DXC ps_6_0.
compute_store_aot_mac_f32_hardware. The translated shader matches all 320 words. The hardware mutation precise float r = mad(...) then escapes with mutation 'fused mad() instead of unfused multiply+add' escaped detection. DXC emits it as FMad (op 46), which the driver may fuse or not. Probe with 4097 * 4097 - 16785408 (1 if fused, 0 if unfused):
| Expression | RX 5700 XT | WARP |
|---|---|---|
precise float m = mad(a, a, c) |
0 (unfused) | 0 (unfused) |
mad(a, a, c) |
0 (unfused) | 0 (unfused) |
RDNA 1 still has the unfused v_mad_f32, so on this adapter the mutation computes what the correct shader computes. The review of #2164 found the same equivalent mutant on WARP and suggested not requiring mad detection on every backend. The mutation is now hardware-only, but this hardware does not fuse either. One option is a first dispatch that measures whether the adapter fuses mad(), with this one mutation reported as a capability skip when it does not. The other three controls would stay strict.
I can send the med3 change as a PR, and the mac_f32 change once you pick the approach.
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 and FXC from the SDK. 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.
Activity
RonLogic commentedon Nov 26, 2026
Cross-adapter comparison on Windows
26300.10075, MSVC Release, with the relevant source unchanged from2215c26dand the D3D12 debug layer enabled: all four CTests passed on in-box WARP (10.0.26100.10068) and physical RTX 4070 (32.0.16.2124). Both FXC and DXCmed3mutations changed only the NaN lane to40000000on the RTX 4070. The hardwaremac_f32run also caught its fusedmadmutation here. The translated shaders matched their references on both backends. These are comparison results for the reported RDNA 1 control behavior.R0Y00 commentedon Nov 26, 2026
Please send the test-only changes. The
precisebranchless median is an appropriate negative control if the same draw keeps the expected NaN-lane mismatch and the other three lanes on both FXC and DXC. For MAC, measure whether the actual shader target fusesmadusing the same cancellation input. If readback reports the unfused value, log that this one mutation is inapplicable. Keep the translated shader's full word comparison and the other three mutations mandatory, and fail on probe compilation, dispatch, readback or any unexpected probe value. This should never skip the whole CTest. Please include the RX 5700 XT and WARP results. HLSL madthepatrickworld commentedon Nov 26, 2026
AMD RDNA 4 (
1002:7550) onmainf14219f2: themac_f32mutation escapes here too, thef32_med3control does not. Not a code change; measurements only.Environment
10.0.26200.9974(UBR0x26f6,DisplayVersion25H2); MSVC19.44.35230; DXC and FXC fromWindows Kits\10\bin\10.0.26100.0\x64\.AMD Radeon RX 9070 XT,vendor=1002 device=7550, driver32.0.32029.2010. Thewarpbackend selects an adapter reported asMicrosoft Basic Render Driver, driver10.0.26100.9818.debug layer unavailable, so no API validation is involved.mainf14219f2(f14219f220df38ac3ee2be9a06b5527b48de63d5).Commands
Observed
The two controls split on this adapter: the branchless
med3helper is caught (that entry passes), and only themad()mutation escapes, attests/compute_store_check.py:3784withmutation 'fused mad() instead of unfused multiply+add' escaped detection. Before it, the hardware run printsgroups=1 compared_words=320 mismatches=0.What that says about fusion here, without needing the mutation: on the correct shader the fixture first requires the fused model to be detected at word 0 (
mac_f32_words(fused=True), lines 3755-3764), and this run reached line 3784, so all those reference controls were rejected. The adapter therefore matched the unfused model on all 320 words and differed from the fused one at word 0. The translated source ispreciseon both products, so what this measures is that the driver honoursprecisehere, not a general property of the adapter.The assertion at 3784 fires when the mutated draw does not come back as a clean difference (
returncode 1withCompute readback differson stderr). So on this card themad()source produced no reported difference: the control could not separate it, the same outcome as the RX 5700 XT report above.That makes three adapters in this thread: the RX 5700 XT and this card report the unfused value, the RTX 4070 above catches the mutation. Under the rule described in the reply above, this readback means that one mutation is inapplicable on this adapter rather than a defect of the lowering; the full 320-word comparison and the four reference controls ran and passed before it.
Limits
mad()" is read from the readbacks, not measured as a capability.f32_med3passes" says that entry's control is caught on this adapter; it says nothing about which rows of the RX 5700 XT table above would reproduce.AI-assisted.
stan495 commentedon Nov 26, 2026
AMD Radeon RX 7900 XTX (RDNA 3,
1002:744c) comparison on174f963d:startup_gfx2hlsl_f32_med3_hardwarepasses (both FXC and DXC), whilecompute_store_aot_mac_f32_hardwarefails at the samefused mad()mutation (escaped detection).Measurements only; no repository files modified.
Environment
10.0.26200.9974)174f963d(working tree has an unrelated pre-existing modification intools/startup/debug_launch.py), presetrelease10.0.26100.0FXC and DXC (dxcompiler.dll1.8.2502.11)$env:XBOX2WINDOWS_ADAPTER = "7900"):AMD Radeon RX 7900 XTX(vendor=1002 device=744c), driver32.0.32029.2010,debug_layer=enabledMicrosoft Basic Render Driver(vendor=1414 device=008c), driver10.0.26100.9818,debug_layer=enabledCommands
Observed
startup_gfx2hlsl_f32_med3_warp: Passed (0.98 sec,debug_errors=0 debug_warnings=0)startup_gfx2hlsl_f32_med3_hardware: Passed (1.37 sec,debug_errors=0 debug_warnings=0)3f800000,40000000,3fc00000,3f800000for the translated lowering and40000000,40000000,3fc00000,3f800000(mismatched only on the NaN lane) for the branchless control.compute_store_aot_mac_f32_warp: Passed (4.00 sec,groups=1 compared_words=320 mismatches=0,debug_errors=0 debug_warnings=0; themad()mutation only runs onbackend == "hardware")compute_store_aot_mac_f32_hardware: Failed (4.85 sec)groups=1 compared_words=320 mismatches=0,debug_errors=0 debug_warnings=0), and all four reference controls failed as expected before reaching the hardware-only mutation attests/compute_store_check.py:3784:This places RDNA 3 (
RX 7900 XTX) alongside RDNA 1 (RX 5700 XT) and RDNA 4 (RX 9070 XT) forcompute_store_aot_mac_f32_hardware, whilestartup_gfx2hlsl_f32_med3_hardwarecatches its branchless control on this adapter.AI-assisted; commands listed were executed locally.
tests: keep two hardware negative controls meaningful on RDNA 1 (#2730)…