fix(agc): order queued labels behind every earlier write at submit #11886

Merged
Sumaiter merged 1 commit from upstream-pr/11886 into main 2026-11-02 12:27:50 +00:00
Sumaiter commented 2026-10-27 11:35:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Sumaiter on 2026-10-27T11:35:52Z.


What

Use VK_ACCESS_MEMORY_WRITE_BIT as the source access for the barrier ahead of GPU label stores queued until Submit. This orders the label behind every earlier write in the batch, including writes not covered by the previous shader, transfer and color-attachment mask. On Intel Arc under Windows, the narrower mask allowed a polling CPU to observe the label before earlier copied bytes reached the host import.

Add agc_driver_label_after_import_copy, which checks 32 rounds of a 256 KiB GPU copy between host imports, each followed by a GPU label and a destination read when the CPU observes that label. Record the remaining limitation for label runs forced in place.

Carried from @BKlaasWerkman's fix/label-run-memory-write branch, rebased onto current main, with the original authorship preserved. The Intel investigation and standalone Vulkan reproduction are in #10199.

Tested

Windows 11 10.0.26200, WinLibs GCC 15.2.0, Release, NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 621.01. Every GPU run used ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation with Khronos validation 1.4.363. Loader output confirms that the layer was inserted.

Build Focused tests agc_driver_alias_copy_label agc_driver_label_after_import_copy
main 3fea2a937ba9 43/43 passed 40/40 fresh processes passed not present
this PR, 55722a42e2ec 44/44 passed 40/40 fresh processes passed 10/10 fresh processes passed

The focused expression was label|store_run|alias_copy|copied_writer|completion|write_back|barrier|^agc_recorder|agc_driver_graphics. Neither the main nor the PR logs contain VUID- or was not found but was requested by env var VK_INSTANCE_LAYERS. The full build completed on both trees. python tools/check_conventions.py --base origin/main and tools/pr_overlap.py --branch fix/issue-10199-label-memory-write were run; open PRs touching Recorder.cpp were also checked manually for this closeStoreRun path.

The original Intel Arc Graphics (Meteor Lake, driver 101.9150) testing is documented in #10199: the change removed the alias-copy failures in 40 runs and the new regression test passed 10 runs.

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: Fixes #10199
  • Unblocks: none
  • GPUs tested: Intel Arc Graphics (Meteor Lake), driver 101.9150, Windows 11 Pro (original change); NVIDIA GeForce RTX 4060 Laptop GPU, driver 621.01, Windows 11 10.0.26200 (this carry)
  • AI-assisted: yes (Kimi K3.1 Pro; original investigation and patch: Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5033229690 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11886). Originally posted by [Sumaiter](https://github.com/Sumaiter) on 2026-10-27T11:35:52Z. --- ### What Use `VK_ACCESS_MEMORY_WRITE_BIT` as the source access for the barrier ahead of GPU label stores queued until `Submit`. This orders the label behind every earlier write in the batch, including writes not covered by the previous shader, transfer and color-attachment mask. On Intel Arc under Windows, the narrower mask allowed a polling CPU to observe the label before earlier copied bytes reached the host import. Add `agc_driver_label_after_import_copy`, which checks 32 rounds of a 256 KiB GPU copy between host imports, each followed by a GPU label and a destination read when the CPU observes that label. Record the remaining limitation for label runs forced in place. Carried from @BKlaasWerkman's `fix/label-run-memory-write` branch, rebased onto current `main`, with the original authorship preserved. The Intel investigation and standalone Vulkan reproduction are in #10199. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 10.0.26200, WinLibs GCC 15.2.0, Release, NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 621.01. Every GPU run used `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` with Khronos validation 1.4.363. Loader output confirms that the layer was inserted. | Build | Focused tests | `agc_driver_alias_copy_label` | `agc_driver_label_after_import_copy` | |---|---|---|---| | `main` `3fea2a937ba9` | 43/43 passed | 40/40 fresh processes passed | not present | | this PR, `55722a42e2ec` | 44/44 passed | 40/40 fresh processes passed | 10/10 fresh processes passed | The focused expression was `label|store_run|alias_copy|copied_writer|completion|write_back|barrier|^agc_recorder|agc_driver_graphics`. Neither the `main` nor the PR logs contain `VUID-` or `was not found but was requested by env var VK_INSTANCE_LAYERS`. The full build completed on both trees. `python tools/check_conventions.py --base origin/main` and `tools/pr_overlap.py --branch fix/issue-10199-label-memory-write` were run; open PRs touching `Recorder.cpp` were also checked manually for this `closeStoreRun` path. The original Intel Arc Graphics (Meteor Lake, driver 101.9150) testing is documented in #10199: the change removed the alias-copy failures in 40 runs and the new regression test passed 10 runs. ### 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: Fixes #10199 - [x] Unblocks: none - [x] GPUs tested: Intel Arc Graphics (Meteor Lake), driver 101.9150, Windows 11 Pro (original change); NVIDIA GeForce RTX 4060 Laptop GPU, driver 621.01, Windows 11 10.0.26200 (this carry) - [x] AI-assisted: yes (Kimi K3.1 Pro; original investigation and patch: Claude Code)
MarcZX10 commented 2026-10-27 11:43:23 +00:00 (Migrated from github.com)

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

Review: APPROVED


I reviewed the submit-time barrier scope and the regression. VK_PIPELINE_STAGE_ALL_COMMANDS_BIT with VK_ACCESS_MEMORY_WRITE_BIT covers the earlier writes the prior type-specific mask missed, and the transfer/host-read destination scope matches the queued GPU labels and CPU pollers. The forced in-place limitation remains explicitly recorded in technical debt. The test reads destination bytes as soon as the label is observed, which exercises the ordering guarantee directly. The PR provides same-machine main/change runs with validation enabled, plus the Intel Arc reproduction data in #10199; hosted conventions, Windows, and Linux checks are green where configured. Approved.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5666503856 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11886#pullrequestreview-5666503856). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T11:43:23Z. **Review:** APPROVED --- I reviewed the submit-time barrier scope and the regression. `VK_PIPELINE_STAGE_ALL_COMMANDS_BIT` with `VK_ACCESS_MEMORY_WRITE_BIT` covers the earlier writes the prior type-specific mask missed, and the transfer/host-read destination scope matches the queued GPU labels and CPU pollers. The forced in-place limitation remains explicitly recorded in technical debt. The test reads destination bytes as soon as the label is observed, which exercises the ordering guarantee directly. The PR provides same-machine `main`/change runs with validation enabled, plus the Intel Arc reproduction data in #10199; hosted conventions, Windows, and Linux checks are green where configured. Approved.
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!11886
No description provided.