Skip to content

hk: flush with memory scope for a G17P alias dependency recorded before any work - #23

Draft
DjDeveloperr wants to merge 6 commits into
integration/aurorafrom
aurora/g17p-alias-scope-stream-opener
Draft

DjDeveloperr wants to merge 6 commits into
integration/aurorafrom
aurora/g17p-alias-scope-stream-opener

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Draft: not hardware-tested. Mirror of aurora-silicon#124, cherry-picked onto #20 (aurora/g17p-memory-scope-flush), which merged into integration/aurora as a196911. Do not merge before the prepared Neo variants run.

Covers alias dependencies with no open compute stream holding work, at command-buffer start or after a stream-closing operation such as a timestamp. It also orders graphics after a memory-scope alias flush recorded in an open stream B holding unrelated compute, when the source transfer writes are in an earlier stream A.

The added ordering applies only with a live G17P alias resource, a compute/transfer source, an open stream holding work, and a graphics destination whose existing CDM cut does not include the flush stream. It adds no flushes. There is no extra ordering when the flush stream is the source stream or its cut is already included, and compute/transfer destinations retain their CDM subqueue ordering. Devices without alias resources gain no ordering or flushes from this change. Hardware performance cost is unmeasured.

The comment also names the untested graphics-only source case; its behavior is unchanged. The existing CPU sync test adds cases for graphics waits on B, the source-stream case, and CDM-only destinations. CI on #23 at 6a13909, which carries this code as 78198e0, built it on x86_64 and aarch64 and ran the meson suites: 156/156 pass on both, including hk_sync_prior with the new cases (run). The negative control, the new cases failing without the fix, has not been run.

Prepared gpubench scratch variants: GB_SPARSE_SPLIT=3 for a timestamp before the barrier mid-command-buffer, and =4 for unrelated compute before an XFER-to-fragment barrier with the render reading the plain alias. Variants 1/2 remain available. The changed C source compiles as an arm64 macOS object with warnings as errors; the Linux target build is blocked by the same VM endpoint. None has run. See #124 for the mechanism and remaining hardware work, including #20's Zink A/B.

Comment-only follow-up to merged #123: aurora-silicon#128; carried into this branch with cherry-pick -x and an opener-aware comment conflict resolution.

…re any work

A dependency between compute or transfer work gets its memory-scope flush
in hk_CmdPipelineBarrier2() only when the open compute stream already
holds work (hk_cdm_visibility_flush_needed() is false at stats.cmds == 0).
The first barrier of a command buffer has no open stream, so with a
sparse or capture/replay resource alive its source writes, which are in an
earlier command buffer, got no memory-scope flush before the first work
after the barrier read them through another address. hk_CmdSetEvent2()
had the same gate.

Record the flush the way a host-read dependency already does: in a stream
ordered after the source scope (hk_sync_get_cs_after()), and order the
destination kinds after that stream with hk_sync_after_stream(). A reader
in the same stream follows the record; a render waits for the stream. For
an event, the flush goes ahead of the event write in the stream that
carries it. hk_cdm_flush() still elides the record when the stream's tail
already has memory scope.

Devices without such a resource record what they did before; so does a
barrier recorded into a stream that holds work.

Not hardware-tested: the Neo is offline. Whether a memory-scope flush in a
later stream writes back lines an earlier command dirtied is the point to
test, with gpubench sparse.churn split so that the transfer barrier opens
a second command buffer, in the same vkQueueSubmit and in a following one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit d87f45f)
Name barriers after a compute stream closes as well as command-buffer openers. Also document the untested graphics-only source case, which keeps the ordinary strong flush. No behaviour changes.

(cherry picked from commit 1498a03)
An XFER source can name stream A while the open CDM stream B holds unrelated compute work. The memory-scope flush lands in B, but the source-stage dependency only orders graphics after A.

After the alias flush, extend graphics destination requirements only when their CDM cut precedes the flush stream. Leave requirements that already include that stream and CDM destinations unchanged. The caller is gated on a live G17P alias resource and a compute or transfer source.

Exercise the ordering helper and submission resolver in the existing CPU sync test, including flushes in the source stream and CDM-only destinations.

(cherry picked from commit d2e11d9)
DjDeveloperr and others added 3 commits October 31, 2026 12:45
…eam-opener

Both branches carry aurora-silicon#128's comment correction, cherry-picked
onto each. Keep this branch's wording, which also describes the stream-opener
flush this branch adds.
…eam-opener

Keep this branch's alias-scope comment, which describes the flushes this
branch adds in place of the gaps #20's comment names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The alias-scope comment names the stream-opener flush this branch adds but
not the ordering hk_sync_after_alias_flush() adds when the open stream
holds work unrelated to the source. Say that a graphics destination is
ordered after that stream too. Comment only; every line now fits in 80
columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 293c57c)
@DjDeveloperr
DjDeveloperr changed the base branch from aurora/g17p-memory-scope-flush to integration/aurora November 1, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant