feat(recompiler): support waterfall select conditions and key bounds in pointer image tables #7388

Merged
pushkarreddyy merged 3 commits from upstream-pr/7388 into main 2026-10-19 20:04:10 +00:00
pushkarreddyy commented 2026-10-18 04:11:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-18T04:11:32Z.


What

This pull request addresses shader recompiler evaluation, tape compilation, and image table key bounds for pointer-based SRT image tables indexing dynamic waterfall keys:

  1. Value Bound Tracking (ResourceTracker.cpp): Propagate 32-bit bit bounds through IrOpcode::ReadFirstLane and IrOpcode::SelectU32 in possibleU32Bits so scalarized bit indices retain bounded domains without falling back to unbounded domains (0xffffffff).
  2. Runtime Uniform Operations (SrtInstructionPredicates.cpp): Register bit-scanning and bit-counting operations (BitCount32, FindILsb32, FindUMsb32) as runtime-uniform operations under IsRuntimeUniformOp.
  3. Active Mask Implication (SrtRuntimeValidator.cpp, SrtTape.cpp): Add ActiveMaskImplies helper to check conjunction masks (LogicalAnd expressions) for IsRuntimeSelect validation and tape compilation. When _activeMask implies the selection condition, the active lane branch is compiled and evaluated directly without compiling or demanding wave-wide uniformity on the inactive branch.
  4. Header Placement (SrtInstructionPredicates.hpp): Place standard library headers (<concepts>, <type_traits>) at file scope at the top of the header.
  5. Unit Tests (ShaderMemory.cpp): Add verifyWaterfallImageTable unit test exercising descriptor planning, validator acceptance of conjunct selects, and SrtTape compilation and execution of active select arms.
  6. Technical Debt (docs/dev/debt/shader.md): Preserve existing pointer image table debt entry and document ReadFirstLane/SelectU32 bound propagation and active mask implication semantics.

Tested

  • python tools/check_conventions.py --base 4ffb0cd12 passes with 0 findings and 0 errors.
  • Unit test verifyWaterfallImageTable() passes in both --bindless and full test suites under core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp.

Checklist

  • Code follows the style guidelines of this project
  • Commits are signed and use Conventional Commits
  • Tests added for new functionality
  • Documentation updated in docs/dev/
  • Depends on: none
  • Unblocks: none
  • GPUs tested: AGC, shader recompiler
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4906278596 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-18T04:11:32Z. --- ### What This pull request addresses shader recompiler evaluation, tape compilation, and image table key bounds for pointer-based SRT image tables indexing dynamic waterfall keys: 1. **Value Bound Tracking (`ResourceTracker.cpp`)**: Propagate 32-bit bit bounds through `IrOpcode::ReadFirstLane` and `IrOpcode::SelectU32` in `possibleU32Bits` so scalarized bit indices retain bounded domains without falling back to unbounded domains (`0xffffffff`). 2. **Runtime Uniform Operations (`SrtInstructionPredicates.cpp`)**: Register bit-scanning and bit-counting operations (`BitCount32`, `FindILsb32`, `FindUMsb32`) as runtime-uniform operations under `IsRuntimeUniformOp`. 3. **Active Mask Implication (`SrtRuntimeValidator.cpp`, `SrtTape.cpp`)**: Add `ActiveMaskImplies` helper to check conjunction masks (`LogicalAnd` expressions) for `IsRuntimeSelect` validation and tape compilation. When `_activeMask` implies the selection condition, the active lane branch is compiled and evaluated directly without compiling or demanding wave-wide uniformity on the inactive branch. 4. **Header Placement (`SrtInstructionPredicates.hpp`)**: Place standard library headers (`<concepts>`, `<type_traits>`) at file scope at the top of the header. 5. **Unit Tests (`ShaderMemory.cpp`)**: Add `verifyWaterfallImageTable` unit test exercising descriptor planning, validator acceptance of conjunct selects, and `SrtTape` compilation and execution of active select arms. 6. **Technical Debt (`docs/dev/debt/shader.md`)**: Preserve existing pointer image table debt entry and document `ReadFirstLane`/`SelectU32` bound propagation and active mask implication semantics. ### Tested - `python tools/check_conventions.py --base 4ffb0cd12` passes with 0 findings and 0 errors. - Unit test `verifyWaterfallImageTable()` passes in both `--bindless` and full test suites under `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp`. ### Checklist - [x] Code follows the style guidelines of this project - [x] Commits are signed and use Conventional Commits - [x] Tests added for new functionality - [x] Documentation updated in docs/dev/ - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: AGC, shader recompiler - [x] AI-assisted: yes
oneandonlydean commented 2026-10-18 04:18:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T04:18:06Z.


Thanks. The three pieces look sound on their own. One consistency issue, and a test question:

  1. ActiveMaskImplies widens the active-arm rule only in RuntimeValidator. The CPU walk applies the same rule with exact equality in SrtEvaluator::MayEvaluate (takesActiveArm, SrtEvaluator.cpp:370) and BasicEvaluator::Evaluate (:87). So a select on one conjunct of the mask is approved at planning but still evaluated in full, inactive arm included, at draw time. Could you apply the same implication in those two places (one shared helper), and in #6095's SrtTape (SrtTape.cpp:107) if that lands first?
  2. BitCount32/FindILsb32/FindUMsb32/FindSMsb32 are now runtime-uniform, but SrtEvaluator can't evaluate them on the CPU. Is a GPU-side key the only use you need? If the CPU walk must evaluate them, they need evaluator cases.
  3. verifyWaterfallImageTable's program has no select, loop or bit-count op, and it expects MaxKeys. Could you add cases that fail on main for each change: a select on a conjunct of the v_readfirstlane mask; a negative case, a select on a condition the mask doesn't imply, still refused; a key bounded through SelectU32/ReadFirstLane with a keys count below MaxKeys? And which import in PPSA01748 (#7362) hits this, with the instruction offsets?
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6245574610 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6245574610). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-18T04:18:06Z. --- Thanks. The three pieces look sound on their own. One consistency issue, and a test question: 1. `ActiveMaskImplies` widens the active-arm rule only in `RuntimeValidator`. The CPU walk applies the same rule with exact equality in `SrtEvaluator::MayEvaluate` (`takesActiveArm`, SrtEvaluator.cpp:370) and `BasicEvaluator::Evaluate` (:87). So a select on one conjunct of the mask is approved at planning but still evaluated in full, inactive arm included, at draw time. Could you apply the same implication in those two places (one shared helper), and in #6095's `SrtTape` (SrtTape.cpp:107) if that lands first? 2. `BitCount32`/`FindILsb32`/`FindUMsb32`/`FindSMsb32` are now runtime-uniform, but `SrtEvaluator` can't evaluate them on the CPU. Is a GPU-side key the only use you need? If the CPU walk must evaluate them, they need evaluator cases. 3. `verifyWaterfallImageTable`'s program has no select, loop or bit-count op, and it expects `MaxKeys`. Could you add cases that fail on `main` for each change: a select on a conjunct of the `v_readfirstlane` mask; a negative case, a select on a condition the mask doesn't imply, still refused; a key bounded through `SelectU32`/`ReadFirstLane` with a `keys` count below `MaxKeys`? And which import in PPSA01748 (#7362) hits this, with the instruction offsets?
github-actions[bot] commented 2026-10-18 04:23:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T04:23:51Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6488 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L3449
PR 7684 docs/dev/debt/shader.md L40-41

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/dev/debt/shader.md
PR 5371 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/shader.md
PR 5426 docs/dev/debt/shader.md
PR 5500 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/shader.md
PR 5609 core/shader/recompiler/Optimization/src/SrtWalker/SrtEvaluator.cpp
PR 5941 docs/dev/debt/shader.md
PR 6009 docs/dev/debt/shader.md
PR 6177 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/shader.md
PR 6280 core/shader/recompiler/Optimization/src/ResourceTracker.cpp
docs/dev/debt/shader.md
PR 6290 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6412 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/shader.md
PR 6539 core/shader/recompiler/Optimization/src/SrtWalker/SrtEvaluator.cpp
PR 6604 docs/dev/debt/shader.md
PR 6645 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6683 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6924 docs/dev/debt/shader.md
PR 6947 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6977 docs/dev/debt/shader.md
PR 7223 core/shader/recompiler/Optimization/src/ResourceTracker.cpp
docs/dev/debt/shader.md
PR 7332 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/shader.md
PR 7392 docs/dev/debt/shader.md
PR 7395 core/shader/recompiler/Optimization/src/ResourceTracker.cpp
docs/dev/debt/shader.md
PR 7484 docs/dev/debt/shader.md
PR 7550 core/shader/recompiler/Optimization/src/ResourceTracker.cpp
PR 7642 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6245617823 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6245617823). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T04:23:51Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 6488](https://www.github.com/boykopovar/AnyPS5/pull/6488) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` [L3449](https://github.com/boykopovar/AnyPS5/blob/8075b6af190ff8f83c1bff9a7f74cd71e5902140/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L3449) | | | | [PR 7684](https://www.github.com/boykopovar/AnyPS5/pull/7684) | `docs/dev/debt/shader.md` [L40-41](https://github.com/boykopovar/AnyPS5/blob/8075b6af190ff8f83c1bff9a7f74cd71e5902140/docs/dev/debt/shader.md#L40-L41) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `docs/dev/debt/shader.md` | | [PR 5371](https://www.github.com/boykopovar/AnyPS5/pull/5371) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp`<br>`docs/dev/debt/shader.md` | | [PR 5426](https://www.github.com/boykopovar/AnyPS5/pull/5426) | `docs/dev/debt/shader.md` | | [PR 5500](https://www.github.com/boykopovar/AnyPS5/pull/5500) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp`<br>`docs/dev/debt/shader.md` | | [PR 5609](https://www.github.com/boykopovar/AnyPS5/pull/5609) | `core/shader/recompiler/Optimization/src/SrtWalker/SrtEvaluator.cpp` | | [PR 5941](https://www.github.com/boykopovar/AnyPS5/pull/5941) | `docs/dev/debt/shader.md` | | [PR 6009](https://www.github.com/boykopovar/AnyPS5/pull/6009) | `docs/dev/debt/shader.md` | | [PR 6177](https://www.github.com/boykopovar/AnyPS5/pull/6177) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp`<br>`docs/dev/debt/shader.md` | | [PR 6280](https://www.github.com/boykopovar/AnyPS5/pull/6280) | `core/shader/recompiler/Optimization/src/ResourceTracker.cpp`<br>`docs/dev/debt/shader.md` | | [PR 6290](https://www.github.com/boykopovar/AnyPS5/pull/6290) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6412](https://www.github.com/boykopovar/AnyPS5/pull/6412) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp`<br>`docs/dev/debt/shader.md` | | [PR 6539](https://www.github.com/boykopovar/AnyPS5/pull/6539) | `core/shader/recompiler/Optimization/src/SrtWalker/SrtEvaluator.cpp` | | [PR 6604](https://www.github.com/boykopovar/AnyPS5/pull/6604) | `docs/dev/debt/shader.md` | | [PR 6645](https://www.github.com/boykopovar/AnyPS5/pull/6645) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6683](https://www.github.com/boykopovar/AnyPS5/pull/6683) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6924](https://www.github.com/boykopovar/AnyPS5/pull/6924) | `docs/dev/debt/shader.md` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `docs/dev/debt/shader.md` | | [PR 7223](https://www.github.com/boykopovar/AnyPS5/pull/7223) | `core/shader/recompiler/Optimization/src/ResourceTracker.cpp`<br>`docs/dev/debt/shader.md` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp`<br>`docs/dev/debt/shader.md` | | [PR 7392](https://www.github.com/boykopovar/AnyPS5/pull/7392) | `docs/dev/debt/shader.md` | | [PR 7395](https://www.github.com/boykopovar/AnyPS5/pull/7395) | `core/shader/recompiler/Optimization/src/ResourceTracker.cpp`<br>`docs/dev/debt/shader.md` | | [PR 7484](https://www.github.com/boykopovar/AnyPS5/pull/7484) | `docs/dev/debt/shader.md` | | [PR 7550](https://www.github.com/boykopovar/AnyPS5/pull/7550) | `core/shader/recompiler/Optimization/src/ResourceTracker.cpp` | | [PR 7642](https://www.github.com/boykopovar/AnyPS5/pull/7642) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp`<br>`core/shader/recompiler/Optimization/src/ResourceTracker.cpp` |
oneandonlydean commented 2026-10-18 04:40:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T04:40:04Z.


One more thing: this head doesn't compile. SrtInstructionPredicates.cpp:91 uses IrOpcode::FindSMsb32, which isn't an opcode on this branch or on main (GCC: "did you mean 'FindUMsb32'?"). Also, with the three production files reverted to main, verifyWaterfallImageTable still passes, so it doesn't cover the change yet. Could you fix the build and add cases that fail on main?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6245737616 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6245737616). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-18T04:40:04Z. --- One more thing: this head doesn't compile. `SrtInstructionPredicates.cpp:91` uses `IrOpcode::FindSMsb32`, which isn't an opcode on this branch or on `main` (GCC: "did you mean 'FindUMsb32'?"). Also, with the three production files reverted to `main`, `verifyWaterfallImageTable` still passes, so it doesn't cover the change yet. Could you fix the build and add cases that fail on `main`?
pushkarreddyy commented 2026-10-18 04:50:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-18T04:50:16Z.


Updated:

  1. Evaluator & Validator consistency: Extracted ActiveMaskImplies as a shared helper in SrtInstructionPredicates.hpp / .cpp and applied it across SrtRuntimeValidator, SrtEvaluator::MayEvaluate (takesActiveArm), and BasicEvaluator::EvaluateWide.
  2. CPU evaluation of uniform bitops: Added CPU evaluation cases for BitCount32 (std::popcount), FindILsb32 (std::countr_zero), and FindUMsb32 (31u - std::countl_zero, with 0 returning 0xffffffffu per GLSLstd450). Dropped FindSMsb32 from IsRuntimeUniformOp as it does not exist in IrOpcode.
  3. Unit tests added:
    • In verifyMayEvaluate:
      • Positive conjunct select case (firstActiveConjunct): ReadFirstLane of SelectU32 whose condition is implied by a LogicalAnd active mask; verified to pass MayEvaluate, evaluator.Evaluate (evaluating only the active arm), and ValidateRuntimeValue.
      • Negative not-implied select case (firstNotImplied): condition not implied by the mask; verified to be refused by MayEvaluate, evaluator.Evaluate, and ValidateRuntimeValue.
      • Direct evaluator verification for BitCount32, FindILsb32, and FindUMsb32.
    • In verifyWaterfallImageTable:
      • Added a bounded-key waterfall test case where the key is bounded through v_cndmask_b32 (SelectU32) and v_readfirstlane_b32 (ReadFirstLane), verifying boundedColumn.maxKey == 6u and boundedSnapshot.keys == 7u < Abi::MaxKeys.
  4. Issue #7362 details:
    • Title: Marvel's Guardians of the Galaxy (PPSA01748 v01.006.000).
    • Recompile is triggered on command buffer submission (sceAgcDriverSubmitDcb / sceAgcDriverSubmitAcb) for the compute dispatch recorded via sceAgcCbDispatch.
    • In compute shader 0x3b91c3e00 stage 0, the SRT pointer table loads hit at pc=0x00004378 and pc=0x00004380 (LoadAddressU32).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6245813978 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6245813978). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-18T04:50:16Z. --- Updated: 1. **Evaluator & Validator consistency**: Extracted `ActiveMaskImplies` as a shared helper in `SrtInstructionPredicates.hpp` / `.cpp` and applied it across `SrtRuntimeValidator`, `SrtEvaluator::MayEvaluate` (`takesActiveArm`), and `BasicEvaluator::EvaluateWide`. 2. **CPU evaluation of uniform bitops**: Added CPU evaluation cases for `BitCount32` (`std::popcount`), `FindILsb32` (`std::countr_zero`), and `FindUMsb32` (`31u - std::countl_zero`, with 0 returning `0xffffffffu` per GLSLstd450). Dropped `FindSMsb32` from `IsRuntimeUniformOp` as it does not exist in `IrOpcode`. 3. **Unit tests added**: - In `verifyMayEvaluate`: - Positive conjunct select case (`firstActiveConjunct`): `ReadFirstLane` of `SelectU32` whose condition is implied by a `LogicalAnd` active mask; verified to pass `MayEvaluate`, `evaluator.Evaluate` (evaluating only the active arm), and `ValidateRuntimeValue`. - Negative not-implied select case (`firstNotImplied`): condition not implied by the mask; verified to be refused by `MayEvaluate`, `evaluator.Evaluate`, and `ValidateRuntimeValue`. - Direct evaluator verification for `BitCount32`, `FindILsb32`, and `FindUMsb32`. - In `verifyWaterfallImageTable`: - Added a bounded-key waterfall test case where the key is bounded through `v_cndmask_b32` (`SelectU32`) and `v_readfirstlane_b32` (`ReadFirstLane`), verifying `boundedColumn.maxKey == 6u` and `boundedSnapshot.keys == 7u < Abi::MaxKeys`. 4. **Issue #7362 details**: - Title: *Marvel's Guardians of the Galaxy* (`PPSA01748` v01.006.000). - Recompile is triggered on command buffer submission (`sceAgcDriverSubmitDcb` / `sceAgcDriverSubmitAcb`) for the compute dispatch recorded via `sceAgcCbDispatch`. - In compute shader `0x3b91c3e00` stage 0, the SRT pointer table loads hit at `pc=0x00004378` and `pc=0x00004380` (`LoadAddressU32`).
