fix(shader): take the LDS lock with one attempt per loop iteration #2800

Closed
ThatsLeo wants to merge 1 commit from upstream-pr/2800 into main
ThatsLeo commented 2026-10-10 15:30:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ThatsLeo on 2026-10-10T15:30:20Z.


What

The 64-bit LDS atomic lock let the elected lane spin in an inner loop until its compare-exchange succeeded. With the LDS in a storage buffer (#1776, LDS beyond the device's shared memory limit), that loop never ended on Intel Arc (Meteor Lake, Mesa 26.2.3 ANV, shaderSharedInt64Atomics 0): agc_driver_lds_beyond_device_limit lost the device (VK_ERROR_DEVICE_LOST) in its first run. The same lock in workgroup memory (agc_driver_lds_atomics64) passes there.

  • The elected lane tries the compare-exchange once. On failure it is not served, and the existing outer loop, which runs until the ballot finds no pending lane, elects again. The update and its result are unchanged; no instruction semantics change.

Dropping the lock removes the hang, so the lock is the cause. A device-scope compare-exchange and release, and an atomic initial store of the lock, did not help. Why ANV does not finish the inner loop is not established.

Tested

Fedora 44, GCC 16.2.1, Release.

  • All 12 agc_driver_lds* tests pass 3 of 3 runs on Intel Arc; the LDS and atomic tests pass on lavapipe.
  • Full ctest on main (5edae353) and on this branch, on Intel Arc and lavapipe: Intel Arc 9 failures on main, 8 here; lavapipe 4 and 4; no new failure. The remaining failures also fail on main: on Intel Arc agc_driver_mesh, agc_driver_f64_fma_subnormals, agc_driver_vop1_float_unary, agc_driver_vopc_compare, agc_pipeline_cache and, on Fedora's non-PIE GCC, guest_dynamic_loader, guest_unwind_module_info and guest_unwind_module_info_failure; on lavapipe agc_driver_f64_fma_subnormals and guest_dynamic_loader, guest_unwind_module_info and guest_unwind_module_info_failure.

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 (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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4812334011 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2800). Originally posted by [ThatsLeo](https://github.com/ThatsLeo) on 2026-10-10T15:30:20Z. --- ### What The 64-bit LDS atomic lock let the elected lane spin in an inner loop until its compare-exchange succeeded. With the LDS in a storage buffer (#1776, LDS beyond the device's shared memory limit), that loop never ended on Intel Arc (Meteor Lake, Mesa 26.2.3 ANV, `shaderSharedInt64Atomics` 0): `agc_driver_lds_beyond_device_limit` lost the device (`VK_ERROR_DEVICE_LOST`) in its first run. The same lock in workgroup memory (`agc_driver_lds_atomics64`) passes there. - The elected lane tries the compare-exchange once. On failure it is not served, and the existing outer loop, which runs until the ballot finds no pending lane, elects again. The update and its result are unchanged; no instruction semantics change. Dropping the lock removes the hang, so the lock is the cause. A device-scope compare-exchange and release, and an atomic initial store of the lock, did not help. Why ANV does not finish the inner loop is not established. ### Tested Fedora 44, GCC 16.2.1, Release. - All 12 `agc_driver_lds*` tests pass 3 of 3 runs on Intel Arc; the LDS and atomic tests pass on lavapipe. - Full `ctest` on `main` (`5edae353`) and on this branch, on Intel Arc and lavapipe: Intel Arc 9 failures on `main`, 8 here; lavapipe 4 and 4; no new failure. The remaining failures also fail on `main`: on Intel Arc `agc_driver_mesh`, `agc_driver_f64_fma_subnormals`, `agc_driver_vop1_float_unary`, `agc_driver_vopc_compare`, `agc_pipeline_cache` and, on Fedora's non-PIE GCC, `guest_dynamic_loader`, `guest_unwind_module_info` and `guest_unwind_module_info_failure`; on lavapipe `agc_driver_f64_fma_subnormals` and `guest_dynamic_loader`, `guest_unwind_module_info` and `guest_unwind_module_info_failure`. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
github-actions[bot] commented 2026-10-10 15:30:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T15:30:29Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6099114859 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2800#issuecomment-6099114859). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T15:30:29Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

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