fix(agc): continue a direct mesh draw past the X group limit in Z #13894

Merged
hugodearaujo merged 3 commits from upstream-pr/13894 into main 2026-11-01 09:10:32 +00:00
hugodearaujo commented 2026-10-31 11:34:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-31T11:34:01Z.


What

A direct draw on the mesh path runs one mesh workgroup per primitivesPerGroup primitives, all in X: vkCmdDrawMeshTasksEXT(groups, instances, 1). When groups is over maxMeshWorkGroupCount[0], the draw stops the title:

[videoout] presentation failed: AGC graphics: mesh draw exceeds workgroup count limits
terminate called after throwing an instance of 'std::runtime_error'
  what():  AGC graphics: mesh draw exceeds workgroup count limits

RADV reports 65,535 for X, Y and Z and 4,194,304 in total. A fast-launch point list (one primitive and one vertex per group) of more than 65,535 points is enough to hit it.

The change. Groups past the X limit go on in Z:

  • MeshGridFor takes layers = ceil(groups / maxX) and columns = ceil(groups / layers), so the groups spread evenly and at most layers - 1 groups are spare. When the draw needs layers, a layer holds at most 65,535 groups even on a device whose X limit is higher, so the stride below fits in 16 bits. Instances stay in Y. A grid that is over the Z limit or the total limit still stops the draw with the same message; the total is checked by dividing the limit, so the product of the three factors can't wrap. A draw with no instances keeps its split and dispatches zero Y groups, as before.
  • The draw pushes the layer stride (the groups per layer, or 0 when the draw is in one layer) in the upper 16 bits of the mesh draw's index word, which holds only the index size and the restart-table bit. The mesh prologue numbers its group WorkgroupId.x + WorkgroupId.z * stride and computes the group's first primitive from it, so the primitive index (and the index or vertex it reads) follows. A draw in one layer pushes 0, so its number is WorkgroupId.x whatever the device reports for the other components; the mesh program reads NumWorkgroups only where main already did.
  • A spare group's first primitive is past the draw's last one, so its vertex count clamps to 0 and it emits no primitive.
  • Every draw with groups <= maxX, every indirect draw and every draw of captured tessellation output pushes a stride of 0 and gets the same number as before.

Not changed: indirect mesh draws (CPU-read and GPU-resolved records) still draw nothing when a record needs more groups than X allows, as ResolveMeshArguments and its tests state.

Tested

