feat(shader): support Null destination in scalar loads #15488

Open
Kikoarl wants to merge 1 commit from upstream-pr/15488 into main
Kikoarl commented 2026-11-03 14:57:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-11-03T14:57:32Z.


What

  • Supports Null (125) as destination in scalarDestinationOperand for SMEM scalar loads (s_load_dword* and s_buffer_load_dword*), discarding loaded components for cache prefetches without mutating registers.
    • ISA specification: AMD "RDNA 2" Instruction Set Architecture §3.6.4 "Null Register" ("The null register (SGPR code 125) can be used as a destination operand for instructions that produce a result that is not needed. Write: data is discarded"), §3.6.1 Table 11 ("Scalar Source / Destination Encoding", code 125 null: "Write: data is discarded"), and §13.4 "SMEM" / Table 76 ("SMEM Instruction Fields", field SDATA: "[6:0] specifies SGPR or NULL (125)").
    • Compiler / Assembler source: LLVM permanent commit links in TableGen definitions SIRegisterInfo.td#L234 (defm SGPR_NULL_gfxpre11 : SIRegLoHi16 <"null", 125>;), SIRegisterInfo.td#L776 (def SReg_32_XM0_XEXEC : SIRegisterClass<... (add ..., SGPR_NULL, ...)>), and SMInstructions.td#L326 (defm S_LOAD_DWORD : SM_Pseudo_Loads <SReg_64, SReg_32_XM0_XEXEC>;).
  • Retains throwing for M0, ExecLo, and ExecHi as scalar load destinations in scalarDestinationOperand.
  • Retains decoder refusal for sbase > 104 (SMEM base register range overflow).
  • Removes test-only accessors in TranslationContext.hpp.
  • Adds unit tests in ShaderSpecialRegistersTests.cpp testing real decoded SMEM instruction words via DecodeRdnaSmem and TranslateInstruction.
  • Records that console cache effects and invalid-address faulting remain unmeasured on gfx1013 in docs/dev/debt/shader.md.

Tested

  • Linux x86_64 Release build via Ninja + ccache in RAM-disk /tmp/anyps5_build.
  • Ran unit test suite:
    • ctest --test-dir /tmp/anyps5_build -R "^shader_special_registers$": Passed 100% (0.00 s).
    • /tmp/anyps5_build/tests/shader_special_registers_tests: Passed cleanly.
    • Recompiler suite (ctest --test-dir /tmp/anyps5_build -R "^shader_"): 14/14 passed (100%).
  • Differential Red/Green test: Reverting OperandAccess.cpp to main fails with terminate called after throwing an instance of std::runtime_error what(): TranslationContext::scalarDestinationOperand invalid scalar-memory destination (exit code 134).
  • Negative test paths: verified refusal when translating instructions with M0, ExecLo, and ExecHi destinations, and decoder refusal on sbase > 104.
  • Passed python3 tools/check_conventions.py --base origin/main cleanly with 0 errors and 0 warnings.
  • Zero code comments.

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: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5139422408 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15488). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-11-03T14:57:32Z. --- ### What - Supports `Null` (125) as destination in `scalarDestinationOperand` for SMEM scalar loads (`s_load_dword*` and `s_buffer_load_dword*`), discarding loaded components for cache prefetches without mutating registers. - **ISA specification**: AMD "RDNA 2" Instruction Set Architecture §3.6.4 "Null Register" ("The null register (SGPR code 125) can be used as a destination operand for instructions that produce a result that is not needed. Write: data is discarded"), §3.6.1 Table 11 ("Scalar Source / Destination Encoding", code 125 `null`: "Write: data is discarded"), and §13.4 "SMEM" / Table 76 ("SMEM Instruction Fields", field `SDATA`: "[6:0] specifies SGPR or NULL (125)"). - **Compiler / Assembler source**: LLVM permanent commit links in TableGen definitions [`SIRegisterInfo.td#L234`](https://github.com/llvm/llvm-project/blob/a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4/llvm/lib/Target/AMDGPU/SIRegisterInfo.td#L234) (`defm SGPR_NULL_gfxpre11 : SIRegLoHi16 <"null", 125>;`), [`SIRegisterInfo.td#L776`](https://github.com/llvm/llvm-project/blob/a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4/llvm/lib/Target/AMDGPU/SIRegisterInfo.td#L776) (`def SReg_32_XM0_XEXEC : SIRegisterClass<... (add ..., SGPR_NULL, ...)>`), and [`SMInstructions.td#L326`](https://github.com/llvm/llvm-project/blob/a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4/llvm/lib/Target/AMDGPU/SMInstructions.td#L326) (`defm S_LOAD_DWORD : SM_Pseudo_Loads <SReg_64, SReg_32_XM0_XEXEC>;`). - Retains throwing for `M0`, `ExecLo`, and `ExecHi` as scalar load destinations in `scalarDestinationOperand`. - Retains decoder refusal for `sbase > 104` (`SMEM base register range overflow`). - Removes test-only accessors in `TranslationContext.hpp`. - Adds unit tests in `ShaderSpecialRegistersTests.cpp` testing real decoded SMEM instruction words via `DecodeRdnaSmem` and `TranslateInstruction`. - Records that console cache effects and invalid-address faulting remain unmeasured on gfx1013 in `docs/dev/debt/shader.md`. ### Tested - Linux x86_64 Release build via Ninja + ccache in RAM-disk `/tmp/anyps5_build`. - Ran unit test suite: - `ctest --test-dir /tmp/anyps5_build -R "^shader_special_registers$"`: Passed 100% (0.00 s). - `/tmp/anyps5_build/tests/shader_special_registers_tests`: Passed cleanly. - Recompiler suite (`ctest --test-dir /tmp/anyps5_build -R "^shader_"`): 14/14 passed (100%). - Differential Red/Green test: Reverting `OperandAccess.cpp` to `main` fails with `terminate called after throwing an instance of std::runtime_error what(): TranslationContext::scalarDestinationOperand invalid scalar-memory destination` (exit code 134). - Negative test paths: verified refusal when translating instructions with `M0`, `ExecLo`, and `ExecHi` destinations, and decoder refusal on `sbase > 104`. - Passed `python3 tools/check_conventions.py --base origin/main` cleanly with 0 errors and 0 warnings. - Zero code comments. ### 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: none - [x] AI-assisted: yes
XairRrR commented 2026-11-03 15:36:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T15:36:09Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The PR merges and builds cleanly, and its new test passes and fails as expected against main. However, it changes SMEM register semantics without naming a source, replaces a correct throw in readOperand(F64) with a value of the wrong type, loosens IR type validation for a type no opcode produces, and adds a debt entry that records no gap.

What I ran

