fix(shader): accept the VOP3P clamp bit on packed 16-bit min, max and shifts #19190
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19190"
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 angrysandhill on 2026-11-12T23:23:15Z.
What
The decoder refused the VOP3P
clampbit on seven packed 16-bit opcodes withVOP3P integer clamp is not implemented:v_pk_max_i16(0x07),v_pk_min_i16(0x08),v_pk_max_u16(0x0c) andv_pk_min_u16(0x0d);v_pk_lshlrev_b16(0x04),v_pk_lshrrev_b16(0x05) andv_pk_ashrrev_i16(0x06).Measured on RDNA2 (gfx1031, RX 6750 XT; the PS5's gfx1013 is not measured),
clampchanges nothing on any of them: every result with it equals the one without. #502 found the same forv_pk_mul_lo_u16on gfx1035, and accepted the bit there without effect. These seven now join it in that exception. Their translation never readsclamp, so the change is decoder-only.The integer dot opcodes (
v_dot2/dot4/dot8_*) keep refusingclamp, as the debt list records.Tested
Setup: Windows 10 Home 22H2 (10.0.19045), AMD Radeon RX 6750 XT (gfx1031), AMD Software Adrenalin 26.10.1 (driver 32.0.21045.16010), WinLibs GCC 15.2.0 r7 UCRT, Release,
BUILD_TESTING=ON, onmaina221a742da.RDNA2 measurement (hardware oracle, HIP runtime).
0x7ffe,0x7fff,0x8000,0x8001,0xfffe,0xffff,0x00ff,0x1234and0xedcc, so shift counts cover 0, 1, 15, 16, 17, 31 and 32, and min/max cover both signed and unsigned limits.clamp, in three operand selects: the default,op_sel:[1,1] op_sel_hi:[0,0]andop_sel:[0,1] op_sel_hi:[1,0]. The assembled words carry the clamp bit (for example0xcc07c00aagainst0xcc07400a).mainclampagainst noclampHW_ORACLE_RUNTIME=vulkan), with and withoutclampVOP3P integer clamp is not implemented)Tests:
agc_driver_packed_min_max_shift_clamp: 32 of the 289 pairs through the 21clampforms. The expected values are RDNA2's.mainwith only this test file added it fails:ShaderRecompiler::Recompile: VOP3P integer clamp is not implemented.^(agc_|shader), 4 at a time: 1,660 tests; 1,658 pass. The two failures also fail onmaina221a742daon this card, with the same messages:agc_driver_sample_order_grid_reference: the odd-row failure #18229 reports; #9503 addresses it.agc_import_settle_initial_dcc: "the resident target missed the CPU store to its FMASK". #19138, merged after that base, reverts #18288, which it names as the change that broke this test on Windows.VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer,ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1, one at a time.-R "^(agc_driver_packed_min_max_shift_clamp|agc_driver_packed_.*|agc_driver_integer_dot|agc_driver_.*vop3p.*|agc_vop.*|shader_.*vop3p.*|agc_driver_.*int16.*)$". They include the new test,agc_driver_packed_integer_clamp,agc_driver_integer_dotand the four decoder tests.VUID-line. The four decoder tests open none.vector_*tests anddecoder_lengthalso pass.Overlap:
tools/pr_overlap.py --branchfinds no conflict. #9889 already conflicts withmain, and gains no conflict hunk from this branch.Not measured: the PS5's gfx1013, and hosts other than this one.
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 MarcZX10 on 2026-11-13T00:22:14Z.
Review: COMMENTED
Reviewed the VOP3P clamp change — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
853710b5d50d8943101b914e654309bffa7533ac(basemain).repo_read.py):Results
clampfor the seven opcodestests/execution/*.cppis globbedFindings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/tests/execution/PackedMinMaxShiftClamp.cpp:155usesstd::nulloptbut does not include<optional>. It compiles only if an included header brings it in. Adding#include <optional>with the other standard headers would make it explicit. Not verified whether the header chain provides it.Sources
clamp: IntegerInstructions.cpp lines 221–236.clamp: IntegerInstructions.cpp lines 155–170.Not verified
main(the failing negative control) and with the change: author-reported, not run here.packedInteger16Native(the native 16-bit path) was not read, so the claim that no clamp read happens there is not verified.agc_driver_packed_min_max_shift_clampis not checked against the test naming scheme.files/.To get this to a good state
Nothing is required.
Optional: add
#include <optional>to the test file (see the non-blocking point above).Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-13T22:32:55Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks merging based on the code reviewed; the hardware and CI results below are author-reported and were not independently run here.
What I ran
6a7f4c133fbb90414d12452494134b777ec127e9and the prepared diff; no repository tests or build commands were run.description.md,commits.md,manifest.json,diff.patch,PackedMinMaxShiftClamp.cpp,RdnaVectorOpDecoder.cpp,PackedIntegerClamp.cpp,MulLoU16HighHalf.cpp,agc_driver_tests.cmake,agc_driver_packed_add_f16_rounding_tests.cmake, andCMakeLists.txt.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
files.jsonwas not available in the review materials, so excluded files and the complete reviewed-file set could not be independently checked.To get this to a good state
Nothing is required.