Arch Linux, RX 9070 XT, RADV (Mesa 26.2.6), Release:

  • CONTROL Resonant (PPSA34547), main de83e8f270 + #11580 + #12458 (the title needs both to reach gameplay). In the opening room, holding L1 at the pillar stops the title within seconds, in 2 of 2 runs (886 s and 541 s after launch). A diagnostic build that printed the draw at the stop showed:

    groups 294456 instances 1 indexCount 294456 primitives 294456 primitivesPerGroup 1 verticesPerGroup 1 inputPrimitive 1 indexed 0 fastLaunch 1 limits 65535/65535/4194304
    

    With this change cherry-picked onto the same build (together with a one-line fault-report change that only touches BdaResources::CheckFault), the second run held L1 at the pillar with no stop, went through the cutscene that follows, the "Choose your Aberrant form" prompt and the walk out of the containment cell ("Orientation: Leave the Oldest House"), and ran its full 1,500 s with nothing from amdgpu in the kernel log. The first run of that build never reached the pillar: the GPU ring timed out during the opening cutscene, 309 s after launch (ring gfx_0.0.0 timeout, the ring reset succeeded; the AGC markers name an unfinished compute dispatch, program 0x1004260100). None of the three runs without this change hung there, and the change does reach every mesh program (at e011e34ad7 each one read NumWorkgroups.x; it now reads WorkgroupId.z and the pushed stride instead), so I can't rule out a link. I've seen it once.

  • agc_driver_mesh: a new non-indexed fast-launch draw of 65,575 one-primitive groups, 65,535 degenerate ones followed by the test's 40 triangles, checks that the 40 triangles are drawn. On RADV it takes two layers of 32,788 groups (one spare). With main's Draw.cpp and Draw.hpp, it fails with mesh draw exceeds workgroup count limits; with the pushed stride forced to 0, it fails with fast-launch draw of 65,575 one-primitive groups: triangle 0 was not rendered in its color, pixel (16, 24, 40, 255).

  • agc_driver_graphics: MeshGridFor against made-up limits (X 1,000, Y 600, Z 3 or 10, total 4,000): one layer at the X limit with a stride of 0 (also for 1 group and for 999 groups with 3 instances), an even split over two and three layers with the stride equal to the columns, instances kept in Y, zero instances keeping the split, and no grid past the Z limit, the total limit or the Y limit, or for zero groups. With the GTX 1650's limits below (X and total 4,194,304), 65,575 and 4,194,304 groups stay in one layer with a stride of 0 and 4,194,305 are refused. With an X limit of 100,000, 100,000 groups stay in one layer and 100,001 and 196,605 groups split into layers of 50,001 and 65,535. A product past 64 bits (X 800,000,000, Y, Z and total 4,294,967,295, 4,294,967,295 groups and instances) is refused.

  • NVIDIA report (GTX 1650, below). At e011e34ad7 the shader read NumWorkgroups.x and WorkgroupId.z at the start of every mesh program, and the first mesh draw failed on that GPU. I dumped the SPIR-V of the test's 43 mesh programs at e011e34ad7 and on this head, for RADV's target and for a 32-lane subgroup target like NVIDIA's (the first program): spirv-val --target-env vulkan1.3 accepts all of them (SPIR-V 1.4, gl_NumWorkGroups and gl_WorkGroupID are v3uint Input variables in the OpEntryPoint interface, with their BuiltIn decorations). With a Z count of 1, WorkgroupId.z is 0 by the spec and the old expression equals x whatever NumWorkgroups.x holds, so on that driver the mesh program must have seen a non-zero WorkgroupId.z, or the driver compiled the two reads differently from the spec; I can't tell which without the hardware. This head stops depending on them: a draw in one layer multiplies WorkgroupId.z by a pushed 0, and a device whose X limit equals its total limit (as on that GPU) never splits a draw.

  • Validation layer, e011e34ad7 against 7806d47120, same machine, same settings and test list as below: 11 of 11 pass on each, the loader inserted the layer 15 times on each, no was not found but was requested line and no VUID- message on either.

  • Validation layer, main c3c45d73ab against this branch, same machine, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, VK_LOADER_DEBUG=layer, ctest -V on agc_driver_graphics, agc_driver_mesh, agc_mesh_output_budget, agc_driver_mesh_barycentric_emulation, agc_driver_mesh_draw_relocation, agc_driver_mesh_index_cache, agc_driver_mesh_provoking_layer, agc_driver_mesh_provoking_vertex, agc_driver_mesh_vector_window_waves, agc_driver_tessellation and agc_driver_tessellation_geometry: 11 of 11 pass on each tree, the loader inserted the layer 15 times on each, no was not found but was requested line and no VUID- message on either. main runs its own agc_driver_mesh, without the new draw.

