build(agc): share a precompiled header across the execution tests #10164

Merged
LeandroLP23 merged 1 commit from upstream-pr/10164 into main 2026-10-26 19:57:19 +00:00
LeandroLP23 commented 2026-10-23 11:35:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-23T11:35:21Z.


What

#10163: each AGC execution test object spends most of its compile time parsing the same headers. 463 of the 478 tests/execution sources include VulkanTestDevice.hpp, which pulls in VulkanDevice.hpp, Draw.hpp, Recompiler.hpp and about 35 more project headers.

The loop that defines the execution tests now gives them one shared precompiled header. The first test builds it from tests/execution/VulkanTestDevice.hpp, <array>, <iostream>, <span>, <string> and <vector>. The other tests reuse it through target_precompile_headers(... REUSE_FROM ...). They are all defined in this loop with the same include directories, flags and CXX_EXTENSIONS OFF, so one PCH fits every one. No source file changes. CMake compiles with -Winvalid-pch, so a PCH that does not match a target is reported rather than silently skipped.

When CMAKE_CXX_COMPILER_LAUNCHER is ccache, these targets run it through cmake -E env CCACHE_SLOPPINESS=pch_defines,time_macros. Without that setting ccache refuses every object built with a PCH ("Could not use precompiled header": 2 of 2 calls uncacheable here). That would make the CI and local caches miss on all 478 objects. cmake -E env works with any ccache version. The ccache key=value command-line form needs 4.8 or later.

Tested

Ryzen AI 7 350, Radeon 860M (AMD driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON. Built on main d339082d2e, same build directory for both sides. The branch is the same change on main c928aeb0a2: the libSceAgcDriver/CMakeLists.txt commits in between add tests to lists and do not touch the execution test loop.

Rebuild after a header edit. Touch tests/execution/VulkanTestDevice.hpp, then build every tests/execution object with ccache disabled, at -j 4, below-normal priority:

Compiles Time
main 463 664 s
this PR 479 (the PCH, then all 478 objects) 341 s

That is 49% less time for the same objects. All 478 now depend on the PCH, so the 15 sources that did not include VulkanTestDevice.hpp also recompile when it changes. They are counted above.

Why the PCH helps: five sources taken at even intervals from the target list, each compiled alone on an idle machine, parse in 2.1 to 4.6 s with -fsyntax-only and compile in 2.4 to 4.1 s at -O3. Parsing is most of each compile, and -O1 is no faster.

ccache. After a populated build, I deleted 40 execution test objects and rebuilt them: 40 of 40 were direct ccache hits, in 4.9 s.

Tests. cmake --build build builds cleanly. One PCH is built (199 MB). Recompiling two objects with ninja -v prints no PCH warning. With ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, ctest -R '^agc_' -j 4 passes 939 of 942. The 3 failures are agc_driver_sample_order, agc_driver_sample_order_grid_reference and agc_driver_sample_order_recipe_depth_locations, the AMD Windows failure of #9507. They fail the same way without this change. The 3 skipped tests (agc_host_import_sparse, agc_driver_ngg_vertex_wave_reduction, agc_driver_sparse_dma_buf_import) also skip on main on this machine. The validation layer is not installed here. The change only affects how these objects compile, not what they record.

Not run here: Linux and macOS. GCC and Clang both support target_precompile_headers with REUSE_FROM, and CI builds both.

tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py --branch reports no conflicting lines. 60 open PRs that conflict with main share this CMakeLists.txt. Seven of them edit near the execution test loop: #6169, #6788, #7642, #8014, #8874, #9508 and #9892. Their changes there are to the foreach(agcTest IN ITEMS ...) list below it, not to the lines this PR adds.

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: #10163
  • Unblocks: none (build time only)
  • GPUs tested: AMD Radeon 860M, driver 32.0.13058.8001, Windows 11 (the AGC tests, run to check the build change)
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4982107616 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10164). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-23T11:35:21Z. --- ### What #10163: each AGC execution test object spends most of its compile time parsing the same headers. 463 of the 478 `tests/execution` sources include `VulkanTestDevice.hpp`, which pulls in `VulkanDevice.hpp`, `Draw.hpp`, `Recompiler.hpp` and about 35 more project headers. The loop that defines the execution tests now gives them one shared precompiled header. The first test builds it from `tests/execution/VulkanTestDevice.hpp`, `<array>`, `<iostream>`, `<span>`, `<string>` and `<vector>`. The other tests reuse it through `target_precompile_headers(... REUSE_FROM ...)`. They are all defined in this loop with the same include directories, flags and `CXX_EXTENSIONS OFF`, so one PCH fits every one. No source file changes. CMake compiles with `-Winvalid-pch`, so a PCH that does not match a target is reported rather than silently skipped. When `CMAKE_CXX_COMPILER_LAUNCHER` is ccache, these targets run it through `cmake -E env CCACHE_SLOPPINESS=pch_defines,time_macros`. Without that setting ccache refuses every object built with a PCH ("Could not use precompiled header": 2 of 2 calls uncacheable here). That would make the CI and local caches miss on all 478 objects. `cmake -E env` works with any ccache version. The `ccache key=value` command-line form needs 4.8 or later. ### Tested Ryzen AI 7 350, Radeon 860M (AMD driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0, Release, `BUILD_TESTING=ON`. Built on `main` `d339082d2e`, same build directory for both sides. The branch is the same change on `main` `c928aeb0a2`: the `libSceAgcDriver/CMakeLists.txt` commits in between add tests to lists and do not touch the execution test loop. **Rebuild after a header edit.** Touch `tests/execution/VulkanTestDevice.hpp`, then build every `tests/execution` object with ccache disabled, at `-j 4`, below-normal priority: | | Compiles | Time | |---|---|---| | `main` | 463 | 664 s | | this PR | 479 (the PCH, then all 478 objects) | 341 s | That is 49% less time for the same objects. All 478 now depend on the PCH, so the 15 sources that did not include `VulkanTestDevice.hpp` also recompile when it changes. They are counted above. Why the PCH helps: five sources taken at even intervals from the target list, each compiled alone on an idle machine, parse in 2.1 to 4.6 s with `-fsyntax-only` and compile in 2.4 to 4.1 s at `-O3`. Parsing is most of each compile, and `-O1` is no faster. **ccache.** After a populated build, I deleted 40 execution test objects and rebuilt them: 40 of 40 were direct ccache hits, in 4.9 s. **Tests.** `cmake --build build` builds cleanly. One PCH is built (199 MB). Recompiling two objects with `ninja -v` prints no PCH warning. With `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`, `ctest -R '^agc_' -j 4` passes 939 of 942. The 3 failures are `agc_driver_sample_order`, `agc_driver_sample_order_grid_reference` and `agc_driver_sample_order_recipe_depth_locations`, the AMD Windows failure of #9507. They fail the same way without this change. The 3 skipped tests (`agc_host_import_sparse`, `agc_driver_ngg_vertex_wave_reduction`, `agc_driver_sparse_dma_buf_import`) also skip on `main` on this machine. The validation layer is not installed here. The change only affects how these objects compile, not what they record. Not run here: Linux and macOS. GCC and Clang both support `target_precompile_headers` with `REUSE_FROM`, and CI builds both. `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py --branch` reports no conflicting lines. 60 open PRs that conflict with `main` share this `CMakeLists.txt`. Seven of them edit near the execution test loop: #6169, #6788, #7642, #8014, #8874, #9508 and #9892. Their changes there are to the `foreach(agcTest IN ITEMS ...)` list below it, not to the lines this PR adds. ### 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: #10163 - [x] Unblocks: none (build time only) - [x] GPUs tested: AMD Radeon 860M, driver 32.0.13058.8001, Windows 11 (the AGC tests, run to check the build change) - [x] AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-10-23 11:39:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T11:39:29Z.

