feat(shader): decode DPP8 on the relative vector instructions #14692
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14692"
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 edubox on 2026-11-01T17:04:47Z.
What
The progress page counted three VOP1 DPP8 forms as not decoded:
V_MOVRELS_B32,V_MOVRELSD_B32andV_MOVRELSD_2_B32(V_MOVRELD_B32was already accepted).acceptsDpp8returned false for exactly those three whilehasDppFormaccepted their DPP16 encodings. This makes DPP8 acceptance follow DPP16 (acceptsDpp8now delegates tohasDppForm), so the three encodings decode. This reverses the DPP8 exclusion added in391eb6ffe8; that commit records no reason, and the ISA sections below do not support excluding these four forms.No translator change was needed:
readRelativeVectorand the normal source read applyapplyBitSourceModifiers, which runsDppMoveU32for the source operand, including the DPP8 flags andfi. AMD's RDNA 2 ISA defines the DPP8/DPP16 forms (section 6.9) and does not list these four in the instructions that cannot use DPP (section 12.19.1); the relative read isD.u = VGPR[src0 + M0].u(section 12.8), so the per-lane value it fetches is the source DPP permutes, and the row/bank masks, fetch-inactive and bound controls go through the same path as the other VOP1 sources.tools/shader_scan.pynow reports 202 of 202 DPP forms decoded (previously 199 of 202).Tested
New execution test
agc_driver_relative_dpp(tests/execution/RelativeDpp.cpp), wave32 with 32 threads and wave64 with 64 threads, runs:v_movrels_b32_dpp,v_movreld_b32_dpp,v_movrelsd_b32_dppandv_movrelsd_2_b32_dppwithdpp8:[0,1,2,3,4,5,6,7].v_movrels_b32_dppwith a DPP16quad_perm:[0,1,2,3]as a regression control.v_movrels_b32_dppwith a non-identity DPP8 selector, once withfi=0and once withfi=1(MaskedNoFiCode/MaskedFiCode), checking the active and fetch-inactive lanes.Each case checks the value read through the relative window and the value written through the relative destination.
Per the shader-recompiler rules, the focused tests were run with
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(earlier run; the re-verification below uses the Flatpak layer):VUID-linesVK_INSTANCE_LAYERSwarningmain:agc_driver_relative_indexingagc_driver_relative_indexingagc_driver_relative_dppaad159ece2(224e5f8f52and the pushed head share the code and tests) with the Flatpak Khronos validation layer 1.3.290 (the host has no system layer):agc_driver_relative_indexingpassed on main and on the change, andagc_driver_relative_dpppassed on the change. The main indexing log and the change indexing log each contain exactly oneVUID-VkDeviceCreateInfo-pNext-pNext(the driver passes an unknownVkStructureTypeinpNext); the change adds no newVUID-, and theVK_INSTANCE_LAYERSwarning is absent from both logs.tools/check_conventions.py --base origin/mainandgit diff --checkare clean;tools/pr_overlap.py --branch feat/shader-movrel-dpp8reports no overlap with open pull requests.Negative controls: with
main's decoder the new test exits 1 withDPP8 modifier is not supported for opcode; withapplyBitSourceModifiersremoved fromreadRelativeVectorit exits 1 withrelative dpp masked: wave32 lane 0 is 0x00000020, expected 0x00000000. Both controls exercise the decode gate and the lane permutation, not only the decode path.The lane selection of these four DPP forms is not measured on a console; the debt note records the ISA sections above and the test coverage (non-identity selector, both
fivalues and full masks).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)Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:49:13Z.
Review: COMMENTED
Correction (2026-11-01): the title-ID/log demand below is not a CONTRIBUTING requirement;
Unblocks: noneis allowed. The technical points below are unaffected.No title reaches this. The motivation is the progress page count (199 to 202 of 202 DPP forms), not a title. There is no title ID and no log line showing a shader on main hitting the rejected
V_MOVREL*DPP8 encoding. Accepting encodings to move a coverage number is the case the throw rule is for: if nothing needs them, they should keep throwing.The semantics are asserted, not measured. The body says the DPP source swizzle goes through
applyBitSourceModifiers/DppMoveU32on the relative-read value. For a relative read the register being permuted is the VGPR picked bysrc0 + M0, and the lanes' value there is what DPP8 would shuffle. What does hardware do when the DPP source is the base register and the data actually read is the indexed one? The test expectations inRelativeDpp.cppcome from the same translator model, so they cannot disagree with it. Which of them was checked against RDNA hardware or the ISA text, and for which section? If it is unknown,acceptsDpp8should keep refusing these three and the gap should be indocs/dev/debt/shader.md.A negative control for the new test. Please show the test failing on main for the three newly accepted forms (it should throw there), and failing with the DPP flags dropped from the relative read, so it is clear it exercises the lane permutation and not just the decode path.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T20:47:52Z.
Review: COMMENTED
Reviewed — no blocking findings
The change lets DPP8 decode on the four relative vector moves that the base decoder refused. The RDNA 2 ISA does not list those instructions among the ones that cannot use DPP, and the existing relative read and write lowering already applies the DPP move. Two things are not verified here: the hand-computed expected values in the new GPU test, and the behaviour on hardware. The hosted Windows job ran no CTest for this head, so the test did not run. Approval waits for the macOS relinker jobs, which were queued at review time.
What I ran
aad159ece29ee0da2067dbfbbf07b2e9106e14f4; basef2d874c1fdccf781c0fa5d86619bb5dd8894b958. 3 files, +134/-7:RdnaVectorOpDecoder.cpp(theacceptsDpp8exclusion removed),tests/execution/RelativeDpp.cpp(new, 132 lines) anddocs/dev/debt/shader.md(+1).RunandRunMaskedhelpers.gpuopen.com, 291 pages) section 12.19.1 lists the instructions that cannot use DPP. The list coversV_FMAMK,V_FMAAK,V_READFIRSTLANE, the F64 conversions and other F64 operations.V_MOVRELS,V_MOVRELD,V_MOVRELSDandV_MOVRELSD_2are not on it. Section 12.8 defines the relative operands asVGPR[S0+M0]andVGPR[D+M0], so the source is a DPP-capable VOP1 operand.readRelativeVectorcallsapplyBitSourceModifiers, which appliesDppMoveU32withdppFlags(which adds the DPP8 lane mode) whenoperand.dppis set.writeRelativeVectorappliesDppUpdateU32for a DPP destination. The relative paths therefore already handle DPP8 selectors once the decoder accepts them.391eb6ffe8("decode DPP8 on VOP1 and VOP2"), whose message gives no reason for it.Results
applyBitSourceModifiersandwriteRelativeVectorapply the DPP moves, including DPP8391eb6ffe8) has no recorded reason; the PR should say why it is reversed (non-blocking)RelativeDpp.cppExpectedvalues were not computed by handRelativeDpp)Commands and unedited precheck output
Commands:
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14692 --output-dir <scratch>/precheck/14692p(report.md in that directory).git fetch https://github.com/boykopovar/AnyPS5.git pull/14692/head.curl -fsSL https://gpuopen.com/download/rdna2-shader-instruction-set-architecture.pdfandpdftotext -layouton it; sections 12.19.1 and 12.8.git log -S 'VMovrelsB32' f2d874c1fd -- core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp.gh api repos/boykopovar/AnyPS5/commits/aad159ece29ee0da2067dbfbbf07b2e9106e14f4/check-runs.Precheck table (unedited):
The precheck deliberately does not configure, build, or compile AnyPS5.git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...aad159ece29ee0da2067dbfbbf07b2e9106e14f4/marc/DeusMachina_0x1914/.venv/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head aad159ece29ee0da2067dbfbbf07b2e9106e14f4 --title feat(shader): decode DPP8 on the relative vector instructions --body /dev/shm/reviewer-run/precheck/14692p/pr-body.md/marc/DeusMachina_0x1914/.venv/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head aad159ece29ee0da2067dbfbbf07b2e9106e14f4 --jsonNo changed Python implementation files.No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.No changed test_*.py files./marc/DeusMachina_0x1914/.venv/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14692 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14692p/stackNot run: C++ tests need exact-head binaries, which require a build; the precheck does not build./marc/DeusMachina_0x1914/.venv/bin/python3 /dev/shm/reviewer-run/precheck/14692p/head-aad159ece29e-d889c6d2/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14692p/head-aad159ece29e-d889c6d2 --json core/libs/prx/libSceAgcDriver/tests/execution/RelativeDpp.cpp core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp docs/dev/debt/shader.mdNo changed Python test module in tools/ can be run as a no-build base-source control.Negative control
Not run here. The execution test needs Vulkan and a build.
Findings
Blocking
None.
Non-blocking
v_movrels_b32,v_movrelsd_b32andv_movrelsd_2_b32from DPP8 in commit391eb6ffe8, and nothing records why. The PR reverses that exclusion on ISA grounds, which the RDNA 2 section 12.19.1 list supports. Please state in the PR body that this reverses an earlier exclusion, and why.Expectedvalues inRelativeDpp.cpp({0x20, 0x10, 0x20, 0x20, 0x20}) and the masked cases depend on the DPP8 selector in the code array. I did not compute them by hand. A GPU run output for this head would settle them.core/libs/prx/libSceAgcDriver/CMakeLists.txtline 556, so it gets a CTest entry, but no hosted run of it appears for this head.Sources
github.com/boykopovar/AnyPS5@aad159ece2/core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp (L727-L731)github.com/boykopovar/AnyPS5@aad159ece2/core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp (L307-L311)github.com/boykopovar/AnyPS5@aad159ece2/core/libs/prx/libSceAgcDriver/tests/execution/RelativeDpp.cppNot verified
Expectedvalues were not computed by hand.To get this to a good state
RelativeDpp.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T09:31:22Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The one-line decoder change is consistent with the ISA sections the PR cites, and the negative control fails as it should. But the new test
agc_driver_relative_dppfails on lavapipe, which is what Linux CI runs. It runs wave32 and wave64 masked cases on an 8-lane host subgroup without the skip that the other DPP execution tests have.What I ran
Head
7895c8ae5447049e1b83f37c2e79eb9dc978e1ce,main4f41f4c375f5abb487dbd184fbc150f31994d762, merged with--no-ffinto tree968a7730dc06104e58747e4d98ee3028b787810f. Debian 13 VM (Xeon Gold 6136, AVX2/FMA), GCC 14.2.0, Release, Ninja. Vulkan through lavapipe (Mesa 26.1.6, LLVM 19,llvmpipe (LLVM 19.1.7, 256 bits), subgroup size 8).Results
git diff --checkcheck_conventions.pylibsagc_driver_relative_indexingagc_driver_relative_dppmain. Reproduced on rerunmainVUID-vkCmdDispatch-groupCountX-00386:agc_driver_native_depth_uniform_planes, which did not run on the older baselinemain(d1ae628bc2). This PR does not touch that test's path, so I do not count it against the PRagc_driver_relative_dpp on lavapipe
Negative control
I restored
core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cppfrommainand rebuiltagc_driver_relative_dpp_tests. The test exited 1 withDPP8 modifier is not supported for opcode. I then restored the merged file and rebuilt, andgit status --porcelainwas empty. On this machine, the unmaskedRuncases (all four movrel forms with DPP8, plus the DPP16 control, in wave32 and wave64) pass with the PR's decoder. The failure comes later, inRunMasked.Findings
Blocking
RelativeDpp.cpp:118-124runsRunMaskedfor wave32 and wave64 withEXEC=0xfwithout checking the host subgroup size. On llvmpipe (subgroup 8), lane 8 is written although EXEC has only lanes 0–3 set.v_movrels_b32_dppinMaskedNoFiCodewith a plainv_mov_b32 v4, v9(no DPP), and lane 8 still came back as0x00000020instead of0xdeadbeef. So the problem is not this PR's decoder change. It is the known limit of running an exec-masked wave on a host subgroup narrower than the wave.Dpp16InactiveSource.cppreturnsVulkanTestSkippedwhensubgroupSize < 32, and it passesdevice->ComputeTarget(32)instead ofdevice.Target()(here at lines 72 and 100).< 32for wave32; check what is needed for wave64), and useComputeTarget(waveSize). If the narrow-subgroup lowering is supposed to support masked waves, that is a separate bug and needs its own PR.Non-blocking
docs/dev/debt/shader.md:247says the test covers "a non-identity DPP8 selector with both bound-control values". DPP8 has nobound_ctrlfield. The two masked variants differ only infi(src00xe9vs0xea). Please write "both fetch-inactive values".MaskedNoFiCode/MaskedFiCodeby hand. They setv8=16,v9=32,M0=1,v4=0xdeadbeef,EXEC=0xf, then runv_movrels_b32 v4, v8 dpp8:[4,5,6,7,4,5,6,7]. So lanes 0–3 should readv9of inactive lanes 4–7, giving 0 withoutfiand0x20withfi, and lanes 4 and up should keep0xdeadbeef. That matches the test's expectations.Not verified
agc_driver_relative_dppmyself. The script's comparison reports no newVUID-for it.< 64subgroup skip in addition to< 32.To get this to a good state
ComputeTarget(waveSize)inRelativeDpp.cpp, as the other DPP execution tests do, so that the test either passes or reports a skip on lavapipe.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T10:33:29Z.
Review: DISMISSED
Re-checked — changes still requested
Commit
e31e6bb6f6fixes the lavapipe failure I reported: the test now usesComputeTarget(waveSize)and skips the masked cases on narrow subgroups. It also fixes the "bound-control" wording. But the skip message does not match the pattern thattools/check_skips.pyaccepts, so the Linux CI stepcheck_skips.py build/ctest.xmlnow fails on this test.What changed since my last review
e31e6bb6f6"test(shader): skip masked relative DPP cases on narrow subgroups". The three earlier commits are unchanged (range-diff=).RelativeDpp.cpp:Run/RunMaskedcall now takesdevice->ComputeTarget(waveSize);subgroupSize < 32, the test prints a message and returnsVulkanTestSkippedafter the unmasked cases have run;subgroupSize < 64, the wave64 masked cases are left out and the test still returns 0.docs/dev/debt/shader.md:247now says "both fetch-inactive values".< 32path.What I ran
Head
e31e6bb6f62dd05ff1f7812b6ed8b24aa1e2d4cc,main4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree17c28bc8f0a6ff18cf3d58083eb851ddc6b73175. Debian 13 VM, GCC 14.2.0, Release, lavapipe (llvmpipe (LLVM 19.1.7, 256 bits), subgroup 8).git diff --checkcheck_conventions.pylibsagc_driver_relative_indexingagc_driver_relative_dppcheck_skips.py(script run and my run)error: agc_driver_relative_dpp skippedmainVUID-is inagc_driver_native_depth_uniform_planes, which did not run on the baselinemaind1ae628bc2and is not on this PR's path, as at my last reviewSkip output and check_skips
Negative control: with
main'sRdnaVectorOpDecoder.cpp, the test exits 1 withShaderRecompiler::Recompile: DPP8 modifier is not supported for opcode. The unmasked cases run before the skip, so the decode gate is still exercised on lavapipe. After I restored the merged file and rebuilt, the test returned 77 again, andgit status --porcelainwas empty.Previous findings
subgroupSize, andComputeTarget(waveSize)is used (RelativeDpp.cpp:121-133). On lavapipe the test no longer fails. The new skip creates a new problem, described below.docs/dev/debt/shader.md:247now says "both fetch-inactive values".New findings
Blocking
tools/check_skips.py, so the Linux CI job fails.RelativeDpp.cpp:124printsskipped masked cases, subgroup size %u cannot hold a wave32.check_skips.pyaccepts a device-limitation skip only when the output matchesskipped,.*(subgroup|...), i.e. the comma has to come right after "skipped". Here "skipped" is followed by " masked cases,", so the skip counts as unexpected..github/workflows/build.yml:553runspython3 tools/check_skips.py build/ctest.xmlon Linux, where lavapipe has subgroup 8, so this test would fail that step on every run. I reproduced this locally with a JUnit file fromctest --output-junit.RelativeIndexingKnownBits.cpp:110:std::printf("relative dpp masked cases skipped, subgroup size %u cannot hold a wave32\n", ...).Non-blocking
RelativeDpp.cpp:129-131.Not verified
agc_driver_relative_dppagainstmainmyself. The test does not exist onmain, and the script's comparison found no newVUID-for it.To get this to a good state
<what> skipped, subgroup size ..., and check thatpython3 tools/check_skips.pyaccepts it on a subgroup-8 device.