Only RADV was tested on this head. A device whose X limit is above 65,575 draws the new test case in one layer, so it checks the draw but not the split.

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: PPSA34547 #7302, the mesh workgroup limit stop at the first pillar
  • GPUs tested: AMD Radeon RX 9070 XT, RADV (Mesa 26.2.6), Arch Linux (kernel 7.2.11)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5097127336 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13894). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-10-31T11:34:01Z. --- ### What A direct draw on the mesh path runs one mesh workgroup per `primitivesPerGroup` primitives, all in X: `vkCmdDrawMeshTasksEXT(groups, instances, 1)`. When `groups` is over `maxMeshWorkGroupCount[0]`, the draw stops the title: ``` [videoout] presentation failed: AGC graphics: mesh draw exceeds workgroup count limits terminate called after throwing an instance of 'std::runtime_error' what(): AGC graphics: mesh draw exceeds workgroup count limits ``` RADV reports 65,535 for X, Y and Z and 4,194,304 in total. A fast-launch point list (one primitive and one vertex per group) of more than 65,535 points is enough to hit it. **The change.** Groups past the X limit go on in Z: - `MeshGridFor` takes `layers = ceil(groups / maxX)` and `columns = ceil(groups / layers)`, so the groups spread evenly and at most `layers - 1` groups are spare. When the draw needs layers, a layer holds at most 65,535 groups even on a device whose X limit is higher, so the stride below fits in 16 bits. Instances stay in Y. A grid that is over the Z limit or the total limit still stops the draw with the same message; the total is checked by dividing the limit, so the product of the three factors can't wrap. A draw with no instances keeps its split and dispatches zero Y groups, as before. - The draw pushes the layer stride (the groups per layer, or 0 when the draw is in one layer) in the upper 16 bits of the mesh draw's index word, which holds only the index size and the restart-table bit. The mesh prologue numbers its group `WorkgroupId.x + WorkgroupId.z * stride` and computes the group's first primitive from it, so the primitive index (and the index or vertex it reads) follows. A draw in one layer pushes 0, so its number is `WorkgroupId.x` whatever the device reports for the other components; the mesh program reads `NumWorkgroups` only where `main` already did. - A spare group's first primitive is past the draw's last one, so its vertex count clamps to 0 and it emits no primitive. - Every draw with `groups <= maxX`, every indirect draw and every draw of captured tessellation output pushes a stride of 0 and gets the same number as before. **Not changed:** indirect mesh draws (CPU-read and GPU-resolved records) still draw nothing when a record needs more groups than X allows, as `ResolveMeshArguments` and its tests state. ### Tested Arch Linux, RX 9070 XT, RADV (Mesa 26.2.6), Release: - **CONTROL Resonant (PPSA34547)**, `main` de83e8f270 + #11580 + #12458 (the title needs both to reach gameplay). In the opening room, holding L1 at the pillar stops the title within seconds, in 2 of 2 runs (886 s and 541 s after launch). A diagnostic build that printed the draw at the stop showed: ``` groups 294456 instances 1 indexCount 294456 primitives 294456 primitivesPerGroup 1 verticesPerGroup 1 inputPrimitive 1 indexed 0 fastLaunch 1 limits 65535/65535/4194304 ``` With this change cherry-picked onto the same build (together with a one-line fault-report change that only touches `BdaResources::CheckFault`), the second run held L1 at the pillar with no stop, went through the cutscene that follows, the "Choose your Aberrant form" prompt and the walk out of the containment cell ("Orientation: Leave the Oldest House"), and ran its full 1,500 s with nothing from amdgpu in the kernel log. The first run of that build never reached the pillar: the GPU ring timed out during the opening cutscene, 309 s after launch (`ring gfx_0.0.0 timeout`, the ring reset succeeded; the AGC markers name an unfinished compute dispatch, program 0x1004260100). None of the three runs without this change hung there, and the change does reach every mesh program (at `e011e34ad7` each one read `NumWorkgroups.x`; it now reads `WorkgroupId.z` and the pushed stride instead), so I can't rule out a link. I've seen it once. - `agc_driver_mesh`: a new non-indexed fast-launch draw of 65,575 one-primitive groups, 65,535 degenerate ones followed by the test's 40 triangles, checks that the 40 triangles are drawn. On RADV it takes two layers of 32,788 groups (one spare). With `main`'s `Draw.cpp` and `Draw.hpp`, it fails with `mesh draw exceeds workgroup count limits`; with the pushed stride forced to 0, it fails with `fast-launch draw of 65,575 one-primitive groups: triangle 0 was not rendered in its color, pixel (16, 24, 40, 255)`. - `agc_driver_graphics`: `MeshGridFor` against made-up limits (X 1,000, Y 600, Z 3 or 10, total 4,000): one layer at the X limit with a stride of 0 (also for 1 group and for 999 groups with 3 instances), an even split over two and three layers with the stride equal to the columns, instances kept in Y, zero instances keeping the split, and no grid past the Z limit, the total limit or the Y limit, or for zero groups. With the GTX 1650's limits below (X and total 4,194,304), 65,575 and 4,194,304 groups stay in one layer with a stride of 0 and 4,194,305 are refused. With an X limit of 100,000, 100,000 groups stay in one layer and 100,001 and 196,605 groups split into layers of 50,001 and 65,535. A product past 64 bits (X 800,000,000, Y, Z and total 4,294,967,295, 4,294,967,295 groups and instances) is refused. - **NVIDIA report (GTX 1650, below).** At `e011e34ad7` the shader read `NumWorkgroups.x` and `WorkgroupId.z` at the start of every mesh program, and the first mesh draw failed on that GPU. I dumped the SPIR-V of the test's 43 mesh programs at `e011e34ad7` and on this head, for RADV's target and for a 32-lane subgroup target like NVIDIA's (the first program): `spirv-val --target-env vulkan1.3` accepts all of them (SPIR-V 1.4, `gl_NumWorkGroups` and `gl_WorkGroupID` are `v3uint` Input variables in the `OpEntryPoint` interface, with their `BuiltIn` decorations). With a Z count of 1, `WorkgroupId.z` is 0 by the spec and the old expression equals `x` whatever `NumWorkgroups.x` holds, so on that driver the mesh program must have seen a non-zero `WorkgroupId.z`, or the driver compiled the two reads differently from the spec; I can't tell which without the hardware. This head stops depending on them: a draw in one layer multiplies `WorkgroupId.z` by a pushed 0, and a device whose X limit equals its total limit (as on that GPU) never splits a draw. - **Validation layer, `e011e34ad7` against `7806d47120`**, same machine, same settings and test list as below: 11 of 11 pass on each, the loader inserted the layer 15 times on each, no `was not found but was requested` line and no `VUID-` message on either. - **Validation layer, `main` c3c45d73ab against this branch**, same machine, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `VK_LOADER_DEBUG=layer`, `ctest -V` on `agc_driver_graphics`, `agc_driver_mesh`, `agc_mesh_output_budget`, `agc_driver_mesh_barycentric_emulation`, `agc_driver_mesh_draw_relocation`, `agc_driver_mesh_index_cache`, `agc_driver_mesh_provoking_layer`, `agc_driver_mesh_provoking_vertex`, `agc_driver_mesh_vector_window_waves`, `agc_driver_tessellation` and `agc_driver_tessellation_geometry`: 11 of 11 pass on each tree, the loader inserted the layer 15 times on each, no `was not found but was requested` line and no `VUID-` message on either. `main` runs its own `agc_driver_mesh`, without the new draw. Only RADV was tested on this head. A device whose X limit is above 65,575 draws the new test case in one layer, so it checks the draw but not the split. ### 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: none - [x] Unblocks: PPSA34547 #7302, the mesh workgroup limit stop at the first pillar - [x] GPUs tested: AMD Radeon RX 9070 XT, RADV (Mesa 26.2.6), Arch Linux (kernel 7.2.11) - [x] AI-assisted: yes
