Repository navigation
borealis: skip query-memory CDM streams in application self-cut prefix check - #1247
Merged
Merged
Conversation
…x check Commit 088f203 (#1213) changed cs_reusable() so a self-cut compute barrier keeps an open compute stream only when that stream already waits for its predecessor on the compute subqueue. Commit c454b39 (#1235) then flushed leading timestamps into a preceding pure HK_SYNC_STAMP carrier before opening a compute stream. When an application compute stream follows a pure HK_SYNC_STAMP or HK_SYNC_QRESET stream (such as a leading timestamp carrier, timestamp copy stream, post-graphics query availability stream, or timestamp reset), an application barrier never names those query-memory streams, so the open compute stream does not wait on them. Treating them as unwaited predecessors in cs_reusable() caused hk_sync_check_cs() to split the compute stream on the first compute barrier, breaking test-hk-sync-stamps.c:1237 and gratuitously splitting compute chains. Scope cdm_waits_for_prefix() by the required producer kinds: - For application work in cs_reusable(), walk back to the latest earlier HK_SYNC_ALL compute stream, ignoring pure HK_SYNC_STAMP and HK_SYNC_QRESET streams while still splitting whenever an unwaited application compute stream sits behind them. - For hk_sync_get_cs_after() and non-application callers (query commands, events, and timestamp streams), keep checking HK_SYNC_STREAM_KINDS so dependencies on earlier stamp or reset streams are never dropped. Signed-off-by: DjDeveloperr <hey@djdev.me>
Author
|
J714s (MacBook Pro M5 Pro,
|
DjDeveloperr
commented
Nov 27, 2026
DjDeveloperr
left a comment
Author
There was a problem hiding this comment.
Independent review at b3dba28a7a8d: LGTM, no blockers.
- Splitting
cdm_waits_for_prefix()/cs_meets()onprefix_kindsviaprevious_on_sq_kinds()cleanly separates reusable application compute streams (HK_SYNC_ALL, so pureHK_SYNC_STAMP/HK_SYNC_QRESETcarriers do not force a split while any unwaited priorHK_SYNC_ALLcompute stream behind them still splits) fromhk_sync_get_cs_after()and stamp/query/reset callers (HK_SYNC_STREAM_KINDS). - Unit coverage in
test-hk-sync-prior.cexercises both cases, Fedora CI is218/218 PASS(hk_sync_stamps 896/896,hk_sync_prior 3,784/3,784), and both J700 (G17P) and J714s (G17S) exact-head verification rows passed with zero faults.
RyanTheTide
approved these changes
Nov 27, 2026
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: MERGE at b3dba28a7a8d
Blockers: none
Checked:
- This fixes the tip's red
hk_sync_stampsfrom the #1213 x #1235 clash (bisect on #1235). Head merged into aurora-wip78d817d9: local drm-shim gate 338 Ok / 0 Fail, against 337/338 at the tip, where onlyhk_sync_stampsfails. - Application compute (
cs_reusable()with kinds lacking STAMP/QRESET) now checks its self-cut prefix only against earlierHK_SYNC_ALLcompute streams. That is safe because:HK_SYNC_STAMPstreams write only query memory, which no application dependency names (hk_sync.h:98-106).HK_SYNC_QRESETis used only for timestamp pool resets (hk_CmdResetQueryPool()setskind_override = stamps ? HK_SYNC_QRESET : HK_SYNC_ALL,hk_query_pool.c:888). Occlusion and pipeline-statistics resets, which dispatches do write through, stayHK_SYNC_ALLand keep ordering every later dispatch.
- Query commands, events and timestamps keep the full
HK_SYNC_STREAM_KINDSprefix: thekinds & (STAMP|QRESET)path, plushk_sync_get_cs_after()and the pinned-stream re-cut, which passHK_SYNC_STREAM_KINDSexplicitly. previous_on_sq_kinds()walks the same list asprevious_on_sq()with a kind filter. An unwaitedHK_SYNC_ALLstream behind a stamp stream still forces the split (newtest_compute_self_cut()cases).
Rows: shared sync code. A J700 row plus another generation at this head, then merge.
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.
Fixes the
asahi - mesa:hk_sync_stampsline 1237 CI failure onaurora-wipcaused by the interaction between #1213 (088f2038215) and #1235 (c454b390fe6).What:
cdm_waits_for_prefix()andcs_meets()insrc/asahi/vulkan/hk_sync.cby the producer kinds that a self-cut compute barrier covers (previous_on_sq_kinds()).cs_reusable(), when checking application compute work againstcmd->sync.req(which never names pure query-memory streams), walk back past pureHK_SYNC_STAMPandHK_SYNC_QRESETstreams to the latest earlierHK_SYNC_ALLcompute stream. This avoids gratuitously splitting an open compute stream after a leading timestamp carrier, timestamp copy stream, post-graphics query availability stream, or timestamp reset, while still splitting whenever an unwaitedHK_SYNC_ALLcompute stream sits behind them.hk_sync_get_cs_after()and non-application callers (HK_SYNC_STAMP/HK_SYNC_QRESET), keep checkingHK_SYNC_STREAM_KINDSso query commands, events, and timestamp streams never drop dependencies on earlier stamp or reset streams.src/asahi/vulkan/tests/test-hk-sync-prior.c(test_compute_self_cut()) covering pureHK_SYNC_STAMP/HK_SYNC_QRESETpredecessors, unwaited vs. waitedHK_SYNC_ALLcompute streams behind a stamp stream, andhk_sync_get_cs_after()withHK_SYNC_QUERY_SCOPE(normal and pinned).Root cause:
cs_reusable()so a self-cut compute barrier keeps an open compute streamd0only whend0already waits forprevious_on_sq(cmd, d0).HK_SYNC_STAMPcarrierc0before creatingd0. Because application barriers never nameHK_SYNC_STAMP,d0does not wait onc0.test-hk-sync-stamps.c:1219recorded aGFX | COMPUTEbarrier afterd0,cdm_waits_for_prefix(cmd, d0)sawc0as an unwaited predecessor and endedd0, causingd1 != d0and failingtest-hk-sync-stamps.c:1237(as well as gratuitously splitting compute chains following any pureHK_SYNC_STAMP/HK_SYNC_QRESETstream).Tested:
./rig/fedora-mesaci.sh b3dba28a7a8d): 218/218 PASS,0fail,0warnings in touched files (hk_sync_stamps: 896 tests, 0 failures;hk_sync_prior: 3,784 checks, 0 failures).J700,G17P B1, stock7.3.0-41.fc44.aurora.aarch64, isolated overlaygit-b3dba28a7a,stock.diff=0,kfaults GPU-side=0,avc_delta=0,recoveries=0):gpubench-d3d12 --verify --test compute.conv2d --param kind=gaussian --param res=1080p --depths 1: PASS (1209.68 us/submit,gpu_us 1093.42 us, CRC2d55a14dvalid).deqp-vk):dEQP-VK.query_pool.occlusion_query.*(434/441 Pass, 7 Not supported, 0 Fail),dEQP-VK.query_pool.statistics_query.compute_shader_invocations.*(60/60 Pass, 0 Fail),dEQP-VK.query_pool.statistics_query.reset_before_copy.*(4,650/4,651 Pass, 1 Not supported, 0 Fail) — 5,144 Pass / 0 Fail total.Risk: two-way · M3, M4, Neo, M5
Not yet:
gpubench-vk render.pass_chain kind=oq_baron J700 (neohwwas occupied by an ABBA run during follow-up) and hardware runs on M3, M4, and M5 (all four M5/G17P chip variants and exact-prior modes are covered byhk_sync_stampsandhk_sync_prior).