Repository navigation
fix(agc): stop draining for GPU-clock COPY_DATA - #7963
Conversation
|
Traces for the summary lines above: |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
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.
|
|
Rebase handoff — rebased onto current Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, To pick it up: Head is |
4145af0 to
a6f0732
Compare
|
Thanks @blawesom for the rebase and the test run! Picked it up: the branch is now at |
|
A second title with these copies: MGS4 (PPSA18194, Master Collection), in Act 1's first gameplay scene. The route is the launcher, then Game Selection, Start Game, New Game and Liquid Easy, skipping the opening cutscene. Linux 6.8, RTX 4070 Ti (595.99.02), release libs,
So every One note: my first launch on this build crashed in the launcher at 23 s (EXIT-139, no message). Three more runs on the same build didn't repeat it (two 60 s runs and the long run above), and AI-assisted: yes (Claude Code) |
|
Thanks @milescoviello for testing a second title! Good to see every |
|
A title data point for this PR: Metal Gear Solid 4 (PPSA18194), which drains the draw pipeline on Setup: Ubuntu 26.04.1, GCC 15.2, Release libs (SPIRV-Tools off), RTX 4070 Ti, NVIDIA 615.71.09.
AI-assisted: yes (Claude Code) |
|
Thanks @milescoviello for the longer interleaved runs! Zero Summary for review: across LEGO Batman (AMD) and MGS4 (NVIDIA), the PR removes the GPU-clock |
|
@MuteRex a run on NVIDIA: RTX 4090, driver 615.78.08, Linux 7.3 (CachyOS), GCC 16.2, Release. I cherry-picked this PR ( Tests. The command from the description, with
Performance, PPSA01748 (Marvel's Guardians of the Galaxy) main menu. Warm caches,
This PR removes about 110 of the 40-frame window's ~2,480 pipeline drains, and saves about 9 ms per frame of drain time. The frame time doesn't change within noise. In this title most drains aren't clock copies, so for Guardians this is a no-regression result, not a speed-up. The menu is bound the way #10441 describes: queue 0x0 is busy recording draws and dispatches, and queue 0x23 waits on a label. Two more launches, one per build, aren't in the table. On those, frame 1150 came before the menu, so the 40 frames included a load of about 150 s and don't measure the same scene. Tested and written by Claude (AI assistant) on a contributor's machine. |
|
Thanks @Tamalero for the run on a 4090 and for the negative control! Good to see both new tests fail with the two driver files reverted and pass with the change, on NVIDIA as well. Agreed on Guardians: most of its drains aren't clock copies, so removing ~110 of ~2,480 is a no-regression result rather than a speed-up, and the frame-time difference is within noise. The That makes three titles across AMD and NVIDIA (LEGO Batman, MGS4, Guardians): the GPU-clock |
|
Windows run of this head
AI-assisted: yes (Claude Code) |
|
@MuteRex a title where this PR's copies are the main drain: Super Meat Boy 3D (PPSA31162 02.000.001), level 1 of World 1. A local diagnostic counted the queue-0 Setup. Linux (Ubuntu 26.04.1, kernel 7.0), RTX 4070 Ti, NVIDIA 615.71.09, i7-13700K, Release libraries, warm shader cache, 3840x2160.
Drains (
The frame doesn't move more than that because the draw committer bounds this scene: with this PR the queue worker waits 6.4 µs per draw for room in the full pipeline. AI-assisted: yes (Claude Code) |
|
@milescoviello Thanks, an interleaved same-machine A/B on the exact head with the drain counts alongside is exactly what we need here. We're checking it against the remaining test requirements for this PR. |
|
@milescoviello One thing before we can count these runs in place of our own game test: on 20 Oct you saw a launcher exit with code 139 after about 23 s on this head, which didn't happen on main in four launches. Did it come back in the runs since, and did you find what caused it? If it turned out to be unrelated (a stale build, a driver hiccup), a line saying so is enough. |
|
@oneandonlydean it didn't come back. Since that crash I've launched builds with this PR seven times, and all seven ran to their timeouts:
I didn't find a cause. The 20 Oct run left no error message and no core I could use. That week this host also had a few one-off crashes on AI-assisted: yes (Claude Code) |
|
@BunnyFl Thanks, this is the kind of evidence these functions were missing. The second-call result (0x23 with no syscall) and the unchecked null name differ from what the current tests expect, so we're checking the PR's assertions against your results. @alvaroelpob please take a look too, particularly the repeated rename and the null-name cases. |
|
Thanks @milescoviello for the Super Meat Boy 3D A/B. A title where the GPU-clock |
A COPY_DATA of the GPU clock into memory no longer drains the draw pipeline when its destination does not overlap pending writes, and is stored on the CPU instead of draining the device when the destination is not imported. The value is read before either drain, so the drains only stalled the queue. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a6f0732 to
c512147
Compare
|
Rebased onto current Retested on Linux 7.0.0-38, AMD Radeon RX 9060 XT (RADV GFX1200), Release,
AI-assisted: yes (Claude Code) |
✅ NVIDIA GPU test: passedPR head
Failing on main too (5, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 404 tests)Skipped (39)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Data from two UE5 titles: a gain in one, no change in the other Both titles issue GPU-clock Trees: A = PPSA22408 (Hot Wheels Infinite Rush), garage menu. Radeon 780M (RADV, Mesa 26.0.8), Ryzen 9 PRO 8945HS, Ubuntu 26.04.1 (Linux 7.0). Same scripted route, one run each, 5 minutes in the garage:
PPSA28416 (Star Wars Galactic Racer), title screen. RTX 3080 Ti (NVIDIA 615.71.09), Ryzen 9 5950X, Ubuntu 26.10 (Linux 7.3), two alternating runs each:
So the change works in both titles. Whether it shows up as frame rate depends on whether the remaining drains take over the wait. AI-assisted. |
…er side Main now stores labels in unregistered host memory on the GPU, so the two GPU-clock COPY_DATA stores into the test's host vector land on the GPU rather than through the CPU path. The test still requires no drain, an increasing clock and both stores made, counted on the CPU, on the GPU or behind completions. Co-authored-by: MuteRex <99267426+MuteRex@users.noreply.github.com>
✅ AMD GPU test: passedPR head
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (7, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (8 IDs in 542 tests)Skipped (59)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validation IDs already present on main (13 IDs in 545 tests)Skipped (49)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
A third title for this change: Metal Gear Solid 4 (PPSA18194, Master Collection) on Linux. RTX 4070 Ti, NVIDIA 615.71.09, Release libraries. I compared Drains. One run per build with
On Frame rate. Four plain runs, alternating
The title tree is held at the 60 fps cap. At that cap, the ~470 ms per 10 s of worker time the change saves shows only as a point or so of worker busy, which is within the run-to-run spread. No crash or regression in any run. AI-assisted: yes (Claude Code) |
|
Found a GDS destination ordering regression in this head, with a reproducer and proposed correction.
This fixture tests CPU command/pipeline ordering and creates no Vulkan device. Separately, the same four focused Vulkan groups ( Correction and registered regression test · logs, patch and receipts Test source: main AI-assisted: yes. |
Validation result (item 7 of batch wt5): GREEN — no regressionEnvironment: CachyOS, kernel 7.3.4-1-cachyos, x86-64, Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RADV, GFX1201) + AI PRO R9700, SHAs
Build lock: Build (PR tree, inside lock,
Focused test pattern (identical set verified by diffing
Test command (identical env, both trees, inside lock, Results base vs head (logs
Layer checks (per AGENTS.md):
VUID / hazard diff: Push: tested SHA pushed to fork as Verdict: PASS — build clean, focused AGC COPY_DATA/GPU-clock/drain/wait/pm4 set identical outcomes on base and head, validation layer inserted in both, no new VUID-/SYNC-HAZARD diagnostics on the PR head. Limitations: focused 13-test set only (not the full suite); single run per tree, no repetition; the PR's new |
What
A
COPY_DATA(0x40) whose source is the GPU clock (source 18) drained work it never depended on:keepsDrawPipelineit was not a keeping opcode, so every one drained the pipelined draw queue. It now keeps the pipeline unless its destination overlaps a pending range, in which case it still drains.PacketMemory, a clock copy into memory that is not imported while the recorder was busy (reason 3) drained the whole device before the store. It is now stored on the CPU, as with an idle recorder, unless the device has a store pending over the destination.The clock value is read when the packet runs, before either drain, so the drains only stalled the queue. PPSA16833 issues these copies every frame for GPU timing.
Tested
Linux 7.0, AMD Radeon RX 9060 XT (RADV, Mesa 26.0.8).
agc_drivercasetestGpuClockCopyBehindGpuWork: a 128 KiB GPU copy followed by two clock copies into host memory. It checks the copy landed, the clocks increase, no device drain happened, and both stores went to the CPU. It fails onmainwith "a GPU-clock COPY_DATA into host memory behind GPU work drained the device".agc_driver_pipelined_clock_copy: withAPS5_PIPELINED_DRAWS=1and the pipeline held over a pending range, it checks that clock copies elsewhere do not drain it and that a clock copy onto the held range still drains once. It fails onmainwith "a GPU-clock COPY_DATA off the pending range drained the pipeline".VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -R '^(agc_driver|agc_driver_pipelined_clock_copy|agc_driver_pipelined_dma|agc_driver_pm4)$' -V:main: the two new tests fail;was not found but was requested by env var VK_INSTANCE_LAYERS, and noVUID-messages.ctest: all pass exceptagc_driver_image_table_vouched_lookupsandagc_driver_guest_memory_lifetime, which fail the same way onmain.Performance, PPSA16833 (LEGO Batman: Legacy of the Dark Knight) main menu, 3840x2160, warm caches,
APS5_TRACE_SECONDS=180:30, same machine and session. Traces attached.Driver.Packet.device_lock(ms per frame)Frame time at this scene is unchanged within noise. The queue worker that ran the clock copies spends about 85 ms less per frame busy, mostly the removed device drain. The frame here is bound elsewhere: the second queue worker waits in
Driver.Packet.memory_waitand the draw committer inRecorder.Sync. Both builds carry the same local window-placement change, which is why the summaries saydirty.315f1a99fd4bis this change onc017549dc; this PR's commit is the same change rebased onto 10 later commits ofmain, none of which toucheslibSceAgcDriver. The main capture reverted the two driver files tomain.main:
{"commit":"315f1a99fd4b","dirty":true,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"180:30"},"gpu":"AMD Radeon RX 9060 XT (RADV GFX1200)","driver":"radv Mesa 26.0.8-1ubuntu0.3","os":"Linux 7.0.0-38-generic","resolution":"3840x2160","window":{"spec":"seconds 180:30","first_present":1436,"ms":30161.106},"presents":112,"frame_ms":{"p50":267.922,"p90":275.207,"p99":295.449,"max":302.908},"gpu_busy_ms_per_present":113.678,"worker_busy_pct":{"queue worker 0x0":99.881,"queue worker 0x20":96.099},"top_phases_ms_per_frame":{"Driver.Packet":527.219,"Driver.Packet.memory_wait":224.507,"Driver.Packet.device_lock":173.858,"Recorder.Sync":128.804,"Resources.Complete":107.409,"Driver.Packet.dispatch":94.176,"Driver.Dispatch":93.408,"Vulkan.Dispatch":83.002},"trace_dropped":false,"trace":"aps5-trace-315f1a99fd4b-1113523.json.gz"}this PR:
{"commit":"315f1a99fd4b","dirty":true,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"180:30"},"gpu":"AMD Radeon RX 9060 XT (RADV GFX1200)","driver":"radv Mesa 26.0.8-1ubuntu0.3","os":"Linux 7.0.0-38-generic","resolution":"3840x2160","window":{"spec":"seconds 180:30","first_present":733,"ms":30039.493},"presents":113,"frame_ms":{"p50":265.1,"p90":270.88,"p99":287.004,"max":289.107},"gpu_busy_ms_per_present":113.241,"worker_busy_pct":{"queue worker 0x0":99.897,"queue worker 0x20":97.04},"top_phases_ms_per_frame":{"Driver.Packet":523.113,"Driver.Packet.memory_wait":223.019,"Driver.Packet.dispatch":182.407,"Recorder.Sync":128.071,"Driver.Dispatch":124.245,"Resources.Complete":106.868,"GpuMutex.wait.label":106.481,"Driver.Packet.prepare_memory":106.471},"trace_dropped":false,"trace":"aps5-trace-315f1a99fd4b-1118384.json.gz"}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)🤖 Generated with Claude Code