MarcZX10 commented 2026-10-31 11:36:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T11:36:29Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The new direct-mesh grid path turns a zero-instance draw into an exception, although the previous path dispatched zero Y workgroups.

What I ran

Reviewed head aa836fbcf7ddb6a9856cdd56f4c667c4cca5f7d9 against base cbed91529193c47194bef11811906c7cb6054af1; the merge preview was clean against that base. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. No build or C++ test was run.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13894
git diff --check cbed91529193c47194bef11811906c7cb6054af1...aa836fbcf7ddb6a9856cdd56f4c667c4cca5f7d9
python3 tools/check_conventions.py --base cbed91529193c47194bef11811906c7cb6054af1 --head aa836fbcf7ddb6a9856cdd56f4c667c4cca5f7d9 --title 'fix(agc): continue a direct mesh draw past the X group limit in Z' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13894-aa836fbcf7dd/pr-body.md
python3 tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13894-aa836fbcf7dd/head-aa836fbcf7dd-b7a9ae92 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp core/libs/prx/libSceAgcDriver/tests/Mesh.cpp

Results

Check Result
Diff whitespace Passed
Conventions and PR template Passed
Dependency and merge preview Passed; clean against current main at cbed91529193c47194bef11811906c7cb6054af1
Test-quality heuristic Warned that the changed C++ tests may be unregistered; manually confirmed Graphics.cpp and Mesh.cpp are listed in core/libs/prx/libSceAgcDriver/CMakeLists.txt
Exact-head C++ tests Not run; they require a build
Hosted CI Intake, conventions, eligibility, labels, and library portability passed; progress report and Windows/relinker jobs were in progress; Linux and specialized jobs were skipped
Precheck helper availability ABI and test-quality helper copies were absent from the isolated PR checkout; the ABI audit is not relevant to these files, and I ran the test-quality helper from the workspace separately
Unedited local check output
diff-check exit=0
All conventions checks passed.
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage.
core/libs/prx/libSceAgcDriver/tests/Mesh.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage.
Heuristic findings require manual interpretation.

