Repository navigation
fix(agc): resolve indexed indirect draws on a queue that never set INDEX_BUFFER_SIZE - #9424
Conversation
|
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.
|
|
Windows run of fed7f19 merged onto Built |
|
Windows check of head Host: Windows 11 (10.0.26300), Ryzen 5 9600X, WinLibs GCC 15.2.0, Release, Ninja. GPUs: NVIDIA GeForce RTX 5070 Ti (driver 617.42) and AMD Radeon RDNA2 iGPU
I have no PPSA03016/PPSA08338 here, so no title run. AI-assisted: yes (Claude Code); results above were run on this machine. |
MarcZX10
left a comment
There was a problem hiding this comment.
The new branch documents and tests the no-size draw path thoroughly, including paired Vulkan validation. There are two repository issues to resolve before this change can proceed:
-
The PR says it carries the patch from #7679, which was closed by the repository's automatic open-PR limit before review. The user's operating constraint for this review is not to reuse work from intake-paused/limit-closed PRs through a different author's branch. Please stop this transfer and let the original author reopen #7679 when eligible, preserving the original patch and authorship there. The commit's author field is preserved, which is good, but does not resolve the intake constraint.
-
The body reports a title-specific stop for Marvel's Spider-Man 2 (PPSA03016), but the checklist says
Unblocks: none. The repository checklist requires a title ID and Game bring-up discussion for a stop seen on a title. Please add the verified discussion reference, or explain that no qualifying bring-up discussion exists and update the claim accordingly.
The paired focused tests and validation-layer report are author-provided and use 0c6a5bd593; current main is 417 commits ahead of that comparison base. If this work is reopened as its original PR, it will still need a current-main update and focused rerun. Hosted eligibility, conventions, intake, labels, and report checks pass; product/relinker jobs are skipped. I did not run the tests locally because no matching checkout/build is available here.
|
@MarcZX10 thanks for the review.
@ycbuzi @wachi35676 thank you both for the Windows runs, on three GPUs this PR hadn't seen. Both are now in the Tested section. |
|
@MarcZX10 the focused set is rerun on current |
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for carrying this. One logic problem on the unknown-limit path, both places in Execution/src/Driver/Draw/Draw.cpp:
- When the limit is unknown
resolveIndirectDrawsetsindexCount = 0, but two record filters still testarguments.firstVertexOrIndex < drawParameters.indexCount, so no record counts as drawable:Draw.cpp:404(recordDraws), used at:413by the empty-indirect skip. For a program already known to take the CPU path,anystays false and the whole draw is skipped as empty (empty_indirect_skipped). That is a silent drop of the exact draws this PR is meant to enable.Draw.cpp:940(drawable) feedslastDrawable. It never matches, sorecord == lastDrawableat:999is never true for these draws and the pipelined commit of the last record doesn't happen.
- Fix: in both lambdas, treat the index range as drawable when
!indirect.indexLimitKnown, as the:966branch already does. - Please add a test that fails without it: an unknown-limit indexed indirect draw where the program is already in
CpuIndirectPrograms(second submission of the same draw), checking that the triangle is drawn. The currentno_sizetests submit it once, so they don't reach:413.
On the carry: the author stays credited, and which PRs may be carried is a maintainer call, not something this review decides.
…DEX_BUFFER_SIZE A queue that has received neither INDEX_BUFFER_SIZE nor INDEX_ATTRIBUTES_INDIRECT since its last reset has no index limit. Such a draw takes the CPU record path and reads each record's index range as written, refusing a range that overflows or is not readable. An explicit INDEX_BUFFER_SIZE of 0 still throws.
…unknown The empty-indirect skip and the last-drawable search filtered records by firstVertexOrIndex < indexCount, which is 0 when the queue never set an index limit, so a second submission of the same draw was skipped as empty.
fed7f19 to
3dbab57
Compare
|
@adriadam10 thanks, you're right. The earlier head was based on On the test:
|
|
An in-game check of 3dbab57 on Spider-Man 2 (PPSA03016 01.004.003), with
Both runs stay on the black loading screen and later run out of VRAM. In the run with the fix that came at 281 s, while about 7,000 sampled textures were created within 20 s. That's a separate problem, and I'm looking at it in #10195. |
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.
|
Re-checked 3dbab57: @MarcZX10's only review is dismissed (2026-10-22, on an older head) and both of its points are met ( |
boykopovar#9424 made QueueState::indexBufferSize a std::optional, so the unset-state comparison against 0 compiled but never held. Check the optional directly instead.
boykopovar#9424 made QueueState::indexBufferSize a std::optional, so the unset-state comparison against 0 compiled but never held. Check the optional directly instead.
boykopovar#9424 made QueueState::indexBufferSize a std::optional, so the unset-state comparison against 0 compiled but never held. Check the optional directly instead.
What
This carries @spiff637's #7679, which the open-PR limit closed on 2026-10-18, before any review. The commit keeps spiff637 as its author. It is rebased on current
main, where #6606 is merged, and its debt line now sits next to main's newer INDEX_ATTRIBUTES_INDIRECT entry. If spiff637 reopens #7679, I'll close this one.An indexed indirect draw (
DRAW_INDEX_INDIRECT0x25,DRAW_INDEX_INDIRECT_MULTI0x38) on a queue that has received neitherINDEX_BUFFER_SIZE(0x13) norINDEX_ATTRIBUTES_INDIRECT(0x91) since its last reset threwINDEX_BUFFER_SIZE has not been set. Marvel's Spider-Man 2 issuesDRAW_INDEX_INDIRECT_MULTIthat way and never emits either packet: spiff637 probed every 0x13 and every suspend-point reset over a whole run.The change, as in #7679:
QueueState::indexBufferSizebecomesstd::optional<std::uint32_t>. A size written by 0x13 or by a 0x91 record behaves as before. An explicit 0 still throws, now asINDEX_BUFFER_SIZE is zero.resolveIndirectDrawmarks the drawindexLimitKnown = falseand keeps the base and alignment checks.ClassifyIndirectDrawsends such a draw to the CPU record path (IndexLimitUnknown, "index limit unknown" in the profiler). Each record'sfirstIndex/indexCountrange is read as written. It must not overflow, and it goes through fix(agc): resolve sparse indirect index ranges per record #6606's per-record readability check.INDEX_BUFFER_SIZEis not measured, and neither is whetherDRAW_INDEX_2/DRAW_INDEX_OFFSET_2MAX_SIZE sets it. The debt entry says so.The second commit is mine, from @adriadam10's review. Since the earlier head,
maingained an empty-indirect skip for programs known to take the CPU path. That skip (recordDraws) and the last-drawable search (drawable) inDraw.cppkept only records withfirstVertexOrIndex < indexCount, andindexCountis 0 when the limit is unknown. So the second submission of the same unknown-limit draw was skipped as empty. Both now count such a record as drawable, as the record loop already does.Tested
main11e8ad2):ctest -R agc -j16: 953 tests, 938 pass, 10 skip and 5 fail. Four of them also fail onmain11e8ad2 on this machine:agc_driver_bda_reads_shadowed_results,agc_driver_bda_reads_shadowed_results_per_build,agc_unit_shadow_completion_storeandagc_driver_tessellation.agc_driver_sgpr_pattern_fill_keysfailed under-j16and passed alone 4 times out of 4.agc_driver_sparse_indirect_indices_no_sizepasses its firstRunand fails the second withthe sparse indexed indirect draw differs from the reference triangle. With only therecordDrawschange, it passes.main0c6a5bd aborts at 151 s withINDEX_BUFFER_SIZE has not been set.APS5_PROFILE_DRAW=1, there is noINDEX_BUFFER_SIZEerror. The[draws]profile counts 567 draws on the "index limit unknown" path in one 10 s window.0x11e2b44c00; the address changes between runs), as spiff637 saw on PPSA08338. That stop is in fix(shader): take lane-mask arms and a merged high word in a pointer-keyed record pointer #8939's thread.main, in its first 40 s, onsceSystemServiceParamGetInt: parameter 100, then 208 and 210 (seen withmaincc00785). This PR doesn't touch that.agc_driver_pm4and the threeno_sizetests fail.main0c6a5bd and on this branch, same machine and GPU. The pattern coversagc_driver_pm4*,agc_driver_draw_offset_indices,agc_driver_sparse_indirect_indices*,agc_driver_pipelined_indirect_draw,agc_driver_rect_list_indirect,agc_driver_prepared_shaders_indirectandagc_driver_*indirect_arguments*. The runs usedctest -VwithANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(layer 1.4.363).main: 26 of 26 pass.agc_driver_sparse_indirect_indices_no_size*.was not found but was requested by env var VK_INSTANCE_LAYERS. Neither log has aVUID-line.main8b3a6ba and on this branch merged onto it (a clean merge), with the same environment and validation layer:main8b3a6ba: 26 of 26 pass.no_sizetests.VUID-line.ctest -R ^agc_ -j8on this branch: 869 tests, 858 pass, 8 skip and 3 fail. The three also fail onmain0c6a5bd on this machine:agc_idle_publish_wait,agc_driver_image_array_window_past_layer_limitandagc_driver_tessellation(agc_driver_tessellation segfaults on RADV with Mesa 26.2+: nir_opt_varyings corrupts the TCS input offset's use list (Mesa bug) #5444).tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.pyfinds no PR on the same lines. Of the PRs it couldn't compare, none touches the index-size, record-range or indirect-path lines.maina6dcea9 (comment): the 19 tests thatagc_driver_pm4_testsandagc_driver_sparse_indirect_indices_testsregister on Windows pass on both repeats ofctest --repeat until-fail:2, withANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1.maina6dcea9 (comment), on an RTX 5070 Ti (NVIDIA 617.42) and an AMD Radeon RDNA2 iGPU1002:13c0(AMD 32.0.21042.62):no_sizetests pass on both GPUs.main. The only failures also fail onmainthere:agc_driver_image_array_window_past_layer_limitdoesn't compile under MinGW, andagc_driver_tessellationfails on AMD.main'sExecutionandGraphics, the threeno_sizetests fail withINDEX_BUFFER_SIZE has not been set.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)