Head 8138127ae8b313d49d1c33996246c15860f5e6fd, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree 22fce29cb6db4e6b1c86330560dc4e6838574c2b. Debian 13 VM, GCC 14.2.0, lavapipe (Mesa 26.1.6).

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...8138127ae8b313d49d1c33996246c15860f5e6fd
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build --output-on-failure -R "^shader_special_registers$"
# negative control: production .cpp files restored from main
git show 4f41f4c375f5:<path> > <path>   # OperandAccess.cpp, ScalarBufferInstructions.cpp, IrBuilderCore.cpp, IrBuilderConversions.cpp, IrProgram.cpp
ninja -C build -j32 -l32 shader_special_registers_tests
ctest --test-dir build --output-on-failure -R "^shader_special_registers$"
build/tests/shader_special_registers_tests
# restore merged files, rebuild, rerun
git show 22fce29cb6db:<path> > <path>
ninja -C build -j32 -l32 shader_special_registers_tests
ctest --test-dir build -R "^shader_special_registers$"
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Build (script) OK
Selected tests (script) 2167 ran, no new failures and no timeouts. 7 known failures also fail on main. agc_driver_alpha_to_coverage_sample_mask_export passed when rerun.
shader_special_registers Passed in 0.01 s
Validation layer comparison (script) 770 tests, layer loaded in 769, layer missing in none, 0 tests with new VUID- lines
Negative control Fails (see below)
Worktree after restore git status --porcelain empty

Negative control

I reverted the five production .cpp files to main and kept the new TranslationContext.hpp accessors so the test still compiles. The test then aborts at its first M0 destination check:

output
terminate called after throwing an instance of 'std::runtime_error'
  what():  TranslationContext::scalarDestinationOperand invalid scalar-memory destination
Aborted
exit=134

With the merged files restored and the target rebuilt, the test passes again.

Findings

Blocking

  1. SMEM semantics with no source. These are the changes:

    • ScalarBufferInstructions.cpp:14 and :33-38 now accept EXEC as the 64-bit SBASE of a raw scalar load.
    • OperandAccess.cpp:103-164 now accepts M0, NULL, EXEC_LO and EXEC_HI as SMEM SDATA destinations. A NULL destination now discards every component instead of throwing.

    CONTRIBUTING requires a PR that adds or changes shader instruction semantics to name an ISA section, an LLVM/ACO/Mesa file or a hardware measurement, and to keep throwing for cases the source doesn't settle. The description names none and says GPUs tested: none. Compilers may never pick M0 or EXEC as an SMEM destination. From memory, LLVM's SMEM sdst register classes exclude M0 and EXEC (I could not check that here). If so, hardware behaviour for these encodings isn't settled by a compiler source.

    Fix: cite the RDNA2 ISA section, or an LLVM/ACO/Mesa file, that defines SDATA = M0/NULL/EXEC and SBASE = EXEC for SMEM, or a hardware-oracle measurement. Keep throwing for any case it doesn't cover, and record the unverified parts in the debt entry.

  2. readOperand(IrType::F64) returns a U64 value instead of throwing. The IR has no F64-typed values: every 64-bit float opcode uses U64 (for example IrOpcode.cpp:295, makeMeta("FPAdd64", U64, U64, U64)). On main, readOperand(op, F64) reached the "unsupported operand type" throw, which was correct for a type the IR never uses.

    • The new branch at OperandAccess.cpp:266-269 returns a CompositeConstructU64 of type U64. It is the only branch whose result type differs from the requested type. The test asserts this mismatch at ShaderSpecialRegistersTests.cpp:343 ("readOperand F64 returns U64 pair construct").
    • Similarly, writeOperand at OperandAccess.cpp:338 accepts F64.
    • CompositeExtractU64 now takes an F64 argument against its declared U64 signature, special-cased in IrBuilderCore.cpp:27, IrBuilderCore.cpp:51, IrProgram.cpp:708 and IrBuilderConversions.cpp:32.

    No production path in the tree produces an F64-typed value. The only one is the test's hand-made CreateValue(IrOpcode::FPAdd64, IrType::F64) at ShaderSpecialRegistersTests.cpp:258, which breaks that opcode's own signature. So these changes widen the IR type checks for code that cannot run, and nothing checks that the SPIR-V emitter would handle an F64 operand to CompositeExtractU64.

    Fix: drop the F64 changes (readOperand, writeOperand, the builder, validator and CompositeExtract exceptions) and the matching tests. If a real producer of F64 values appears later, add the type with its own opcode signatures, or a bitcast to U64, in that PR.

  3. The debt entry records no gap. docs/dev/debt/shader.md:38 describes implemented behaviour: what is mapped, what advances and what throws. CONTRIBUTING says an entry states the gap first (what differs from the console, what is unverified, what throws) and describes behaviour only as far as the gap needs it. The PR also adds no code comment, so no debt entry is required for the conventions check.

    Fix: replace it with the actual gap, for example "SMEM SDATA M0/NULL/EXEC and SBASE EXEC are not measured on a PS5", with a closing condition. Remove it if a cited source settles everything.

Non-blocking

  1. The description overstates the change. It says the PR adds U16 and F16 reads from scalar and special registers in readOperand. Both branches (OperandAccess.cpp:242-248) are unchanged from main. The new tests for them pass without this PR's changes to those lines.
  2. Test-only accessors in a production header. TranslationContext.hpp:35-38 adds public ReadOperand/WriteOperand/ScalarDestinationOperand/SLoad wrappers whose only purpose is the test. Consider testing through TranslationContext's existing public translation entry points with decoded SMEM instructions. That would also cover the decoder's mapping of codes 124-127, which the hand-built RdnaOperands skip.
  3. Unused include. ShaderSpecialRegistersTests.cpp includes RdnaDecoder/RdnaInstructionDecoder.hpp but never decodes anything.

Not verified

  • I did not check the hardware semantics of SMEM with SDATA = M0/NULL/EXEC or SBASE = EXEC: there is no PS5 or RDNA hardware and no network here. The LLVM register-class remark above is from memory.
  • I ran only shader_special_registers myself. The wider selected suite and the Khronos validation layer comparison are the script's results, on lavapipe only.
  • I did not run any SPIR-V emission for an F64-typed CompositeExtractU64, because no production code produces one.