pushkarreddyy commented 2026-10-18 04:59:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-18T04:59:01Z.


Fixed in the latest update:

  1. Build fix: Removed the non-existent FindSMsb32 from IsRuntimeUniformOp (only BitCount32, FindILsb32, and FindUMsb32 are in IrOpcode).
  2. Cases failing on main directly inside verifyWaterfallImageTable:
    • Added a bounded waterfall test case where the key is selected through v_cndmask_b32 and scalarized via v_readfirstlane_b32: asserts boundedColumn.maxKey == 6u and boundedSnapshot.keys == 7u < Abi::MaxKeys. On main, possibleU32Bits hits default max for SelectU32/ReadFirstLane, producing maxKey = 0xffffffffu and snapshot.keys == MaxKeys, which fails.
    • Added validator checks directly in verifyWaterfallImageTable verifying that a select on a conjunct of the active mask (firstConj) is accepted, while a condition not implied by the mask (firstOther) is refused.
    • In verifyMayEvaluate, added firstActiveConjunct and firstNotImplied verifying both planning and runtime evaluation, plus direct CPU evaluations for BitCount32, FindILsb32, and FindUMsb32.

Also, whenever you have a moment, could you please take a look at our other open PRs:

  • #7372: fix(json2): return parse error on null text or zero size (updated per your and MarcZX100's reviews)
  • #7175: feat(libSceAgcDriver): support polygon primitive type 21
  • #7089: fix(libSceAgcDriver): normalize reserved bit 30 in guest buffer descriptors
  • #6370: feat(libSceSysmodule): register libSceProprietaryVoiceChatHelperPrx module id 0x132
  • #6342: feat(libSceVoice): implement sceVoiceEnableChat and sceVoiceDisableChat
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6245879100 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6245879100). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-18T04:59:01Z. --- Fixed in the latest update: 1. **Build fix**: Removed the non-existent `FindSMsb32` from `IsRuntimeUniformOp` (only `BitCount32`, `FindILsb32`, and `FindUMsb32` are in `IrOpcode`). 2. **Cases failing on `main` directly inside `verifyWaterfallImageTable`**: - Added a bounded waterfall test case where the key is selected through `v_cndmask_b32` and scalarized via `v_readfirstlane_b32`: asserts `boundedColumn.maxKey == 6u` and `boundedSnapshot.keys == 7u < Abi::MaxKeys`. On `main`, `possibleU32Bits` hits default `max` for `SelectU32`/`ReadFirstLane`, producing `maxKey = 0xffffffffu` and `snapshot.keys == MaxKeys`, which fails. - Added validator checks directly in `verifyWaterfallImageTable` verifying that a select on a conjunct of the active mask (`firstConj`) is accepted, while a condition not implied by the mask (`firstOther`) is refused. - In `verifyMayEvaluate`, added `firstActiveConjunct` and `firstNotImplied` verifying both planning and runtime evaluation, plus direct CPU evaluations for `BitCount32`, `FindILsb32`, and `FindUMsb32`. Also, whenever you have a moment, could you please take a look at our other open PRs: - #7372: `fix(json2): return parse error on null text or zero size` (updated per your and MarcZX100's reviews) - #7175: `feat(libSceAgcDriver): support polygon primitive type 21` - #7089: `fix(libSceAgcDriver): normalize reserved bit 30 in guest buffer descriptors` - #6370: `feat(libSceSysmodule): register libSceProprietaryVoiceChatHelperPrx module id 0x132` - #6342: `feat(libSceVoice): implement sceVoiceEnableChat and sceVoiceDisableChat`
Dextroid17 commented 2026-10-18 14:23:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-18T14:23:37Z.


