fix(shader): apply v_dot2_f32_f16's accumulator modifiers as RDNA 2 does #8886
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8886"
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 boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-21T04:40:38Z.
What
v_dot2_f32_f16was refused whenever its accumulator (src2) had op_sel set, neg_hi set or op_sel_hi clear:VOP3P v_dot2_f32_f16 accumulator op_sel, op_sel_hi and neg_hi are not implemented. A shader compiler may well leave op_sel_hi[2] at 0 for an f32 operand.Measured on RDNA 2, the f32 accumulator behaves like a v_fma_mix f32 operand:
The decoder now normalizes the accumulator's selects and turns neg_hi[2] into
absolute. The accumulator read already appliesabsoluteand thennegate.Source of the semantics: an RX 6700 XT (gfx1031) running raw ISA through the HIP runtime of AMD's Windows driver 32.0.21045.5002, on 64 random rows and on the 32 rows of
Float16Dot.cpp. On those 32 rows, the default encoding reproduces that test's existing measuredv_dot2column exactly. Scripts and data: https://gist.github.com/thuanquang/cc3c7c9b1d198561ea25474766998ec9Float16Dot.cpp's three refusal checks become a second program that runs five accumulator variants (op_sel, op_sel_hi cleared, neg_hi, neg_lo, neg_lo with neg_hi) and checks them against the values measured on the same rows.Tested
Windows 11 26200, RX 6700 XT (gfx1031), AMD driver 32.0.21045.5002, MinGW GCC 15.2.0 Release,
main7d7b09740,ANYPS5_REQUIRE_VULKAN=1:agc_driver_float16_dot: with this change it passes 3 of 3. With only the decoder change reverted, the new test fails with the old refusal.--repeat until-fail:3on 8 tests:agc_driver_float16_dot,agc_driver_f32_dot2_rounding,agc_driver_fma_mix_f16_denormal_modes,agc_driver_integer_dot,agc_driver_mix_precision,agc_driver_packed_alu,agc_driver_packed_f16_denormal_modesandagc_driver_vop3_pack_ldexp. All 8 pass with this change.ctest -Von the same 8: 8 of 8 onmainand with this change, with 0VUID-lines on either side. The layer was inserted in every test process.Other GPUs, from reviewers:
maincecb540a6on an NVIDIA RTX 4090 (617.42, Windows 11 Pro 26200): the same 8 tests pass 8 of 8 onmainand with this change, in 3 runs without and 3 with the Khronos validation layer, with noVUID-line on either side;agc_driver_float16_dotreports the new accumulator cases.Not tested:
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-21T06:20:56Z.
A Linux run, since this PR's runtime CI jobs were skipped. It uses lavapipe from Mesa 25.2.8 with LLVM 20.1.2, the same driver as Linux CI, on Ubuntu 24.04 (WSL) with GCC 13.3, Release,
-DANYPS5_ENABLE_SPIRV_TOOLS=ONandANYPS5_REQUIRE_VULKAN=1.This PR's commit was applied onto a
maind0852defabuild, which also carries #8055's float-atomic files that this test doesn't reach.agc_driver_float16_dotpasses 3 of 3, including the five accumulator variants checked against the RX 6700 XT's measured values.Imported from boykopovar/AnyPS5. Originally posted by MaxLikesCode on 2026-10-21T16:35:23Z.
RTX 4090 (Ada) on Windows, head
994f69db4merged ontomaincecb540a6(clean), the 8 tests from the Tested section (agc_driver_float16_dot,agc_driver_f32_dot2_rounding,agc_driver_fma_mix_f16_denormal_modes,agc_driver_integer_dot,agc_driver_mix_precision,agc_driver_packed_alu,agc_driver_packed_f16_denormal_modes,agc_driver_vop3_pack_ldexp):main: 8 of 8 in 3 runs without and 3 with the validation layer.agc_driver_float16_dotreportsv_dot2_f32_f16 tests passedwith the new accumulator cases.VUID-.NVIDIA GeForce RTX 4090, driver 617.42, Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON,ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,ctest --test-dir build -R <tests> -V. Validation runs addVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Vulkan-ValidationLayersvulkan-sdk-1.4.363.0, implicit layers disabled); the loader log shows the layer inserted in every Vulkan test process, and no log haswas not found but was requested by env var VK_INSTANCE_LAYERS.AI-assisted: yes (Claude Code)