shader: lower v_dot2c_f32_f16 in direct Compute and Pixel DXIL #3257
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3257"
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 legacy-code-archaeologist on 2026-11-28T02:19:19Z.
Lowers plain VOP2
v_dot2c_f32_f16(0x02) in direct Compute and Pixel DXIL on top of the mergedv_dot2_f32_f16path (#3239).Fixes #3256. Refs #2935.
Summary
src/gfx1013_direct_compute.inl:DirectCompute::float_alu()to handlev_dot2c_f32_f16: enforcesEncoding::Vop2with zero modifiers (refusing_e64/wide,subword,dpp_control,permuted,abs,neg,clamp,scale), accepts packedf16x2inline/SGPR/VGPR/literalsrc0and VGPRvsrc1, reads the initial binary32 accumulator fromi.dst, fixesop_sel = 0andop_sel_hi = 3, and reuses thelegacyF16ToF32+fmul+fadd+keep_subnormalbinary32 subnormal preservation and0x8000ffumode gate.op.name == "v_dot2c_f32_f16"tohalf_binary = trueinDirectCompute::lower()sos_round_mode,s_denorm_mode,s_setreg, and conditional mode writes gatev_dot2c_f32_f16identically tov_dot2_f32_f16.tests/native_dot2c_f32_f16_check.py,tests/cmake/native_packed_dot2c_f16.cmake:19cases: VGPR basic/cancel, back-to-back multi-accumulate intovdst,vdstaliasingsrc0andvsrc1, SGPR/literalsrc0, inline binary16 float/integer constants (0.5,1.0,-1.0,0), binary16 subnormals, binary32 subnormal accumulators (0x00000001,0x80400000, nonzero-dot rounding), partialEXEC_LO(0xAAAAAAAA) lane preservation, signed zero, Inf, and NaN.9refusals:_e64(0xD5020000), DPP16, DPP8, SDWA,vcc_losrc0,s_round_mode 0x4,s_denorm_mode 0x3,s_denorm_mode 0xC, and conditional mode write.Verification (
devandrelease/O2, Windows10.0.26100)ctest --preset dev --no-tests=error -V -R '^native_packed_dot2c?_f16_'&ctest --preset release --no-tests=error -V -R '^native_packed_dot2c?_f16_':native_packed_dot2c_f16_ir: Passed (19cases matched exact model;9refusals matched).native_packed_dot2c_f16_controls: Passed (19cases compiled to DXIL;9refusals verified).native_packed_dot2c_f16_pixel_warp: Passed (Microsoft Basic Render Driver10.0.26100.9711,4quad draws matched;debug_layer=unavailable).native_packed_dot2c_f16_pixel_hardware: Passed (4quad draws matched; host hardware pixel adapter isNVIDIA Quadro M1000M,32.0.15.7371,debug_layer=unavailable).native_packed_dot2c_f16_compute_hardware: Skipped (77) (Intel(R) HD Graphics 530, vendor8086, device191b, driver31.0.101.2111lacks SM 6.6 wave32 — needs testing on a wave32-capable GPU).native_packed_dot2_f16_{ir,controls,pixel_warp,pixel_hardware}: Passed (30cases,10refusals,7quad draws);_compute_hardwareskipped (77, Intel HD 530).ctest --preset dev --no-tests=error -R '^native_.*_(controls|ir)$' --output-on-failure: 71/71 passed (0skips).rc=8): forcingop_sel_hi = 0fordot2cfailednative_packed_dot2c_f16_ir; droppingkeep_subnormalfordot2cfailednative_packed_dot2c_f16_pixel_warp(0x00000001/0x80400000flushed to0); removingv_dot2c_f32_f16fromhalf_binaryfailednative_packed_dot2c_f16_ir.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T04:13:13Z.
Review: APPROVED
Independently reviewed
870b15d2integrated overmainfbef6381(treee0bef3e6). The merge is clean, andgit diff --cached --checkis clean.What I traced. VOP2
v_dot2c_f32_f16reuses thev_dot2_f32_f16lowering, with these differences:op_sel = 0,op_sel_hi = 3), so lows are paired with lows and highs with highs;read(i.dst), where the VOP2 decoder hasi.dst = 256 + vdst).It joins
half_binary, so thes_round_mode,s_denorm_modeands_setreggates apply to it as they do tov_dot2_f32_f16.vcc_loand the other special sources stay refused throughhalf_pair.What I ran. I built
compile_dxil native_store_replay native_compute_ir_dump offscreen_checkindevandrelease, then ranThe
_hardwaretests ran at-j 1. All 10 pass in Debug and in Release/O2, with no skips:native_packed_dot2c_f16_ir: 19 cases and 9 refusals.native_packed_dot2c_f16_controls: 19 compiled and 9 refusals.native_packed_dot2c_f16_pixel_warpandnative_packed_dot2c_f16_pixel_hardware: 4 quad draws each.native_packed_dot2c_f16_compute_hardware: "19 cases matched across 2x32 lanes and guards" on the RTX 5090. The description says this test skipped on the author's GPU, so this is its first wave32 run.native_packed_dot2_f16_*neighbours: 30 cases, 10 refusals, 7 quad draws.The 79
^native_.*_(controls|ir)$tests pass indev.Negative control and mutants. Each mutant was rebuilt in
devand run against all five new tests:src/gfx1013_direct_compute.inlback tomainop_sel_hi = 0(high pair reads low halves)_ir,_pixel_warp, both hardware testsop_sel = 1(pair 0 reads src0's high half)_ir,_pixel_warp, both hardware testssrc[2]instead of D_ir,_pixel_warp, both hardware testsv_dot2c_f32_f16left out ofhalf_binary_ir,_controls(mode refusal 5)_e64/ wide encoding accepted_ir,_controls(refusal 0)Afterwards I restored and rebuilt. The restored build passes again, and
git diff --quietis clean.Verdict: approve on
870b15d2.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC (the one CTest picked up); Python 3.12.10; wave32; D3D12 debug layer enabled in the pixel tests.
CI:
Build and test on Windowspasses on870b15d2.This reply was AI-assisted.