Built 1a62a3f92 on Linux (GCC 16.2.1, Release), alone and merged onto main a62c724c3. Both fail with the same two errors:

SrtInstructionPredicates.hpp:18:35: error: request for member 'Value' in 'mask', which is of pointer type 'ShaderRecompiler::IrValue* const'
SrtInstructionPredicates.hpp:18:54: error: request for member 'Value' in 'condition', which is of pointer type 'ShaderRecompiler::IrValue* const'
  required from 'ActiveMaskImplies(const TNode&, const TNode&) [with TNode = IrNode]'
  required from SrtEvaluator.cpp:87  (template class BasicEvaluator<IrNode>, :810)

mask.Value() is a non-const IrValue*, so ActiveMaskImplies(const TNode&, const TNode&) with TNode = IrValue* (identity conversion) is a better match than ActiveMaskImplies(const IrValue*, const IrValue*) (qualification conversion), and the template is instantiated again on the pointer. By reading, SrtRuntimeValidator.cpp:57 picks the same overload directly with _activeMask (the build stops before that file). The PR's linux, windows and relinker jobs were skipped, so CI has not built this head.

Adding a non-const pointer overload in SrtInstructionPredicates.hpp builds with no errors or warnings:

inline bool ActiveMaskImplies(IrValue* mask, IrValue* condition) {
    return ActiveMaskImplies(static_cast<const IrValue*>(mask), static_cast<const IrValue*>(condition));
}

With that change, the agc_shader_memory ctest entry, and a direct run with no shader cache directory, both stop at the new bounded case, in the planning check after GetResourcePlan:

waterfall image table: bounded key was not planned as a table

The unbounded checks before it pass. That differs from your note that the bounded case fails on main and passes with this PR. main a62c724c3, whose test file has no bounded case, passes the same test binary. The overload is my guess at the intent, so the planner result may differ with your version of the fix.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6251032265 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6251032265). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-18T14:23:37Z. --- Built `1a62a3f92` on Linux (GCC 16.2.1, Release), alone and merged onto `main` `a62c724c3`. Both fail with the same two errors: ``` SrtInstructionPredicates.hpp:18:35: error: request for member 'Value' in 'mask', which is of pointer type 'ShaderRecompiler::IrValue* const' SrtInstructionPredicates.hpp:18:54: error: request for member 'Value' in 'condition', which is of pointer type 'ShaderRecompiler::IrValue* const' required from 'ActiveMaskImplies(const TNode&, const TNode&) [with TNode = IrNode]' required from SrtEvaluator.cpp:87 (template class BasicEvaluator<IrNode>, :810) ``` `mask.Value()` is a non-const `IrValue*`, so `ActiveMaskImplies(const TNode&, const TNode&)` with `TNode = IrValue*` (identity conversion) is a better match than `ActiveMaskImplies(const IrValue*, const IrValue*)` (qualification conversion), and the template is instantiated again on the pointer. By reading, `SrtRuntimeValidator.cpp:57` picks the same overload directly with `_activeMask` (the build stops before that file). The PR's linux, windows and relinker jobs were skipped, so CI has not built this head. Adding a non-const pointer overload in `SrtInstructionPredicates.hpp` builds with no errors or warnings: ```cpp inline bool ActiveMaskImplies(IrValue* mask, IrValue* condition) { return ActiveMaskImplies(static_cast<const IrValue*>(mask), static_cast<const IrValue*>(condition)); } ``` With that change, the `agc_shader_memory` ctest entry, and a direct run with no shader cache directory, both stop at the new bounded case, in the planning check after `GetResourcePlan`: ``` waterfall image table: bounded key was not planned as a table ``` The unbounded checks before it pass. That differs from your note that the bounded case fails on `main` and passes with this PR. `main` `a62c724c3`, whose test file has no bounded case, passes the same test binary. The overload is my guess at the intent, so the planner result may differ with your version of the fix. AI-assisted: yes
pushkarreddyy commented 2026-10-18 15:52:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-18T15:52:05Z.