Negative control

Assertion Change to code under test Did the test fail?
Oversized direct mesh draw is rejected on the base implementation The PR author reports running the new GPU case against base Draw.cpp Yes, reported failure: mesh draw exceeds workgroup count limits; not independently run by me
Shader numbering maps the extra Z layer to later workgroups The PR author reports reverting only the shader numbering change Yes, reported failure: triangle 0 was not rendered in its color; not independently run by me

Findings

Blocking

A direct mesh draw with draw.instanceCount == 0 now gets {0, 0, 0} from MeshGridFor, then fails Require(grid.groups != 0) before recording the draw. On the base, the code allowed the same case through its bounds checks and passed instanceCount as groupCountY, recording zero Y workgroups. This changes a no-work draw into a runtime failure. Please preserve zero-instance draws as no-ops (for example, mark the prepared draw as nothing before the nonzero-grid check) and add a regression test for the preparation/dispatch path; the current helper-only test does not exercise this call-site behavior.

Non-blocking

The PR description reports an otherwise unexplained GPU ring timeout in one of two changed-build title runs, before the target mesh draw; I could not independently determine whether it is related. The other reported run and focused GPU tests pass, so this is not the basis for the requested changes.

Sources

Not verified

No local build, agc_driver_graphics, agc_driver_mesh, console behavior, or independent GPU/title run was performed. The GPU and validation-layer runs in the PR description are author-reported evidence, not local runs.

To get this to a good state