Review: APPROVED


Reviewed head 3fe7aaf3b4 against the current main. The change is scoped to the execution-test target loop, and the PR reports measured rebuild, ccache-hit, full build, and AGC test results with the three known AMD failures and three skips clearly called out. I also confirmed the PR checks: conventions, eligibility, intake, labels, and report pass; full Linux/Windows build jobs are skipped by the repository PR policy. No blocking issue found in the patch. AI assistance is disclosed in the checklist.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5627700340 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10164#pullrequestreview-5627700340). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T11:39:29Z. **Review:** APPROVED --- Reviewed head 3fe7aaf3b4ca738f1dca58073d6897f6206012a against the current main. The change is scoped to the execution-test target loop, and the PR reports measured rebuild, ccache-hit, full build, and AGC test results with the three known AMD failures and three skips clearly called out. I also confirmed the PR checks: conventions, eligibility, intake, labels, and report pass; full Linux/Windows build jobs are skipped by the repository PR policy. No blocking issue found in the patch. AI assistance is disclosed in the checklist.
THEMANnt commented 2026-10-25 12:46:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-25T12:46:08Z.

Review: APPROVED


Reviewed head 3fe7aaf3b4ca738f1dca58073d6897f6206012a6. No actionable findings in this focused shared-PCH build change.

The first generated execution-test target owns the PCH and subsequent targets reuse it. The existing loop applies common includes, linked dependencies and language settings before selecting reuse. The ccache launcher branch supplies the required PCH sloppiness settings through cmake -E env, preserving the configured launcher command.

Validation: Windows/MinGW GCC 15.2.0: exercised the exact changed loop with three representative executable targets and a small stand-in header. One .gch is generated and all three targets build/run, with invalid-PCH warnings treated as errors. A selected-test configuration also builds one shared PCH: the selected target exits 0 and both excluded-test stubs exit the expected 77. A ccache configuration verifies the generated launcher property contains CCACHE_SLOPPINESS=pch_defines,time_macros. Conventions and whitespace pass. Hosted relinker/ASan and policy checks pass; product jobs are skipped.

Scope: CMake/PCH mechanics and selected-test behavior, not compilation of the actual Vulkan header graph or all AGC fixtures. Full-driver build, real ccache hit rates, GPU execution and the reported speedup were not independently measured.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643252520 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10164#pullrequestreview-5643252520). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-25T12:46:08Z. **Review:** APPROVED --- Reviewed head `3fe7aaf3b4ca738f1dca58073d6897f6206012a6`. No actionable findings in this focused shared-PCH build change. The first generated execution-test target owns the PCH and subsequent targets reuse it. The existing loop applies common includes, linked dependencies and language settings before selecting reuse. The ccache launcher branch supplies the required PCH sloppiness settings through cmake -E env, preserving the configured launcher command. **Validation:** Windows/MinGW GCC 15.2.0: exercised the exact changed loop with three representative executable targets and a small stand-in header. One .gch is generated and all three targets build/run, with invalid-PCH warnings treated as errors. A selected-test configuration also builds one shared PCH: the selected target exits 0 and both excluded-test stubs exit the expected 77. A ccache configuration verifies the generated launcher property contains CCACHE_SLOPPINESS=pch_defines,time_macros. Conventions and whitespace pass. Hosted relinker/ASan and policy checks pass; product jobs are skipped. **Scope:** CMake/PCH mechanics and selected-test behavior, not compilation of the actual Vulkan header graph or all AGC fixtures. Full-driver build, real ccache hit rates, GPU execution and the reported speedup were not independently measured.
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!10164
No description provided.