perf(shader): stop zeroing mesh window buffer slots at workgroup start #15362
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15362"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by beardsciences on 2026-11-03T03:07:27Z.
What
#12233 moved a mesh program's vector window into a storage buffer on NVIDIA's proprietary driver. Each workgroup slot was zeroed when a workgroup claimed it: every invocation stored 0 to each window entry that a buffer read could see before a write. In MediEvil: Resurrection's clipping geometry program (PPSA07550) that is 192 entries of 312 per invocation.
This drops the zeroing. A register that is read through the buffer before any write in the workgroup now returns whatever an earlier workgroup left in that slot instead of 0. On the console an unwritten VGPR is undefined, so a program cannot depend on either value. The lock, the write-through stores and the stale-read loads are unchanged. The debt entry now says that slots are not cleared; its cold-compile figure is re-measured on a recent
main(the old one is from October).Cost in PPSA07550 gameplay: Dan's Crypt, the first level, with Sir Dan standing at the start after the level's opening movie (no input after the menu; presents and GPU time stay flat in 5 s steps across every window). RTX 3060 Ti, warm caches (one untraced run of each build first),
APS5_TRACE_SECONDS=640:60and no other trace or profile switch, two alternating runs per build.mainis5cb015caaa, the change is this PR's commit9642972a8bon it.main, run 1main, run 2All four summaries report
trace_dropped(the event buffers of the queue worker and the draw committer filled after 10–32 s);totals_fullis false for every thread, so the summary numbers are complete. Traces andtools/trace_digest.pyoutput attached.aps5-trace-5cb015caaaaf-16556.json.gz
aps5-trace-5cb015caaaaf-17036.json.gz
aps5-trace-9642972a8b39-46064.json.gz
aps5-trace-9642972a8b39-50108.json.gz
digest-main-1.txt
digest-main-2.txt
digest-pr-1.txt
digest-pr-2.txt
summary-main-1.txt
summary-main-2.txt
summary-pr-1.txt
summary-pr-2.txt
Summary lines
A local replay tool (not part of this PR) that re-runs draws captured from the title's menu through the driver gave the same images for all 58 captured draws with and without the zeroing (on an earlier
main,66e1f7f993with #7893).The change edits
SpirvModuleEmitter.cpp, so the shader cache's source version changes and cached modules are rebuilt once.Overlap: 93 open PRs share a file with this one.
tools/pr_overlap.py --branchfinds no overlap with the 56 it could compare; it could not compare the other 37 because they conflict withmain. Checked by hand: #5021, #5371, #6235, #6280, #6412, #6488, #6751, #6924, #7392, #7410, #7684, #8004, #9356, #9387, #10233, #11483, #12790 branch from before #12233 and do not have the mesh window code; #7085, #7223, #7642, #9020, #9183, #9335, #9508, #9748, #9889, #10193, #10867, #11351, #11551, #13486, #13928, #13929, #14217, #14218 merge with this change on their own trees without a conflict (#7642, #9508, #10193, #13928 and #13929 edit lines inSpirvModuleSetup.cppthree lines from the one this PR removes); #12548 adds a debt entry directly above the mesh window entry and #14212 rewraps the whole debt file, so whichever of those lands after this needs a one-line rebase.Tested
Windows 11, NVIDIA GeForce RTX 3060 Ti, driver 621.01 (32.0.16.2101).
mainis5cb015caaaand the change is this PR's commit9642972a8bon it; every build below is a clean tree at one of those two commits.tools/check_conventions.py --base origin/mainpasses.Validation,
mainand the change:ctest --test-dir build -R "mesh|vector_window|relative|window_lane|ngg|provoking" -VwithANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer; both logs attached, each starting with its commit. Neither containswas not found but was requested by env var VK_INSTANCE_LAYERS; the loader insertsVK_LAYER_KHRONOS_validationinto all 24 Vulkan instances in each, next to the machine's implicit layers (NVIDIA's and the OBS and Overwolf capture hooks), which load in every run here. The layer reports the same 20 messages in both, allWARNING-VkImageSubresourceRange-layerCount-compatibility, and noVUID-error. Both pass 28 of 28.validation-main-5cb015caaa.txt
validation-pr-9642972a8b.txt
agc_driver_mesh_vector_window_wavespasses with this change (2 of 2) and still fails withAPS5_NO_MESH_WINDOW_BUFFER=1(2 of 2, wrong threads per wave: 0 64 64 64), so it still covers the driver bug; log attached.regression-pr-9642972a8b.txt
MediEvil: Resurrection (PPSA07550), both builds from boot through the 3D main menu, the New Game movie and Dan's Crypt: the menu and the level render the same.
Before:

main, the spot the traces measure (frames from separate runs of the same builds withAPS5_DUMP_FRAMES).After: this PR, the same spot.

3D main menu,


mainthen this PR (a few game frames apart; only the skeleton's idle pose differs):Not tested: AMD and Intel GPUs (the path is not taken there), other NVIDIA GPUs and drivers.
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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T03:42:12Z.
Review: COMMENTED
Reviewed — no blocking findings
The shader change is internally consistent and its supplied traces reproduce, but approval is withheld while macOS CI and the requested title-output evidence remain outstanding.
What I ran
Reviewed all four changed files at exact head
9642972a8b39dc0c24eb35d08c597961f316ec69, against basef6232fcfda70644495273f6b8dd88cf0603463d6. The stack preview merged cleanly with that base. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. I did not build or run CTest locally. I downloaded the four attached trace archives, four summary records, four digest outputs, two validation logs, and the regression log. I reran the digests usingtrace_digest.pyfrom this PR head.The four trace/summary pairs were matched by each JSON summary’s
tracefield. The PR’strace_digest.pyoutput matched all four attached digest files after normalizing their CRLF line endings. I compared the attached main/change validation logs and inspected the attached negative-control log; these are author-supplied runs, not runs I performed.Results
Commands and unedited output
git diff --check ...exited 0 with no output.python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15362concludedchecks failedbecause the optional test-quality helper is absent from its isolated snapshot. Its relevant table:Unedited helper error:
Artifact-check output:
Clean stack-preview output:
Hosted checks at final refresh:
Negative control
agc_driver_mesh_vector_window_wavesdetects the broken array pathAPS5_NO_MESH_WINDOW_BUFFER=10 64 64 64; I read the log but did not rerun itFindings
Blocking
None found in the source-level review.
Non-blocking
The prior reviewer request for same-head screenshots of the 3D menu and measured gameplay remains unanswered (discussion). The existing gameplay captures and GPU test are useful, but they do not provide those requested visual comparisons against the earlier menu regression. I could not independently run the title here.
Sources
Not verified
I did not build AnyPS5, run the GPU CTest, replay the game, or independently repeat the negative control. Both macOS relinker jobs were pending. The traces report dropped event buffers; the summary records say
totals_fullis false, and the digest output marks the event-level trace summaries incomplete. The performance summary statistics themselves were reproduced from the attached records and traces.To get this to a good state
Please add the requested same-head screenshots of the affected menu and measured gameplay spot, and let both macOS relinker jobs finish. On any new head I will rerun the precheck, inspect the complete diff, and verify the attached artifacts against that head; after required CI completes I can reconsider approval.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T04:52:48Z.
Review: COMMENTED
Re-checked — same head, menu evidence still missing
At head
9642972a8b39dc0c24eb35d08c597961f316ec69, the gameplay screenshot pair is now attached and the required CI has completed, but the previously requested 3D-menu comparison is still absent, so I am withholding approval.What I ran
The earlier full review covered all four changed files at head
9642972a8b39dc0c24eb35d08c597961f316ec69against basef6232fcfda70644495273f6b8dd88cf0603463d6, including the no-build precheck, source review, trace/summary matching, fourtrace_digest.pyreproductions, and comparison of the attached Vulkan validation logs. This follow-up checked the updated PR description, the exact head and current hosted statuses. I did not run the game or build locally.Results
Current hosted check output
Negative control
agc_driver_mesh_vector_window_wavesdetects the broken array pathAPS5_NO_MESH_WINDOW_BUFFER=1; I did not rerun it.Findings
Blocking
None confirmed in the reviewed source or attached performance evidence.
Non-blocking
The earlier reviewer asked for a screenshot of the 3D menu where the zeroing regression was visible, plus a screenshot of the measured gameplay spot. The current description adds before/after images of the Dan's Crypt gameplay spot, addressing the latter. It still has no image of the 3D menu on either build. Since the PR describes this title-specific path as reaching uninitialized mesh-window values, that menu result remains unverified here; I am not approving until the requested menu evidence is available.
Sources
Not verified
I did not replay MediEvil or independently run the Vulkan tests or negative control. The attached title captures and test logs are author-supplied. The trace summaries report dropped event buffers, although
totals_fullis false; the earlier review reproduced all four digest files from the attached traces and summaries.To get this to a good state
Please add a same-head before/after capture of the 3D menu on the stated NVIDIA machine, alongside the gameplay screenshots. I will review those images and refresh the head and hosted checks before deciding whether approval is warranted.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T05:19:54Z.
Review: APPROVED
Re-checked — same head, approved
The author added the requested same-head menu comparison and fly-through captures; the visible menu difference is limited to the animated character, and the NVIDIA GPU report also includes a passing mesh-window regression test.
What I ran
Confirmed the PR remains open at head
9642972a8b39dc0c24eb35d08c597961f316ec69, with recorded basef6232fcfda70644495273f6b8dd88cf0603463d6. My previous review at this exact head covered the full source diff, performance summaries, four trace digests and Vulkan validation logs. This follow-up downloaded and visually inspected the new image attachments, checked current hosted statuses, and inspected the relevant test line in the NVIDIA report's raw log. I did not build locally or replay the game. Environment: Debian Linux 6.1 x86_64, Python 3.11.2, GCC 12.2.0.Results
agc_driver_mesh_vector_window_wavespassed, 1/1.Raw status and test output
Negative control
The earlier review records the author's reported
APS5_NO_MESH_WINDOW_BUFFER=1control, which makesagc_driver_mesh_vector_window_wavesfail with the expected wrong-threads-per-wave result; I did not rerun that control. The new NVIDIA report confirms the test passes with this PR enabled.Findings
Blocking
None found in the reviewed source or the new same-head visual and GPU evidence.
Non-blocking
No PS5 console run was provided; the attached captures and GPU runs are host-side evidence.
Sources
Not verified
No local build, game replay, PS5 console test or independent negative control was run. The automated GPU report, Vulkan validation results and title screenshots were supplied by contributors; upstream Linux, Windows and specialized jobs are skipped.
To get this to a good state
No additional change is requested at this head. I will recheck the complete diff and new evidence if the head changes.