feat(agc): fast-link interlock pipelines and keep their dynamic write mask on RADV from Mesa 26.3.1 #24305

Merged
janzezno merged 1 commit from upstream-pr/24305 into main 2026-11-27 13:47:51 +00:00
janzezno commented 2026-11-20 13:38:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by janzezno on 2026-11-20T13:38:58Z.


What

Mesa 26.3.1 carries fa7e1ec7 "aco: consider p_jump_to_epilog as a POPS end export" (mesa!45546), the fix for mesa#16653. On RADV reporting 26.3.1 or newer, a pipeline whose fragment shader declares an interlock capability is fast-linked from graphics pipeline libraries again (#9185 excluded it) and keeps the dynamic color write mask (#21260 took it away). Every other driver, and RADV before 26.3.1, keeps both workarounds.

  • OrderedInterlockEpilogs(driver, driverVersion) (Execution/include/InterlockEpilog.hpp) is true for VK_DRIVER_ID_MESA_RADV at VK_MAKE_API_VERSION(0, 26, 3, 1) or newer, and is stored as Context::orderedInterlockEpilogs.
  • AvoidsInterlockEpilog(context, shaders) in Graphics/src/Pipeline.cpp replaces FragmentInterlock(shaders) in libraryKeys and in the dynamic color write mask choice.
  • agc_driver_pixel_interlock used to require that neither path ran. Now, where the gate is true, it requires at least one fast-linked pipeline and one dynamic mask set (if the device has them); where it is false, it still requires neither. It prints both counts. The new unit test agc_interlock_epilog covers the version check.
  • The debt entry "Fragment shader interlock pipelines" is changed in #21260's pending fragment docs/dev/debt/changes/fix-agc-interlock-static-color-write-mask.md, edited in place because tools/debt_fold.py refuses two fragments for one entry. The entry now names the gate and its limit: it reads driverVersion, so it misses a 26.2 backport and trusts a development build that reports 26.3.1 without the fix.

Overlap: #20519 (with #22424 on top of it) and #23982 edit the same libraryKeys condition, and #23982 also edits the dynamicColorWriteMask initialiser in the Pipeline constructor. Each conflict resolves by keeping both conditions. Merge order: #23982 goes first and I rebase onto it (agreed in https://github.com/boykopovar/AnyPS5/pull/23982#issuecomment-7050910122); this PR goes before #20519, which keeps both conditions on the libraryKeys line (agreed in https://github.com/boykopovar/AnyPS5/pull/20519#issuecomment-7067027528).

Tested

Arch Linux, Linux 7.3, AMD Radeon RX 7900 GRE (RADV NAVI31). Mesa 26.3.1 (Arch 26.3.1-2, system ICD) and Mesa 26.2.7 (the Arch package extracted, with its own ICD JSON) ran the same binaries. Both sides are on main 0a025bd3c6.

Stress test of agc_driver_pixel_interlock: 240 runs, 12 in parallel, per build and Mesa:

Build Mesa 26.2.7 failed Mesa 26.3.1 failed
main 0 / 240 0 / 240
this PR 0 / 240 (gate false: no fast links, no mask sets) 0 / 240 (gate true: every run fast-linked 2 pipelines and set the dynamic mask 10 times)
this PR with the gate forced true (control) 226 / 240, "pixel N counted 63 of 64 overlapping read-modify-writes" 0 / 240

On main 40206fe50d, before #21260 merged, 26.2.7 failed 228 of 240 by default and 233 of 240 with APS5_NO_PIPELINE_LTO=1. With #9185's exclusion also removed, it failed 233 to 234 of 240 with and without APS5_NO_DYNAMIC_COLOR_WRITE_MASK=1. 26.3.1 passed 240 of 240 in every one of those configurations, so fa7e1ec7 fixes both the fast-link path and the dynamic-mask path.

Focused GPU tests: ctest --test-dir build -R 'interlock|pipeline_librar|color_write|raster_order' -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LOADER_DEBUG=layer, validation layer 1.4.363, three times on each Mesa. main passed 13/13 every time; this PR passed 14/14 every time (the extra test is agc_interlock_epilog). Every log shows Insert instance layer "VK_LAYER_KHRONOS_validation" (10 times), none contains was not found but was requested by env var VK_INSTANCE_LAYERS, and none contains VUID- on either side. tools/check_conventions.py --base upstream/main passes.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.3.1 and 26.2.7, Arch Linux (Linux 7.3)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5414264893 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24305). Originally posted by [janzezno](https://github.com/janzezno) on 2026-11-20T13:38:58Z. --- ### What Mesa 26.3.1 carries fa7e1ec7 "aco: consider p_jump_to_epilog as a POPS end export" ([mesa!45546](https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45546)), the fix for [mesa#16653](https://gitlab.freedesktop.org/mesa/mesa/-/work_items/16653). On RADV reporting 26.3.1 or newer, a pipeline whose fragment shader declares an interlock capability is fast-linked from graphics pipeline libraries again (#9185 excluded it) and keeps the dynamic color write mask (#21260 took it away). Every other driver, and RADV before 26.3.1, keeps both workarounds. - `OrderedInterlockEpilogs(driver, driverVersion)` (`Execution/include/InterlockEpilog.hpp`) is true for `VK_DRIVER_ID_MESA_RADV` at `VK_MAKE_API_VERSION(0, 26, 3, 1)` or newer, and is stored as `Context::orderedInterlockEpilogs`. - `AvoidsInterlockEpilog(context, shaders)` in `Graphics/src/Pipeline.cpp` replaces `FragmentInterlock(shaders)` in `libraryKeys` and in the dynamic color write mask choice. - `agc_driver_pixel_interlock` used to require that neither path ran. Now, where the gate is true, it requires at least one fast-linked pipeline and one dynamic mask set (if the device has them); where it is false, it still requires neither. It prints both counts. The new unit test `agc_interlock_epilog` covers the version check. - The debt entry "Fragment shader interlock pipelines" is changed in #21260's pending fragment `docs/dev/debt/changes/fix-agc-interlock-static-color-write-mask.md`, edited in place because `tools/debt_fold.py` refuses two fragments for one entry. The entry now names the gate and its limit: it reads `driverVersion`, so it misses a 26.2 backport and trusts a development build that reports 26.3.1 without the fix. Overlap: #20519 (with #22424 on top of it) and #23982 edit the same `libraryKeys` condition, and #23982 also edits the `dynamicColorWriteMask` initialiser in the `Pipeline` constructor. Each conflict resolves by keeping both conditions. Merge order: #23982 goes first and I rebase onto it (agreed in https://github.com/boykopovar/AnyPS5/pull/23982#issuecomment-7050910122); this PR goes before #20519, which keeps both conditions on the `libraryKeys` line (agreed in https://github.com/boykopovar/AnyPS5/pull/20519#issuecomment-7067027528). ### Tested Arch Linux, Linux 7.3, AMD Radeon RX 7900 GRE (RADV NAVI31). Mesa 26.3.1 (Arch 26.3.1-2, system ICD) and Mesa 26.2.7 (the Arch package extracted, with its own ICD JSON) ran the same binaries. Both sides are on `main` 0a025bd3c6. Stress test of `agc_driver_pixel_interlock`: 240 runs, 12 in parallel, per build and Mesa: | Build | Mesa 26.2.7 failed | Mesa 26.3.1 failed | |---|---|---| | `main` | 0 / 240 | 0 / 240 | | this PR | 0 / 240 (gate false: no fast links, no mask sets) | 0 / 240 (gate true: every run fast-linked 2 pipelines and set the dynamic mask 10 times) | | this PR with the gate forced true (control) | 226 / 240, "pixel N counted 63 of 64 overlapping read-modify-writes" | 0 / 240 | On `main` 40206fe50d, before #21260 merged, 26.2.7 failed 228 of 240 by default and 233 of 240 with `APS5_NO_PIPELINE_LTO=1`. With #9185's exclusion also removed, it failed 233 to 234 of 240 with and without `APS5_NO_DYNAMIC_COLOR_WRITE_MASK=1`. 26.3.1 passed 240 of 240 in every one of those configurations, so fa7e1ec7 fixes both the fast-link path and the dynamic-mask path. Focused GPU tests: `ctest --test-dir build -R 'interlock|pipeline_librar|color_write|raster_order' -V` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and `VK_LOADER_DEBUG=layer`, validation layer 1.4.363, three times on each Mesa. `main` passed 13/13 every time; this PR passed 14/14 every time (the extra test is `agc_interlock_epilog`). Every log shows `Insert instance layer "VK_LAYER_KHRONOS_validation"` (10 times), none contains `was not found but was requested by env var VK_INSTANCE_LAYERS`, and none contains `VUID-` on either side. `tools/check_conventions.py --base upstream/main` passes. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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: AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.3.1 and 26.2.7, Arch Linux (Linux 7.3) - [x] AI-assisted: yes
MarcZX10 commented 2026-11-20 14:04:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T14:04:42Z.

Review: APPROVED


Reviewed — looks good

The reviewed code makes the RADV version gate control both interlock fast linking and dynamic color write masks; no blocking defect was verified.

What I ran

Read the prepared diff and changed files at head 548661e3b0aac84bc7420b7b26e45b102c224415 using repo_read.py. No tests or build commands were run; runtime and test results in the description are author-reported.

Files read: core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp, core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp, core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp, and core/libs/prx/libSceAgcDriver/Execution/include/InterlockEpilog.hpp. Files excluded by review-bundle rule: core/libs/prx/libSceAgcDriver/tests/InterlockEpilog.cpp, core/libs/prx/libSceAgcDriver/tests/cmake/agc_interlock_epilog_tests.cmake, core/libs/prx/libSceAgcDriver/tests/execution/PixelInterlock.cpp, and docs/dev/debt/changes/fix-agc-interlock-static-color-write-mask.md.

Results

Check Result Note
Diff and changed-code review passed Gate is applied to both affected pipeline decisions.
Build and tests not run Only author-reported results are supplied.
Excluded-file review not run Four changed files were excluded by bundle rule.

Findings

Blocking

None verified in the code read.

Non-blocking

None.

Not verified

The three changed test files and the debt fragment were excluded from the bundle and were not inspected. No build, test, or hardware run was performed by this review. The supplied stress and focused-test results are author-reported.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5993911588 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24305#pullrequestreview-5993911588). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T14:04:42Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed code makes the RADV version gate control both interlock fast linking and dynamic color write masks; no blocking defect was verified. ## What I ran Read the prepared diff and changed files at head `548661e3b0aac84bc7420b7b26e45b102c224415` using `repo_read.py`. No tests or build commands were run; runtime and test results in the description are author-reported. Files read: `core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`, `core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp`, `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`, and `core/libs/prx/libSceAgcDriver/Execution/include/InterlockEpilog.hpp`. Files excluded by review-bundle rule: `core/libs/prx/libSceAgcDriver/tests/InterlockEpilog.cpp`, `core/libs/prx/libSceAgcDriver/tests/cmake/agc_interlock_epilog_tests.cmake`, `core/libs/prx/libSceAgcDriver/tests/execution/PixelInterlock.cpp`, and `docs/dev/debt/changes/fix-agc-interlock-static-color-write-mask.md`. ## Results | Check | Result | Note | |---|---|---| | Diff and changed-code review | passed | Gate is applied to both affected pipeline decisions. | | Build and tests | not run | Only author-reported results are supplied. | | Excluded-file review | not run | Four changed files were excluded by bundle rule. | ## Findings ### Blocking None verified in the code read. ### Non-blocking None. ## Not verified The three changed test files and the debt fragment were excluded from the bundle and were not inspected. No build, test, or hardware run was performed by this review. The supplied stress and focused-test results are author-reported. ## To get this to a good state Nothing is required.
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!24305
No description provided.