perf(agc): partition relocation runs by tagged address #7508
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7508"
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 Scramblrrrr on 2026-10-18T10:14:01Z.
What
Driver::tagVariantRunslabels captured words with their relocatable user-data origins. It currently binary-searches the sorted read list for every word, including large untagged image-table regions. A bounded 007 First Light queue-worker sample identified this walk as a hot path.Walk the sorted read addresses intersecting each region instead, emitting the intervening untagged runs directly. The partitioning step changes from O(words � log(reads)) to O(log(reads) + intersecting reads); the existing content copy and provenance/rejection checks remain. Adjacent words with the same origin still coalesce, duplicate addresses retain the first sorted read's meaning, and the cached run boundaries/origins stay the same. There are no title checks, new exports or shader ABI changes.
The new synthetic test compares partitions with the previous per-word algorithm across zero/one-word ranges, boundaries, bit-63 origins, masked and negative origins, duplicate/unaligned reads, empty input, a sparse million-word region, a near-limit address and 2,000 deterministic randomized cases.
Tested
November 18 fresh current-main refresh:
138b978db7ac35de920471c9fd501843e1276caaon main324cc9554da119c4a71bac0d8c5ee9dde12b31f5. The production change remains the same sparse read-list walk. The merge preserves main's newer supplied-word handling and per-partitionAppendSharedWords; test registration follows the current CMake-fragment layout and has a 30-second limit.Windows 11 / NVIDIA GeForce RTX 5070 Ti / driver 617.42 / WinLibs GCC 15.2.0 r7 / Release / SPIRV-Tools OFF:
VUID-orSYNC-HAZARD-identifiers and no missing requested layer message.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU=NVIDIA VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, withVK_LAYER_PATHpointing to that layer. Serialctest -R '^agc_driver_(draw_cache_relocation.*|mesh_draw_relocation)$' -j1 -V.Independent evidence, attributed to the original tested setups:
domx4q November18 Linux/RTX4090 validation: main1ccc399b17 versus this head138b978 merged onto it, the same eight native relocation controls pass both; the new CPU partition test also passes the candidate. Arch Linux, NVIDIA620.70.06, Khronos1.4.363.1,16 actual layer insertions per arm, no missing layer or VUIDs. No speed comparison was made.
XatiX's Age of Mythology: Retold report: an independently written equivalent walk reduced welcome-screen frame p50 from 3178 to 2543 ms on Windows/RTX 5080, and matched runs/bases across 3.31 million regions. Both arms carried that title's required PRs. A rerun on this refresh was requested; these are not measurements of the refreshed head or gameplay.
SleglJan's earlier Linux/RTX 3080 cross-test includes alternating menu samples on a combined integration stack. It is not an isolated current-main gameplay result.
Review scope: the main-only native gate passes, and the repeated 007 integration measurements are below. The title result is explicitly limited to its common bring-up stack and animated offline menu. No current-main gameplay unblock or30 FPS claim is made. Raw title data remains local.
Repeated 007 menu cross-test (November 18)
The sparse relocation walk improves this combined bring-up stack in the offline Story menu. Plain main cannot reach this scene, so this is an integration-specific result, separate from the main-only native gate above.
Baseline
6bed05f52e3fa027c63c2385441b655fc911fb08; candidate 2730f2eb9fe9be4ba859595db8519442b2054d16 adds only this PR's four-file topic delta. The common stack includes canonical #9508/#22072 and the #15295/#12827/#15296 resident-memory prototype. That prototype retains an unchanged-byte redundant-upload assertion failure on both arms; this is not a merge-ready memory-series claim.Windows 11 26200, Ryzen 7800X3D, RTX 5070 Ti / 617.42, 32 GiB, GCC15.2 r7 Release, SPIRV-Tools OFF, title01.018.000, 3840x2160. Same executable and other417 module hashes. Both arms: import1024MiB, texture2048MiB, default mirror limit, GPU heap on, synchronous draws off, lazy shader preparation, pipeline journal off, implicit layers disabled for the child, allocation profiling off. The original RAM safeguards remain active.
Six fresh processes in A1,B1,B2,A2,A3,B3 order. Each official
tools/trace_digest.pycapture covers30 seconds after the offline Story menu settles, with no further input. The background is animated, so both repeated samples and reversed order matter. No bounded working-set trim overlaps any capture, no trace drops, and all six runs close normally after capture; no fatal report is recorded.Median presents/s: 1.459 -> 1.621 (+11.1%). Every candidate sample is above every baseline; ranges 1.445-1.490 versus 1.618-1.640. Median frame p50 684.978 -> 617.411ms.
The matching own-driver phase is
Driver.Draw.shader_compile_and_link: median 192.6 -> 122.6ms/present. GPU busy median stays 128.186 -> 128.171ms/present. Inclusive CPU phase times overlap and are not additive.For this exact integration, the same12 relocation native controls also pass36/36 per head across three rounds,24 actual Khronos insertions/round, zero skips/VUIDs. All unchanged resident data checks complete three times per head while retaining the existing one upload-count assertion/failing exit. This is separate from main324cc955 versus PR138b978, whose same eight native controls pass24/24 per head with16 actual layer insertions/round.
This is a repeatable menu improvement, not playable gameplay, a current-main 007 FPS claim, or30 FPS. Loading still reaches a separate memory limit on this stack. Raw title traces, code, logs and screenshots remain local; the values above are aggregate official-digest results. AI-assisted.
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 akkadbakkad89 on 2026-10-18T11:28:14Z.
Verified at head
890660892:agc_relocation_runspasses on Windows 11, MinGW (WinLibs GCC 15.2.0), Release build.Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-18T21:51:47Z.
@Scramblrrrr here's an independent cross-test on Linux, as you asked. In 007 First Light's main menu, #7508 lowers the frame p50 by 38.9 ms (−10.8%) on top of a stack of other PRs. There are two samples with it and three without. E1 ran in the afternoon; E2, H1, E3 and H2 then alternated. The ranges don't overlap.
Setup:
main1b0c7cfa0plus #5799, #6317 (at ebb43c123), #6332, #6881 (merged since), #6346, #6868, #6465, #5372 (at e5390612f), #6471, #6918, #6454 (a508aa03c) and #6567. On top come a two-line test adaptation of #6881's fixture to #6454's shared columns (tests only) and a local commit that logs the window-title FPS.main(#6317, #6881 and #6868 in docs and tests only).ShaderResources, resolved as in the comment linked below.4d515a405, which has the same diff as #7508's head890660892againstmain.Driver::tagVariantRuns. I resolved it by puttingAppendSharedWords(...)first inside theForEachRelocationRuncallback, the same way as your c872fab89. The function is token-identical to yours.agc_relocation_runs,agc_driver_graphicsandagc_descriptor_cachepass, and the wholectestrun passes (1436/1436).APS5_PAD_INPUT_FILE, from an existing save.main's defaults plusAPS5_PROFILE_DRAW=1,APS5_TRACE_EVENTS=2097152andSDL_VIDEODRIVER=x11. The samples after E1 also setAPS5_NO_PAD_INPUT=1andSDL_GAMECONTROLLER_IGNORE_DEVICESfor the connected controller. E1's p50 (362.4) lies between E2's and E3's.APS5_TRACE_SECONDS=1320:180, and every sample is in the menu before it opens.tagVariantRunsis timed in this row: incacheDrawStagesit runs after thevectorslap and before thekey/lookup/validateone. It is the only draw row that moves beyond E's own spread. It accounts for 33.0 of the 35.3 ms by which the rows' total drops (means 288.8 → 253.5).Driver.Draw.shader_compile_and_linkgoes from 201–209 to 171 ms per present, andDriver.Packetfrom 345–356 to 315–318 ms.Driver.Dispatchstays at 55–59 ms.Not covered:
#6539 (TheAggie) also changes
Driver::tagVariantRuns, in the block right aftervariant.relocatableWords = relocatable;, so one of the two will need a rebase after the other merges.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T02:01:58Z.
This pull request is labeled
perf, so it needs the summary line of a capture onmainand one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste bothaps5-summary.jsonllines, attach the two traces and add the output oftools/trace_digest.py.Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-19T02:47:46Z.
Thanks for the repeated cross-test and phase breakdown. The non-overlapping p50 ranges and the key/lookup/validate reduction are useful evidence; keeping this attributed to your Linux/3080 menu stack, not extrapolating to Windows/gameplay or standalone main.
Current #7508 head is
858c36315on main324e0e48e. It preservesAppendSharedWords(...)first inside each partition callback, as in your cross-test and our integration. Exact-head relocation/tag/mesh controls pass 3/3 (1.23 s); current Windows combined integration also passes those controls, but our preceding menu samples did not establish an isolated FPS benefit. PR stays draft while that validation gap remains. If you have thetrace_digest.pysummary lines for E/H, please add those too so the performance evidence is easy to review against the project's convention.I have noted #6539's adjacent edit for the next refresh. Currently testing #6946 independently on Windows: public integration
6d6021bb0, 136/136 selected controls plus 4/4 finisher/proof controls pass. OFF/ON menu pair is underway with PROFILE_DRAW unset on both arms; no result yet. Separately, current-main 007 Resume runs still meet our RAM guard before a cinematic is verified. Full aggregate results are on #5714; no #6172 resolution claim. Raw title data remains local. AI-assisted: Codex.Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-19T13:12:57Z.
Refreshed the draft branch onto main3bb15be09 at23caea2a1, preserving the per-partition AppendSharedWords call. The only conflict was adjacent CMake test registration; both the relocation fixture and new draw-input driver test are retained. Conventions pass. Production diff remains the same relocation-run helper/call site; no #6539 combination.
This refresh has not yet had a fresh standalone native run. Prior exact-head3/3 evidence remains for858c36315; current 007 integration162c34ee8 carries the same helper and is rebuilding for its native gates. No new title/FPS claim and draft status retained. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-19T14:02:20Z.
Fresh exact-head23caea2a1 validation completed:3/3 relocation-run, draw-cache relocation and mesh-draw relocation tests pass1.19s, zero skips, Windows/RTX5070Ti617.42/WinLibs15.2 Release. Current-main rebase is now tested and the description is updated. Draft/performance qualification unchanged. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-22T07:31:22Z.
Refreshed to current main
d6eafa54dat5e9d5c26b; exact-head Windows/NVIDIA focused controls3/3PASS1.30s, actual Khronos1.4.363 layer loaded, no VUID/missing-layer errors. Same two existing GPU controls also pass on current-main GPU code (cc9da1ac6 adds only a SystemService change), without validation errors. Body updated with exact setup and limits. Main's removal of the obsolete robustness test is retained; per-partition shared-word append remains. Draft/performance qualification unchanged. AI-assisted: Codex.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T10:54:26Z.
Review: APPROVED
Reviewed — looks good
The reviewed change at
138b978db7ac35de920471c9fd501843e1276caapreserves the prior partition semantics in the inspected code, and the supplied focused checks report passing; I did not run checks in this review.What I ran
No commands or tests were run. The change and relevant caller/test registration code were inspected through
repo_read.py.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
The inspected changes are in
RelocationRuns.hpp,DrawRelocate.cpp,RelocationRuns.cpp, andagc_relocation_runs_tests.cmakeat commit138b978db7ac35de920471c9fd501843e1276caa.Not verified
I did not run the reported native GPU controls, partition reference test, or performance captures. The repository files listed as reviewed in
manifest.jsonwere all read; no excluded changed files were listed.To get this to a good state
Nothing is required.