Please handle zero-instance direct mesh draws as no-ops and cover the caller path, then update the PR. I will rerun the same no-build checks and review the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5722546617 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13894#pullrequestreview-5722546617). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T11:36:29Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The new direct-mesh grid path turns a zero-instance draw into an exception, although the previous path dispatched zero Y workgroups. ## What I ran Reviewed head `aa836fbcf7ddb6a9856cdd56f4c667c4cca5f7d9` against base `cbed91529193c47194bef11811906c7cb6054af1`; the merge preview was clean against that base. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. No build or C++ test was run. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13894 git diff --check cbed91529193c47194bef11811906c7cb6054af1...aa836fbcf7ddb6a9856cdd56f4c667c4cca5f7d9 python3 tools/check_conventions.py --base cbed91529193c47194bef11811906c7cb6054af1 --head aa836fbcf7ddb6a9856cdd56f4c667c4cca5f7d9 --title 'fix(agc): continue a direct mesh draw past the X group limit in Z' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13894-aa836fbcf7dd/pr-body.md python3 tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13894-aa836fbcf7dd/head-aa836fbcf7dd-b7a9ae92 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp core/libs/prx/libSceAgcDriver/tests/Mesh.cpp ``` ## Results | Check | Result | |---|---| | Diff whitespace | Passed | | Conventions and PR template | Passed | | Dependency and merge preview | Passed; clean against current `main` at `cbed91529193c47194bef11811906c7cb6054af1` | | Test-quality heuristic | Warned that the changed C++ tests may be unregistered; manually confirmed `Graphics.cpp` and `Mesh.cpp` are listed in `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | Exact-head C++ tests | Not run; they require a build | | Hosted CI | Intake, conventions, eligibility, labels, and library portability passed; progress report and Windows/relinker jobs were in progress; Linux and specialized jobs were skipped | | Precheck helper availability | ABI and test-quality helper copies were absent from the isolated PR checkout; the ABI audit is not relevant to these files, and I ran the test-quality helper from the workspace separately | <details><summary>Unedited local check output</summary> ```text diff-check exit=0 All conventions checks passed. core/libs/prx/libSceAgcDriver/tests/Graphics.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage. core/libs/prx/libSceAgcDriver/tests/Mesh.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage. Heuristic findings require manual interpretation. ``` </details> ## Negative control | Assertion | Change to code under test | Did the test fail? | |---|---|---| | Oversized direct mesh draw is rejected on the base implementation | The PR author reports running the new GPU case against base `Draw.cpp` | Yes, reported failure: `mesh draw exceeds workgroup count limits`; not independently run by me | | Shader numbering maps the extra Z layer to later workgroups | The PR author reports reverting only the shader numbering change | Yes, reported failure: `triangle 0 was not rendered in its color`; not independently run by me | ## Findings ### Blocking A direct mesh draw with `draw.instanceCount == 0` now gets `{0, 0, 0}` from `MeshGridFor`, then fails `Require(grid.groups != 0)` before recording the draw. On the base, the code allowed the same case through its bounds checks and passed `instanceCount` as `groupCountY`, recording zero Y workgroups. This changes a no-work draw into a runtime failure. Please preserve zero-instance draws as no-ops (for example, mark the prepared draw as `nothing` before the nonzero-grid check) and add a regression test for the preparation/dispatch path; the current helper-only test does not exercise this call-site behavior. ### Non-blocking The PR description reports an otherwise unexplained GPU ring timeout in one of two changed-build title runs, before the target mesh draw; I could not independently determine whether it is related. The other reported run and focused GPU tests pass, so this is not the basis for the requested changes. ## Sources - [New grid helper and zero-instance return](https://github.com/boykopovar/AnyPS5/blob/aa836fbcf7ddb6a9856cdd56f4c667c4cca5f7d9/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L1207-L1213) - [Call site that turns the zero grid into an exception](https://github.com/boykopovar/AnyPS5/blob/aa836fbcf7ddb6a9856cdd56f4c667c4cca5f7d9/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L1528-L1536) - [Base behavior passed the instance count through to the draw](https://github.com/boykopovar/AnyPS5/blob/cbed91529193c47194bef11811906c7cb6054af1/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L1518-L1524) ## Not verified No local build, `agc_driver_graphics`, `agc_driver_mesh`, console behavior, or independent GPU/title run was performed. The GPU and validation-layer runs in the PR description are author-reported evidence, not local runs. ## To get this to a good state Please handle zero-instance direct mesh draws as no-ops and cover the caller path, then update the PR. I will rerun the same no-build checks and review the new head.
MarcZX10 commented 2026-10-31 12:23:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T12:23:23Z.

Review: APPROVED


Re-checked — new head, looks good

The updated grid preserves zero-instance draws and bounds the total-workgroup check without multiplication overflow, resolving both previously reported blockers.

What I ran

Reviewed exact head e011e34ad7e874fe147dcd599adb55d0abe7224a against PR base cbed91529193c47194bef11811906c7cb6054af1 and live main 60bdb061356db736928eee431cd8bd4c9ba68036. The current-main merge preview is clean (201e280a167756b08398995c236665a9dc800f41). Environment: Linux x86-64, GCC 12.2.0, Python 3.11.2. I did not build locally or run C++ tests.

git merge-tree --write-tree 60bdb061356db736928eee431cd8bd4c9ba68036 refs/reviews/pr-13894-current
git diff --check 60bdb061356db736928eee431cd8bd4c9ba68036...refs/reviews/pr-13894-current
python3 tools/check_conventions.py --base 60bdb061356db736928eee431cd8bd4c9ba68036 --head refs/reviews/pr-13894-current
gh pr view 13894 -R boykopovar/AnyPS5 --json headRefOid,statusCheckRollup

Results

Check Result
Diff check and conventions Passed; no whitespace errors; All conventions checks passed.
Current-main merge preview Clean; tree 201e280a167756b08398995c236665a9dc800f41
Hosted checks Ubuntu and Windows relinker checks and ASan passed; macOS relinker checks were queued; Windows product check was in progress; Linux product jobs were skipped
GPU validation Author reports agc_driver_graphics and agc_driver_mesh pass on this exact head under the validation layer, with no VUIDs; not independently run here
Precheck helper checks ABI audit and test-quality helper could not run because those local helper scripts are absent from the isolated PR checkout
Unedited local output
All conventions checks passed.