To get this to a good state

  1. Cite the source (ISA section, LLVM/ACO/Mesa file or hardware-oracle measurement) for the new SMEM destinations and the EXEC base. Keep throwing for anything it doesn't settle.
  2. Remove the F64 handling in readOperand/writeOperand and the CompositeExtractU64 F64 exceptions in the builder and validator, together with their tests.
  3. Rewrite the docs/dev/debt/shader.md entry so it states only what is unverified, with a closing condition, or drop it.
  4. Correct the description's U16/F16 claim.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5755016615 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15488#pullrequestreview-5755016615). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T15:36:09Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The PR merges and builds cleanly, and its new test passes and fails as expected against `main`. However, it changes SMEM register semantics without naming a source, replaces a correct throw in `readOperand(F64)` with a value of the wrong type, loosens IR type validation for a type no opcode produces, and adds a debt entry that records no gap. ## What I ran Head `8138127ae8b313d49d1c33996246c15860f5e6fd`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `22fce29cb6db4e6b1c86330560dc4e6838574c2b`. Debian 13 VM, GCC 14.2.0, lavapipe (Mesa 26.1.6). ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...8138127ae8b313d49d1c33996246c15860f5e6fd python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build --output-on-failure -R "^shader_special_registers$" # negative control: production .cpp files restored from main git show 4f41f4c375f5:<path> > <path> # OperandAccess.cpp, ScalarBufferInstructions.cpp, IrBuilderCore.cpp, IrBuilderConversions.cpp, IrProgram.cpp ninja -C build -j32 -l32 shader_special_registers_tests ctest --test-dir build --output-on-failure -R "^shader_special_registers$" build/tests/shader_special_registers_tests # restore merged files, rebuild, rerun git show 22fce29cb6db:<path> > <path> ninja -C build -j32 -l32 shader_special_registers_tests ctest --test-dir build -R "^shader_special_registers$" git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Build (script) | OK | | Selected tests (script) | 2167 ran, no new failures and no timeouts. 7 known failures also fail on `main`. `agc_driver_alpha_to_coverage_sample_mask_export` passed when rerun. | | `shader_special_registers` | Passed in 0.01 s | | Validation layer comparison (script) | 770 tests, layer loaded in 769, layer missing in none, 0 tests with new `VUID-` lines | | Negative control | Fails (see below) | | Worktree after restore | `git status --porcelain` empty | ## Negative control I reverted the five production `.cpp` files to `main` and kept the new `TranslationContext.hpp` accessors so the test still compiles. The test then aborts at its first `M0` destination check: <details><summary>output</summary> ``` terminate called after throwing an instance of 'std::runtime_error' what(): TranslationContext::scalarDestinationOperand invalid scalar-memory destination Aborted exit=134 ``` </details> With the merged files restored and the target rebuilt, the test passes again. ## Findings ### Blocking 1. **SMEM semantics with no source.** These are the changes: - `ScalarBufferInstructions.cpp:14` and `:33-38` now accept `EXEC` as the 64-bit SBASE of a raw scalar load. - `OperandAccess.cpp:103-164` now accepts `M0`, `NULL`, `EXEC_LO` and `EXEC_HI` as SMEM SDATA destinations. A `NULL` destination now discards every component instead of throwing. CONTRIBUTING requires a PR that adds or changes shader instruction semantics to name an ISA section, an LLVM/ACO/Mesa file or a hardware measurement, and to keep throwing for cases the source doesn't settle. The description names none and says `GPUs tested: none`. Compilers may never pick `M0` or `EXEC` as an SMEM destination. From memory, LLVM's SMEM `sdst` register classes exclude M0 and EXEC (I could not check that here). If so, hardware behaviour for these encodings isn't settled by a compiler source. Fix: cite the RDNA2 ISA section, or an LLVM/ACO/Mesa file, that defines SDATA = M0/NULL/EXEC and SBASE = EXEC for SMEM, or a hardware-oracle measurement. Keep throwing for any case it doesn't cover, and record the unverified parts in the debt entry. 2. **`readOperand(IrType::F64)` returns a `U64` value instead of throwing.** The IR has no F64-typed values: every 64-bit float opcode uses `U64` (for example `IrOpcode.cpp:295`, `makeMeta("FPAdd64", U64, U64, U64)`). On `main`, `readOperand(op, F64)` reached the "unsupported operand type" throw, which was correct for a type the IR never uses. - The new branch at `OperandAccess.cpp:266-269` returns a `CompositeConstructU64` of type `U64`. It is the only branch whose result type differs from the requested type. The test asserts this mismatch at `ShaderSpecialRegistersTests.cpp:343` ("readOperand F64 returns U64 pair construct"). - Similarly, `writeOperand` at `OperandAccess.cpp:338` accepts F64. - `CompositeExtractU64` now takes an F64 argument against its declared `U64` signature, special-cased in `IrBuilderCore.cpp:27`, `IrBuilderCore.cpp:51`, `IrProgram.cpp:708` and `IrBuilderConversions.cpp:32`. No production path in the tree produces an F64-typed value. The only one is the test's hand-made `CreateValue(IrOpcode::FPAdd64, IrType::F64)` at `ShaderSpecialRegistersTests.cpp:258`, which breaks that opcode's own signature. So these changes widen the IR type checks for code that cannot run, and nothing checks that the SPIR-V emitter would handle an F64 operand to `CompositeExtractU64`. Fix: drop the F64 changes (`readOperand`, `writeOperand`, the builder, validator and `CompositeExtract` exceptions) and the matching tests. If a real producer of F64 values appears later, add the type with its own opcode signatures, or a bitcast to `U64`, in that PR. 3. **The debt entry records no gap.** `docs/dev/debt/shader.md:38` describes implemented behaviour: what is mapped, what advances and what throws. CONTRIBUTING says an entry states the gap first (what differs from the console, what is unverified, what throws) and describes behaviour only as far as the gap needs it. The PR also adds no code comment, so no debt entry is required for the conventions check. Fix: replace it with the actual gap, for example "SMEM SDATA M0/NULL/EXEC and SBASE EXEC are not measured on a PS5", with a closing condition. Remove it if a cited source settles everything. ### Non-blocking 1. **The description overstates the change.** It says the PR adds `U16` and `F16` reads from scalar and special registers in `readOperand`. Both branches (`OperandAccess.cpp:242-248`) are unchanged from `main`. The new tests for them pass without this PR's changes to those lines. 2. **Test-only accessors in a production header.** `TranslationContext.hpp:35-38` adds public `ReadOperand`/`WriteOperand`/`ScalarDestinationOperand`/`SLoad` wrappers whose only purpose is the test. Consider testing through `TranslationContext`'s existing public translation entry points with decoded SMEM instructions. That would also cover the decoder's mapping of codes 124-127, which the hand-built `RdnaOperand`s skip. 3. **Unused include.** `ShaderSpecialRegistersTests.cpp` includes `RdnaDecoder/RdnaInstructionDecoder.hpp` but never decodes anything. ## Not verified - I did not check the hardware semantics of SMEM with SDATA = M0/NULL/EXEC or SBASE = EXEC: there is no PS5 or RDNA hardware and no network here. The LLVM register-class remark above is from memory. - I ran only `shader_special_registers` myself. The wider selected suite and the Khronos validation layer comparison are the script's results, on lavapipe only. - I did not run any SPIR-V emission for an F64-typed `CompositeExtractU64`, because no production code produces one. ## To get this to a good state 1. Cite the source (ISA section, LLVM/ACO/Mesa file or hardware-oracle measurement) for the new SMEM destinations and the EXEC base. Keep throwing for anything it doesn't settle. 2. Remove the F64 handling in `readOperand`/`writeOperand` and the `CompositeExtractU64` F64 exceptions in the builder and validator, together with their tests. 3. Rewrite the `docs/dev/debt/shader.md` entry so it states only what is unverified, with a closing condition, or drop it. 4. Correct the description's U16/F16 claim. <!-- anyps5-bots job=3406 head=8138127ae8b313d49d1c33996246c15860f5e6fd -->
XairRrR commented 2026-11-03 20:42:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T20:42:32Z.

Review: CHANGES_REQUESTED


Re-checked — changes still requested

The new push removes the F64 operand handling, drops the unused include, rewrites the debt entry as a gap and names an RDNA2 ISA and LLVM source. Two problems remain. The LLVM citation does not seem to support SDATA = M0/EXEC. The new raw SBASE = EXEC path can't be reached from decoded shaders.

What changed since my last review

  • The commit was rewritten from 8138127ae8b3 to 3d7836f85bdc.
  • The F64 changes are gone, both their tests and the IrBuilder, IrProgram and CompositeExtract exceptions. The PR now touches 6 files instead of 9.
  • RdnaDecoder/RdnaInstructionDecoder.hpp is no longer included by the test.
  • docs/dev/debt/shader.md:38 now opens with what is unmeasured, cites "RDNA2 ISA §§9.2, 12.4, 13.3.7 Table 88 and LLVM SMInstructions.td (allowing SReg_32 for SDATA and SReg_64 for SBASE)", and ends with "Closes when: measured on a PS5".
  • The description now says the U16/F16 tests cover existing behaviour, and it cites the same sources.
  • The discussion has no author reply. The GPU CI comments are for the earlier heads.

What I ran

Head 3d7836f85bdc0bd1495f64603ad22f0c7c45c8b0, main 086c0686c8adff3ee648fdbe34e0b0b647e1d511, merged tree 6df5f43869cbde9b7d5db9fb756ce4ffe7ae70fc. Debian 13 VM, GCC 14.2.0, lavapipe (Mesa 26.1.6).

git diff --check 086c0686c8adff3ee648fdbe34e0b0b647e1d511...3d7836f85bdc0bd1495f64603ad22f0c7c45c8b0
python3 tools/check_conventions.py --base 086c0686c8adff3ee648fdbe34e0b0b647e1d511
ctest --test-dir build --output-on-failure -R "^shader_special_registers$"
# negative control: OperandAccess.cpp and ScalarBufferInstructions.cpp restored from main
git show 086c0686c8ad:<path> > <path>
ninja -C build -j32 -l32 shader_special_registers_tests
ctest --test-dir build --output-on-failure -R "^shader_special_registers$"
build/tests/shader_special_registers_tests
# same reverted state: VUID origin check for the script's only new-VUID test
ninja -C build -j32 -l32 agc_driver_image_gather_volume_tests
env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -V -R "^agc_driver_image_gather_volume$"
# restore merged files
git show 6df5f43869cb:<path> > <path>
ninja -C build -j32 -l32 agc_driver_image_gather_volume_tests shader_special_registers_tests
ctest --test-dir build -R "^shader_special_registers$"
git status --porcelain
Check Result
git diff --check clean
check_conventions.py All conventions checks passed.
Build (script) OK
Selected tests (script) 2192 ran, 0 new failures, 0 timeouts. 7 known failures also fail on main.
shader_special_registers Passed (0.01 s)
Negative control Fails: the test aborts with scalarDestinationOperand invalid scalar-memory destination
Validation (script) 783 tests, layer loaded in 782, none missing. agc_driver_image_gather_volume lists VUID-VkSamplerCreateInfo-addressMode* lines marked "test not run on main". I got the same 4 VUIDs with this PR's production files reverted to main, so they come from main, not from this PR.
Worktree after restore git status --porcelain is empty

Previous findings

  1. SMEM semantics with no source. Resolved in form, still open in substance. A source is now named in the debt entry and the description, but it doesn't seem to support SDATA = M0/EXEC (see new blocking finding 1).
  2. readOperand(F64) returns U64 / F64 IR exceptions. Resolved. The diff against main has no F64 changes left.
  3. Debt entry records no gap. Resolved. The entry now opens with what isn't measured and has a closing condition.
  4. Non-blocking: the description overstates U16/F16. Resolved. It now says the tests verify existing reads.
  5. Non-blocking: test-only accessors in TranslationContext.hpp:35-38. Still open. Because the tests bypass the decoder, they hide new blocking finding 2.
  6. Non-blocking: unused decoder include. Resolved.

New findings

Blocking

  1. The LLVM citation doesn't seem to support SDATA = M0/EXEC. The debt entry (docs/dev/debt/shader.md:38) says LLVM SMInstructions.td allows SReg_32 for SDATA.
    • From memory: LLVM defines S_LOAD_DWORD with the SReg_32_XM0_XEXEC destination class and the wider loads with SReg_*_XEXEC. Those classes exclude M0 and EXEC on purpose. If so, LLVM never emits these encodings, and the source doesn't settle what hardware does with them.
    • I could not check this: the sandbox has no LLVM sources, no llvm-mc and no network.
    • I also could not match "§§9.2, 12.4, 13.3.7 Table 88" to scalar-memory content in the RDNA2 ISA, because I don't have the document here.
    • The project rule is that cases the source doesn't settle throw.
    • Fix: give a permanent link (tagged or commit URL) to the exact LLVM lines, and the ISA section titles with the sentence that allows SDATA = M0/NULL/EXEC. If LLVM really uses _XM0_XEXEC, keep throwing for M0, EXEC_LO and EXEC_HI as SMEM destinations. NULL can stay if the ISA text covers it.
  2. The raw SBASE = EXEC path can't be reached.
    • ScalarBufferInstructions.cpp:14 and :33-38 accept ExecLo as a raw base.
    • The SMEM decoder still throws SMEM base register range overflow for any sbase * 2 > 104 other than 106, so sbase 126 never gets past it: RdnaMemoryOpDecoder.cpp#L790-L797.
    • The test passes only because it builds the ExecLo operand by hand and calls the new SLoad accessor.
    • So the description's claim of ExecLo base support is not true for real shaders, and the debt entry records a gap for code that never runs.
    • Fix: either drop the ExecLo base changes and that part of the debt entry, or map sbase 126 to ExecLo in the decoder and test it with a decoded s_load_dwordx* word. Doing the latter needs the source from finding 1.

Non-blocking

  1. Debt entry wording. "Multi-dword destination advances crossing beyond ExecHi ... throw" describes what the code does, not a gap. "Closes when: measured on a PS5" is enough.

Not verified

  • I could not check the hardware or LLVM semantics of SMEM with SDATA = M0/NULL/EXEC or SBASE = EXEC: there is no RDNA hardware, LLVM source or network here. The register-class point above is from memory.
  • The GPU runs in the discussion were for the earlier heads f655009 and 8138127, not this one. GPUs tested: none.
  • I ran only shader_special_registers and agc_driver_image_gather_volume myself. The rest are the script's results, on lavapipe only.

To get this to a good state

  1. Link the exact LLVM lines and ISA text for SDATA = M0/NULL/EXEC. Keep throwing for any destination the source excludes.
  2. Remove the unreachable ExecLo SBASE handling, or wire it through the decoder and test it with a decoded instruction.
  3. Preferably, test through decoded SMEM words instead of the new TranslationContext accessors.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5759185476 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15488#pullrequestreview-5759185476). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T20:42:32Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes still requested The new push removes the F64 operand handling, drops the unused include, rewrites the debt entry as a gap and names an RDNA2 ISA and LLVM source. Two problems remain. The LLVM citation does not seem to support SDATA = M0/EXEC. The new raw SBASE = EXEC path can't be reached from decoded shaders. ## What changed since my last review - The commit was rewritten from `8138127ae8b3` to `3d7836f85bdc`. - The F64 changes are gone, both their tests and the `IrBuilder`, `IrProgram` and `CompositeExtract` exceptions. The PR now touches 6 files instead of 9. - `RdnaDecoder/RdnaInstructionDecoder.hpp` is no longer included by the test. - `docs/dev/debt/shader.md:38` now opens with what is unmeasured, cites "RDNA2 ISA §§9.2, 12.4, 13.3.7 Table 88 and LLVM SMInstructions.td (allowing SReg_32 for SDATA and SReg_64 for SBASE)", and ends with "Closes when: measured on a PS5". - The description now says the U16/F16 tests cover existing behaviour, and it cites the same sources. - The discussion has no author reply. The GPU CI comments are for the earlier heads. ## What I ran Head `3d7836f85bdc0bd1495f64603ad22f0c7c45c8b0`, `main` `086c0686c8adff3ee648fdbe34e0b0b647e1d511`, merged tree `6df5f43869cbde9b7d5db9fb756ce4ffe7ae70fc`. Debian 13 VM, GCC 14.2.0, lavapipe (Mesa 26.1.6). ``` git diff --check 086c0686c8adff3ee648fdbe34e0b0b647e1d511...3d7836f85bdc0bd1495f64603ad22f0c7c45c8b0 python3 tools/check_conventions.py --base 086c0686c8adff3ee648fdbe34e0b0b647e1d511 ctest --test-dir build --output-on-failure -R "^shader_special_registers$" # negative control: OperandAccess.cpp and ScalarBufferInstructions.cpp restored from main git show 086c0686c8ad:<path> > <path> ninja -C build -j32 -l32 shader_special_registers_tests ctest --test-dir build --output-on-failure -R "^shader_special_registers$" build/tests/shader_special_registers_tests # same reverted state: VUID origin check for the script's only new-VUID test ninja -C build -j32 -l32 agc_driver_image_gather_volume_tests env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -V -R "^agc_driver_image_gather_volume$" # restore merged files git show 6df5f43869cb:<path> > <path> ninja -C build -j32 -l32 agc_driver_image_gather_volume_tests shader_special_registers_tests ctest --test-dir build -R "^shader_special_registers$" git status --porcelain ``` | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed. | | Build (script) | OK | | Selected tests (script) | 2192 ran, 0 new failures, 0 timeouts. 7 known failures also fail on `main`. | | `shader_special_registers` | Passed (0.01 s) | | Negative control | Fails: the test aborts with `scalarDestinationOperand invalid scalar-memory destination` | | Validation (script) | 783 tests, layer loaded in 782, none missing. `agc_driver_image_gather_volume` lists `VUID-VkSamplerCreateInfo-addressMode*` lines marked "test not run on main". I got the same 4 VUIDs with this PR's production files reverted to `main`, so they come from `main`, not from this PR. | | Worktree after restore | `git status --porcelain` is empty | ## Previous findings 1. **SMEM semantics with no source.** Resolved in form, still open in substance. A source is now named in the debt entry and the description, but it doesn't seem to support SDATA = M0/EXEC (see new blocking finding 1). 2. **`readOperand(F64)` returns `U64` / F64 IR exceptions.** Resolved. The diff against `main` has no F64 changes left. 3. **Debt entry records no gap.** Resolved. The entry now opens with what isn't measured and has a closing condition. 4. **Non-blocking: the description overstates U16/F16.** Resolved. It now says the tests verify existing reads. 5. **Non-blocking: test-only accessors in `TranslationContext.hpp:35-38`.** Still open. Because the tests bypass the decoder, they hide new blocking finding 2. 6. **Non-blocking: unused decoder include.** Resolved. ## New findings ### Blocking 1. **The LLVM citation doesn't seem to support SDATA = M0/EXEC.** The debt entry (`docs/dev/debt/shader.md:38`) says LLVM `SMInstructions.td` allows `SReg_32` for SDATA. - From memory: LLVM defines `S_LOAD_DWORD` with the `SReg_32_XM0_XEXEC` destination class and the wider loads with `SReg_*_XEXEC`. Those classes exclude M0 and EXEC on purpose. If so, LLVM never emits these encodings, and the source doesn't settle what hardware does with them. - I could not check this: the sandbox has no LLVM sources, no `llvm-mc` and no network. - I also could not match "§§9.2, 12.4, 13.3.7 Table 88" to scalar-memory content in the RDNA2 ISA, because I don't have the document here. - The project rule is that cases the source doesn't settle throw. - Fix: give a permanent link (tagged or commit URL) to the exact LLVM lines, and the ISA section titles with the sentence that allows SDATA = M0/NULL/EXEC. If LLVM really uses `_XM0_XEXEC`, keep throwing for M0, EXEC_LO and EXEC_HI as SMEM destinations. NULL can stay if the ISA text covers it. 2. **The raw SBASE = EXEC path can't be reached.** - `ScalarBufferInstructions.cpp:14` and `:33-38` accept `ExecLo` as a raw base. - The SMEM decoder still throws `SMEM base register range overflow` for any `sbase * 2 > 104` other than 106, so `sbase` 126 never gets past it: [RdnaMemoryOpDecoder.cpp#L790-L797](https://github.com/boykopovar/AnyPS5/blob/3d7836f85bdc0bd1495f64603ad22f0c7c45c8b0/core/shader/recompiler/RdnaDecoder/src/RdnaMemoryOpDecoder.cpp#L790-L797). - The test passes only because it builds the `ExecLo` operand by hand and calls the new `SLoad` accessor. - So the description's claim of `ExecLo` base support is not true for real shaders, and the debt entry records a gap for code that never runs. - Fix: either drop the `ExecLo` base changes and that part of the debt entry, or map `sbase` 126 to `ExecLo` in the decoder and test it with a decoded `s_load_dwordx*` word. Doing the latter needs the source from finding 1. ### Non-blocking 1. **Debt entry wording.** "Multi-dword destination advances crossing beyond ExecHi ... throw" describes what the code does, not a gap. "Closes when: measured on a PS5" is enough. ## Not verified - I could not check the hardware or LLVM semantics of SMEM with SDATA = M0/NULL/EXEC or SBASE = EXEC: there is no RDNA hardware, LLVM source or network here. The register-class point above is from memory. - The GPU runs in the discussion were for the earlier heads `f655009` and `8138127`, not this one. `GPUs tested: none`. - I ran only `shader_special_registers` and `agc_driver_image_gather_volume` myself. The rest are the script's results, on lavapipe only. ## To get this to a good state 1. Link the exact LLVM lines and ISA text for SDATA = M0/NULL/EXEC. Keep throwing for any destination the source excludes. 2. Remove the unreachable `ExecLo` SBASE handling, or wire it through the decoder and test it with a decoded instruction. 3. Preferably, test through decoded SMEM words instead of the new `TranslationContext` accessors. <!-- anyps5-bots job=3581 head=3d7836f85bdc0bd1495f64603ad22f0c7c45c8b0 -->
