feat(shader): support source modifiers in v_lshl_add_u32 and v_add_lshl_u32 #25964
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/25964"
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 Kikoarl on 2026-11-23T01:32:16Z.
What
Support floating-point sign-bit source operand modifiers (
abs,neg) for VOP3 shift-add instructions (v_lshl_add_u32andv_add_lshl_u32), grounded in two native hardware measurements:tools/hw-oraclemeasurement (comment): 196/196 output words match float sign-bit operations (x & 0x7fffffff,x ^ 0x80000000) across all three sources.tools/hw-oraclemeasurement (comment): 196/196 output words agree bit-for-bit with gfx1036.Generic VOP3 field encoding follows AMD RDNA 2 ISA §12.9 Table 74; console silicon (gfx1013) remains unmeasured and is recorded in
docs/dev/debt/changes/feat-shader-vop3-shift-add.md. Encodings with nonzeroclamp,omod, orop_selcontinue to throwVOP3 source modifiers are not implemented.Added decoder regression test
agc_vop3_shift_add_decode(core/libs/prx/libSceAgcDriver/tests/Vop3ShiftAddDecode.cpp) covering all 64 acceptedabs/negcombinations and explicit decoder refusal for nonzeroclamp,omod(1..3), andop_sel(1..15) on both opcodes.Tested
/tmp/anyps5_verify_build(-DBUILD_TESTING=ON), rebased cleanly ontoorigin/main(115a7036e2, PR headebfbc4b133):agc_driver_vop3_shift_add_source_modifiers,Vop3ShiftAddSourceModifiers.cpp): Passed (0.75 son Intel RPL-S Mesa Vulkan).agc_vop3_shift_add_decode,Vop3ShiftAddDecode.cpp): Passed (0.00 s, verifying acceptedabs/negencodings and refusal ofclamp,omod, andop_sel).#issuecomment-7104309821) and RDNA4 gfx1201 (#issuecomment-7104587368), 196/196 words matching.python3 tools/debt_fold.py --check,python3 tools/check_conventions.py --base origin/main, andgit diff --check origin/main..HEAD: Passed cleanly.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T01:38:00Z.
Review: APPROVED
Reviewed — looks good
No verified blocking defect was found in the reviewed changes; the draft covers the changed lines and the implementation paths inspected.
What I ran
Reviewed head
0a433a17536f318006b0194c596c6edf7ec6b3c5usingrepo_read.pyto inspect the prepared diff and repository files. No build, test, or precheck command was run; the execution test and conventions check mentioned in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No build, execution test, convention check, physical-console behavior, or behavior on other GPUs was verified. The reviewed files were
core/libs/prx/libSceAgcDriver/tests/execution/Vop3ShiftAddSourceModifiers.cpp,core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp, anddocs/dev/debt/changes/feat-shader-vop3-shift-add.md; all three changed files listed in the manifest were read. No files were excluded by the manifest.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T02:01:03Z.
Review: CHANGES_REQUESTED
I reviewed exact head
0a433a17536f318006b0194c596c6edf7ec6b3c5against the cited LLVM opcode/profile definitions and the new execution fixture. The fixture is sensitive to the implementation, but the GPU runs execute AnyPS5's translated SPIR-V and therefore do not establish how native RDNA interprets the encoded modifier bits. The claimed destinationop_selbehavior needs a native oracle; details are inline.No build or test command was run for this review.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T06:03:40Z.
Review: CHANGES_REQUESTED
The new head correctly preserves a conservative refusal for
clamp,omod, andop_sel, so the earlier destination-selector defect is addressed.The remaining ABS/NEG implementation still needs its evidence boundary recorded accurately. The native R9700 run supports these sign-bit interpretations on gfx1201 (14 of the former 16 columns matched), but it was explicitly GFX12-only. The cited LLVM profiles use plain integer operands and do not advertise these source modifiers, so they are not independent support for gfx1013 behavior. The new debt text currently calls the behavior “verified” without naming gfx1201 and cites the generic VOP3 fields as if they defined opcode-specific semantics; the PR description still claims support for the now-refused output modifiers and selector.
Please either add a gfx1013/PS5-generation native oracle, or scope the debt explicitly to the gfx1201 measurement and state that gfx1013/console behavior remains unmeasured. Update the PR description and cited table/source accordingly. A decoder-level refusal regression for
clamp,omod, andop_selwould also make the new conservative boundary durable.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T06:03:43Z.
Review: COMMENTED
Reviewed — comments
Changes are required before merge: the implementation and test description disagree about which modifier bits are supported, leaving the claimed behavior unverified.
What I ran
Reviewed head
2004e5b2796be4eb1d444f8705e4975a59e4d5d. No commands or tests were run;repo_read.pywas used to inspect the prepared diff and repository files.Results
Findings
Blocking
None.
Non-blocking
op_selis supported and the test claims coverage for it, but the decoder rejects any nonzeroopSelfor these opcodes. The test’s 16 instructions vary sourceabs/negonly; they do not enableop_sel,omod, orclamp. Please align the stated scope and test coverage with the actual implementation, or implement and test the additional modifiers. Seecore/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp:2074andcore/libs/prx/libSceAgcDriver/tests/execution/Vop3ShiftAddSourceModifiers.cpp:105.Not verified
files.jsonwas unavailable.To get this to a good state
Nothing is required. Optional: align the PR description and test coverage with the modifiers the decoder accepts.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T06:39:33Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: update the debt record to match the implementation and stated behavior.
What I ran
Reviewed head
7c53cc0bbf0cd38f81a8857f0f66eb467ddef3f4using the prepared diff andrepo_read.py. No test or convention check was run. I read all three changed files:core/libs/prx/libSceAgcDriver/tests/execution/Vop3ShiftAddSourceModifiers.cpp,core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp, anddocs/dev/debt/changes/feat-shader-vop3-shift-add.md.Results
Findings
Blocking
docs/dev/debt/changes/feat-shader-vop3-shift-add.md:5says the decoder rejectsclampandomod, but the changed decoder accepts both when zero and rejects only nonzero values; it also saysop_selis rejected although the code likewise accepts zero. More significantly, the PR description saysomodandclampare supported as no-ops, while the decoder rejects nonzero values for both. Resolve the contradictory scope and make the debt record accurately describe implemented and unimplemented behavior.Non-blocking
None.
Not verified
No build, execution test, or convention check was run. The claimed Linux Intel RPL-S execution and convention results were not independently verified. Files excluded by preparation rules are not listed in the manifest, so none are identified here.
To get this to a good state
Align the PR description, decoder behavior, and debt record on whether nonzero
clampandomodare supported, then update the debt record to describe the actual behavior.Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T14:41:30Z.
Review: CHANGES_REQUESTED
Re-reviewed exact head
7c53cc0bbf0cd38f81a8857f0f66eb467ddef3f4after the new native gfx1036 report. The 98/98 words per opcode materially extend the prior gfx1201 evidence: on both measured GPUs, ABS/NEG follow the sign-bit interpretation rather than integer magnitude/negation or globally ignored modifiers. The conservative decoder refusal forclamp,omod, andop_selremains correct. I no longer retain a code-behavior blocker or require a new decoder test in this PR.Only the evidence/claim boundary still needs correction:
omod,clampas no-ops, andop_sel, although the current decoder deliberately rejects all three. Please update What/Tested/GPUs to describe the implemented ABS/NEG scope and distinguish contributor hardware reports from the translated-SPIR-V Intel test.No additional local build, console, or GPU run was performed for this review; the gfx1036 results are from the linked contributor report. Once those two text surfaces match the current code and measured hardware boundary, my remaining change request is resolved.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-24T13:54:11Z.
Review: COMMENTED
Thanks for correcting the supported modifier list in the PR description. I rechecked
7c53cc0bbf0cd38f81a8857f0f66eb467ddef3f4on Windows. The decoder check covered 16,384 encodings: all 128 ABS/NEG-only combinations decoded with the expected operand flags, and all 16,256 with nonzeroclamp,omodorop_selwere rejected. An independent calculation matched all 512 values in the execution fixture. I did not run a GPU or console for this follow-up.One documentation item remains in
docs/dev/debt/changes/feat-shader-vop3-shift-add.md. Please name gfx1036 and gfx1201 as the measured source for ABS/NEG, and make explicit that ABS/NEG on gfx1013/PS5 remains unmeasured too. Please make the same distinction in What/Tested, keeping the VOP3 field layout and the Intel translated execution test separate from the native measurements.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-24T14:01:18Z.
Review: APPROVED
Rechecked exact head
8c2c93d153288a72e7749096f7a25b0bea280cda. The updated debt fragment records native gfx1036 and gfx1201 as the evidence for ABS/NEG, states that gfx1013 console behavior remains unmeasured, and records the continued rejection of nonzeroclamp,omod, andop_sel. The PR description now distinguishes the native reports from the Intel translated-SPIR-V fixture. This resolves my documentation request.The branch was rewritten, so I compared the two trees directly. The debt fragment is the only changed file. The decoder and GPU fixture have identical Git blobs, so the Windows CPU sweep of all 16,384 modifier encodings and the independent check of all 512 fixture values still apply. The current head merges cleanly into
maina246c178f5, andgit diff --check,tools/check_conventions.py, andtools/debt_fold.py --checkpassed locally. I did not run the shader fixture on a GPU or use a console. Native results are from the linked gfx1036 and gfx1201 contributor runs.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-24T18:16:01Z.
Review: APPROVED
Re-reviewed exact head
7eedf25a24688b3a7e18be91ff8310f3b292142f. The decoder, GPU fixture, and debt fragment are Git-blob-identical to the previously approved head; the new topic files are the CPU decoder test and its CMake registration.I configured and built the repository target
agc_vop3_shift_add_decode_testson Windows with WinLibs GCC 15.2.0 r7, Release, then ran registered CTestagc_vop3_shift_add_decode3/3. The test covers 128 accepted ABS/NEG combinations across the two opcodes and 78 refusal cases for nonzero clamp, omod, and op_sel.Negative control: in a scratch-only mutation I restored conservative rejection of nonzero ABS/NEG in the shift-add branch. The target rebuilt, and CTest failed on the accepted modifier combinations. After restoring the exact head, rebuilding and rerunning, CTest passed. The worktree is clean.
tools/check_conventions.py --base 17220db6a3c5fe1aeb92a68260812ed10f010b66andgit diff --checkpassed.tools/debt_fold.py --checkexits 1 because two existing libSceRudp fragments target one entry; both reported files have identical blobs on the topic parent and this head, so this PR did not introduce that failure.The exact head merges cleanly with current
mainf5d7f0ddbd4a448a0bae53b2cdd6c14262604548. #25799 still has the known same-hunk overlap inRdnaVectorOpDecoder.cpp; if it lands first, both semantically separate modifier branches need to be retained during the rebase.No GPU or console run was performed for this follow-up. The native gfx1036/gfx1201 evidence remains the linked contributor work; gfx1013 remains explicitly unmeasured.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-24T23:00:28Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the code inspected accepts the documented
abs/negsource modifiers and continues to refuse unsupported result modifiers.What I ran
Reviewed head
7eedf25a24688b3a7e18be91ff8310f3b292142f. I did not run commands; the change description reports build, test, hardware-oracle, and convention-check results that I did not independently verify.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I read all five changed files listed in the manifest:
core/libs/prx/libSceAgcDriver/tests/Vop3ShiftAddDecode.cpp,core/libs/prx/libSceAgcDriver/tests/cmake/agc_vop3_shift_add_decode_tests.cmake,core/libs/prx/libSceAgcDriver/tests/execution/Vop3ShiftAddSourceModifiers.cpp,core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp, anddocs/dev/debt/changes/feat-shader-vop3-shift-add.md. No changed files were excluded. I did not run the reported build or tests, independently verify the hardware measurements, or confirm behavior on gfx1013 console silicon.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-28T06:37:04Z.
Review: COMMENTED
Actionable comments posted: 1
d8bb1acb-0d3a-419b-bb30-0624223aa69aReviewing files that changed from the base of the PR and between
69d574e9a2and1528388764.core/libs/prx/libSceAgcDriver/tests/Vop3ShiftAddDecode.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_vop3_shift_add_decode_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/Vop3ShiftAddSourceModifiers.cppcore/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cppdocs/dev/debt/changes/feat-shader-vop3-shift-add.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T06:40:26Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: remove the duplicate modifier application in the new shift-add decode branch.
What I ran
Reviewed head
152838876444e12b7168026a9223c9b6cb81f498; no commands or tests were run. I read the prepared description, commits, manifest, diff, and full text for the changed decoder and decoder test. I also read the added decoder test CMake file. The remaining changed files are listed under Not verified.Results
Findings
Blocking
core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp:2569appliesapplyNativeVop3SourceModifierstwice in succession. The helper assigns each source's absolute and negate flags, so the second call is redundant. Remove the duplicate call; leaving it in creates unnecessary repeated work in every decoded shift-add instruction and suggests a copy/paste error in the new path.Non-blocking
None.
Not verified
I did not read the full execution test (
core/libs/prx/libSceAgcDriver/tests/execution/Vop3ShiftAddSourceModifiers.cpp) or the debt note (docs/dev/debt/changes/feat-shader-vop3-shift-add.md).review/files.jsonwas not available through the reader, so I could not independently verify its excluded-file list or compare every file listed as reviewed. The description's reported test and hardware results were not run or independently confirmed here.To get this to a good state
Remove the duplicate source-modifier application and rerun the decoder and execution tests.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T21:30:25Z.
Review: COMMENTED
I traced the VOP3 field decoding and the generic operand modifier path. The decoder tests cover all 64 accepted combinations for each opcode and keep combined
clamp,omodandop_selencodings rejected. The execution fixture checks the resulting words, which is important because the modifiers act on the sign bit of a U32 argument. I built the exact submittedVop3ShiftAddDecode.cppfixture with the head’s decoder sources on Linux and it passed. The paired Vulkan control and translated execution fixture are still queued. The native samples in the PR are gfx1036 and gfx1201, and the debt fragment records gfx1013 as unmeasured.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.