git diff --check produced no output and exited 0. git merge-tree --write-tree printed:

201e280a167756b08398995c236665a9dc800f41

Negative control

Assertion Code change for control Result
The helper refuses overflowing workgroup totals and retains zero-instance splits Restore the previous product check and zero-instance behavior Not run locally; the new tests assert the synthetic overflow refusal and zero-instance grids.

Findings

Blocking

None found on this head.

Non-blocking

None.

Sources

Not verified

I did not run a local build, C++ tests, or a console test. The two GPU results are author-reported. macOS relinker checks were queued and the Windows product check was still running at review time.

To get this to a good state

No source changes are requested. Let the pending hosted checks finish; I will recheck if the head changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5722695496 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13894#pullrequestreview-5722695496). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T12:23:23Z. **Review:** APPROVED --- # Re-checked — new head, looks good The updated grid preserves zero-instance draws and bounds the total-workgroup check without multiplication overflow, resolving both previously reported blockers. ## What I ran Reviewed exact head `e011e34ad7e874fe147dcd599adb55d0abe7224a` against PR base `cbed91529193c47194bef11811906c7cb6054af1` and live `main` `60bdb061356db736928eee431cd8bd4c9ba68036`. The current-main merge preview is clean (`201e280a167756b08398995c236665a9dc800f41`). Environment: Linux x86-64, GCC 12.2.0, Python 3.11.2. I did not build locally or run C++ tests. ```sh git merge-tree --write-tree 60bdb061356db736928eee431cd8bd4c9ba68036 refs/reviews/pr-13894-current git diff --check 60bdb061356db736928eee431cd8bd4c9ba68036...refs/reviews/pr-13894-current python3 tools/check_conventions.py --base 60bdb061356db736928eee431cd8bd4c9ba68036 --head refs/reviews/pr-13894-current gh pr view 13894 -R boykopovar/AnyPS5 --json headRefOid,statusCheckRollup ``` ## Results | Check | Result | |---|---| | Diff check and conventions | Passed; no whitespace errors; `All conventions checks passed.` | | Current-main merge preview | Clean; tree `201e280a167756b08398995c236665a9dc800f41` | | Hosted checks | Ubuntu and Windows relinker checks and ASan passed; macOS relinker checks were queued; Windows product check was in progress; Linux product jobs were skipped | | GPU validation | Author reports `agc_driver_graphics` and `agc_driver_mesh` pass on this exact head under the validation layer, with no VUIDs; not independently run here | | Precheck helper checks | ABI audit and test-quality helper could not run because those local helper scripts are absent from the isolated PR checkout | <details><summary>Unedited local output</summary> ```text All conventions checks passed. ``` `git diff --check` produced no output and exited 0. `git merge-tree --write-tree` printed: ```text 201e280a167756b08398995c236665a9dc800f41 ``` </details> ## Negative control | Assertion | Code change for control | Result | |---|---|---| | The helper refuses overflowing workgroup totals and retains zero-instance splits | Restore the previous product check and zero-instance behavior | Not run locally; the new tests assert the synthetic overflow refusal and zero-instance grids. | ## Findings ### Blocking None found on this head. ### Non-blocking None. ## Sources - [Grid limits and workgroup dispatch at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/e011e34ad7e874fe147dcd599adb55d0abe7224a/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L1207-L1216) - [Mesh group ID reconstruction at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/e011e34ad7e874fe147dcd599adb55d0abe7224a/core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp#L220-L231) - [Zero-instance and overflow boundary cases at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/e011e34ad7e874fe147dcd599adb55d0abe7224a/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L11689-L11715) ## Not verified I did not run a local build, C++ tests, or a console test. The two GPU results are author-reported. macOS relinker checks were queued and the Windows product check was still running at review time. ## To get this to a good state No source changes are requested. Let the pending hosted checks finish; I will recheck if the head changes.
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!13894
No description provided.