feat(shader): translate buffer_atomic_csub without glc #15252

Merged
Kikoarl merged 1 commit from upstream-pr/15252 into main 2026-11-05 23:17:01 +00:00
Kikoarl commented 2026-11-02 22:21:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-11-02T22:21:30Z.


What

MemoryInstructionDispatch.cpp threw buffer_atomic_csub without glc is not supported when translating buffer_atomic_csub with glc = 0.

In AMD RDNA 2 ISA (MUBUF format):

  • When glc = 1, atomic instructions return the previous memory value to the destination register.
  • When glc = 0, atomic instructions perform the atomic memory operation without returning data to the destination register.

TranslationContext::bufferAtomic already natively checks if (inst.glc) { writeOperand(inst.destination, result); }, so omitting the artificial throw allows buffer_atomic_csub without glc to emit BufferAtomicUSubSat32 and correctly skip writing to destination. Updates tests/execution/BufferAtomicCsub.cpp's NoReturnCode check from expecting a throw to asserting successful compilation to valid SPIR-V.

Tested

  • Linux x86_64: ctest --test-dir /tmp/anyps5_build -R "buffer_atomic_csub_translation" -V passed (1/1 tests passed, 0.00s).
  • Verified both glc = false (no destination register write) and glc = true (destination register write) in BufferAtomicCsubTranslation.cpp.
  • python3 tools/check_conventions.py --base origin/main passed cleanly with 0 warnings.
  • python3 tools/progress.py confirms reduction of unsupported throw sites.

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 under Silent stubs in their library's technical debt file
  • 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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (CPU translation & IR regression tests)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5128360197 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15252). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-11-02T22:21:30Z. --- ### What `MemoryInstructionDispatch.cpp` threw `buffer_atomic_csub without glc is not supported` when translating `buffer_atomic_csub` with `glc = 0`. In AMD RDNA 2 ISA (MUBUF format): - When `glc = 1`, atomic instructions return the previous memory value to the destination register. - When `glc = 0`, atomic instructions perform the atomic memory operation without returning data to the destination register. `TranslationContext::bufferAtomic` already natively checks `if (inst.glc) { writeOperand(inst.destination, result); }`, so omitting the artificial throw allows `buffer_atomic_csub` without `glc` to emit `BufferAtomicUSubSat32` and correctly skip writing to destination. Updates `tests/execution/BufferAtomicCsub.cpp`'s `NoReturnCode` check from expecting a throw to asserting successful compilation to valid SPIR-V. ### Tested - Linux x86_64: `ctest --test-dir /tmp/anyps5_build -R "buffer_atomic_csub_translation" -V` passed (1/1 tests passed, 0.00s). - Verified both `glc = false` (no destination register write) and `glc = true` (destination register write) in `BufferAtomicCsubTranslation.cpp`. - `python3 tools/check_conventions.py --base origin/main` passed cleanly with 0 warnings. - `python3 tools/progress.py` confirms reduction of unsupported throw sites. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (CPU translation & IR regression tests) - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!15252
No description provided.