Repository navigation
fix(agc): store labels the GPU cannot reach in stream order - #2044
Merged
oneandonlydean merged 1 commit intoOct 10, 2026
Merged
Conversation
A label in memory the device has no host import of was stored when its batch was reaped, after later labels the GPU had already made visible. A title that reused that memory saw its next command buffer overwritten by the stale value (boykopovar#1458). Wait for the recorded work and store it then. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 9, 2026
Contributor
|
Windows run: Windows 11 Pro 25H2 (10.0.26200.9457), RTX 5060 Ti (NVIDIA 617.42), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release,
AI-assisted: yes |
9 tasks done
|
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.
|
SleglJan
pushed a commit
to SleglJan/AnyPS5
that referenced
this pull request
Oct 10, 2026
…abel-pm4 fix(agc): store labels the GPU cannot reach in stream order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
For #1458. Astro Bot stops at submission validation after about 20 s when part of its command memory has no host import:
A label whose memory the device has no host import of was stored by a completion action of its batch, so it landed only when the batch was reaped. Labels recorded after it were stored by the GPU and became visible first. The title saw those, reused the earlier label's memory for its next command buffer, and the late store then wrote the label's
1over aRELEASE_MEMheader there (EdouardSence traced the write toRecorder::AfterCompletionswith a watchpoint).On the console the CP stores labels in stream order: a later
RELEASE_MEMvalue is never visible before an earlier one. The Linux amdgpu driver relies on this. Its gfx10 fences areRELEASE_MEMwrites (gfx_v10_0_ring_emit_fence), andamdgpu_fence_processsignals every fence up to the last sequence number it reads.As oneandonlydean diagnosed, a label the GPU can't store has to be stored at its place in the stream.
WriteLabelOnGpunow answers "memory not imported" for such a label in every case, not only withAPS5_DRAIN_COMPLETION_LABELS=1. The callers then wait for the recorded work and store it on the CPU. Labels in imported memory are unchanged, and so is a label behind a pending write-back, which the GPU also stores in order. The cost is one wait per label the GPU cannot reach. That is listed in TechnicalDebt. Open #1747 and #1896 addreason == 6checks, which never match after this change; #1864 edits neighbouring lines inPacketMemory.cppandDeferredLabels.cpp.Which title needs it
PPSA21567 (Astro Bot, v01.019.000), from #1458. EdouardSence's runs were on
main6b57386 with #759 merged locally (without #759 it stops earlier, on another error) andAPS5_HOST_IMPORT_MIB=64. There it stops at the line above in 3 runs out of 3, and withAPS5_DRAIN_COMPLETION_LABELS=1it runs to the 100 s timeout in 3 runs out of 3. That debug variable stores these labels the same way as this change, and it also turns off label queuing, which this change keeps. We do not have this title and could not run it with this change.Tested
CachyOS Linux, GCC, RTX 4070 Ti (NVIDIA) and Radeon 610M (RADV).
agc_driver_unimported_label_ordertest. It records a fill, then a label in memory the device has no import of, then a later label in imported memory, and waits for the later one to land. The guest then writes aRELEASE_MEMheader over the first label's word, and the test waits for the device to go idle. Onmainthe first label still holds0when the later one has landed, and the reused word ends up0x00000001, the PPSA21567: submission stops on "unsupported PM4 packet type: header 0x00000001" where a RELEASE_MEM header is expected #1458 symptom (3 runs out of 3 on each GPU). With the change it passes 3 runs out of 3 on each GPU.check_conventions.py --base origin/mainandgit diff --check: clean.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code