test(agc): inspect vector windows before optimization #4182

Closed
MarcZX10 wants to merge 1 commit from upstream-pr/4182 into main
MarcZX10 commented 2026-10-12 00:51:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T00:51:48Z.


What

agc_vector_window inspects the emitted SPIR-V to check that relative VGPR accesses use a function-scope window array and access chains. The fixture has no observable shader output, so the default optimizer removes the window before the structural assertion examines it, reporting zero arrays and access chains.

Run this structural lowering test with APS5_SPIRV_OPT=none, preserving its input for inspection. This change is limited to the vector-window assertion. Open PR #4177 separately fixes the registered-workgroup lane-63 fixture, the other failure reported in #4167.

Tested

  • Linux Release configure with GCC, BUILD_TESTING=ON, and ANYPS5_ENABLE_SPIRV_TOOLS=ON completed.
  • Built agc_vector_window_tests with Ninja.
  • ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx ctest --test-dir /tmp/AnyPS5-4167-build -R '^agc_vector_window$' --output-on-failure --timeout 120 passed (1/1).
  • python3 tools/check_conventions.py --base upstream/main --head HEAD passed.
  • git diff --check passed.

Checklist

  • Based on current main; no other open PR implements the same change
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4823645084 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4182). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T00:51:48Z. --- ### What `agc_vector_window` inspects the emitted SPIR-V to check that relative VGPR accesses use a function-scope window array and access chains. The fixture has no observable shader output, so the default optimizer removes the window before the structural assertion examines it, reporting zero arrays and access chains. Run this structural lowering test with `APS5_SPIRV_OPT=none`, preserving its input for inspection. This change is limited to the vector-window assertion. Open PR #4177 separately fixes the registered-workgroup lane-63 fixture, the other failure reported in #4167. ### Tested - Linux Release configure with GCC, `BUILD_TESTING=ON`, and `ANYPS5_ENABLE_SPIRV_TOOLS=ON` completed. - Built `agc_vector_window_tests` with Ninja. - `ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx ctest --test-dir /tmp/AnyPS5-4167-build -R '^agc_vector_window$' --output-on-failure --timeout 120` passed (1/1). - `python3 tools/check_conventions.py --base upstream/main --head HEAD` passed. - `git diff --check` passed. ### Checklist - [x] Based on current `main`; no other open PR implements the same change - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (Codex)
Dextroid17 commented 2026-10-12 01:09:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T01:09:17Z.


#4182: agc_vector_window is a real registered test, APS5_SPIRV_OPT=none is a real optimizer-disable switch read in SpirvOptimizer.cpp, and APPEND is the right call — it preserves the test's existing ANYPS5_NO_SHADER_CACHE=1 environment entry rather than replacing it, matching how this file already appends to other tests' environments. Without this the test strips the window before its own structural assertion can see it and genuinely fails (functionArrays==1 etc. all false), not silently passes against a weaker check.

#3883: the stub follows this file's own pattern exactly (NotImplemented_nid_no_patch, matching the sibling declared right above it), and the NID is independently re-derivable in-tree — ComputeNid("sceAgcDriverGetHsOffchipParam") reproduces r28hEh6cNH0 using this project's own hash function, not an external lookup. One thing worth being plain about: the signature (two uint16_t* outputs) comes entirely from a third-party reverse-engineering project (ps5-vulkan), not from anything in this tree or from hardware — nothing here corroborates it, and the only related in-tree function, the setter sceAgcDriverSetHsOffchipParam, takes three uint64_t by value, which doesn't confirm or contradict it either way. The TechnicalDebt entry is honest about that ("unknown"), which is the right call given the evidence.

One thing to flag before merging: open PR #3648 also edits the same block of docs/dev/TechnicalDebt.md this PR appends to, which isn't listed in the "Depends on" line — worth a quick check for a textual conflict on whichever lands second.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115967186 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4182#issuecomment-6115967186). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T01:09:17Z. --- #4182: `agc_vector_window` is a real registered test, `APS5_SPIRV_OPT=none` is a real optimizer-disable switch read in `SpirvOptimizer.cpp`, and `APPEND` is the right call — it preserves the test's existing `ANYPS5_NO_SHADER_CACHE=1` environment entry rather than replacing it, matching how this file already appends to other tests' environments. Without this the test strips the window before its own structural assertion can see it and genuinely fails (`functionArrays==1` etc. all false), not silently passes against a weaker check. #3883: the stub follows this file's own pattern exactly (`NotImplemented_nid_no_patch`, matching the sibling declared right above it), and the NID is independently re-derivable in-tree — `ComputeNid("sceAgcDriverGetHsOffchipParam")` reproduces `r28hEh6cNH0` using this project's own hash function, not an external lookup. One thing worth being plain about: the signature (two `uint16_t*` outputs) comes entirely from a third-party reverse-engineering project (ps5-vulkan), not from anything in this tree or from hardware — nothing here corroborates it, and the only related in-tree function, the setter `sceAgcDriverSetHsOffchipParam`, takes three `uint64_t` by value, which doesn't confirm or contradict it either way. The TechnicalDebt entry is honest about that ("unknown"), which is the right call given the evidence. One thing to flag before merging: open PR #3648 also edits the same block of `docs/dev/TechnicalDebt.md` this PR appends to, which isn't listed in the "Depends on" line — worth a quick check for a textual conflict on whichever lands second. Written with AI assistance.
github-actions[bot] commented 2026-10-12 01:18:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T01:18:01Z.


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
#1341 core/libs/prx/libSceAgcDriver/CMakeLists.txt L1060
#4048 core/libs/prx/libSceAgcDriver/CMakeLists.txt L1060
#4206 core/libs/prx/libSceAgcDriver/CMakeLists.txt L1060
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116042535 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4182#issuecomment-6116042535). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T01:18:01Z. --- <!-- 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 | |---|---|---|---| | #1341 | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` [L1060](https://github.com/boykopovar/AnyPS5/blob/436e310ddb56fcf5dd1d40ba1f8113fe8cb8c113/core/libs/prx/libSceAgcDriver/CMakeLists.txt#L1060) | | | | #4048 | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` [L1060](https://github.com/boykopovar/AnyPS5/blob/436e310ddb56fcf5dd1d40ba1f8113fe8cb8c113/core/libs/prx/libSceAgcDriver/CMakeLists.txt#L1060) | | | | #4206 | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` [L1060](https://github.com/boykopovar/AnyPS5/blob/436e310ddb56fcf5dd1d40ba1f8113fe8cb8c113/core/libs/prx/libSceAgcDriver/CMakeLists.txt#L1060) | | |
oneandonlydean commented 2026-10-12 07:36:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T07:36:31Z.


Closing: #4057 made the agc_vector_window fixtures observable, so the test passes on main with the optimizer on. If it still fails on current main, please reopen.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6119849981 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4182#issuecomment-6119849981). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T07:36:31Z. --- Closing: #4057 made the `agc_vector_window` fixtures observable, so the test passes on main with the optimizer on. If it still fails on current main, please reopen.

Pull request closed

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!4182
No description provided.