Skip to content

feat(shader): decode cache invalidations and performance hints as no-ops - #253

Merged
boykopovar merged 2 commits into
boykopovar:mainfrom
adriadam10:feat/shader-cache-hint-noops
Oct 2, 2026
Merged

boykopovar merged 2 commits into
boykopovar:mainfrom
adriadam10:feat/shader-cache-hint-noops

Conversation

@adriadam10

Copy link
Copy Markdown
Collaborator

What

These threw in the decoder ("unsupported SOPP opcode", "SMEM/MUBUF opcode is not supported"):

  • SOPP: s_icache_inv, s_incperflevel, s_decperflevel, s_wait_idle, s_ttracedata_imm (same as s_ttracedata)
  • SMEM: s_gl1_inv, s_dcache_inv, s_dcache_wb
  • MUBUF: buffer_gl0_inv, buffer_gl1_inv

SPIR-V has no cache control, so they translate like s_clause/s_waitcnt, which already emit nothing (ControlNop/Waitcnt lower to no SPIR-V). s_wait_idle goes to Waitcnt, the rest to ControlNop. The SMEM/MUBUF forms are decoded without operands (cacheControlInstruction), so the register analyses don't see a phantom s0/v0 destination or a descriptor base.

Found with an ISA sweep (every gfx1013 opcode from llvm-mc through DecodeRdnaInstruction + TranslateInstruction). shadPS4 does not translate the GCN equivalents (they hit UNREACHABLE), so there is no reference behaviour to follow; no-op is what the existing wait/hint opcodes do here.

Test agc_driver_cache_control: hand-assembled compute shader (words from llvm-mc -mcpu=gfx1013 -show-encoding) that loads a dword, runs all ten instructions around the load, adds 1 and stores; all 64 lanes are checked through the full Recompile + dispatch path.

Tested

Linux: passes on RADV (Radeon 660M) and lavapipe; without the change it fails with "unsupported SOPP opcode 19". Full ctest (99) passes. 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

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Progress report (709d7fe → e56511f)

📈 GPU shader instructions: 53.34% (+0.68%, +8 implemented instructions)

✅ 8 implemented
Encoding Name
MUBUF BUFFER_GL0_INV
MUBUF BUFFER_GL1_INV
SMEM S_DCACHE_INV
SMEM S_GL1_INV
SOPP S_DECPERFLEVEL
SOPP S_ICACHE_INV
SOPP S_INCPERFLEVEL
SOPP S_WAIT_IDLE

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>
s_icache_inv, s_incperflevel, s_decperflevel, s_ttracedata_imm, s_wait_idle,
s_gl1_inv, s_dcache_inv, s_dcache_wb, buffer_gl0_inv and buffer_gl1_inv threw
in the decoder. SPIR-V has no cache control, so they translate like s_clause
and s_waitcnt, which already emit nothing. The SMEM and MUBUF forms carry no
operands, so no pass sees a phantom base or destination register.

Co-Authored-By: Claude <noreply@anthropic.com>
@adriadam10
adriadam10 force-pushed the feat/shader-cache-hint-noops branch from b3ae67e to e56511f Compare October 1, 2026 20:51
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