compute: accept SDWA v_cvt_pkrtz_f16_f32 and v_add_co_ci_u32 #3201
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3201"
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 Leyukaka on 2026-11-27T21:31:20Z.
Fixes #3183. Part of #2935. Target branch
main.Change (
src/gfx1013_compute_native.cpp,src/gfx1013_direct_compute.inl): the SDWA forms ofv_cvt_pkrtz_f16_f32andv_add_co_ci_u32are accepted in direct compute. Both ops already had direct lowerings but were missing from the SDWA operand profiles.v_add_co_ci_u32takes the SDWA source selections. It computes the sum and carry-out from the selected operands plus VCC carry-in, writes the carry to VCC as the VOP2 form does, and places the result per dst_sel/dst_unused.v_cvt_pkrtz_f16_f32takes full f32 sources (src_sel DWORD; other selections stay refused) and places the packed result per dst_sel/dst_unused.Tests. The setup was Windows 11 build 26300.9974 with an NVIDIA GeForce RTX 5080 (driver 32.0.16.2101) and DXC from the Windows SDK 10.0.26100, on
main5b145ca9plus this commit (5a516752).native_sdwa_f16_hardwarereads back both ops in several destination placements against a CPU reference, including the carry in VCC.native_sdwa_f16_ir,native_f16_alu*andnative_direct_containerpass.v_add_co_ci_u32result without SDWA placement failsnative_sdwa_f16_hardware.Measured on a local capture (counts and instruction shape only) with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests, baselinemain6057071b. The change was measured ona5dad843; the commits in between do not touch the two native source files.v_cvt_pkrtz_f16_f32_sdwaand 3v_add_co_ci_u32_sdwarequests stopped first at "unimplemented direct SDWA operand profile".AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T22:04:29Z.
Review: APPROVED
Independently reviewed
5a516752integrated overmain63fd6ea8(tree1a03639e). The merge is clean andgit diff --cached --checkis clean.What I traced.
v_add_co_ci_u32joins the integer SDWA profile, so sext is allowed and neg/abs (control & 0x30), clamp and omod are refused.v_cvt_pkrtz_f16_f32joins the fp-input profile, so abs/neg are allowed and sext is refused. Clamp and omod are refused for it too, because it is in neitherfloatsnorconversion. Both are refused undergraphics.v_add_co_ci_u32reachescarry_destination()withi.subwordset: the other carry ops never pass the SDWA profile check. The operands are selected before the optionalv_subrevswap. Carry-out and the VCC carry-in come from the full 32-bit sum of the selected operands. Only the VGPR result goes throughplace_subword().src_sel:DWORD, and the packed word is then placed perdst_sel/dst_unused.What I ran. I built
compile_dxil native_store_replay native_compute_ir_dumpindevandrelease, then ran6/6 pass in Debug and in Release
/O2, with no skips.native_sdwa_f16_hardwarechecked 74 results and 1,990 guards.Negative control and mutants. Each mutant was rebuilt in
devand run against the six tests:mainnative_sdwa_f16_irgets "unimplemented direct SDWA operand profile",native_sdwa_f16_hardwarefailsplace_subwordnative_sdwa_f16_hardware, word 29:0xffffffffvs0xffff0000)subword()selectionnative_sdwa_f16_hardware, word 34:0x1vs0x0)place_subwordnative_sdwa_f16_hardware, word 26:0x3c00vs0x3c001357)src_sel:DWORDrefusalgraphicsrefusal for the two profilesRestored and rebuilt afterwards;
git diff --quietis clean.Non-blocking.
WORD_0source compiles and converts the whole f32 word. These refusals pass on this head and kill the mutant:Verdict: approve on
5a516752.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.26100, DXC 1.9.2602.17; Python 3.12.10; wave32. Debug-layer status was not checked.
CI:
Build and test on Windowspasses on5a516752(theprpreset doesn't include these tests).This reply was AI-assisted.