XairRrR commented 2026-11-03 23:23:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T23:23:13Z.

Review: CHANGES_REQUESTED


Re-checked — changes still requested

The commit was rewritten as 77d3ddaf66d6. It now only lets SMEM scalar loads take Null (125) as the destination, and it drops the M0/EXEC destination, the EXEC base and the test-only accessors. The tests now decode real SMEM words. One rule is still not met: the new instruction semantics name no source.

What changed since my last review

  • The single commit 3d7836f85bdc was replaced by 77d3ddaf66d6. The PR now touches 4 files (+170 −0).
  • OperandAccess.cpp now has only an early return for RdnaOperandKind::Null in scalarDestinationOperand (core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp:104-106). M0, EXEC_LO and EXEC_HI still reach the invalid scalar-memory destination throw.
  • ScalarBufferInstructions.cpp and TranslationContext.hpp are no longer changed. On the merged tree they are the same as on main.
  • ShaderSpecialRegistersTests.cpp builds SMEM words and runs them through DecodeRdnaSmem and TranslateInstruction. It checks:
    • SDATA = 125 for s_load_dword* and s_buffer_load_dword* emits no register writes.
    • SDATA 124, 126 and 127 throw.
    • sbase 63 is refused by the decoder.
    • s4 and vcc_lo destinations still lower to writes.
  • The debt entry (docs/dev/debt/shader.md:38) is shorter. It no longer cites the RDNA2 ISA sections or LLVM SMInstructions.td.
  • The description has been rewritten to match. There is still no author reply in the discussion, and the GPU CI comments are for the older heads f655009 and 8138127.

What I ran

Head 77d3ddaf66d684be0d9e116723ce6523243aab16, main 1c8c0efc8c41314402e6966da5bef6ea3d639d10, merged tree 67eba10a5600b90700dfa4df794ec4425b4f5b83. Debian 13 VM, GCC 14.2.0, lavapipe (Mesa 26.1.6).

git diff --check 1c8c0efc8c41314402e6966da5bef6ea3d639d10...77d3ddaf66d684be0d9e116723ce6523243aab16
python3 tools/check_conventions.py --base 1c8c0efc8c41314402e6966da5bef6ea3d639d10
ctest --test-dir build --output-on-failure -R "^shader_special_registers$"
# negative control: OperandAccess.cpp restored from main
git show 1c8c0efc8c41:core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp > <same path>
ninja -C build -j32 -l32 shader_special_registers_tests
ctest --test-dir build --output-on-failure -R "^shader_special_registers$"
# same reverted state: where the VUIDs come from
ninja -C build -j32 -l32 agc_driver_image_gather_volume_tests
env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -V -R "^agc_driver_image_gather_volume$"
# restore merged file
git show 67eba10a5600:core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp > <same path>
ninja -C build -j32 -l32 agc_driver_image_gather_volume_tests shader_special_registers_tests
ctest --test-dir build -R "^shader_special_registers$"
git status --porcelain
Check Result
git diff --check clean
check_conventions.py All conventions checks passed.
Build (script) OK
Selected tests (script) 2196 ran, 0 new failures, 0 timeouts. The 7 known failures fail on main too.
shader_special_registers Passed (0.01 s)
Negative control The test fails as expected (Subprocess aborted)
Validation (script) 784 tests; the layer loaded in 783 and is missing in none. agc_driver_image_gather_volume reports VUID-VkSamplerCreateInfo-addressMode* marked "test not run on main". With OperandAccess.cpp reverted to main I got the same 4 VUIDs, so they come from main, not from this PR.
Worktree after restore git status --porcelain is empty
Negative control output
terminate called after throwing an instance of 'std::runtime_error'
  what():  TranslationContext::scalarDestinationOperand invalid scalar-memory destination
1006 - shader_special_registers (Subprocess aborted)

Previous findings

  1. The LLVM citation doesn't support SDATA = M0/EXEC (blocking). No longer applies. M0, EXEC_LO and EXEC_HI as SMEM destinations still throw (OperandAccess.cpp:112), and the test checks this with decoded words 124, 126 and 127.
  2. The raw SBASE = EXEC path can't be reached (blocking). Resolved. ScalarBufferInstructions.cpp is unchanged from main, and the PR no longer claims an EXEC base.
  3. SMEM semantics with no source (from earlier rounds). Still open, now only for Null. The ISA/LLVM citation was removed together with the M0/EXEC part, and nothing replaced it. See new blocking finding 1.
  4. Test-only accessors in TranslationContext.hpp (non-blocking). Resolved. The header is unchanged and the tests go through DecodeRdnaSmem and TranslateInstruction.
  5. Debt entry describes code instead of a gap (non-blocking). Resolved. The text about crossing past ExecHi is gone.

New findings

