Skip to content

feat(shader): implement waitcnt counter variants - #387

Closed
asimplestray wants to merge 1 commit into
boykopovar:mainfrom
asimplestray:feat/shader-misc-ops
Closed

asimplestray wants to merge 1 commit into
boykopovar:mainfrom
asimplestray:feat/shader-misc-ops

Conversation

@asimplestray

@asimplestray asimplestray commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What

Implements 3 SOPK opcodes (0x18-0x1A, verified against LLVM's GFX10 disassembler tests):

  • S_WAITCNT_VMCNT/EXPCNT/LGKMCNT decode to their own opcodes (previously folded into generic SWaitcnt) and reuse the wait translation, including the immediate-operand decode and the wait-opcode classifications.

The S_FLBIT_I32/S_QUADMASK_B32 parts of the original revision have since landed in main via other work; the test still covers all five encodings.

Tested

Linux (GCC, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=OFF): full build, ctest 126/126 pass, including the new scalar_misc_ops test.

Checklist

  • Based on current main; no other open PR implements the same opcodes (checked open shader PRs)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (decoding unknown opcodes still throws)
  • 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 (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Progress report (7d40a57 → b92a852)

📈 GPU shader instructions: 64.58% (+0.26%, +3 implemented instructions)

✅ 3 implemented
Encoding Name
SOPK S_WAITCNT_EXPCNT
SOPK S_WAITCNT_LGKMCNT
SOPK S_WAITCNT_VMCNT

@asimplestray asimplestray changed the title feat(shader): implement scalar misc ops and waitcnt variants feat(shader): implement waitcnt counter variants Oct 2, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 2, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for this. On main, SOPK 0x18 to 0x1a already decode to SWaitcnt and translate as a wait (decodeSopkOpcode in RdnaScalarOpDecoder.cpp). This PR gives them their own enum values but doesn't change what any shader does. #383 has landed and counts the three for the progress report, with an execution test, so I think this one can be closed. If there's a behavioural difference I missed, let me know.

@adriadam10

Copy link
Copy Markdown
Collaborator

Closing, as Dean noted above: on main, SOPK 0x18-0x1a already decode to SWaitcnt (RdnaScalarOpDecoder.cpp) and translate as a wait, so the new enum values don't change what any shader does, and #383 already counts the three in the progress report with an execution test. Thanks for the work; feel free to reopen if there's a behavioural difference we missed.

@adriadam10 adriadam10 closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants