test(agc): gate queued count-indirect case on device support #20528

Merged
kali113 merged 1 commit from upstream-pr/20528 into main 2026-11-28 07:46:53 +00:00
kali113 commented 2026-11-15 08:33:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kali113 on 2026-11-15T08:33:52Z.


What

agc_driver_queued_indirect_read_order expects its indirect argument and count reads to stay queued while a preceding image write is pending. Without VK_KHR_draw_indirect_count, the count case takes the driver's CPU feature-gap path, so its queued-read assertion is not applicable. On MoltenVK it reports that the queued draw holds no argument read and aborts during shutdown.

Read DrawIndirectSupport().count from the test device and run that case only when supported. The ordinary indirect case still runs, and an omitted count case prints an explicit message. The packet requests at most one draw, so it does not require multi-draw support. Neighbouring indirect tests also inspect DrawIndirectSupport() for their capability-dependent checks.

This is a test correction. The CPU fallback's ordering and count-clamping gaps remain; no driver behaviour changes. The supported count-indirect path is unchanged and was not exercised on this GPU.

Tested

  • Apple M5 Pro, macOS 27.3 (26C5035r), MoltenVK 1.4.2, LunarG Vulkan SDK 1.4.363.1; Apple clang 21.0.0, x86_64 Release under Rosetta, BUILD_TESTING=ON.
  • Clean build of the focused target from main 324dc5aae5, then rebuild with this change. No other PRs applied.
  • ctest -R '^agc_driver_queued_indirect_read_order$' -V -j 1: baseline fails in 3/3 runs; change passes in 3/3 runs, with the ordinary case executed and the count case explicitly omitted.
  • Both sides use ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, and VK_LOADER_DEBUG=layer. Every log confirms insertion of validation layer 1.4.363; none reports a missing requested layer or any VUID- error.
  • An additional baseline trace selects the GPU path for DRAW_INDIRECT and cpu (feature gap) for the count-indirect packet. The patched trace retains the ordinary GPU path.
  • python3 tools/check_conventions.py --base origin/main and git diff --check pass.
  • No Linux, Windows or title run.

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: Apple M5 Pro, MoltenVK 1.4.2 (SDK 1.4.363.1), macOS 27.3 (26C5035r)
  • AI-assisted: yes (Claude Code; verified and continued with Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5321000034 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20528). Originally posted by [kali113](https://github.com/kali113) on 2026-11-15T08:33:52Z. --- ### What `agc_driver_queued_indirect_read_order` expects its indirect argument and count reads to stay queued while a preceding image write is pending. Without `VK_KHR_draw_indirect_count`, the count case takes the driver's CPU feature-gap path, so its queued-read assertion is not applicable. On MoltenVK it reports that the queued draw holds no argument read and aborts during shutdown. Read `DrawIndirectSupport().count` from the test device and run that case only when supported. The ordinary indirect case still runs, and an omitted count case prints an explicit message. The packet requests at most one draw, so it does not require multi-draw support. Neighbouring indirect tests also inspect `DrawIndirectSupport()` for their capability-dependent checks. This is a test correction. The CPU fallback's ordering and count-clamping gaps remain; no driver behaviour changes. The supported count-indirect path is unchanged and was not exercised on this GPU. ### 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. --> - Apple M5 Pro, macOS 27.3 (26C5035r), MoltenVK 1.4.2, LunarG Vulkan SDK 1.4.363.1; Apple clang 21.0.0, x86_64 Release under Rosetta, `BUILD_TESTING=ON`. - Clean build of the focused target from `main` `324dc5aae5`, then rebuild with this change. No other PRs applied. - `ctest -R '^agc_driver_queued_indirect_read_order$' -V -j 1`: baseline fails in 3/3 runs; change passes in 3/3 runs, with the ordinary case executed and the count case explicitly omitted. - Both sides use `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, and `VK_LOADER_DEBUG=layer`. Every log confirms insertion of validation layer 1.4.363; none reports a missing requested layer or any `VUID-` error. - An additional baseline trace selects the GPU path for `DRAW_INDIRECT` and `cpu (feature gap)` for the count-indirect packet. The patched trace retains the ordinary GPU path. - `python3 tools/check_conventions.py --base origin/main` and `git diff --check` pass. - No Linux, Windows or title run. ### 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: Apple M5 Pro, MoltenVK 1.4.2 (SDK 1.4.363.1), macOS 27.3 (26C5035r) - [x] AI-assisted: yes (Claude Code; verified and continued with Codex)
copilot-pull-request-reviewer[bot] commented 2026-11-15 08:34:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-15T08:34:00Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5909864696 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20528#pullrequestreview-5909864696). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-15T08:34:00Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
MarcZX10 commented 2026-11-15 09:08:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T09:08:17Z.

Review: APPROVED


Reviewed — looks good

The change gates the count-indirect test on device support while retaining the ordinary indirect case; I found no blocking defect in the changed code.

What I ran

Reviewed head 1df7763ed5010688897aebae03cbfe7d06849bb8. I read the prepared description, commit list, manifest, diff, and the complete changed file. I did not run commands or tests; repo_read.py was unavailable as a command tool.

Results

Check Result Note
Changed-code review passed Guard follows reported device capability
Tests not run Results in description are author-reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

Did not independently verify the author-reported build, CTest runs, convention check, or git diff --check. No other files were changed according to the manifest; the only changed file was read in full. No excluded changed files were listed.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5909980101 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20528#pullrequestreview-5909980101). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-15T09:08:17Z. **Review:** APPROVED --- # Reviewed — looks good The change gates the count-indirect test on device support while retaining the ordinary indirect case; I found no blocking defect in the changed code. ## What I ran Reviewed head `1df7763ed5010688897aebae03cbfe7d06849bb8`. I read the prepared description, commit list, manifest, diff, and the complete changed file. I did not run commands or tests; `repo_read.py` was unavailable as a command tool. ## Results | Check | Result | Note | |---|---|---| | Changed-code review | passed | Guard follows reported device capability | | Tests | not run | Results in description are author-reported | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Did not independently verify the author-reported build, CTest runs, convention check, or `git diff --check`. No other files were changed according to the manifest; the only changed file was read in full. No excluded changed files were listed. ## To get this to a good state Nothing is required.
kurexw commented 2026-11-17 03:23:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kurexw on 2026-11-17T03:23:21Z.

Review: COMMENTED


Tested on an Apple M4 (macOS 27.2, MoltenVK 1.4.2 from the LunarG SDK 1.4.363.1, x86-64 build under Rosetta).

This PR merges cleanly. I tested main at 939d3630ed against this PR's commit merged onto it. I tested commit 8cdf291c9f; the current head 1df7763ed5 has the identical patch, rebased. Both sides built apart from libcurl.prx (#17425) and TimeGetFields.cpp, which fails identically on both sides.

The test set is the 29 agc_driver_* tests that fail on main on this Mac. Environment: ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, three runs per side. Every test process logged Insert instance layer "VK_LAYER_KHRONOS_validation" (layer 1.4.363), and none logged the missing-layer message.

main (3 runs) this PR (3 runs)
agc_driver_queued_indirect_read_order Subprocess aborted Passed
the other 28 Failed, identical Failed, identical
VUID- lines per run 10 10
  • On main, the count-indirect case logs AGC graphics: queued indirect read: the queued draw holds no read of its indirect argument range. MoltenVK then loses the device (VK_ERROR_OUT_OF_DEVICE_MEMORY ... kIOGPUCommandBufferCallbackErrorInnocentVictim), and the test aborts with vkWaitForFences graphics: Vulkan result -4.
  • With this PR, the first case passes, and the second logs skipped, the count-indirect draw needs VK_KHR_draw_indirect_count, which this device lacks.
  • The 10 VUID- lines are the same on both sides: 4 VUID-VkDeviceCreateInfo-sType-unique (from Recorder.cpp, addressed by #21965) and 6 VUID-VkSamplerCreateInfo-samplerMipLodBias-04467.

Overlap: #21059 (which conflicts with main in Draw.cpp) also edits QueuedIndirectReadOrder.cpp. At its own merge-base on this M4, it runs the count-indirect case instead of skipping it: the driver reads the arguments on the CPU, and the test checks the result. That way the case keeps checking something on devices without drawIndirectCount. If #21059 lands, this skip may no longer be needed.

I didn't test this on Linux, Windows or another GPU vendor.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5932264227 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20528#pullrequestreview-5932264227). Originally posted by [kurexw](https://github.com/kurexw) on 2026-11-17T03:23:21Z. **Review:** COMMENTED --- Tested on an Apple M4 (macOS 27.2, MoltenVK 1.4.2 from the LunarG SDK 1.4.363.1, x86-64 build under Rosetta). This PR merges cleanly. I tested `main` at 939d3630ed against this PR's commit merged onto it. I tested commit 8cdf291c9f; the current head 1df7763ed5 has the identical patch, rebased. Both sides built apart from `libcurl.prx` (#17425) and `TimeGetFields.cpp`, which fails identically on both sides. The test set is the 29 `agc_driver_*` tests that fail on `main` on this Mac. Environment: `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, three runs per side. Every test process logged `Insert instance layer "VK_LAYER_KHRONOS_validation"` (layer 1.4.363), and none logged the missing-layer message. | | main (3 runs) | this PR (3 runs) | | --- | --- | --- | | `agc_driver_queued_indirect_read_order` | Subprocess aborted | Passed | | the other 28 | Failed, identical | Failed, identical | | `VUID-` lines per run | 10 | 10 | - On `main`, the count-indirect case logs `AGC graphics: queued indirect read: the queued draw holds no read of its indirect argument range`. MoltenVK then loses the device (`VK_ERROR_OUT_OF_DEVICE_MEMORY ... kIOGPUCommandBufferCallbackErrorInnocentVictim`), and the test aborts with `vkWaitForFences graphics: Vulkan result -4`. - With this PR, the first case passes, and the second logs `skipped, the count-indirect draw needs VK_KHR_draw_indirect_count, which this device lacks`. - The 10 `VUID-` lines are the same on both sides: 4 `VUID-VkDeviceCreateInfo-sType-unique` (from `Recorder.cpp`, addressed by #21965) and 6 `VUID-VkSamplerCreateInfo-samplerMipLodBias-04467`. Overlap: #21059 (which conflicts with `main` in `Draw.cpp`) also edits `QueuedIndirectReadOrder.cpp`. At its own merge-base on this M4, it runs the count-indirect case instead of skipping it: the driver reads the arguments on the CPU, and the test checks the result. That way the case keeps checking something on devices without `drawIndirectCount`. If #21059 lands, this skip may no longer be needed. I didn't test this on Linux, Windows or another GPU vendor.
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!20528
No description provided.