Blocking

  1. No source for SDATA = NULL in SMEM loads. CONTRIBUTING.md says that pull requests which add or change shader instruction semantics say where they come from: hardware measurement, or the exact ISA section or LLVM/ACO/Mesa file. Before this PR, 125 as an SMEM destination threw. Now it is accepted, and every loaded component is dropped. Neither the description nor docs/dev/debt/shader.md:38 names a source. The behaviour is very likely right, since NULL ignores writes everywhere else in the recompiler (writeRawU32, OperandAccess.cpp:514-516). But the rule asks for a source, and the reviewer has to be able to check it.
    • Fix: in the description, cite the RDNA2 ISA text that defines NULL (SGPR code 125) as a write-ignored destination and allows it as SMEM SDATA (section title and sentence), or an LLVM MC test/register class at a commit URL that accepts s_load_dword null, ... on gfx10. A permanent link is enough. No code change is needed.

Non-blocking

  1. Debt entry wording. "SMEM scalar loads with Null (125) destination (prefetch discard) discard loaded components" describes what is implemented. The gap is the second sentence. Suggestion: "SMEM loads with SDATA = NULL are translated as loads whose result is dropped; console cache effects and faulting on invalid addresses are not measured on a PS5. Closes when: measured on a PS5."
  2. The loads are still emitted. sLoad still calls addMemoryInfo and emits LoadAddressU32 / ReadConstBuffer for each component before the writes are dropped (ScalarBufferInstructions.cpp:37-50). So a NULL-destination raw load still registers a scalar-address resource and still issues a host read unless later passes remove it. If the guest address is invalid, this differs from a prefetch. The debt entry already records the faulting question, so this is a note, not a request.

Not verified

  • The hardware semantics of SMEM with SDATA = NULL: there is no RDNA hardware, ISA document or LLVM source here.
  • No GPU run for this head: the GPU CI comments are for f655009 and 8138127, and the checklist says GPUs tested: none. Lavapipe only.
  • I ran shader_special_registers and agc_driver_image_gather_volume myself. The other results come from the script.

To get this to a good state

  1. Name the source for NULL as an SMEM destination (ISA section and sentence, or an LLVM file at a commit URL) in the description, and preferably in the debt entry too.
  2. Optionally, reword the debt entry so it starts with the gap.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5760907298 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15488#pullrequestreview-5760907298). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T23:23:13Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes still requested The commit was rewritten as `77d3ddaf66d6`. It now only lets SMEM scalar loads take `Null` (125) as the destination, and it drops the M0/EXEC destination, the EXEC base and the test-only accessors. The tests now decode real SMEM words. One rule is still not met: the new instruction semantics name no source. ## What changed since my last review - The single commit `3d7836f85bdc` was replaced by `77d3ddaf66d6`. The PR now touches 4 files (+170 −0). - `OperandAccess.cpp` now has only an early return for `RdnaOperandKind::Null` in `scalarDestinationOperand` (`core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp:104-106`). M0, EXEC_LO and EXEC_HI still reach the `invalid scalar-memory destination` throw. - `ScalarBufferInstructions.cpp` and `TranslationContext.hpp` are no longer changed. On the merged tree they are the same as on `main`. - `ShaderSpecialRegistersTests.cpp` builds SMEM words and runs them through `DecodeRdnaSmem` and `TranslateInstruction`. It checks: - SDATA = 125 for `s_load_dword*` and `s_buffer_load_dword*` emits no register writes. - SDATA 124, 126 and 127 throw. - `sbase` 63 is refused by the decoder. - `s4` and `vcc_lo` destinations still lower to writes. - The debt entry (`docs/dev/debt/shader.md:38`) is shorter. It no longer cites the RDNA2 ISA sections or LLVM `SMInstructions.td`. - The description has been rewritten to match. There is still no author reply in the discussion, and the GPU CI comments are for the older heads `f655009` and `8138127`. ## What I ran Head `77d3ddaf66d684be0d9e116723ce6523243aab16`, `main` `1c8c0efc8c41314402e6966da5bef6ea3d639d10`, merged tree `67eba10a5600b90700dfa4df794ec4425b4f5b83`. Debian 13 VM, GCC 14.2.0, lavapipe (Mesa 26.1.6). ``` git diff --check 1c8c0efc8c41314402e6966da5bef6ea3d639d10...77d3ddaf66d684be0d9e116723ce6523243aab16 python3 tools/check_conventions.py --base 1c8c0efc8c41314402e6966da5bef6ea3d639d10 ctest --test-dir build --output-on-failure -R "^shader_special_registers$" # negative control: OperandAccess.cpp restored from main git show 1c8c0efc8c41:core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp > <same path> ninja -C build -j32 -l32 shader_special_registers_tests ctest --test-dir build --output-on-failure -R "^shader_special_registers$" # same reverted state: where the VUIDs come from ninja -C build -j32 -l32 agc_driver_image_gather_volume_tests env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -V -R "^agc_driver_image_gather_volume$" # restore merged file git show 67eba10a5600:core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp > <same path> ninja -C build -j32 -l32 agc_driver_image_gather_volume_tests shader_special_registers_tests ctest --test-dir build -R "^shader_special_registers$" git status --porcelain ``` | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed. | | Build (script) | OK | | Selected tests (script) | 2196 ran, 0 new failures, 0 timeouts. The 7 known failures fail on `main` too. | | `shader_special_registers` | Passed (0.01 s) | | Negative control | The test fails as expected (Subprocess aborted) | | Validation (script) | 784 tests; the layer loaded in 783 and is missing in none. `agc_driver_image_gather_volume` reports `VUID-VkSamplerCreateInfo-addressMode*` marked "test not run on main". With `OperandAccess.cpp` reverted to `main` I got the same 4 VUIDs, so they come from `main`, not from this PR. | | Worktree after restore | `git status --porcelain` is empty | <details><summary>Negative control output</summary> ``` terminate called after throwing an instance of 'std::runtime_error' what(): TranslationContext::scalarDestinationOperand invalid scalar-memory destination 1006 - shader_special_registers (Subprocess aborted) ``` </details> ## Previous findings 1. **The LLVM citation doesn't support SDATA = M0/EXEC (blocking).** No longer applies. M0, EXEC_LO and EXEC_HI as SMEM destinations still throw (`OperandAccess.cpp:112`), and the test checks this with decoded words 124, 126 and 127. 2. **The raw SBASE = EXEC path can't be reached (blocking).** Resolved. `ScalarBufferInstructions.cpp` is unchanged from `main`, and the PR no longer claims an EXEC base. 3. **SMEM semantics with no source (from earlier rounds).** Still open, now only for `Null`. The ISA/LLVM citation was removed together with the M0/EXEC part, and nothing replaced it. See new blocking finding 1. 4. **Test-only accessors in `TranslationContext.hpp` (non-blocking).** Resolved. The header is unchanged and the tests go through `DecodeRdnaSmem` and `TranslateInstruction`. 5. **Debt entry describes code instead of a gap (non-blocking).** Resolved. The text about crossing past ExecHi is gone. ## New findings ### Blocking 1. **No source for SDATA = NULL in SMEM loads.** CONTRIBUTING.md says that pull requests which add or change shader instruction semantics say where they come from: hardware measurement, or the exact ISA section or LLVM/ACO/Mesa file. Before this PR, 125 as an SMEM destination threw. Now it is accepted, and every loaded component is dropped. Neither the description nor `docs/dev/debt/shader.md:38` names a source. The behaviour is very likely right, since NULL ignores writes everywhere else in the recompiler (`writeRawU32`, `OperandAccess.cpp:514-516`). But the rule asks for a source, and the reviewer has to be able to check it. - Fix: in the description, cite the RDNA2 ISA text that defines NULL (SGPR code 125) as a write-ignored destination and allows it as SMEM SDATA (section title and sentence), or an LLVM MC test/register class at a commit URL that accepts `s_load_dword null, ...` on gfx10. A permanent link is enough. No code change is needed. ### Non-blocking 1. **Debt entry wording.** "SMEM scalar loads with Null (125) destination (prefetch discard) discard loaded components" describes what is implemented. The gap is the second sentence. Suggestion: "SMEM loads with SDATA = NULL are translated as loads whose result is dropped; console cache effects and faulting on invalid addresses are not measured on a PS5. Closes when: measured on a PS5." 2. **The loads are still emitted.** `sLoad` still calls `addMemoryInfo` and emits `LoadAddressU32` / `ReadConstBuffer` for each component before the writes are dropped (`ScalarBufferInstructions.cpp:37-50`). So a NULL-destination raw load still registers a scalar-address resource and still issues a host read unless later passes remove it. If the guest address is invalid, this differs from a prefetch. The debt entry already records the faulting question, so this is a note, not a request. ## Not verified - The hardware semantics of SMEM with SDATA = NULL: there is no RDNA hardware, ISA document or LLVM source here. - No GPU run for this head: the GPU CI comments are for `f655009` and `8138127`, and the checklist says `GPUs tested: none`. Lavapipe only. - I ran `shader_special_registers` and `agc_driver_image_gather_volume` myself. The other results come from the script. ## To get this to a good state 1. Name the source for NULL as an SMEM destination (ISA section and sentence, or an LLVM file at a commit URL) in the description, and preferably in the debt entry too. 2. Optionally, reword the debt entry so it starts with the gap. <!-- anyps5-bots job=3709 head=77d3ddaf66d684be0d9e116723ce6523243aab16 -->