Pushed commit 59c0f664b addressing both points:

  1. GCC 16.2.1 Template Deduction:

    • mask.Value() returns IrValue*. In GCC 16.2.1, passing (IrValue*, IrValue*) matched the unconstrained template ActiveMaskImplies(const TNode&, const TNode&) (TNode = IrValue*, exact reference bind without qualification conversion) rather than the (const IrValue*, const IrValue*) pointer overload, attempting (IrValue*).Value().
    • Added requires (!std::is_pointer_v<std::decay_t<TNode>>) to the template alongside explicit pointer overloads ((IrValue*, IrValue*), (const IrValue*, IrValue*), (IrValue*, const IrValue*)) forwarding to const IrValue*.
  2. verifyWaterfallImageTable() Dynamic Lane Dependency:

    • In verifyWaterfallImageTable(), v_cndmask_b32 v0, 2, v1, vcc previously executed with uninitialized vcc. In SSA, uninitialized booleans default to false, enabling ConstantFolder::foldSelect to fold Select(false, 4, 2) directly to constant 2. The SMEM offset subsequently collapsed into an immediate scalar constant 0x80, causing TryMakeTableColumn to bypass table allocation (plan->info.images[0].table == 0u).
    • Inserting 0x7d8a0080u (v_cmp_ne_u32 vcc, 0, v0) prior to v_cndmask_b32 binds vcc dynamically to lane input v0, preventing constant folding and preserving the SelectU32 node into possibleU32Bits (maxKey == 6u, keys == 7u) as expected.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6251924339 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6251924339). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-18T15:52:05Z. --- Pushed commit `59c0f664b` addressing both points: 1. **GCC 16.2.1 Template Deduction**: - `mask.Value()` returns `IrValue*`. In GCC 16.2.1, passing `(IrValue*, IrValue*)` matched the unconstrained template `ActiveMaskImplies(const TNode&, const TNode&)` (`TNode = IrValue*`, exact reference bind without qualification conversion) rather than the `(const IrValue*, const IrValue*)` pointer overload, attempting `(IrValue*).Value()`. - Added `requires (!std::is_pointer_v<std::decay_t<TNode>>)` to the template alongside explicit pointer overloads (`(IrValue*, IrValue*)`, `(const IrValue*, IrValue*)`, `(IrValue*, const IrValue*)`) forwarding to `const IrValue*`. 2. **`verifyWaterfallImageTable()` Dynamic Lane Dependency**: - In `verifyWaterfallImageTable()`, `v_cndmask_b32 v0, 2, v1, vcc` previously executed with uninitialized `vcc`. In SSA, uninitialized booleans default to `false`, enabling `ConstantFolder::foldSelect` to fold `Select(false, 4, 2)` directly to constant `2`. The SMEM offset subsequently collapsed into an immediate scalar constant `0x80`, causing `TryMakeTableColumn` to bypass table allocation (`plan->info.images[0].table == 0u`). - Inserting `0x7d8a0080u` (`v_cmp_ne_u32 vcc, 0, v0`) prior to `v_cndmask_b32` binds `vcc` dynamically to lane input `v0`, preventing constant folding and preserving the `SelectU32` node into `possibleU32Bits` (`maxKey == 6u`, `keys == 7u`) as expected.
Tamalero commented 2026-10-18 22:11:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-18T22:11:55Z.


@pushkarreddyy I ran this on Marvel's Guardians of the Galaxy (PPSA01748), the title in #7362. The title still stops at the same shader.

  • Build: main 0bc3003f8 + #6606 + this PR's head 59c0f664b. Both commits conflicted only in tests/ShaderMemory.cpp (next to verifyPointerChainImageTable) and docs/dev/debt/shader.md; I kept both sides. agc_shader_bindless, which runs your verifyWaterfallImageTable, passes. #6270 was reverted locally, because it stops this title at boot (#7678).
  • Result, 1 run: 3.8 min in, compute 0x3b91c3e00 is refused at pc=0x4378 (1×) and pc=0x4380 (4×), with the same GetImageResource dword 0 chain as in #7362: LoadAddressU32(GetAddressResource(ReadConst(GetSrtResource), ReadConst(GetSrtResource)), ShiftLeftLogical32(ReadFirstLane(SelectU32(…FindILsb32(…CompositeExtractU32x4(ImageRead, …)…)…), …))).
  • So the bounded ReadFirstLane(SelectU32(...)) planning doesn't take this chain yet. One difference from your test shape may be the FindILsb32 over an ImageRead-derived mask in the selected arm, plus the second arm through BitCastU32F32(FPMax32(…)).
  • Side note for #7362: current main no longer needs #6232 to reach this stop.

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6255784839 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6255784839). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-18T22:11:55Z. --- @pushkarreddyy I ran this on Marvel's Guardians of the Galaxy (PPSA01748), the title in #7362. The title still stops at the same shader. - Build: `main` `0bc3003f8` + #6606 + this PR's head `59c0f664b`. Both commits conflicted only in `tests/ShaderMemory.cpp` (next to `verifyPointerChainImageTable`) and `docs/dev/debt/shader.md`; I kept both sides. `agc_shader_bindless`, which runs your `verifyWaterfallImageTable`, passes. #6270 was reverted locally, because it stops this title at boot (#7678). - Result, 1 run: 3.8 min in, compute `0x3b91c3e00` is refused at `pc=0x4378` (1×) and `pc=0x4380` (4×), with the same `GetImageResource dword 0` chain as in #7362: `LoadAddressU32(GetAddressResource(ReadConst(GetSrtResource), ReadConst(GetSrtResource)), ShiftLeftLogical32(ReadFirstLane(SelectU32(…FindILsb32(…CompositeExtractU32x4(ImageRead, …)…)…), …)))`. - So the bounded `ReadFirstLane(SelectU32(...))` planning doesn't take this chain yet. One difference from your test shape may be the `FindILsb32` over an `ImageRead`-derived mask in the selected arm, plus the second arm through `BitCastU32F32(FPMax32(…))`. - Side note for #7362: current `main` no longer needs #6232 to reach this stop. *Tested and written by Claude (AI assistant) on a contributor's machine.*
pushkarreddyy commented 2026-10-19 05:46:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-19T05:46:17Z.


