Repository navigation
feat(shader): accept every SDWA selector on VOP2 integer ops - #509
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
|
Thanks, checked against the RDNA2 ISA SDWA description: the source field is extracted (sign-extended with |
|
Gated on PPSA21564 with #510 on top: no visual or FPS change. |
Takes upstream's merged versions of our boykopovar#586 boykopovar#611 boykopovar#612 boykopovar#505 boykopovar#490 boykopovar#619 boykopovar#503 boykopovar#627 boykopovar#628 boykopovar#618 and drops astrobot's local copies, plus gate-batch-3 (boykopovar#469 boykopovar#500 boykopovar#504 boykopovar#509 boykopovar#510 boykopovar#514 boykopovar#525 boykopovar#526 boykopovar#528), round o/p (boykopovar#617 boykopovar#620 boykopovar#621 boykopovar#622 boykopovar#623 boykopovar#624 boykopovar#501 boykopovar#508 boykopovar#629 boykopovar#630 boykopovar#631). Conflicts: - SpirvAnalysis.hpp/.cpp, SpirvBufferAccess.cpp: upstream's boykopovar#586/boykopovar#612. The 64-bit LDS atomics keep the full array (f27d6e5 no longer needed). - SpirvMemoryInstructions.cpp: upstream's constant slot plus offset; astrobot's split-wave append/consume kept. - GuestTextureResource.cpp, TextureTiling.cpp and their tests: upstream's boykopovar#490/boykopovar#503 (astrobot had no other change there). - MaskedSelect.cpp test, ShaderMemory.cpp LDS test: upstream's. - State.cpp: upstream's boykopovar#505 export count and boykopovar#469 null pixel program; astrobot's depth export rejection and depth target model kept. - Pipeline.cpp: upstream's pipeline key; astrobot's depth attachment and blend check (a trailing unused attachment stays valid, as colorGapPipelineTests expects). - Draw.cpp, Recorder.cpp, ShaderResources.cpp: astrobot's (renderPassKey with depth, moved sample functions, residency maintenance), which already hold the merged boykopovar#505/boykopovar#628/boykopovar#490 changes. - ShaderInputState.cpp: both register sets. - State.hpp: the duplicate exportIndex member from the auto-merge removed. - CMakeLists.txt: astrobot's test list (a superset of upstream's). - tests/Graphics.cpp: upstream's CompactedExportTests replaces astrobot's inline copy; tests/Recorder.cpp: upstream's viewPastLastMipTests added.
What
VOP2 SDWA on integer ops threw for most selector combinations:
v_min_i32,v_max_i32,v_sub_co_ci_u32,v_subrev_co_ci_u32had no SDWA rule, so any non-DWORD selector threwVOP2 SDWA modifier is not supported for opcode.v_mul_{i32_i24,hi_i32_i24,u32_u24,hi_u32_u24},v_max_u32,v_lshrrev_b32,v_ashrrev_i32,v_lshlrev_b32,v_add_co_ci_u32andv_subrev_nc_u32, anydst_selother than DWORD threw. Onv_and/or/xor/xnor_b32, bytedst_selthrew.All of them now take every
src0_sel/src1_sel(withsext) and everydst_selwithUNUSED_PAD,UNUSED_SEXTorUNUSED_PRESERVE, likev_add_nc_u32andv_min_u32already did. The five integer profiles in the decoder are merged into one. The translator needed no change: these ops already read their sources throughapplyBitSourceModifiersand write throughwriteRawU32, which apply the selectors. On the carry ops, the carry is computed from the selected 32-bit operands. Only the VGPR write depends ondst_sel.clampon these ops and the reserveddst_unusedvalue 3 still throw.Behaviour measured on HW (RDNA2, gfx1035)
I ran the 13 forms in the test (all 13 ops, with byte and word selectors,
sexton either source, and all threedst_unusedmodes, plus the carry-out of the three carry ops) on 2048 rows of edge words and random values. The Python model matches all 32768 results. The model zero- or sign-extends the selected source field, computes the 32-bit op, then writes the destination field: zero the rest, sign-extend upward with the lower bits zero, or keep the rest.Tested
New execution test
agc_driver_sdwa_integer_selectors_tests: 32 rows with expected values from the hardware (the model matches every cell). Rows are picked so each op gets both signs of each selected source, both values of the carry and the top bit of the written field. For min/max both comparison outcomes are covered, and for shifts the counts 0, 1-15 and 16-31.It passes on RADV and lavapipe. It fails without each part of the change: no rule for
v_min_i32, no rule forv_sub_co_ci_u32and a DWORD-only destination for the integer profile all throw again, and droppingsexton the sources gives wrong values (4 mutations). The full Release ctest passes exceptagc_driver_pixel_helper_lanes, which also fails onmainon local RADV.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)