fix(rocr): wddm/queue: fix AQL->PM4 consumer race on not-yet-published VENDOR_SPECIFIC packets - #9274
Merged
Merged
Conversation
fcui-amd
requested review from
cfreeamd,
chrispaquot,
dayatsin-amd and
gandryey
as code owners
July 27, 2026 02:23
❌ PR Check — Action Required
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
dayatsin-amd
approved these changes
Aug 5, 2026
…FIC packets at write-index burst boundaries AqlToPm4Thread can admit a ring slot before its body is published when a producer bumps write_dispatch_id by a whole burst at once (e.g. HIP graph replay). IsInvalidPacket reads the header non-atomically and gates only HSA_PACKET_TYPE_INVALID, so a recycled slot mid-publication reads type VENDOR_SPECIFIC (0) with a stale ven_hdr and is processed as a malformed PM4-IB -> assert(ven_hdr == AMD_AQL_FORMAT_PM4_IB) at queue.cpp:841 (or silent GPU corruption on NDEBUG). Fix: read the slot header in SwitchAql2PM4 via wsl::atomic::Load(memory_order_acquire), and defer-and-retry a VENDOR_SPECIFIC slot whose ven_hdr != AMD_AQL_FORMAT_PM4_IB (return HSA_STATUS_SUCCESS), mirroring the INVALID handling. Hoist AMD_AQL_FORMAT_PM4_IB to a file const. Validated gfx1151 / ROCm 7.13 / WSL2: A/B assert builds abort before, zero aborts after.
consume Follow-up nits from PR #68: 1. IsInvalidPacket() now reads the slot header via wsl::atomic::Load(..., memory_order_acquire), matching SwitchAql2PM4() so the readiness gate uses the same acquire pairing with the producer's release publication instead of a plain (racy) read. 2. Clear ven_hdr (= 0) when a VENDOR_SPECIFIC slot is consumed, so a recycled slot cannot transiently read a stale AMD_AQL_FORMAT_PM4_IB before the next producer republishes its body. Signed-off-by: Flora Cui <flora.cui@amd.com>
fcui-amd
force-pushed
the
users/fcui/wsl-aql-pm4-acquire-fix
branch
from
August 6, 2026 02:14
dc4ff32 to
34742e0
Compare
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.
Motivation
port librocdxg pr
ROCm/librocdxg#68
ROCm/librocdxg#72
to rocr repo
Technical Details
details are described in ROCm/librocdxg#68
Issue Tracking
Test Plan
HIP graph replay as mentioned in ROCm/librocdxg#68
Test Result
Submission Checklist