fix(agc): keep pipeline layout alive during background LTO #2869

Merged
MarcZX10 merged 1 commit from upstream-pr/2869 into main 2026-10-10 19:41:43 +00:00
MarcZX10 commented 2026-10-10 17:06:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T17:06:33Z.


What

Fixes #2777 by making the background link-time-optimization job use the pipeline layout retained by the pipeline-library store. The previous job captured a Pipeline-owned layout, which can be destroyed after the job passes its released check but before vkCreateGraphicsPipelines uses it. The store-owned layout is the same layout used to create the libraries and remains alive until pending links finish.

This change is based on Silverash-i8's candidate commit 758eeb9f, cherry-picked with its original author preserved. Silverash's report on #2777 includes repeatable Intel Windows faults in igc-default64.dll and successful runs of the affected tests with the fix. AMD reports a separate issue in the LTO path that this layout lifetime fix does not address.

Tested

  • Linux Release: built agc_driver_recorder_tests successfully.
  • Linux: ctest --test-dir /tmp/AnyPS5-2777-build --output-on-failure -R '^agc_pipeline_library$' passed (1/1).
  • python3 tools/check_conventions.py --base upstream/main passed; git diff --check passed.
  • The Intel Windows race cannot be reproduced on this Linux host; see the hardware results in #2777.

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 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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4812977588 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2869). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T17:06:33Z. --- ### What Fixes #2777 by making the background link-time-optimization job use the pipeline layout retained by the pipeline-library store. The previous job captured a `Pipeline`-owned layout, which can be destroyed after the job passes its released check but before `vkCreateGraphicsPipelines` uses it. The store-owned layout is the same layout used to create the libraries and remains alive until pending links finish. This change is based on Silverash-i8's candidate commit [`758eeb9f`](https://github.com/Silverash-i8/AnyPS5-fork/commit/758eeb9fb255d88c41945b299dc3ec5ac1578331), cherry-picked with its original author preserved. Silverash's report on #2777 includes repeatable Intel Windows faults in `igc-default64.dll` and successful runs of the affected tests with the fix. AMD reports a separate issue in the LTO path that this layout lifetime fix does not address. ### Tested - Linux Release: built `agc_driver_recorder_tests` successfully. - Linux: `ctest --test-dir /tmp/AnyPS5-2777-build --output-on-failure -R '^agc_pipeline_library$'` passed (1/1). - `python3 tools/check_conventions.py --base upstream/main` passed; `git diff --check` passed. - The Intel Windows race cannot be reproduced on this Linux host; see the hardware results in #2777. ### Checklist - [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 - [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
Zurisen commented 2026-10-10 17:50:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Zurisen on 2026-10-10T17:50:31Z.


Native NVIDIA run: the fault in #2777 is not Intel-only, and this change fixes it here too.

Setup: Windows 11 Home (26200), RTX 4070 Laptop GPU (Ada, driver 32.0.15.9636), i7-14650HX, WinLibs GCC 15.2.0 r7, Release, -DBUILD_TESTING=ON, main 57f96fd2. This PR's 51078717 was cherry-picked onto the same main and rebuilt in the same tree.

Reproducing it reliably on NVIDIA: with warm caches and the default -j6 the faults are rare (4 crashed tests in 5 full-suite runs, 1 in 160 runs of four of the tests), which is probably why it hasn't shown up on NVIDIA before. With every cache cold and more parallelism the background link reliably outlives the Pipeline:

ANYPS5_NO_SHADER_CACHE=1 APS5_NO_PIPELINE_CACHE=1 __GL_SHADER_DISK_CACHE=0 ctest --test-dir build -R "^agc_driver_" -j12 --timeout 120
Build (252 agc_driver_ tests per batch, conditions above) Batches Crashed tests
main 5 (3 before and 2 after the runs below) 50: 8, 10, 14, 8, 10
main with APS5_NO_PIPELINE_LTO=1 3 0
main + 51078717 10 0 (2520 test runs)

Every crash is a SEGFAULT inside NVIDIA's driver: 50 at nvoglv64.dll+0xed5110 and 4 at nvoglv64.dll+0x4cd96a, all reading 0xffffffffffffffff except one read of 0x161:

FATAL: unhandled exception 0xc0000005 on thread 4448 ''
  rip 0x00007ffa159a5110 nvoglv64.dll+0xed5110
  read of 0xffffffffffffffff

Crashed tests on main (times out of 5 batches): prepared_exports, pixel_wave_reduction, pixel_uint16_export, pixel_helper_lanes, pixel_barycentric_emulation 5; packed_unorm_color_target, depth_bias_per_face 4; srgb8_color_target, pixel_fixed_point_position 3; pixel_valid_mask, ngg_vertex_wave_info, mesh, dual_source_blend 2; pixel_interlock, exec_host_lanes, draw_offset_indices 1.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6100448565 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2869#issuecomment-6100448565). Originally posted by [Zurisen](https://github.com/Zurisen) on 2026-10-10T17:50:31Z. --- Native NVIDIA run: the fault in #2777 is not Intel-only, and this change fixes it here too. **Setup:** Windows 11 Home (26200), RTX 4070 Laptop GPU (Ada, driver 32.0.15.9636), i7-14650HX, WinLibs GCC 15.2.0 r7, Release, `-DBUILD_TESTING=ON`, `main` `57f96fd2`. This PR's `51078717` was cherry-picked onto the same `main` and rebuilt in the same tree. **Reproducing it reliably on NVIDIA:** with warm caches and the default `-j6` the faults are rare (4 crashed tests in 5 full-suite runs, 1 in 160 runs of four of the tests), which is probably why it hasn't shown up on NVIDIA before. With every cache cold and more parallelism the background link reliably outlives the `Pipeline`: ``` ANYPS5_NO_SHADER_CACHE=1 APS5_NO_PIPELINE_CACHE=1 __GL_SHADER_DISK_CACHE=0 ctest --test-dir build -R "^agc_driver_" -j12 --timeout 120 ``` | Build (252 `agc_driver_` tests per batch, conditions above) | Batches | Crashed tests | |---|---|---| | `main` | 5 (3 before and 2 after the runs below) | 50: 8, 10, 14, 8, 10 | | `main` with `APS5_NO_PIPELINE_LTO=1` | 3 | 0 | | `main` + `51078717` | 10 | 0 (2520 test runs) | Every crash is a SEGFAULT inside NVIDIA's driver: 50 at `nvoglv64.dll+0xed5110` and 4 at `nvoglv64.dll+0x4cd96a`, all reading `0xffffffffffffffff` except one read of `0x161`: ``` FATAL: unhandled exception 0xc0000005 on thread 4448 '' rip 0x00007ffa159a5110 nvoglv64.dll+0xed5110 read of 0xffffffffffffffff ``` Crashed tests on `main` (times out of 5 batches): `prepared_exports`, `pixel_wave_reduction`, `pixel_uint16_export`, `pixel_helper_lanes`, `pixel_barycentric_emulation` 5; `packed_unorm_color_target`, `depth_bias_per_face` 4; `srgb8_color_target`, `pixel_fixed_point_position` 3; `pixel_valid_mask`, `ngg_vertex_wave_info`, `mesh`, `dual_source_blend` 2; `pixel_interlock`, `exec_host_lanes`, `draw_offset_indices` 1.
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!2869
No description provided.