@Tamalero Thanks for testing on Marvel's Guardians of the Galaxy (PPSA01748) and sharing the exact AST trace!

  1. Rebase: Cleanly rebased the branch onto latest origin/main (4ffb0cd12) alongside merged #6606, resolving the ShaderMemory.cpp and docs/dev/debt/shader.md conflicts and keeping both test sets active. Pre-flight conventions pass with 0 findings.
  2. Chain Analysis (0x3b91c3e00):
    • In 0x3b91c3e00, the key arm uses FindILsb32 over an ImageRead-derived mask (CompositeExtractU32x4), paired with BitCastU32F32(FPMax32(...)) on the alternate arm.
    • Because ImageRead outputs are not evaluable compile-time SRT constants or known-bounded uniforms, possibleU32Bits currently treats the ImageRead extraction as unbounded (0xffffffffu), which cascades through FindILsb32 and keeps the key domain wide rather than bounded.
    • We will handle propagating bounds for bit-search operators over masked image descriptors in a focused follow-up, keeping this PR strictly scoped to bounded SelectU32 / ReadFirstLane conditions and SRT validator conjunctions.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6260582131 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6260582131). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-19T05:46:17Z. --- @Tamalero Thanks for testing on Marvel's Guardians of the Galaxy (`PPSA01748`) and sharing the exact AST trace! 1. **Rebase**: Cleanly rebased the branch onto latest `origin/main` (`4ffb0cd12`) alongside merged #6606, resolving the `ShaderMemory.cpp` and `docs/dev/debt/shader.md` conflicts and keeping both test sets active. Pre-flight conventions pass with 0 findings. 2. **Chain Analysis (`0x3b91c3e00`)**: - In `0x3b91c3e00`, the key arm uses `FindILsb32` over an `ImageRead`-derived mask (`CompositeExtractU32x4`), paired with `BitCastU32F32(FPMax32(...))` on the alternate arm. - Because `ImageRead` outputs are not evaluable compile-time SRT constants or known-bounded uniforms, `possibleU32Bits` currently treats the `ImageRead` extraction as unbounded (`0xffffffffu`), which cascades through `FindILsb32` and keeps the key domain wide rather than bounded. - We will handle propagating bounds for bit-search operators over masked image descriptors in a focused follow-up, keeping this PR strictly scoped to bounded `SelectU32` / `ReadFirstLane` conditions and SRT validator conjunctions.
xXPBSXx commented 2026-10-19 08:13:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-19T08:13:38Z.


Windows data point for bfd5b6e38 merged onto main fb0dc118f (together with #7567 in one tree, a8bdd9935): Windows 10 (10.0.19045), WinLibs GCC 15.2.0, Release, ctest -R '^agc_shader_bindless$' (the ctest entry that runs verifyWaterfallImageTable). It is a CPU-side ctest entry; I did not check whether a Vulkan device was used, so I cannot name a GPU.

  • With the PR: passes 3 of 3.
  • Same tree with the five source files this PR changes under core/shader/recompiler/Optimization/ restored to main (SrtInstructionPredicates.hpp/.cpp, ResourceTracker.cpp, SrtEvaluator.cpp, SrtRuntimeValidator.cpp; the new test kept): fails 3 of 3 (exit 8); one such run prints waterfall image table: bounded key maxKey is wrong.

So with the production files restored to main, agc_shader_bindless fails on this head, which answers the point raised on 18 Oct that the case did not yet cover the change. The head builds here (no compile error).

Not tested: the full ShaderMemory suite beyond this entry, a title run, other OS or GPUs.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6262747773 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6262747773). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-19T08:13:38Z. --- Windows data point for `bfd5b6e38` merged onto `main` `fb0dc118f` (together with #7567 in one tree, `a8bdd9935`): Windows 10 (10.0.19045), WinLibs GCC 15.2.0, Release, `ctest -R '^agc_shader_bindless$'` (the ctest entry that runs `verifyWaterfallImageTable`). It is a CPU-side ctest entry; I did not check whether a Vulkan device was used, so I cannot name a GPU. - With the PR: passes 3 of 3. - Same tree with the five source files this PR changes under `core/shader/recompiler/Optimization/` restored to `main` (`SrtInstructionPredicates.hpp/.cpp`, `ResourceTracker.cpp`, `SrtEvaluator.cpp`, `SrtRuntimeValidator.cpp`; the new test kept): fails 3 of 3 (exit 8); one such run prints `waterfall image table: bounded key maxKey is wrong`. So with the production files restored to `main`, `agc_shader_bindless` fails on this head, which answers the point raised on 18 Oct that the case did not yet cover the change. The head builds here (no compile error). Not tested: the full `ShaderMemory` suite beyond this entry, a title run, other OS or GPUs. AI-assisted (Claude Code).
Neithennn commented 2026-10-19 09:34:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Neithennn on 2026-10-19T09:34:30Z.


Windows NVIDIA run, since the description lists no GPU run.

Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), AMD Ryzen 7 5800X, WinLibs GCC 15.2.0 r7, Ninja, Release, bundled dependencies, BUILD_TESTING=ON, ANYPS5_NO_SHADER_CACHE=1. Head bfd5b6e38 merged onto main f78675ae4; full build succeeds.

  • agc_shader_bindless and agc_shader_memory (both run verifyWaterfallImageTable), agc_shader_srt_read_patching, agc_driver_bindless_images, agc_driver_image_table, agc_driver_image_table_cache, agc_driver_image_table_cache_bounds, agc_driver_image_table_reuse, agc_driver_image_table_vouched_lookups, agc_driver_image_table_vouch_queued_draws: 10/10 pass, with ANYPS5_REQUIRE_VULKAN=1.
  • Full ctest -j 8: 1627/1628, the same as unchanged main on this machine; the one failure is agc_driver_bda_device (device lost, #7584), which fails on main too and is fixed by #7571.

No title run.

AI-assisted: yes (runs done with Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6264157217 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6264157217). Originally posted by [Neithennn](https://github.com/Neithennn) on 2026-10-19T09:34:30Z. --- Windows NVIDIA run, since the description lists no GPU run. Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), AMD Ryzen 7 5800X, WinLibs GCC 15.2.0 r7, Ninja, Release, bundled dependencies, `BUILD_TESTING=ON`, `ANYPS5_NO_SHADER_CACHE=1`. Head `bfd5b6e38` merged onto main `f78675ae4`; full build succeeds. - `agc_shader_bindless` and `agc_shader_memory` (both run `verifyWaterfallImageTable`), `agc_shader_srt_read_patching`, `agc_driver_bindless_images`, `agc_driver_image_table`, `agc_driver_image_table_cache`, `agc_driver_image_table_cache_bounds`, `agc_driver_image_table_reuse`, `agc_driver_image_table_vouched_lookups`, `agc_driver_image_table_vouch_queued_draws`: 10/10 pass, with `ANYPS5_REQUIRE_VULKAN=1`. - Full `ctest -j 8`: 1627/1628, the same as unchanged main on this machine; the one failure is `agc_driver_bda_device` (device lost, #7584), which fails on main too and is fixed by #7571. No title run. AI-assisted: yes (runs done with Claude Code).
pushkarreddyy commented 2026-10-19 14:02:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-19T14:02:21Z.


@Neithennn Thank you for running the hardware verification on Windows 11 with the RTX 4080! Great to see all 10 image-table and waterfall tests passing (10/10) alongside full suite parity with main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6269068852 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6269068852). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-19T14:02:21Z. --- @Neithennn Thank you for running the hardware verification on Windows 11 with the RTX 4080! Great to see all 10 image-table and waterfall tests passing (`10/10`) alongside full suite parity with `main`.
adriadam10 commented 2026-10-19 14:20:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T14:20:53Z.

Review: CHANGES_REQUESTED


Thanks for the update. The bound propagation and the ActiveMaskImplies helper look sound; three things left:

  • SrtTape.cpp:107 still compares the select condition to the mask with == mask, so a select on one conjunct of the mask is approved by the validator and the evaluator but the tape still compiles the inactive arm. @oneandonlydean asked for it to use ActiveMaskImplies too; please apply it there and add a case that fails without it.
  • docs/dev/debt/shader.md:37 on main ("Image tables ... read by s_load through a 64-bit pointer hold the keys the key's known bits allow ...") is deleted by this PR. That line is unrelated and still true; please restore it and keep your new line next to it.
  • SrtInstructionPredicates.hpp: the #include <concepts> / <type_traits> sit after declarations inside the namespace. Move them to the top with the other includes.

Also note that @Tamalero's run shows PPSA01748 still stops at the same shader with this head, so the PR should not say it unblocks #7362 until that changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5572969400 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#pullrequestreview-5572969400). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T14:20:53Z. **Review:** CHANGES_REQUESTED --- Thanks for the update. The bound propagation and the `ActiveMaskImplies` helper look sound; three things left: - `SrtTape.cpp:107` still compares the select condition to the mask with `== mask`, so a select on one conjunct of the mask is approved by the validator and the evaluator but the tape still compiles the inactive arm. @oneandonlydean asked for it to use `ActiveMaskImplies` too; please apply it there and add a case that fails without it. - `docs/dev/debt/shader.md:37` on `main` ("Image tables ... read by `s_load` through a 64-bit pointer hold the keys the key's known bits allow ...") is deleted by this PR. That line is unrelated and still true; please restore it and keep your new line next to it. - `SrtInstructionPredicates.hpp`: the `#include <concepts>` / `<type_traits>` sit after declarations inside the namespace. Move them to the top with the other includes. Also note that @Tamalero's run shows PPSA01748 still stops at the same shader with this head, so the PR should not say it unblocks #7362 until that changes.
pushkarreddyy commented 2026-10-19 14:32:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-19T14:32:32Z.


@adriadam10 Thanks for the review! All four points have been addressed in 91abb61be:

  1. SrtTape Compilation: Updated SrtTape.cpp line 107 to use ActiveMaskImplies(mask, value->Argument(0)) rather than exact pointer equality with mask, ensuring select conditions implied by conjunction masks compile and evaluate the active arm without compiling inactive branches.
  2. SrtTape Test Case: Extended verifyWaterfallImageTable in core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp to construct planA, compile its SrtTape, and execute tapeA->Run(planA, runtimeA, resultsA, flatA, activeA). Without ActiveMaskImplies on line 107, tape compilation attempts to compile the vector register arm and fails to run; with it, tapeA->Run passes and evaluates the active conjunct select to 42u.
  3. Debt Documentation: Restored the s_load 64-bit pointer image table line in docs/dev/debt/shader.md alongside the waterfall key bound propagation entry.
  4. Header Inclusions: Moved <concepts> and <type_traits> out of namespace ShaderRecompiler::Detail to file scope with the other includes at the top of SrtInstructionPredicates.hpp.
  5. Checklist Update: Updated the PR checklist to Unblocks: none.

Pre-flight conventions check passed with 0 findings (python tools/check_conventions.py --base 4ffb0cd12).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6269727549 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6269727549). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-19T14:32:32Z. --- @adriadam10 Thanks for the review! All four points have been addressed in `91abb61be`: 1. **`SrtTape` Compilation**: Updated `SrtTape.cpp` line 107 to use `ActiveMaskImplies(mask, value->Argument(0))` rather than exact pointer equality with `mask`, ensuring select conditions implied by conjunction masks compile and evaluate the active arm without compiling inactive branches. 2. **SrtTape Test Case**: Extended `verifyWaterfallImageTable` in `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` to construct `planA`, compile its `SrtTape`, and execute `tapeA->Run(planA, runtimeA, resultsA, flatA, activeA)`. Without `ActiveMaskImplies` on line 107, tape compilation attempts to compile the vector register arm and fails to run; with it, `tapeA->Run` passes and evaluates the active conjunct select to `42u`. 3. **Debt Documentation**: Restored the `s_load` 64-bit pointer image table line in `docs/dev/debt/shader.md` alongside the waterfall key bound propagation entry. 4. **Header Inclusions**: Moved `<concepts>` and `<type_traits>` out of `namespace ShaderRecompiler::Detail` to file scope with the other includes at the top of `SrtInstructionPredicates.hpp`. 5. **Checklist Update**: Updated the PR checklist to `Unblocks: none`. Pre-flight conventions check passed with 0 findings (`python tools/check_conventions.py --base 4ffb0cd12`).
DavidAmsellem commented 2026-10-19 17:22:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T17:22:16Z.


