Skip to content

drm/asahi: g17: G17P cross-queue sync fast paths and compute MCache tables - #1892

Merged
DjDeveloperr merged 5 commits into
integration/aurorafrom
djdev/g17p-sync-copy
Nov 14, 2026
Merged

DjDeveloperr merged 5 commits into
integration/aurorafrom
djdev/g17p-sync-copy

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Summary

Four G17P changes for cross-queue synchronization and compute writes (M5 and other generations unchanged):

  • Share one UAT execution context among a VM's queues. Logical queues of one VM used separate execution contexts, so every cross-queue hop between them paid the memory-scope write-back that ends each command, and each queue spent one of the machine-wide contexts. On G17P a VM's queues now share its live context. Each queue keeps its own scheduler page, QoS identity and work list, and kills and scheduler releases stay per queue.
  • Order same-context compute inputs by kick dependencies. A compute command that consumes another queue's compute output in the same execution context now names the producer as a kick-entry dependency instead of waiting on a completion-wait record. The completion-wait record released it only after the producer's completion stamp landed. Sources in other contexts keep the record.
  • Leave out the predecessor record on cross-queue kicks. With same-context inputs ordered by the kick entry, the record only gave the firmware one more item to walk per hop. A queue's first kick, which installs it, keeps the record.
  • Name compute write ranges in an MCache table. G17P compute kicks now carry the command's write ranges in an MCache table, as fragment kicks already do, instead of dropping the validated list. Firmware builds without MCache tables and M5 command sets keep sending none.

All four are on by default, with no switch.

Testing

Neo (J700, G17P), on the default kit's kernel, with a test build where each change sat behind a same-boot switch (same code paths as these commits), one boot, A/B per switch:

row before after
sync.signal queues d2, binary, µs per hop 29.7 15.2
sync.signal queues d2, timeline, µs per hop 30.4 15.6
copy.bw fill d1, µs 1221 1143
copy.bw fill d4, µs 1219 1140
  • Sharing the context alone changes nothing. The two ordering changes need it, and together the three halve the cross-queue hop.
  • The MCache table takes 6.5% off fill. buf2buf is unchanged.
  • render.light queues and concurrent rows are unchanged. compute.heavy alu queues d2 is +0.7% per submit (+1.6% GPU time), within run-to-run spread but still to be watched.
  • Correctness, with full counts, passes with all three ordering changes on: cross-queue order, coherence, acquire, data, chained, slow-producer and fan-in tests.
  • dEQP-VK synchronization (basic, timeline semaphores, multi-queue sync and sync2) 0 Fail. fill/update and copy groups with the MCache table: 0 Fail.
  • A 60 s multi-client run had 0 lost devices.

These exact commits get their own hardware row (the same rows plus the fast merge gate) in the next default-kit qualification.

  • fedora kcheck (full arm64 build, Neo kit config) of 1134ce5: OK, vmlinux + Image + aurora.ko linked, no new warnings in the changed files.
  • Host tests (tools/asahi/run-host-tests.py, every g17 test plus queue-priority and m3-runtime, which read the changed files): 33/33 passed.

🤖 Generated with Claude Code

Userspace lists the buffers a compute command writes (the compute
attachment list), and fragment kicks already name their attachments in
an MCache table when the firmware takes one. Compute kicks never did:
the list was validated and dropped.

Give G17P compute kicks the same table: the command's write ranges, as
attachment-class ranges translated in the work's UAT context, in the
MCache space of the descriptor's main register array, which the kick
entry names through the descriptor's client alias like its register
bindings. Firmware builds without MCache tables and M5 command sets keep
sending none.

Signed-off-by: Diljit Singh <[email protected]>
Every logical queue took its own execution context (TTBAT slot and
context id), even the queues of one VM. GPU caches are tagged by address
and context, so queues of one client in separate contexts only see each
other's writes after the memory-scope write-back that ends each command,
and every cross-queue hop pays for it. It also spends one of the
machine-wide execution contexts per queue rather than per client.

On G17P, let the logical queues of one VM share its live execution
context. Each sharer keeps its own scheduler page, QoS identity and work
list; only the context id is common. Work keys are the context id plus
the low six bits of a work-state word, so sharers draw work-state
indices from one claim map. Kills and scheduler releases stay keyed by
the per-queue scheduler page. The last sharer's explicit release
returns the root; a sharer dropped without one leaves it to the last
reference, as an unshared context does. M5 is unchanged.

Signed-off-by: Diljit Singh <[email protected]>
A G17P compute command that consumes another queue's compute output
waits through a completion-wait record: the firmware releases it once
the producer's completion stamp lands, well after the producer's GPU
work ended. Between kicks of one execution context the GPU needs no
write-back, so the kick entry's dependency alone orders them, as M5's
shared-ring queues already do.

Name a source of the consumer's own execution context as a kick-entry
dependency and leave out its completion-wait record. Sources in other
contexts keep the record.

Signed-off-by: Diljit Singh <[email protected]>
A G17P compute kick whose entry names another queue's kick also carried
a predecessor record after its announcement. With cross-queue inputs of
one execution context ordered by the kick entry itself, the record only
adds an item for the firmware to walk on every hop. Keep it for the
queue's first kick, which installs the queue.

Signed-off-by: Diljit Singh <[email protected]>
…nit harness

The module initializer now also initializes the registry of execution
contexts shared by a VM's G17P queues, before either adapter registers.
The probe-init harness compiles that initializer: give it a stub that
records the init, and check it is done before registration like the
binding and queue-share registries.

Signed-off-by: Diljit Singh <[email protected]>
@DjDeveloperr
DjDeveloperr merged commit 6cfa315 into integration/aurora Nov 14, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the djdev/g17p-sync-copy branch November 16, 2026 05:03
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