Skip to content

startup_gfx2hlsl_fma_mix_dispatch_hardware fails on RX 9070 XT: -0 addend reads back as +0 #2746

Backlog

Description

@MasterDomino

startup_gfx2hlsl_fma_mix_dispatch_hardware (added in #2055) fails on an AMD Radeon RX 9070 XT, while its WARP variant passes. I first saw it on several unrelated PR heads during reviews. It also fails on a main revision that includes #2055 (de75613f), in both the dev and release presets, so none of those PRs caused it.

Environment: Windows 11 build 26300; AMD Radeon RX 9070 XT (1002:7550), driver 32.0.32029.2010; WARP 10.0.26100.9818. Synthetic fixture only.

ctest --preset release --no-tests=error -R '^startup_gfx2hlsl_fma_mix_dispatch_(warp|hardware)$' -V
adapter=Microsoft Basic Render Driver ... all fma_mix checks passed
adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
hardware: negated inline 0 addend keeps a -0 product readback: MISMATCH
  expected 80000000, got 00000000
hardware: control without the high-half shift reads the low half in all 4 high-half cases: MISMATCH

Both failures come from one case. The row v_fma_mix_f32 v1, v2, v3, -0 op_sel:[0,1,0] op_sel_hi:[0,1,0] translates to v1 = U(F(v2) * f16tof32(v3 >> 16) + (-0.0));. The fixture sets v2 = 0x80000000 (OVERRIDES), so the product is -0. IEEE gives -0 + -0 = -0; WARP returns 0x80000000 and the RX 9070 XT returns +0. The second check fails for the same reason, because that -0 row is one of the 4 high-half rows the control compares.

Likely cause (hypothesis, not confirmed against the driver's ISA): D3D float math without precise isn't required to preserve the sign of zero. The AMD compiler appears to treat the -0.0 addend, or the sum, as +0. The translation is IEEE-correct, but nothing tells the driver to keep signed zeros there.

Possible fixes for the translator owner:

  • Drop the addend: emit the product alone when the addend is an inline -0 (x + (-0.0) == x exactly in IEEE). No signed-zero add is left for the compiler to fold.
  • Mark it precise: mark that expression precise, and check that DXC and the AMD driver then keep -0.

Either fix should be checked on this adapter with the existing case, plus the same case on a non-zero product as a control.

@Not-Saii, this is your fixture from #2055; happy to rerun a fix on the RX 9070 XT.

AI-assisted; commands listed were executed locally.

Activity

  1. R0Y00 commented on Nov 26, 2026

    @R0Y00
    Owner

    Thanks for isolating this on the RX 9070 XT and checking an unaffected main build. The RX 5700 XT report in #2729 reproduces the same signed-zero word mismatch. Its probe also found that removing the addend alone still returned +0, so please use the same focused candidate from #2729 for the RDNA 4 retest. On the exact candidate, record the signed-zero word, a nonzero product, and the wrong-half mutation separately on the RX 9070 XT and WARP. Keep the raw-bit expectation in the existing test.

  2. MasterDomino commented on Nov 26, 2026

    @MasterDomino
    CollaboratorAuthor

    Same class, more cases: on this RX 9070 XT, startup_gfx2hlsl_f16_alu_draw_hardware also fails on main (WARP passes).

    Both fail with FXC and DXC. So a fix for signed zero, such as precise or avoiding a fold the driver can take, likely needs to cover f16 multiplies as well as the fma_mix addend.

    AI-assisted; commands listed were executed locally.

  3. thepatrickworld commented on Nov 26, 2026

    @thepatrickworld
    Contributor

    RDNA 4 retest of the #2729 candidate on b457f7ff (26200.9974): a zero product from an operand widened out of binary16 reads back +0, and the same expression under precise keeps -0.

    Not a code change; measurements only.

    Environment

    • Windows 10.0.26200.9974 (25H2, UBR 0x26f6); MSVC BuildTools toolset 14.44.35207; DXC from Windows Kits\10\bin\10.0.26100.0\x64\, reporting dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17).
    • main b457f7ff (b457f7ffa48fe4adb87e6b7d58a21a179dfee221), preset dev.
    • Adapter AMD Radeon RX 9070 XT vendor=1002 device=7550, driver 32.0.32029.2010. warp reports Microsoft Basic Render Driver vendor=1414 device=008c, driver 10.0.26100.9818. Every mode line reports debug_layer=unavailable.

    It reproduces on this build

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

    1027: adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
    1027: driver=32.0.32029.2010
    1027: hardware: negated inline 0 addend keeps a -0 product readback: MISMATCH
    1027:   expected 80000000, got 00000000
    1027: hardware: control without the high-half shift reads the low half in all 4 high-half cases: MISMATCH
    1027: hardware: control changes 4 of 4 high-half results: ok
    1027: FAILED: 2 check(s): hardware: negated inline 0 addend keeps a -0 product readback, hardware: control without the high-half shift reads the low half in all 4 high-half cases
    1026: warp: control changes 3 of 4 high-half results: ok
    1/2 Test #1026: startup_gfx2hlsl_fma_mix_dispatch_warp .......   Passed    0.74 sec
    2/2 Test #1027: startup_gfx2hlsl_fma_mix_dispatch_hardware ...***Failed    0.90 sec
    

    The other 16 readback checks and every decode check pass on both backends. The second failure is the test's own negative control (mutated = line.replace(' >> 16)', ')')); it is the same zero-product case, and it is consistent with the same sign loss, but I did not take its per-row words apart (that dump goes to a temporary directory).

    The candidate rows, on this adapter

    Standalone cs_6_0 shader through offscreen_check --raw-uav-dump (the tool's bindings: t0 = its 2x1 R32_FLOAT texture 0.25/0.75, u0 = raw buffer pre-filled with raw_uav_fill_word). Operands are u0.Load(k) ^ constant against fill words whose value is fixed by the tool, so nothing folds; rows 10-12 store the operands themselves. Two shaders, identical except that one also declares the precise form:

    row expression (v2 = -0.0, v3 = 0x44003A00 → high 4.0, low 0.75) A: RX 9070 XT A: WARP B: RX 9070 XT B: WARP
    0 F(v2) * f16tof32(v3 >> 16) + (-0.0) — the translated line 80000000 80000000 00000000 80000000
    1 same, no addend 80000000 80000000 00000000 80000000
    2 F(v2) * f16tof32(v3 & 0xffff) + (-0.0) — low half 00000000 80000000 00000000 80000000
    3 mad(F(v2), f16tof32(v3 >> 16), -0.0) 80000000 80000000 00000000 80000000
    4 F(v2) * F(v3f) + (-0.0), binary32 operand (4.015625) 80000000 80000000 80000000 80000000
    5 precise mul + add 80000000 80000000 repeat of row 0 repeat of row 0
    6 precise mad 80000000 80000000 repeat of row 3 repeat of row 3
    7 F(v2) * f16tof32(v3 >> 16) + 0.0 80000000 80000000 00000000 80000000
    8 0.25 * f16tof32(v3 >> 16) — nonzero product 3f800000 3f800000 3f800000 3f800000
    9 0.25 * f16tof32(v3 & 0xffff) — wrong half 3e400000 3e400000 3e400000 3e400000
    10-12 operands as stored words 80000000, 44003a00, 40808000 same same same

    The three records you asked for: the signed-zero word is rows 0-7; the nonzero product is rows 8-9, identical on both adapters (1.0 and 0.1875), so the multiply and the readback are sound; the wrong-half mutation is row 9, distinct from row 8, so reading the wrong half is separable whenever the product is not zero.

    DXIL, which is what separates the rows

    In shader B (no precise anywhere), every store above maps to one of four instructions:

    %16 = fmul fast float %15, %6      ; %15 = legacyF16ToF32(high half)  -> stores 0, 4, 20, 28 -> rows 0, 1, 5, 7
    %20 = fmul fast float %19, %6      ; legacyF16ToF32(low half)         -> store 8           -> row 2
    %22 = tertiary.f32 = FMad(%6, %15, -0.0)                              -> stores 12, 24     -> rows 3, 6
    %24 = fmul fast float %11, %6      ; binary32 operand                 -> store 16          -> row 4
    

    + (-0.0) is not in the DXIL at all (folded away, and the identity is exact), so the sign is lost on the multiply, not on the addend: row 1, which has no addend, fails the same way. The rows that lose the sign are the ones whose operand is widened out of binary16 through legacyF16ToF32; the fmad row 3 is not a fmul fast and loses it too, while the binary32 row 4 is a fmul fast and keeps it. So neither the addend nor the fast-math flag alone is the criterion.

    In shader A, the same four instructions carry !dx.precise: %16 becomes fmul without fast (and is shared by stores 0, 4, 20, 28 through CSE), %17 is the tertiary with !dx.precise for rows 3 and 6, and those rows keep -0 on the card.

    What this establishes, and what it does not

    • Establishes: on this adapter and driver, a multiply or mad whose operand is widened out of binary16 drops the sign of a zero result; WARP keeps it; the same probe with a binary32 operand keeps it; and the precise form keeps it on both.
    • Does not establish where the sign is dropped. precise changes at least the multiply's fast-math flag, the !dx.precise metadata on the conversion and on the tertiary, and which instructions CSE merges, so this is not a one-variable experiment and I am not naming the driver or the compiler as the cause. No ISA disassembly was taken.

    Reproducing this: one trap, measured

    A probe that also contains the precise form of the same expression does not lose the sign on that row (80000000 in shader A above), because the non-fast multiply from the precise declaration is what the plain copy shares through CSE; on the mad rows the same effect comes from !dx.precise on the tertiary instead. My first probe was written that way and read -0 everywhere. Keep precise out of the translation unit to see the loss.

    Limits

    One adapter and one driver, with WARP as the only reference; cs_6_0; numthreads(1,1,1), one group, so nothing here covers a wave or per-lane behaviour, nor cs_6_6/cs_6_7, nor -enable-16bit-types. The debug layer is unavailable, so it cannot separate "HLSL outside the spec" from a compiler or driver defect through validation.

    AI-assisted.

  4. RavenCurseBurg commented on Nov 26, 2026

    @RavenCurseBurg
    Contributor

    I will take the packed v_pk_mul_f16 and SDWA v_mul_f16 signed-zero cases reported in this thread. I will check the generated shaders for both compiler targets, isolate the multiply and its sign controls, and send a focused candidate if the existing code loses that guarantee. I can run Intel UHD 770, RTX 4060 and WARP locally. The RDNA 4 retest would use the same submitted candidate. The v_fma_mix candidate in #2729 remains with its author.

  5. RavenCurseBurg commented on Nov 26, 2026

    @RavenCurseBurg
    Contributor

    The packed and SDWA multiply candidate for the additional RDNA 4 cases is #2779 at 3fdbaa40. On the SDWA edge set, lane 2 reads e000abcd on WARP, Intel UHD 770 and RTX 4060 under both FXC and DXC. An explicit sign-clearing control gives 6000abcd and fails all six comparisons. The PR includes the exact CTest command for the RX 9070 XT retest.

  6. Not-Saii commented on Nov 26, 2026

    @Not-Saii
    Contributor

    The v_fma_mix* part of this issue is addressed on main as of 02075500 (#2818): the lowering now goes through a precise mad, as the probes here suggested. The cache revision moves to x2w-startup-shader-28. WARP and an RTX 4090 pass, but neither failed before, so the RDNA 4 result is still open.

    @MasterDomino or @thepatrickworld, could one of you rerun on the RX 9070 XT at 02075500 or later?

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

    Expected:

    • hardware: negated inline 0 addend keeps a -0 product readback: ok;
    • hardware: control that clears a -0 result fails only the -0 product case: ok.

    The mad(4097, 4097, -16785408) line prints whether the card fuses; it is information, not a check. Please include the driver and debug-layer status. The packed v_pk_mul_f16 and SDWA v_mul_f16 cases from this thread went in separately with #2779; this run does not cover them.

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

  7. thepatrickworld commented on Nov 26, 2026

    @thepatrickworld
    Contributor

    Rerun at 02075500: 2/2 pass — the hardware entry on the RX 9070 XT, the warp entry on WARP. This is the RDNA 4 adapter from the report, so the two lines below are the ones you asked for.

    Tree: 02075500eacd1347eb2217193b53a89a47f67e5b, tracked tree clean (ARBRE_PROPRE), offscreen_check rebuilt at that commit (build date 2026-11-26 12:41:36).

    cmake --preset dev -DINTAKE_PYTHON=…\out\pe-env\Scripts\python.exe
    cmake --build --preset dev --target offscreen_check
    ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_fma_mix_dispatch_(warp|hardware)$' -V
    1/2 Test #1035: startup_gfx2hlsl_fma_mix_dispatch_warp .......   Passed    0.97 sec
    2/2 Test #1036: startup_gfx2hlsl_fma_mix_dispatch_hardware ...   Passed    1.28 sec
    100% tests passed out of 2
    Total Test time (real) =   2.34 sec
    

    Nothing skipped: two entries selected, two executed, no ***Skipped.

    The two lines you named, verbatim from the hardware entry (#1036):

    hardware: negated inline 0 addend keeps a -0 product readback: ok
    hardware: control that clears a -0 result fails only the -0 product case: ok
    

    Adapter and debug-layer state, from that same entry (#1036 — the header is reprinted before every readback batch, identical each time):

    backend=hardware debug_layer=unavailable
    adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
    driver=32.0.32029.2010
    

    So this is not a WARP result wearing the label. debug_layer=unavailable is the state itself: no D3D12 debug layer on this machine, so this run carries no validation-layer assertions — the readback comparisons stand on their own.

    The mad line, information only, not a check (the harness prints it without the : ok suffix an actual check carries):

    hardware: mad(4097, 4097, -16785408) = 00000000 (unfused)
    

    The WARP entry reports the same value for the same fixture (warp: mad(4097, 4097, -16785408) = 00000000 (unfused), #1035), so that line does not distinguish the two backends.

    Limits: one physical adapter (RX 9070 XT, driver 32.0.32029.2010) plus WARP's Microsoft Basic Render Driver (driver 10.0.26100.9818), Windows 11 25H2 build 26200.9974, dev preset. This run says nothing about the packed v_pk_mul_f16 or the SDWA v_mul_f16 cases — those are #2779.

    AI-assisted.

  8. Not-Saii commented on Nov 26, 2026

    @Not-Saii
    Contributor

    Thanks @thepatrickworld, that settles the v_fma_mix* part on RDNA 4. Before #2818, the -0 case read 00000000 on this card. At 02075500 it reads correctly, and the sign-clearing control fails only that case.

    What's left in this issue is the binary16 multiply part that @MasterDomino reported: seven packed v_pk_mul_f16 cases and the SDWA v_mul_f16 cases in startup_gfx2hlsl_f16_alu_draw_hardware. #2779 (4bbe52ee) adds precise to that product. It was measured on WARP, Intel UHD 770 and an RTX 4060, but not on an RX 9070 XT. Could one of you rerun it on main at 02075500 or later?

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

    Per the #2779 description, the focused SDWA case (set 0, lane 2) should read e000abcd. If that run passes too, I think this issue can close. #2729 stays open for the RX 5700 XT.

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

  9. thepatrickworld commented on Nov 26, 2026

    @thepatrickworld
    Contributor

    Rerun at da782506 (which contains 02075500): startup_gfx2hlsl_f16_alu_draw_hardware passes on the RX 9070 XT, and the SDWA case you named reads back e000abcd under both compilers.

    Measured head da7825068fe9eb820701b0c23048d037d3cb67a9 (committed 13:49:24 +0100), executable built at 13:52:24 at that commit. git merge-base --is-ancestor 02075500 HEAD exits 0. For ordering: the head of my earlier post-merge receipt (4bbe52ee) is itself an ancestor of 02075500, so that receipt predates the baseline you asked for and cannot answer this question — which is why this is a fresh run and not a re-post.

    Commands

    cmake --preset dev -DINTAKE_PYTHON=<shared venv, path elided>
    cmake --build --preset dev --target offscreen_check
    ctest --preset dev --no-tests=error -R "^startup_gfx2hlsl_f16_alu_draw_(warp|hardware)$" -V

    git status --porcelain --untracked-files=no was empty before the build. The run's own output does not print the revision, so the ordering evidence is the ancestry check plus the executable timestamp.

    Observed

    1/2 Test #1007: startup_gfx2hlsl_f16_alu_draw_warp .......   Passed   51.11 sec
    2/2 Test #1008: startup_gfx2hlsl_f16_alu_draw_hardware ...   Passed   70.41 sec
    100% tests passed out of 2
    CTEST_EXIT=0
    
    1008: backend=hardware debug_layer=unavailable
    1008: adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
    1008: driver=32.0.32029.2010
    

    The warp entry reports adapter=Microsoft Basic Render Driver vendor=1414 device=008c.

    The case you named, verbatim from the hardware entry — the first line of each pair is the readback, the second is the expected vector the fixture prints (startup_flat_param words= is printed from the mapped readback buffer in tests/startup_flat_param.cpp; the set N: line prints expected, so the two lines agreeing is what makes the lane read e000abcd):

    1008: startup_flat_param words=60001234,60005678,e000abcd,60003456
    1008: fxc sdwa v_mul_f16_word_1_word_0_word_1_preserve_plain_plain_edge set 0: 60001234,60005678,e000abcd,60003456
    1008: startup_flat_param words=60001234,60005678,e000abcd,60003456
    1008: dxc sdwa v_mul_f16_word_1_word_0_word_1_preserve_plain_plain_edge set 0: 60001234,60005678,e000abcd,60003456
    

    What the entry actually covers

    Delta from the sha you named

    Between 02075500 and da782506, tools/startup/gfx2hlsl.py moves 38+/2- — a scalar destination mask discard in Stage, an SQ_RSRC_IMG_2D_ARRAY dimension test, and mesh57's null-export early exit — and the fixture does not move. No changed line mentions mul16. At the measured head the helper still reads float mul16(float a, float b) { precise float product = a * b; return product; }, and both v_mul_f16 and v_pk_mul_f16 call it.

    Limits

    AI-assisted.

  10. Not-Saii commented on Nov 26, 2026

    @Not-Saii
    Contributor

    Thanks again @thepatrickworld. With this run, every RX 9070 XT failure reported here passes on main:

    Both runs were without the debug layer, which isn't installed on that machine. @MasterDomino, unless you see something else on your card, I think this can be closed. The RDNA 1 retest stays in #2729.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions