revert(shader): check scalar buffer bounds in 64 bits again (#10337) #12529
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12529"
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 imellag on 2026-10-28T17:50:31Z.
What
Reverts the shader change of #10337 (merge
58dfa6689f):EmitRuntimeScalarBufferLoad(SpirvRuntimeBuffer.cpp) checks a scalar buffer load against the descriptor's size with the 64-bit product and compare again, instead of the 32-bitOpUMulExtendedand its two extracts.On MoltenVK the 32-bit form raises the GPU time per frame by 50 to 90 percent in the two titles I measured, so God of War Sons of Sparta loses about a third of its frame rate and Planet of Lana halves. The report and the bisection are on #10337. A 32-bit check that is not slower on MoltenVK can come back as a new PR. #10337 measured a 3.6 percent GPU gain on RADV in one menu; this revert gives that back on RADV.
The extended
BufferDescriptorRuntime.cppfixture from #10337 stays: it covers zero, short, exact, strided and large descriptor ranges, and the 64-bit check makes the same bounds decision for all of them. OnlySpirvRuntimeBuffer.cppchanges;git revert -m 1of the merge would also drop the fixture.Tested
Apple M4 Pro, macOS 27.2, MoltenVK 1.4.2, x86_64 Release under Rosetta.
maindoesn't run titles or the AGC execution tests on macOS yet, so both arms are a support branch, notmain:support/macos-boot-1028ateca446163e=main750cf6cf48+ only the macOS boot PRs #7631 #10552 #11249 #11447 #11554 #10669 #7804 (the conflict of #7631 withmain's #10898 in DirectMemory.cpp, and #7804's in Process.cpp and Time.cpp, resolved locally);bench/revert-10337at0d46353574= that base + this PR's commit cherry-picked.git diff eca446163e 0d46353574is this PR's diff and nothing else: one file,SpirvRuntimeBuffer.cpp, 4 insertions and 11 deletions.Both built from clean trees with every submodule at
main's pins ("dirty":falsebelow).God of War Sons of Sparta (PPSA28997 01.008.001), same pad file, warm shader cache per side, mimalloc injected on both sides, 10 s window at 135 s (the Cyclops fight). Summary lines, traces and
tools/trace_digest.pyoutput attached:eca446163e0d46353574Recorder.Syncper frame (waits for that GPU)The warm-up runs before these captures, without a trace window: 35.2 fps on the base, 51.7 fps with the change (from 30 s).
Bisection, from the earlier runs (GPU busy per present averaged over 70-110 s, gameplay before the fight):
d13b3d7c55good,750cf6cf48bad, 287 first-parent commits, 10 steps. The last good is899b2d361f(#10336) at 14.6 ms per present, the first bad is58dfa6689f(#10337) at 23.4 ms. Every commit before it measured 14.6-14.9 ms, every one after 21.6-23.6 ms. Planet of Lana (PPSA19450), capped at 30 fps by the game, went from 32.3 to 15.5 fps onmainwith #10337; I did not repeat it on this exact pair.Shader test, on the same two builds:
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -R '^agc_driver_buffer_descriptor_runtime$' -V(the fixture #10337 extended): passes on both, nowas not found but was requested by env var VK_INSTANCE_LAYERSand noVUID-in either log. Unedited logs attached (test-base.txt,test-pr.txt; only the local paths replaced by<bench>).python3 tools/check_conventions.py --base upstream/main: passed.tools/pr_overlap.py: #6412, #7642, #9508 and #10193 also editSpirvRuntimeBuffer.cppbut conflict withmain, so it couldn't compare them; none of them touchesEmitRuntimeScalarBufferLoad.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-10-28T17:56:59Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The revert is plausibly motivated by the reported MoltenVK regression, but the speed claim and shader validation are not yet documented with the evidence required by the repository rules.
What I ran
Reviewed head
1fd69ab76746d874666abb3d6710318cda5f8309against basee4da19aff06e25ae16b90f460dff22e8ac1eb786; it merges cleanly (merge tree20ae603e4bfcf4534a530281d827f2442a126367). Environment: Debian 12. No compiler or local GPU tests were run.Results
main20ae603e4bfcf4534a530281d827f2442a126367git diff --checkUnedited hosted check output
The merge check printed:
git diff --checkprinted no output and exited 0.Negative control
Findings
Blocking
Performance report is incomplete. The PR claims a substantial speed change, but includes aggregate FPS and GPU-time figures rather than the corresponding
aps5-summary.jsonllines, and attaches no matching traces ortools/trace_digest.pyoutput. The repository asks speed-changing PRs to provide same-machine, same-scene captures for the base and change, with the summary lines and traces. The posted numbers are useful context, but do not let reviewers verify the capture metadata or inspect the traces. Please add the two summary lines and matching trace files, plus each digest. Since macOSmaindoes not currently boot the title, identify the exact support-branch base and candidate SHAs used, show that the pair differs only by this patch, and state that limitation alongside the evidence.Shader test evidence needs reproducible identifiers/output. The PR says
agc_driver_buffer_descriptor_runtimepassed on a support branch and with this commit under Vulkan validation, but gives neither the exact tested SHAs nor the test output. The contribution rules call for the same focused shader/AGC tests on the base and change, with validation enabled and logs checked for missing-layer warnings and newVUID-errors. Please add the exact baseline/candidate SHAs and concise unedited test output (or a linked log) showing those checks. The listed current hosted product jobs are skipped.Non-blocking
Sources
Not verified
I did not run the MoltenVK captures, the AGC runtime test, or a local build. Product Linux/Windows jobs were skipped; the relinker and ASAN jobs were pending. Windows, Linux Vulkan hardware, and console behavior were not tested by me.
To get this to a good state
Please add the paired summary lines, matching traces and digests, and exact validation-test baseline/candidate SHAs with output. I’ll re-check the evidence and rerun any available focused checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T07:27:35Z.
Review: CHANGES_REQUESTED
Re-checked — changes still requested
The author has now supplied paired support-branch captures, digests and test logs, which addresses the missing-evidence request in substance. I inspected the actual attachments. The capture metadata includes three additional
APS5_TRACE_*switches disallowed by the performance-report form, and the CTest logs do not show the required Vulkan validation-layer configuration. I cannot treat those runs as satisfying the repository’s reporting/test requirements yet.What I ran
git patch-id; the patch IDs match.git diff --check.SpirvRuntimeBuffer.cpp; the pairwise merge auto-merges that file, although the broader pairwise tree has other conflicts.Results
git diff --checkagc_driver_buffer_descriptor_runtimeUnedited source excerpts from the attached test logs
Negative control
The uploaded base and candidate test logs both report 1/1 pass. I did not independently rerun the test or its control.
Findings
Blocking
APS5_TRACE_SECONDS=135:10as the onlyAPS5_TRACE_*/APS5_PROFILE_*switch. The supplied summary lines listAPS5_TRACE_DIR,APS5_TRACE_EVENTSandAPS5_TRACE_SUMMARY_EVERY, contrary to the capture form. Keep the same machine, scene and support-branch base/candidate arrangement, and attach the new summary lines, traces and digests.agc_driver_buffer_descriptor_runtimeon both support-branch arms withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. The attached logs show onlyANYPS5_NO_SHADER_CACHE=1andAPS5_NO_PIPELINE_JOURNAL=1; they do not establish that validation was enabled or that the loader accepted the requested layer.Non-blocking
Sources
1fd69ab76746d874666abb3d6710318cda5f8309Not verified
I did not independently reproduce the performance results or the reported test outcomes.