MarcZX10 commented 2026-11-21 05:21:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T05:21:51Z.

Review: APPROVED


Reviewed — looks good

The change preserves Null for scalar memory load destinations and adds focused decoder and translation coverage; no blocking defect was found in the reviewed code.

What I ran

Reviewed head eb6aec786d87356494b827b9e37111eb50d830cd using the pinned repo_read.py reader. No build or test commands were run; the test results in the PR description are author-reported.

Results

Check Result Note
Diff and changed files passed Four changed files read
Targeted caller context passed Scalar load write path inspected
Build and tests not run Results below are author-reported
Console behavior not run Hardware effects remain unmeasured

Findings

Blocking

None.

Non-blocking

None.

Not verified

No commands were run. The reported Linux build, test suite, differential test, and conventions check were not independently verified. Console cache effects and invalid-address faulting were not measured. files.json was unavailable through the reader; the manifest lists four changed files, all included and read. No changed files were excluded according to the supplied manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6003078220 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15488#pullrequestreview-6003078220). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T05:21:51Z. **Review:** APPROVED --- # Reviewed — looks good The change preserves `Null` for scalar memory load destinations and adds focused decoder and translation coverage; no blocking defect was found in the reviewed code. ## What I ran Reviewed head `eb6aec786d87356494b827b9e37111eb50d830cd` using the pinned `repo_read.py` reader. No build or test commands were run; the test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Diff and changed files | passed | Four changed files read | | Targeted caller context | passed | Scalar load write path inspected | | Build and tests | not run | Results below are author-reported | | Console behavior | not run | Hardware effects remain unmeasured | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified No commands were run. The reported Linux build, test suite, differential test, and conventions check were not independently verified. Console cache effects and invalid-address faulting were not measured. `files.json` was unavailable through the reader; the manifest lists four changed files, all included and read. No changed files were excluded according to the supplied manifest. ## To get this to a good state Nothing is required.
Plyxen commented 2026-12-03 10:36:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T10:36:01Z.

Review: APPROVED


I read the diff at c524383b52. Windows 11 with GCC 15.2 and Linux (Ubuntu 24.04 in WSL2, GCC 13.3), merged into main at b97867d3ce6 together with other open PRs (so not an isolated build).

  • shader_special_registers: pass on both.
  • Control (same tree and tests, the changed files of those PRs put back to main's): fails on both with "TranslationContext::scalarDestinationOperand invalid scalar-memory destination".

Not checked: a title.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6168068077 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15488#pullrequestreview-6168068077). Originally posted by [Plyxen](https://github.com/Plyxen) on 2026-12-03T10:36:01Z. **Review:** APPROVED --- I read the diff at `c524383b52`. Windows 11 with GCC 15.2 and Linux (Ubuntu 24.04 in WSL2, GCC 13.3), merged into `main` at `b97867d3ce6` together with other open PRs (so not an isolated build). - `shader_special_registers`: pass on both. - Control (same tree and tests, the changed files of those PRs put back to `main`'s): fails on both with "TranslationContext::scalarDestinationOperand invalid scalar-memory destination". Not checked: a title. AI-assisted: yes (Claude Code)
ligmaSec commented 2026-12-03 22:41:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:41:06Z.

Review: COMMENTED


The trial merge onto c1601e56d5 was clean. The translator fixture checks that the Null destination does not write SGPR, VCC, EXEC, or M0 state and retains a real-SGPR control. Please keep the cache and invalid-address semantics recorded as unmeasured, since the IR register-state test cannot settle what the console’s memory path does. Move the direct shader debt edit into a fragment. Paired controls are pending.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6179886824 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15488#pullrequestreview-6179886824). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T22:41:06Z. **Review:** COMMENTED --- The trial merge onto `c1601e56d5` was clean. The translator fixture checks that the Null destination does not write SGPR, VCC, EXEC, or M0 state and retains a real-SGPR control. Please keep the cache and invalid-address semantics recorded as unmeasured, since the IR register-state test cannot settle what the console’s memory path does. Move the direct shader debt edit into a fragment. Paired controls are pending. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/15488:upstream-pr/15488'
git switch 'upstream-pr/15488'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/15488'
git switch 'upstream-pr/15488'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/15488'
git switch 'upstream-pr/15488'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/15488'
git switch 'main'
git merge --squash 'upstream-pr/15488'
git switch 'main'
git merge --ff-only 'upstream-pr/15488'
git switch 'main'
git merge 'upstream-pr/15488'
git push origin 'main'
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!15488
No description provided.