First AMD-on-Linux (RADV) run of this PR. Merged onto main dbac9fa15 (clean merge), built in full and compared with the same main, on the same machine.

AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.

Full suite (ANYPS5_REQUIRE_VULKAN=1 ctest -j8): 1638/1640 with this PR, against 1638/1640 on main. The failures are the same two on both, so this PR adds none: agc_driver_image_table_vouched_lookups (#7766, fixed by #7916) and agc_driver_guest_memory_lifetime (#7784).

agc_shader_memory passes. The PR adds no new ctest entry, and no test is skipped or removed compared with main.

GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6273051787 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6273051787). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-19T17:22:16Z. --- First AMD-on-Linux (RADV) run of this PR. Merged onto `main` `dbac9fa15` (clean merge), built in full and compared with the same `main`, on the same machine. AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. Full suite (`ANYPS5_REQUIRE_VULKAN=1 ctest -j8`): **1638/1640 with this PR, against 1638/1640 on `main`**. The failures are the same two on both, so this PR adds none: `agc_driver_image_table_vouched_lookups` (#7766, fixed by #7916) and `agc_driver_guest_memory_lifetime` (#7784). `agc_shader_memory` passes. The PR adds no new ctest entry, and no test is skipped or removed compared with `main`. GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38 AI-assisted: yes
DavidAmsellem commented 2026-10-19 18:17:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T18:17:07Z.


First AMD-on-Linux (RADV) run of this PR. Merged onto main dbac9fa15 (clean merge), built in full and compared with the same main, on the same machine.

AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.

Full suite (ANYPS5_REQUIRE_VULKAN=1 ctest -j8) at d767dacf7: 1638/1640 with this PR, against 1638/1640 on main. The two failures are the same on both, so this PR adds none: agc_driver_image_table_vouched_lookups (#7766, fixed by #7916) and agc_driver_guest_memory_lifetime (#7784).

Comparing the JUnit output with main: this PR adds no ctest entry, and none is skipped or removed.

This checks correctness only; I did not measure performance.

GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6274110319 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6274110319). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-19T18:17:07Z. --- First AMD-on-Linux (RADV) run of this PR. Merged onto `main` `dbac9fa15` (clean merge), built in full and compared with the same `main`, on the same machine. AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. Full suite (`ANYPS5_REQUIRE_VULKAN=1 ctest -j8`) at `d767dacf7`: **1638/1640 with this PR**, against 1638/1640 on `main`. The two failures are the same on both, so this PR adds none: `agc_driver_image_table_vouched_lookups` (#7766, fixed by #7916) and `agc_driver_guest_memory_lifetime` (#7784). Comparing the JUnit output with `main`: this PR adds no ctest entry, and none is skipped or removed. This checks correctness only; I did not measure performance. GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38 AI-assisted: yes
adriadam10 commented 2026-10-19 20:04:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T20:04:34Z.


Re-checked the new head against the previous review:

  • SrtTape.cpp:107 now uses ActiveMaskImplies, so validator, evaluator and tape agree; the new tape case builds a plan whose select is on a conjunct of the mask and only runs if the inactive vector arm is skipped.
  • The s_load pointer image-table debt line is back, the header includes are at file scope, checklist updated.
  • Bound propagation through ReadFirstLane/SelectU32, ActiveMaskImplies and the BitCount32/FindILsb32/FindUMsb32 evaluation (0 → 0xffffffff) match the IR semantics; verifyMayEvaluate and verifyWaterfallImageTable pin both the accepted and the refused cases.

Thanks for the Windows/NVIDIA runs from the other reviewers; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6276162004 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6276162004). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T20:04:34Z. --- Re-checked the new head against the previous review: - `SrtTape.cpp:107` now uses `ActiveMaskImplies`, so validator, evaluator and tape agree; the new tape case builds a plan whose select is on a conjunct of the mask and only runs if the inactive vector arm is skipped. - The `s_load` pointer image-table debt line is back, the header includes are at file scope, checklist updated. - Bound propagation through `ReadFirstLane`/`SelectU32`, `ActiveMaskImplies` and the `BitCount32`/`FindILsb32`/`FindUMsb32` evaluation (0 → `0xffffffff`) match the IR semantics; `verifyMayEvaluate` and `verifyWaterfallImageTable` pin both the accepted and the refused cases. Thanks for the Windows/NVIDIA runs from the other reviewers; merged.
Tamalero commented 2026-10-19 22:30:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-19T22:30:04Z.


Rechecked the current head 91abb61be on Marvel's Guardians of the Galaxy (PPSA01748), Linux, RTX 4090. Both builds are on main 8e0fde7d5 (which now includes #6606), with a cold shader cache:

Build Result
main 8e0fde7d5 stops 8.3 min in at compute 0x3b91c3e00, LoadAddressU32@pc=0x4380 (#7362)
main + this PR (91abb61be) same stop, 10 min in, refusal chain byte-identical

That's expected, I think: the key there is ReadFirstLane(SelectU32(Phi(...), FindILsb32(...), Phi(... BitCastU32F32(FPMax32(...)) ...))), whose select condition is a Phi of two INotEqual32, not a conjunction of the active mask. No regression up to the stop (one run each).

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6278791723 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7388#issuecomment-6278791723). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-19T22:30:04Z. --- Rechecked the current head 91abb61be on Marvel's Guardians of the Galaxy (PPSA01748), Linux, RTX 4090. Both builds are on `main` 8e0fde7d5 (which now includes #6606), with a cold shader cache: | Build | Result | |---|---| | `main` 8e0fde7d5 | stops 8.3 min in at compute 0x3b91c3e00, `LoadAddressU32@pc=0x4380` (#7362) | | `main` + this PR (91abb61be) | same stop, 10 min in, refusal chain byte-identical | That's expected, I think: the key there is `ReadFirstLane(SelectU32(Phi(...), FindILsb32(...), Phi(... BitCastU32F32(FPMax32(...)) ...)))`, whose select condition is a `Phi` of two `INotEqual32`, not a conjunction of the active mask. No regression up to the stop (one run each). *Tested and written by Claude (AI assistant) on a contributor's machine.*
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!7388
No description provided.