Skip to content

fix(agc): name the mesh limit a pipeline exceeds and its values - #11065

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
morten-holm:fix/agc-mesh-limit-details
Oct 27, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
morten-holm:fix/agc-mesh-limit-details

Conversation

@morten-holm

Copy link
Copy Markdown
Contributor

What

The mesh pipeline check used one message for three limits. The message was mesh output or LDS exceeds device limits. It did not show which limit failed. It did not show the values.

This change moves the check to ValidateMeshLimits. The function checks four limits separately: the workgroup size, the output vertices, the output primitives, and the LDS size. Each failure names the limit. It shows the value of the shader and the value of the device.

Example: mesh LDS 12288 bytes exceeds the device shared memory limit 12284.

The conditions do not change. The same pipelines are accepted. The same pipelines are rejected. Only the text of the error changes.

A shader of PPSA21567 asked for 12288 bytes of LDS. MoltenVK reported a limit of 12284 bytes. The old message did not show this difference.

meshLimitTests in core/libs/prx/libSceAgcDriver/tests/Graphics.cpp tests the function. For each limit it checks one value over the limit and one value at the limit.

Tested

macOS, Apple M2, x86-64 build under Rosetta 2, Release.

main does not build libc on macOS, because link.h is not found. The test ran in a separate tree that has local macOS patches and the same diff.

The test sets the limits in a Context structure. It does not create a Vulkan device. It did not run with VK_LAYER_KHRONOS_validation.

Not tested: Linux, Windows, a draw on a GPU.

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: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

The mesh pipeline check rejected a shader with one message for three
limits, so a shader 4 bytes over the shared memory limit could not be told
from one with too many output vertices. ValidateMeshLimits checks the
workgroup, output vertices, output primitives and LDS size separately and
names the limit and both values.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The refactor preserves the existing limit predicates and the added boundary tests cover each reported limit. I cannot approve yet because the repository requires the focused AGC tests on both main and this head with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, including comparison of VUID- diagnostics. The PR reports a local agc_driver_graphics_tests run, but not that main-versus-change validation comparison; hosted checks skip the AGC targets. Please report the test command, OS/GPU/driver, confirm the validation layer loaded in both logs, and note any new VUIDs. I have not reproduced a runtime defect in this diff.

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1395 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6194 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6481 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6804 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6959 core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6970 core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7256 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7275 core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
PR 7310 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7410 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8395 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9020 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9335 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9356 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9387 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9489 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9675 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9748 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9897 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10049 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10348 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10435 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10556 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 11265 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
PR 11557 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp

@ycbuzi

ycbuzi commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

A Windows run of this head: Windows 11 Home 10.0.26200, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release. 708cc2260d merged onto main 7e4f6e0440 with no conflicts.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added the agc libSceAgc* label Oct 25, 2026

@klosixgaming-arch klosixgaming-arch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 708cc2260d by reading the diff and the existing review thread. I did not build or run this, so everything below is from the code, not from a test of mine.

What it does. Pulls the mesh-limit checks out of the Pipeline constructor into ValidateMeshLimits, with one Require per limit and a message that names the limit and both values. The conditions are the same four as before (invocations against both maxMeshWorkGroupInvocations and maxMeshWorkGroupSize[0], output vertices, output primitives, LDS bytes).

Checked each predicate against the old code: invocations are <= both limits as before, maxVertices/maxPrimitives are <=, and LDS is ldsSizeDwords * 4 widened to 64-bit before the multiply, same as the old expression. The new meshLimitTests hits both sides of every boundary with numbers that do not coincide (96/97, 256/257, 512/513, 3071/3072 dwords against 12284 bytes), so an off-by-one would show.

Useful for the open blockers: the old message was a bare "mesh workgroup exceeds device limits", which is hard to act on. The new one prints the pipeline's value and the device limit, which is what you need to tell whether a title is asking for something the device cannot do or whether the limit query is wrong.

Nits: the meshLimitTests fixture constructs MeshConfiguration with nine positional initialisers; a designated-field style would survive a reordering of that struct. The process requirement MarcZX10 raised (a main-versus-head run with validation layers) is real, and ycbuzi's Windows run in the thread covers the build; I'd still want that evidence recorded in the description.

Approving: it is a behaviour-preserving refactor with better diagnostics and boundary tests.

AI-assisted: yes. Written with AI assistance and reviewed by me.

@morten-holm

Copy link
Copy Markdown
Contributor Author

I ran the focused mesh test on main and on this head, on the same machine: macOS 27.0.1, Apple M2, MoltenVK (the #2842 build with a local patch that adds the mesh stage to the subgroup supported stages). The process is x86-64 under Rosetta, so I built the Khronos validation layer v1.4.363 for x86-64. Both runs used base 0a77bbf18c.

Command: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation agc_driver_mesh_tests

  • The layer loaded in both runs. Neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS.
  • Both runs log the same two VUID-VkDeviceCreateInfo-pProperties-04451 messages. This PR adds no new VUID-.
  • Both runs stop at the same check: indexed triangle list, one-wave subgroups: triangle 0 was not rendered in its color. The failure is the same on main, so this PR does not cause it.
  • As ycbuzi noted, agc_driver_graphics_tests creates no Vulkan device, so validation does not apply to it.

This change adds host-side checks and error text. It makes no Vulkan calls.

AI-assisted: yes (Claude Code)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@adriadam10 adriadam10 self-assigned this Oct 27, 2026
@adriadam10
adriadam10 dismissed MarcZX10’s stale review October 27, 2026 01:40

Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.

@adriadam10
adriadam10 merged commit 83370fe into boykopovar:main Oct 27, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked that the four predicates in ValidateMeshLimits match the old two Requires (invocations against both limits, vertices, primitives, LDS dwords * 4 widened to 64 bit), that meshLimitTests hits both sides of every boundary and could not build without the change, and that the designated initialisers follow the order of MeshConfiguration. The validation-layer main-versus-head run requested earlier is in the thread; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants