Repository navigation
borealis/agx2: Enable deferred CDM cache flushes on G13X - #1233
Merged
RyanTheTide merged 1 commit intoNov 27, 2026
Merged
Conversation
Move AGX_CAP_CDM_DEFER_FLUSH into AGX_CAPS_G13 so G13X (M1 Pro/Max) joins G13G in deferring trailing 0x1ff CDM cache flushes on independent application compute dispatches until a declared barrier, non-deferred/meta launch, or stream close. Update test-chip-caps.c to expect AGX_CAP_CDM_DEFER_FLUSH on both G13G and G13X, and update test-hk-cdm-barrier-stream.c to exercise deferred flushes on both G13G and G13X while keeping non-deferred narrowing coverage on G14X. Signed-off-by: Dante Loi <danteloi1993@gmail.com>
|
|
RyanTheTide
approved these changes
Nov 27, 2026
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: MERGE at da260397f11c
Blockers: none
Checked:
- The cap moves into
AGX_CAPS_G13, so G13X gets it via the chip-caps table, not a chip check (NO-GATES fine).AGX_CHIP_G13Xcovers the S/C/D variants (agx_chip.h:669-671): M1 Pro/Max/Ultra. No other chip's caps change. - The #1219 fix still holds at this head:
hk_dispatch_precomp()passesallow_defer = false(hk_cmd_buffer.c:5592), andhk_dispatch_with_usc()allows deferral only forMESA_SHADER_COMPUTE(hk_cmd_dispatch.c:1022-1023). The GS/tess pre-pass launches in hk_cmd_draw.c are not COMPUTE stage, andin_metalaunches still drain. Cases 5-7 of the stream test (precomp never defers; a deferred app launch drains before precomp; an SSBO barrier before precomp is upgraded to 0x1ff) now run on G13X as well as G13G. - The narrowing-only tests moved from G13X to G14X, so they still cover a non-deferring chip. G14X keeps the 0x1ff default word (
agx2_cdm_barrier_default_word), so the expected words are unchanged. - Head merged into aurora-wip
743fa0d3(clean; none of the touched files changed since your base13400438): local drm-shim gate 338 Ok / 0 Fail. - Negative check: with
agx_chip_caps.hreverted to aurora-wip and the tests kept,asahi-agx-chip-capsfails andhk_cdm_barrier_streamaborts (336/2). - Rows at this head: present: J316c M1 Max G13X (yours) and J316s M1 Pro G13S (comment above; also
AGX_CHIP_G13X, sync barrier compute shard 27/27). That covers both dies of the only chip entry that changes. A regression row on another generation is not needed: on every other chipAGX_CAP_CDM_DEFER_FLUSHis unchanged, socdm_flush_pendingis never set and the command stream is the same by construction.
Evidence
- Gate (head merged into aurora-wip 743fa0d, tree 1cf25468):
Ok: 338 Fail: 0 - Mutation (agx_chip_caps.h reverted, tests kept):
Ok: 336 Fail: 2(asahi-agx-chip-capsexit 1,hk_cdm_barrier_streamSIGABRT) git diff --stat 13400438..743fa0d3 --(the 3 touched files): empty
joshuaswarren
pushed a commit
that referenced
this pull request
Nov 27, 2026
…ait slots on G14X Add two AGX2 compute-shader scheduling passes gated via agx_chip_caps on G14X (Apple M2 Pro/Max/Ultra), with no new runtime switches: 1. AGX_CAP_COMPUTE_HOIST_LOAD_ADDRS (1u << 28; agx_hoist_loads in agx_pressure_schedule.c, run after agx_ilp_schedule on AGX2 compute): hoists non-coherent device_loads together with up to 3 pure SSA address-producing predecessors (depth <= 4) up to 64 instructions earlier while maintaining a strictly-earlier SSA dominance invariant. 2. AGX_CAP_COMPUTE_SMART_WAITS (1u << 27; agx_insert_waits_local in agx_insert_waits.c): precomputes per-block first-use positions in a single O(N) backward pass (respecting #1232 reorderable loads across threadgroup barriers) and partitions the two hardware scoreboard slots by first-use distance to eliminate mid-burst AGX_MAX_PENDING=8 slot-0 overflow stalls. Rebased cleanly onto aurora-wip 7617c83 (preserving #1232 drain_on_tg_barrier and #1233 G13X CDM defer flush). Author-Model: google/gemini-4-neon
joshuaswarren
added a commit
that referenced
this pull request
Nov 27, 2026
…ait slots on G14X Add two AGX2 compute-shader scheduling passes gated via agx_chip_caps on G14X (Apple M2 Pro/Max/Ultra), with no new runtime switches: 1. AGX_CAP_COMPUTE_HOIST_LOAD_ADDRS (1u << 28; agx_hoist_loads in agx_pressure_schedule.c, run after agx_ilp_schedule on AGX2 compute): hoists non-coherent device_loads together with up to 3 pure SSA address-producing predecessors (depth <= 4) up to 64 instructions earlier while maintaining a strictly-earlier SSA dominance invariant. 2. AGX_CAP_COMPUTE_SMART_WAITS (1u << 27; agx_insert_waits_local in agx_insert_waits.c): precomputes per-block first-use positions in a single O(N) backward pass (respecting #1232 reorderable loads across threadgroup barriers) and partitions the two hardware scoreboard slots by first-use distance to eliminate mid-burst AGX_MAX_PENDING=8 slot-0 overflow stalls. Rebased cleanly onto aurora-wip 7617c83 (preserving #1232 drain_on_tg_barrier and #1233 G13X CDM defer flush). Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
RyanTheTide
pushed a commit
that referenced
this pull request
Nov 28, 2026
Document and assert in hk_dispatch_with_usc_launch() that draw-feeding GS/tess compute helpers on current_cs.pre_gfx never defer their trailing CDM cache flush, and update the stale AGX2 flush comment on the G17P compute launch path after AGX_CAP_CDM_DEFER_FLUSH landed in #1219/#1233. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
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.
Problem
PR #1219 added
AGX_CAP_CDM_DEFER_FLUSHto omit redundant trailing0x1ffCDM cache flushes after independent application compute launches, but enabled it onG13Gonly untilG13Xhardware qualification was completed.Change
src/asahi/lib/agx_chip_caps.h: moveAGX_CAP_CDM_DEFER_FLUSHintoAGX_CAPS_G13soG13X(M1 Pro/Max) shares the deferred CDM flush behavior withG13G.src/asahi/lib/tests/test-chip-caps.c: updatetest_cdm_defer_flush()to expectAGX_CAP_CDM_DEFER_FLUSHon bothG13GandG13X.src/asahi/vulkan/tests/test-hk-cdm-barrier-stream.c: run the deferred-flush stream suite (test_defer_flush_g13()) on bothG13GandG13X, and run the non-deferred0x1ff/0x160narrowing tests onG14X(which keeps non-deferred flushes).Testing
Tested on a 16-inch MacBook Pro M1 Max (J316c, G13X), kernel
7.3.0-ds4-ARCH:origin/aurora-wip13400438325):libvulkan_asahi.sosha256d39ac03363d8a344844f4a0741550018b4b1b94c4f8bb427840a6c75691f15f4agx2-g13x-cdm-defer-flushda260397f11):libvulkan_asahi.sosha256279b2d2ef82180e1ca5a1d714210ea0ee96e898cc99b559a002fbd0c54b41c23asahi-agx-chip-caps(OK),hk_cdm_barrier_stream(OK).deqp-vk, 0 regressions):dEQP-VK.compute.pipeline.basic.*: 77 Pass, 0 Fail, 3 NotSupporteddEQP-VK.compute.pipeline.indirect_dispatch.*: 18 Pass, 0 Fail, 27 NotSupporteddEQP-VK.synchronization2.op.single_queue.barrier.*ssbo_compute*: 100 Pass, 0 Fail, 104 NotSupporteddEQP-VK.synchronization2.op.single_queue.barrier.*image_compute*: 412 Pass, 0 Fail, 225 NotSupporteddEQP-VK.synchronization2.op.single_queue.barrier.*indirect*: 369 Pass, 0 Fail, 262 NotSupporteddEQP-VK.synchronization2.op.single_queue.event.*ssbo_compute*: 150 Pass, 0 Fail, 194 NotSupporteddEQP-VK.synchronization.op.single_queue.barrier.*ssbo_compute*: 50 Pass, 0 Fail, 52 NotSupporteddEQP-VK.memory_model.message_passing.core11.u32.coherent.fence_fence.atomicwrite.device.*: 13 Pass, 0 Fail, 44 NotSupportedgpubench-vk alternating A/B (depth 4, 3 pairs x 5 runs, M1 Max J316c)
compute.lightcompute.heavycompute.conv2dcompute.stereocopy.bwdiag.fill