Skip to content

feat(shader): VOP3 v_max/min_f16, v_cvt_f32_f16/ubyte and abs/neg on f16 binaries - #252

Merged
boykopovar merged 2 commits into
boykopovar:mainfrom
adriadam10:feat/vop3-f16-ubyte-aliases
Oct 2, 2026
Merged

boykopovar merged 2 commits into
boykopovar:mainfrom
adriadam10:feat/vop3-f16-ubyte-aliases

Conversation

@adriadam10

Copy link
Copy Markdown
Collaborator

What

The VOP1/VOP2 forms of these already translate, but their VOP3 encodings threw "VOP3 opcode is not implemented":

  • v_max_f16_e64, v_min_f16_e64 (were explicitly excluded as VOP3 aliases)
  • v_cvt_f32_f16_e64, v_cvt_f32_ubyte0..3_e64 (missing from the VOP3-encoded VOP1 table)

VOP3 f16 binaries (add/sub/subrev/mul/min/max_f16) also rejected abs/neg ("VOP3 source modifiers are not implemented") although readF16AsF32 already applies them, so they are now accepted. clamp/omod stay rejected for f16 results: writeF16 does not apply result modifiers (separate fix).

Found with an ISA sweep: every gfx1013 opcode from llvm-mc fed to DecodeRdnaInstruction + TranslateInstruction; these were the VOP3 forms whose short form already works.

Test agc_driver_vop3_aliases: hand-assembled compute shader (words from llvm-mc -mcpu=gfx1013 -show-encoding, same harness as MixPrecision), 64 lanes compared with a CPU model: v_max_f16 -a,|b|, v_min_f16 |a|,-b, v_mul_f16 -|a|,b, v_cvt_f32_f16 b mul:4, v_cvt_f32_f16 -|a|, v_cvt_f32_ubyte0..3 with mul:2, div:2, clamp. Only the written f16 half is checked.

Tested

Linux: test passes on RADV (Radeon 660M) and lavapipe; without the decoder change it fails with "VOP3 opcode is not implemented". CI runs it on lavapipe through #251.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: ci: run the shader execution tests on lavapipe #251 (test helper VulkanTestDevice.hpp + lavapipe in CI); review only the last commit
  • AI-assisted: yes

adriadam10 and others added 2 commits October 1, 2026 22:45
MixPrecision and SdwaDestination dispatch hand-assembled RDNA through the
recompiler and compare every lane with a CPU model, but were never in ctest.
Move them to tests/execution/, which is globbed into one test per file with
the same target names, so new execution tests add a file and no CMake lines.
They exit 77 (skipped) when the host has no Vulkan device; the Linux runner
installs lavapipe and sets ANYPS5_REQUIRE_VULKAN=1 so they cannot skip there.

Co-Authored-By: Claude <noreply@anthropic.com>
…pt abs/neg on f16 binaries

The VOP2/VOP1 forms already translate; the VOP3 encodings were rejected by the
decoder. VOP3 f16 add/sub/subrev/mul/min/max now take abs and neg, which
readF16AsF32 already applies. Clamp and omod stay rejected for them because
writeF16 does not apply result modifiers.

Co-Authored-By: Claude <noreply@anthropic.com>
@adriadam10
adriadam10 force-pushed the feat/vop3-f16-ubyte-aliases branch from 65dc444 to d97c6ae Compare October 1, 2026 20:51
@boykopovar
boykopovar merged commit 9b3927b into boykopovar:main Oct 2, 2026
3 checks passed
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 2, 2026
…opovar#251 execution tests, NGS2/audio boykopovar#236-boykopovar#248, boykopovar#249, boykopovar#292, our boykopovar#246) into astrobot

Conflicts:
- tests/Recorder.cpp: our boykopovar#246 commit is already on astrobot (3a494ec) along
  with the later key-fill tests, so ours is kept; every line upstream's boykopovar#246
  added is present once.
- RdnaOpcode.hpp: upstream's order (SClause before SCbranchCdbg, then the cache
  and perf-hint no-ops).
- SpirvAluEmitterMath.cpp: v_writelane fix landed on both sides with the same
  semantics; ours kept.
- libSceNgs2.native: upstream's NGS2 (system, racks, voices, ATRAC9, tests)
  replaces astrobot's single-file port. Astro Bot imports no NGS2 functions.
  Upstream left the Geom and Pan helpers as throwing stubs, so astrobot's
  working versions move to src/GeomPan.cpp in place of Unimplemented.cpp.
  libSceNgs2's stub layer and VerboseLog.hpp (used only by the old port) go.
- TechnicalDebt.md: both entries kept.

boykopovar#143 (NGG passthrough) stays as on astrobot: upstream did not touch its files
since the boykopovar#258 revert. The recompile request serialization stays at version 7.
@adriadam10
adriadam10 deleted the feat/vop3-f16-ubyte-aliases branch October 3, 2026 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build ci .github shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants