shader: lower quad-local DPP16 and DPP8 extra f32, carry, and dot ops in pixel_aot #417
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/423"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-22T01:27:22Z.
Change
Lower quad-local
DPP16(quad_perm) andDPP8(dpp8) forms for the remaining 12 extraf32, carry-in/carry-outu32, andgfx1030dot-accumulate instructions intools/pixel_aot.py, covering 12 additionalDPP16and 12 additionalDPP8forms ongfx1013(+24 forms) and 11 additionalDPP16and 11 additionalDPP8forms ongfx1030(+22 forms;v_mac_f32_dppisgfx1013-only):v_*_dppinstructions (12):f32unary & accumulate (7):v_rndne_f32_dpp,v_sin_f32_dpp,v_cos_f32_dpp,v_rcp_iflag_f32_dpp,v_frexp_mant_f32_dpp,v_frexp_exp_i32_f32_dpp,v_mac_f32_dpp.u32(3):v_add_co_ci_u32_dpp,v_sub_co_ci_u32_dpp,v_subrev_co_ci_u32_dpp(reading and updating the trackedvcc/vcc_loper-lane condition).gfx1030, 2):v_dot2c_f32_f16_dppandv_dot4c_i32_i8_dpp.src0asuintbits through SM 6.0 quad intrinsics, handlesfrexpsubnormals purely with bitwisefirstbithigh(immune to desktop denormal flushing), appliesDPP16-/|.|modifiers on floating-point and packedf16x2(v_dot2c_f32_f16_dpp) operands, emits optional helpers only when used, and rejects modifiers onDPP8or integer ops, cross-quadDPP8,row_*/wave_*, partial masks, non-VGPR operands, uninitialized accumulators, untracked/mismatchedvcc, WQM, andvmcnthazards.DPP_EXTRA_BODY(assembled ongfx1013, 2 constant sets, 5 negative mutations) andDPP_DOTC_BODY(assembled ongfx1030, 2 constant sets, 4 negative mutations) derive quad coordinates fromuv.x/uv.yand exercise all 12 forms end to end.Verification
Tested on Linux x86_64 (Python 3.13.5, LLVM 19.1.7, Clang 19.1.7) on top of
e5e0079:python3 -B tests/pixel_aot_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so— passed (controls, negative controls,gfx1013assembly→DXBC/XDAT/XBCH/FSSM→disassembly→lowering parity forDPP_EXTRA_BODYand all existing fixtures, andgfx1030parity forDPP_DOTC_BODY).python3 -B tests/ffx_dispatch_aot_check.py llvm-mc-19 llvm-objcopy-19 libLLVM-19.so— passed.python3 -B tests/script_state_check.py,tests/bcpack_check.py,tests/resource_ranges_check.py,tests/layout_chunks_check.py,tests/docs_links_check.py,tests/bidi_controls_check.py— all passed.tools/form_coverage.pyrecords 12DPP16+ 12DPP8forms againstdocs/coverage/gfx1013.tsvand 11DPP16+ 11DPP8forms againstdocs/coverage/rdna2.tsv.DPP_EXTRA_BODY,DPP_DOTC_BODY, all 9 negative mutations, andfrexpsubnormal/±0/±Inf/NaN edge cases on a 4-lane SIMT 2×2 pixel quad C++20 harness withclang++-19 -std=c++20 -O2 -Wall -Wextra -Wpedantic -Werror -fsanitize=undefined,address— bit-exact match across all 4 quad lanes and all 9 mutations caught; 0 sanitizer errors.dxc -Gis -T ps_6_0), WARP (pixel_aot_warp), and hardware (pixel_aot_hardware) checks were not run locally on Linux; relying on thebuild-and-testWindows CI job to verify DXC compilation and D3D12 WARP quad readback.Evidence and follow-up
tests/pixel_aot_check.pyare original MIT-licensedgfx1013/gfx1030assembly sequences built from source at test time.f32/move/select), #414 (23 integer/bitwise/shift), #419 (23f16), and #421 (19 conversions) with zero opcode overlap (combined97/101DPP16+97/101DPP8ongfx1013,96/100ongfx1030, leaving only the 4v_movrel*dynamic VGPR-indexing forms).Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by MarlomMedeiros on 2026-11-22T18:29:01Z.
Review: COMMENTED
Ran the Windows gates the author could not (Linux-only environment) on Windows 11 build 26300.10075, RTX 5070 (10de:2f04) driver 32.0.16.2135, in-box WARP 10.0.26100.10068, debug layer enabled.
Results:
tests/pixel_aot_check.pycontrols (run insidebinarymode): pass.tests/form_coverage_check.py: pass. LLVM 15 gfx1013 binary round-trip: pass.pixel_aot_warpunder ctest: pass (12.3s, debug_errors=0).pixel_aot_hardware: the complete draw suite passes on the RTX 5070 when run directly,python -B tests/pixel_aot_check.py draw <dxc> offscreen_check.exe hardware: 113 renderer runs, every onemax_absolute_error=0,debug_errors=0 debug_warnings=0, including the newdpp_extraanddpp_dotcfixtures with all negative mutations reportingpixel_mismatch. Total wall time ~61s.One non-code flag: the same run under ctest reports
Timeout, because this branch'sset_tests_properties(pixel_aot_hardware ... TIMEOUT 60)is 60s and the suite needs ~61s on this adapter. Not a correctness issue: currentmainsplits draw modes so each registered test fits, and a rebase onto it resolves the bookkeeping.Semantic review of the new code:
co_ciops model carry-in conservatively: carry-out must equal carry-in (vcc/vcc_lo) andscalar["vcc"]must hold a tracked("condition", expr, 0, 1)tuple. The carry/borrow formulas (t < a || r < tfor add,a < b || t < cifor sub, mirrored for subrev) are correct for two-step carry propagation.v_dot2c_f32_f16_dppapplies abs/neg at the packed halfword level (0x7fff7fff/0x80008000) and accumulatesdst's prior value;v_dot4c_i32_i8_dppsign-extends each byte lane with<<24 >>24arithmetic shifts. Both match ISA semantics.v_mac_f32_dppcorrectly readsdstbefore writing (mad(a, b, acc)), anddpp_extra_vgprrejects non-VGPR operands and uninitialized destinations.mods_ok = is_dpp16 and allow_fp_modsenforces both ISA rules at once: DPP8 never takes source modifiers, and integer ops never take fp modifiers.frexphelpers are bit-exact (subnormal normalization viafirstbithigh, inf/NaN/zero passthrough, exponent forced to 0.5<=m<1), consistent with the existing f32 frexp/ldexp approach._dppmnemonics are auto-denied inside exec-masked regions by the existing_dpppattern, which is correct since quad-local ops are not pure per-lane.Base note: this branch sits on
a8e2d39and carries its owndpp_extra_vgpr/parse_dpp_suffix/emit_quad_swizzle_u32; currentmainalready hasdpp_vgpr/parse_dpp/emit_quad_swizzle_u32plus thedppanddpp_int32fixtures, so the rebase will want to foldDPP_EXTRAonto the upstream helpers rather than keep parallel copies.No blockers on the change itself.
AI-assisted: yes. All reported checks ran locally on the adapter and driver listed.
Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-22T02:39:01Z.
Physical-silicon verification: extra f32 / carry / dot-accumulate DPP forms pass on wave 4 / 32 / 64
Independent verification of the wave-width-independence claim ("valid across wave sizes 4 (WARP) through 64") that CI cannot cover (CI excludes
_hardwaretests). Measured on this dual-GPU Windows box.PR head:
b7bb9d1e8de3e7a3107d2f8b41fd6ad18a30cdbe(single commit one5e0079, an ancestor of currentmain; PR mergeable/clean).Environment
tools/dev.ps1(VS 2022 BuildTools, MSVC 14.44.35207); venv Python forINTAKE_PYTHONC:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/dxc.exe(Windows SDK 10.0.26100.0, CTestfind_program)adapter=Microsoft Basic Render Driver vendor=1414 device=008c,driver=10.0.26100.9711— native wave width 4adapter=AMD Radeon RX 9060 XT vendor=1002 device=7590,driver=32.0.32029.2010— native wave width 64 (RDNA4)adapter=NVIDIA GeForce RTX 5060 Ti vendor=10de device=2d04,driver=32.0.16.2124— native wave width 32Commands (exact)
Results
pixels=4096 channels=16384 max_absolute_error=0pixels=4096 channels=16384 max_absolute_error=0pixels=4096 channels=16384 max_absolute_error=0llvm-objcopy+LLVM-C.dll): exit 0 —check_binaryis assert-only/silent on success and includes both new fixtures (with_constants(DPP_EXTRA_BODY)gfx1013 andwith_constants(DPP_DOTC_BODY)gfx1030): assembly → DXBC/XDAT/XBCH/FSSM → disassembly → lowering parity passed alongside all pre-existing fixtures.FORM_COVERAGE_RECORDconfirms all 12 new opcodes translated on every backend:v_rndne_f32_dpp v_sin_f32_dpp v_cos_f32_dpp v_rcp_iflag_f32_dpp v_frexp_mant_f32_dpp v_frexp_exp_i32_f32_dpp v_mac_f32_dpp v_add_co_ci_u32_dpp v_sub_co_ci_u32_dpp v_subrev_co_ci_u32_dpp v_dot2c_f32_f16_dpp v_dot4c_i32_i8_dpp— exactly the 12 forms listed in the PR body, including both gfx1030 dot-accumulate forms.pixel_aot_*skips on any backend; capability skips outside this group (bvh_wave64_*,wave_shuffle_warp) did not occur here.vcc-tracking carry forms (v_add_co_ci_u32_dppetc.) and thefrexpbitwise-subnormal path were bit-exact on desktop GPUs that flush FTZ in other contexts — no denormal-flushing divergence observed.Wave-width verdict
The wave-width-independence claim holds on silicon as measured: bit-exact readback (
max_absolute_error=0over 16384 channels × 2 constant sets) on all three native widths (WARP 4, RTX 5060 Ti 32, RX 9060 XT 64). Everything above was measured on this box except the native wave-width labels themselves, which are platform facts for these adapters.#421 (conversions) and #428 (v_movrel*) were verified in separate worktrees; separate comments posted there.
AI-assisted; runs executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-22T14:50:38Z.
@KomaGuy, a quick coordination question so we don't overlap: this PR adds the DPP16/DPP8 forms of
v_dot2c_f32_f16andv_dot4c_i32_i8, but as far as I can see the plain VOP2 e32 forms (v_dot2c_f32_f16_e32,v_dot4c_i32_i8_e32) are still rejected onmain. Do you plan to add them here or in a follow-up? If not, I'd add them after this lands, reusing yourdpp_dot4c_i32_i8/ dot2c helpers rather than adding parallel ones. I'll hold off until you reply.This comment is AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-22T15:17:54Z.
Thanks for checking! I'm away from my PC for the next ~4 hours, so I'll add the plain VOP2 e32 forms to this PR once I'm back.
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-22T20:29:37Z.
Added the plain VOP2 e32 dot-accumulate forms (
v_dot2c_f32_f16_e32andv_dot4c_i32_i8_e32) and refreshed ontomain(b5509fe) indf675d7:v_dot2c_f32_f16_e32andv_dot4c_i32_i8_e32(accepting both_e32and bare spellings, VGPR/SGPR/literal/inlinesrc0with VGPRvsrc1, reusingdot_word,dpp_vgpr, anddpp_dot4c_i32_i8) are now lowered, exercised inDPP_DOTC_BODY(gfx1030binary round-trip + draw + 2 new e32 mutations), and covered by positive/negative controls.dpp_extra_vgpr/parse_dpp_suffix/emit_quad_swizzle_u32copies in favor of the shared upstream helpers, pulls inmain's split draw tests (fixing the 60s ctest budget), and compilescheck_dpp_extra_drawwithmode="any"+flush_ftzassertion (matchingcurveand #569).All 4/4 CI checks are green (
df675d7).Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T16:58:25Z.
Measured on RDNA4 at
df675d7, plus three mutations and two findings in the lowering. The fixture does bite, and two code paths diverge from the same instructions lowered elsewhere in the file.Environment and result
Windows 11 25H2 (build 26200.9711), MSVC 19.44 + DXC, adapter AMD Radeon RX 9070 XT (vendor
1002, device7550), driver32.0.32029.2010,debug_layer=unavailable, headdf675d7, clean build.pixel_aot_hardwarePassed 23.05 s,pixel_aot_warpPassed 10.81 s.Mutations I ran against it (external, source-level)
dpp_ci = ... ? 0u : 0u):***Failed 1.52 sec,pixel_mismatch. The CI=1 chain is genuinely exercised, not just seeded by thev_cmp_f.***Failed 1.38 sec,pixel_mismatchon both backends. So lane data does reach the observed lane on some channels — the blind spot below is partial, not clean, and I could not turn it into a passing draw.RNDNE: the run settles the rounding question
Set 1 drives
v21 = 1.5, 2.5, 3.5, 4.5, sov_rndne_f32_dpp -v21has four exact ties. Ties-away or floor would produce45, -13and62, 11; the draw passes with the reference's44, -13/54, 11. So on this adapterround()is ties-to-even, as the lowering assumes. That part is proven by measurement, not by the docs.What is still not established
1. One lane per quad is compared.
dpp_extra_referencegenuinely models four lanes, then keeps only index0for all four channels, and each channel ends on aquad_perm:[0,0,0,0]/dpp8:[0,0,0,0,4,4,4,4]broadcast. The case file then writes the samefloat464 times. So the 4096 compared pixels are 1024 samples of one lane, not four lanes × 1024. Emitting four distinct expected values per quad row would make the mapping claim measurable; today a wrongAcrossY/Diagonalonly shows up if the data flow later routes that lane into lane 0.2.
frexpand denormals. The helper is right — I checkedmant = 1by hand:firstbithigh = 0,shift = 23, mantissa0, so0.5and exponent-148, and the bitwise form is immune to flushing inside itself. But no subnormal ever enters it:v32 = (1 + lane) * 0.375 * c3stays in0.375 .. 3.0, so theexp == 0branches of both helpers are dead code for this fixture. Feeding0x00000001from the constant buffer (expect0.5/-148) is the only way to exercise the claim the PR makes.3.
dot4cwrap vs saturation is undecidable here. The values peak at 555 and the reference masks& 0x3ffat the end, so the comparison is blind mod 1024 (and the shader mod 65536). An input accumulator of0x7ffffff0plus one negative product separates wrap from clamp in one case.4.
dot2crounding order. The lowering nestsmad(hi, mad(lo, acc))while the existing VOP3P form computes(a0*b0) + (a1*b1) + c— same mathematics, two different rounding orders for the same instruction. Every product in the fixture is exact (1.0*2.0,3.0*-0.5, …), so neither order is tested.Two issues in the lowering itself
v_sin_f32_dpp/v_cos_f32_dppskip the revolution reduction. They emitsin((x) * 6.283185307179586f)andcos(...)directly, while the non-DPP forms go throughsin32/cos32, which callturns()first. The comment above those helpers (tools/pixel_aot.py, "Removing the nearest integer is exact in binary32 and keeps the radian argument within [-pi, pi], where D3D bounds the sin and cos error") says exactly why the reduction is needed. Same instruction, two lowerings: beyond|x| = 0.5the DPP path loses precision and past ~2.7e6 it carries no information. No case in the fixture exceeds|x| = 0.25.v_mac_f32_dppusesmad, while the plainv_mac_f32usesmad32, which flushes denormals. One opcode, two denormal models in the same file; at most one of them is faithful to RDNA2. The fixture cannot separate them — its operands are all normal and it compiles with denormal modeany.Rejects
Most of the new controls are real: cross-quad,
row_*/wave_*, partial masks, non-VGPR operands, uninitialised accumulator, untrackedvcc, modifiers on DPP8,dot4cwith a float constant, WQM andvmcntall reach their guard, with the right message.Three do not. These are accepted by the PR's list but die on the generic regex, so the guard they are meant to test never runs:
whereas
v_dot2c_f32_f16_e32 v12, -v12, v13does reachUnsupported dot-product operand -v12.expect_value_erroralready exists in the file and would pin the message.Rules still without any negative control: destination above
v255, wrong operand count, duplicated modifier, thecondition[2:] != (0, 1)check, a modifier onsrc1of a carry op, and the_e64/clampspellings of the dot-accumulate forms — those are currently rejected by accident of the regex, so widening the pattern later would drop the clamp silently.Minor: the body says five plus four mutations and nine negative mutations in the harness; the code has five plus six, and eleven. Small, but those numbers read as evidence.
Verdict
The reference is a real lane-by-lane model — that is a step beyond the other DPP fixtures — the carry chain exercises CI=1, and RNDNE is proven ties-to-even on this part. The two lowering issues above are the only things I would want fixed before merge; the rest is coverage claim versus coverage.
AI-assisted; the run and all mutations were executed locally on the adapter above. The lane analysis and the line references come from a separate review pass and were re-verified here at
df675d7.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T17:09:26Z.
Thanks for the separate wave64 result and the carry/mux mutations. Before #423 can land, please reuse the existing turn reduction for DPP sin/cos and use the same established denormal treatment as the plain MAC path. Give each an input that distinguishes the two current lowerings. Keep dot rounding and overflow claims limited until the fixture sees results that distinguish them, and make the claimed lane mapping and frexp subnormal path observable. #423 remains behind the shared DPP changes.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T20:40:26Z.
I reproduced the first Windows failure at
3118ca5on both RTX 4060 Laptop and in-box WARP. Removing sin range reduction still passed at the old phase. I pushed0715b38with two exactly representable non-extremal phases and a binary16 RTZ reference. The Release selection^pixel_aot_dpp_extra_passed 2/2. Removing either reducer now causes a pixel mismatch, and the MAC, lane, frexp and integer-wrap controls still run.One review item remains for the floating dot. Both packed f16 inputs can be
0x3c003c00with a destination float of0x4b800000(2^24). Under ties-to-even, the current sequential emissions can round two separate +1 terms back to0x4b800000. Summing the products before accumulating gives0x4b800001. Please compare exact returned bits on a native gfx1030 implementation of the affected form, or take the floating dot out of this candidate so the independently verified opcodes can proceed.AMD RDNA2 instruction reference
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-23T20:56:54Z.
@R0Y00 @thepatrickworld Thanks for the detailed audits (and @R0Y00 for
0715b38fixing the large-turns inputs so WARP detects omitted range reduction too!) — all 4/4 CI checks are now green on0715b38:v_sin_f32/v_cos_f32andv_mac_f32semantics (tools/pixel_aot.py):v_sin_f32_dppandv_cos_f32_dppthroughsin32/cos32(reusingturns()range reduction) instead of unreducedsin/cos(x * 2pi).v_mac_f32_dppthroughmad32(unfused, denormal-flushing multiply-add) instead ofmad.tools/pixel_aot.py,tests/pixel_aot_check.py):dpp_vgprnow raises an explicitValueError(f"DPP operand {raw} is read before it is written")for uninitialized sources/accumulators.parse_dppnow distinguishes cross-quadDPP8from non-repeated quad-localDPP8and refuses unprovedfi:andbound_ctrl:modifiers.v_dot2c_f32_f16/v_dot4c_i32_i8e32 handling now parses operands explicitly and raises specificValueErrordiagnostics for non-VGPRsrc1(|v13|,s44,1), source modifiers onsrc0, trailingclamp, and uninitialized accumulators, while_e64spellings remain rejected as unsupported instructions.must_rejectchecks withexpect_value_errorpinning every diagnostic (includingv256, operand count, duplicate modifier,src1modifier onco_ci,fi:/bound_ctrl:, WQM, andvmcnt).tests/pixel_aot_check.py,CMakeLists.txt,docs/experiments.md):draw-coreinto their ownpixel_aot_dpp_extra_{hardware,warp}CTest (draw-dpp-extra,TIMEOUT 60 SKIP_RETURN_CODE 77, recordingFORM_COVERAGE_RECORD).DPP_EXTRA_SEMANTICS_BODY(compiled under-denorm preserve): verifies large-turnssin32/cos32(123457.125and123457.375, with mutations removingturns()), unfusedv_mac_f32_dpp(4097 * 4097 - 16785408 = 0.0, wrong fused reference1.0rejected), denormal input flush (2^-127 * 2^126 + 0.5 = 0.5, wrong reference1.0andftz32mutation rejected), and all 4 lanes ofdpp8:[1,2,3,0,5,6,7,4]under injective base-4 weights(1, 4, 16, 64)with mutations changing only lane 3 or lane 1.DPP_EXTRA_SUBNORMAL_BODY(lossless integer readback viatranslate_int): verifiesv_frexp_mant_f32_dppandv_frexp_exp_i32_f32_dppon binary32 subnormals0x00000001,0x007fffff, and0x80000001, with HLSL mutations breaking eachexp == 0ubranch.DPP_DOTC_WRAP_BODY(lossless integer readback ongfx1030): verifies 32-bit signed wrap-around on bothv_dot4c_i32_i8_dppandv_dot4c_i32_i8_e32(0x7ffffff0 + 32 = 0x80000010and0x80000010 - 32 = 0x7ffffff0) with a clamped reference rejected.docs/experiments.mdto explicitly note thatv_dot2c_f32_f16inputs are exact binary16 values so nested-madvs sum-of-products rounding order remains unmeasured.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T21:13:00Z.
At
8868f7cthe verified DPP scalar/carry work and the gfx1030 integer dot forms remain. This candidate explicitly refusesv_dot2c_f32_f16in the plain, DPP16 and DPP8 forms pending native rounding evidence. The original implementation and its fixtures remain available in0715b38for that follow-up. The integer dot fixture keeps its wrap controls and now also detects a corrupted DPP8 rotation. Missing integer-dot inputs report a translated refusal. The Python checks and LLVM 15 round trip passed, and the focused Release draws passed 2/2 on RTX 4060 Laptop and in-box WARP. Waiting for the new head's CI.Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T21:09:16Z.
On the floating dot: the ISA does not decide it, and the candidate currently holds three different models of the same instruction — including two for the two spellings of it. That is the part I would fix first; the gfx1030 question can stay open behind it.
What the primary source says
RDNA 2 ISA,
V_DOT2C_F32_F16(VOP2 opcode 2, p. 131 of 283):and
V_DOT2_F32_F16(VOP3P opcode 19, p. 164 of 283), same shape with a third source:Neither entry says anything about order or precision, unlike
V_ADD_F32andV_MUL_F32on the same page ("0.5ULP precision, denormals are supported").Neither entry carries a precision or rounding statement, which is unusual for this document and is the whole difficulty: the neighbouring ops are annotated —
V_ADD_F32"0.5ULP precision, denormals are supported",V_MUL_F32likewise. The dot ops get none of it. The single-expression form is equally consistent with rounding once at the end and with rounding per operation, and the document does not separate them.What it does settle:
f16 x f16is exactly representable in binary32 (11-bit significands, 22-bit product ≤ 24), so the products never round and the accumulation is the only rounding in the expression.Exact bits for your case (inputs
0x3c003c00, destination0x4b800000= 2^24), computed:fma(1,1,fma(1,1,2^24))→ 2^24 + 1 is a tie between 2^24 and 2^24+2, ties-to-even keeps 2^24, twice →0x4b8000000x4b800001Three models in one candidate
dot_reference,v22single(...), one Python-double evaluation0x4b800001v_dot2_f32_f16((a0 * b0) + (a1 * b1) + c_expr)0x4b800001v_dot2c_f32_f16mad(a1, b1, mad(a0, b0, acc))0x4b800000Those last two rows are measured, and the words differ: I drew the three shapes from one shader with acc =
0x4b800000and both packed operands 1.0. The RX 9070 XT (32.0.32029.2010) and the in-box WARP (10.0.26100.9711) agree channel for channel — sum-first((p0*q0) + (p1*q1) + acc)→0x4b800001, themad()chain →0x4b800000, an explicit sequential((p1*q1) + ((p0*q0) + acc))→0x4b800000.One limit I should state rather than paper over: that draw cannot tell you whether
mad()fused. Fused and unfused both land on0x4b800000for this input, and the emitter writes these asprecise float aluN = ...— precisely the qualifier that tells DXC not to contract, so the likelier reading is that it did not fuse. The probe is also hand-written HLSL reproducing the two emitted shapes, so it validates the shapes, not the translator's output. What it does establish is the part that matters here: the two spellings return different words on the same hardware, and the difference is in the source order, with no driver involved.So the two spellings of one instruction disagree with each other on your exact case, with no driver involved:
V_DOT2Cis only the accumulate form ofV_DOT2, and the ISA writes both the same way. The test cannot see it because no set inDOT_SETSreaches a case where the orders differ. Addingpack_f16_pair(1.0, 1.0)with a destination of0x4b800000would surface it on WARP alone.Why I cannot hand you gfx1030 bits
We have no RDNA 1 or 2 silicon, and it would not answer the question if we did: the harness draws the HLSL our lowering emits, through DXC and the desktop driver. The console's
v_dot2c_f32_f16is never executed, so no measurement on any adapter distinguishes these models — the ISA and LLVM citations earlier in this thread are references, not readback, and the same limit applies to them.There is also a hard ceiling on matching the oracle: no binary32 emission reproduces "one rounding of the exact sum" in general.
(p0 + p1) + accmatches your case, but it roundsp0 + p1separately — a third model, not the oracle's.What I would do
v_dot2c_f32_f16emit the same shape asv_dot2_f32_f16, so the two spellings of one instruction agree — and so the accumulate form matchesdot_referenceon your case, which it presently does not. That is a two-line change and it does not depend on knowing the hardware's answer.2^24set, so whichever model the entry asserts is visible in the diff.dot_referenceimplement exactly the model the emission uses, or say in the comment that the accumulation order is not specified by the ISA — but not both a strict expectation and an unpinned lowering.If you would rather not carry an unproven accumulation at all, dropping the floating dot from this candidate is the cleaner option and the verified integer dots plus the DPP forms can proceed without it. Either way this is your call on the candidate; I am not pushing a patch for it. Say which way you want it and I will measure the aligned version on the RX 9070 XT and on WARP.
AI-assisted; the arithmetic and the emitted shapes are from the tree, the ISA citations from the RDNA 2 instruction set document.