Skip to content

agx: hoist compute loads/addrs and balance multi-slot waits on G14X (+1.13% 2B decode) - #1224

Merged
RyanTheTide merged 2 commits into
aurora-wipfrom
agx/agx2-compute-hoist-addr-smart-waits
Nov 28, 2026
Merged

RyanTheTide merged 2 commits into
aurora-wipfrom
agx/agx2-compute-hoist-addr-smart-waits

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Nov 27, 2026 •

Copy link
Copy Markdown

What

Add post-schedule compute load/address hoisting (agx_hoist_loads + addr_chain) and multi-slot wait balancing (AGX_CAP_COMPUTE_SMART_WAITS) on Apple M2 Max (G14X / G14C) on top of aurora-wip, with full unit tests and Apple M2 Max decode/CTS verification.

  • Base (aurora-silicon/mesa aurora-wip): 7617c835cd8b (benchmarked matched against aurora-wip@3edbd1c46211 and re-verified on aurora-wip@a15657a362b7, harmonized cleanly with merged #1232 drain_on_tg_barrier and #1233 G13X CDM defer flush)
  • Branch / Commit carried: agx/agx2-compute-hoist-addr-smart-waits, single cohesive commit bb81a8ad8d4cd5f9983a81894baff8df066db492 (9 files, +685/-8: agx_chip_caps.h, test-chip-caps.c, agx_compile.c, agx_compiler.h, agx_insert_waits.c, agx_pressure_schedule.c, meson.build, test-hoist-loads.cpp, test-insert-waits.cpp)
  • What it carries (the passes + G14X capability enablement + failing-on-base unit tests):
    1. agx_hoist_loads + address-producer hoisting (agx_pressure_schedule.c, agx_compile.c, agx_compiler.h), lifting compute device loads and their address arithmetic above independent ALU after scheduling.
    2. Multi-slot compute wait balancing (AGX_CAP_COMPUTE_SMART_WAITS in agx_chip_caps.h and agx_insert_waits.c), splitting >8-load compute bursts across scoreboard slots so loops avoid AGX2's 8-pending-load mid-burst slot 0 stall.
    3. Capability gating strictly on G14X (Apple M2 Max, leaving G13G, G13X, G14G, G14S, G14D, fragment shaders, and AGX3/Gen 15+ untouched; G13X will be proposed separately once measured on aurora-wip), with no new runtime env switches.

Table 1: Measured Results on aurora-wip Base (Apple M2 Max, G14C B1)

Matched interleaved ABBA across three aurora-wip .so binaries built from the exact same base (MESA_SHADER_CACHE_DISABLE=1, MLX_OMARCHY_DEFER_TOKENS=0, omarchy-mlx 819625f8f34e, zero driver env flags, /proc/self/maps + SHA-256 verified, 100% bit-identical greedy token digests):

Model Context Comparison (aurora-wip) Arm A Arm B Delta Pairs Greedy Digest
Qwen3.8-2B-mlx-4Bit 512 base vs smart_waits only 5.3228 ms (187.87 tok/s) 5.2973 ms (188.78 tok/s) +0.48% (-25.5 us/tok) 5/5 4784df039da04560
Qwen3.8-2B-mlx-4Bit 512 base vs hoist_addr + smart_waits (this PR) 5.3415 ms (187.21 tok/s) 5.2915 ms (188.98 tok/s) +1.13% (-50.0 us/tok) 5/5 4784df039da04560
Qwen3.8-2B-mlx-4Bit 512 smart_waits vs hoist_addr + smart_waits 5.3142 ms (188.18 tok/s) 5.2852 ms (189.21 tok/s) +0.52% (-29.0 us/tok) 4/5 4784df039da04560
Qwen3.8-2B-mlx-4Bit 2048 base vs hoist_addr + smart_waits (this PR) 5.4395 ms (183.84 tok/s) 5.3985 ms (185.24 tok/s) +0.70% (-41.0 us/tok) 5/5 c5fb4074d0b56223
Qwen3.5-9B-MLX-4bit 512 base vs hoist_addr + smart_waits (this PR) 16.4084 ms (60.94 tok/s) 16.3994 ms (60.98 tok/s) -0.01% (neutral) 1/3 cedd5549b251572a

The 3-way comparison shows that agx_hoist_loads + address hoisting adds +0.52% (4/5) on top of smart_waits alone even alongside aurora-wip's agx_ilp_schedule, for a combined +1.13% (5/5, -50.0 us/tok) win on Qwen3.8-2B ctx=512 and +0.70% (5/5) on ctx=2048.

Table 2: Reference Measurements on Shipped Mesa Vulkan Driver Line (1650fc1a33, non-aurora-wip)

For reference on our shipped Mesa Vulkan driver line (1650fc1a33, which uses agx_pressure_schedule rather than agx_ilp_schedule), matched same-binary interleaved ABBA (MESA_SHADER_CACHE_DISABLE=1, MLX_OMARCHY_DEFER_TOKENS=0, omarchy-mlx f63bb9878) toggling AGX_HOIST_LOADS=0 vs 1 won all 24/24 decode pairs and all 6/6 prefill cells (zero regressions, bit-exact):

Model Context Decode (=0) Decode (=1) Decode Delta Pairs Prefill (=0 -> =1) Prefill Delta Greedy Digest
Qwen3.8-2B-mlx-4Bit 512 5.2200 ms (191.57 tok/s) 5.0153 ms (199.39 tok/s) +4.12% (-204.7 us/tok) 5/5 369.1 -> 369.0 ms (1387 -> 1388 tok/s) +0.08% (3/5) 4784df039da04560
Qwen3.8-2B-mlx-4Bit 2048 5.3454 ms (187.08 tok/s) 5.1272 ms (195.04 tok/s) +4.18% (-218.2 us/tok) 5/5 1016.6 -> 1016.5 ms (2015 -> 2015 tok/s) +0.01% (3/5) c5fb4074d0b56223
Qwen3-4B-Instruct-2507-4bit 512 11.6089 ms (86.14 tok/s) 11.5247 ms (86.77 tok/s) +0.89% (-84.2 us/tok) 5/5 829.2 -> 826.4 ms (617 -> 620 tok/s) +0.23% (5/5) a6fad159dfa90047
Qwen3-4B-Instruct-2507-4bit 2048 13.9122 ms (71.88 tok/s) 13.7435 ms (72.76 tok/s) +1.21% (-168.7 us/tok) 3/3 2952.5 -> 2909.3 ms (694 -> 704 tok/s) +0.77% (2/3) 9115b5280c1d7e33
Qwen3.5-9B-MLX-4bit 512 16.0213 ms (62.42 tok/s) 15.9135 ms (62.84 tok/s) +0.75% (-107.8 us/tok) 3/3 1482.6 -> 1480.2 ms (345 -> 346 tok/s) +0.15% (2/3) cedd5549b251572a
Qwen3.5-9B-MLX-4bit 2048 16.3011 ms (61.35 tok/s) 16.1982 ms (61.74 tok/s) +0.63% (-102.9 us/tok) 3/3 4434.0 -> 4415.1 ms (462 -> 464 tok/s) +0.42% (2/3) 5b327e139ad9b881

Enabling all three (AGX_HOIST_LOADS + AGX_HOIST_ADDR + AGX_SMART_WAITS) on the shipped line adds another +1.85% (5/5) on omarchy-mlx 819625f8f34e (2B@512: 202.71 -> 206.42 tok/s, 2B@2048: 198.74 -> 202.49, 9B@512: 63.41 -> 64.35, 9B@2048: 62.13 -> 63.10, 16/16 wins, bit-exact).

Conformance & Unit Tests

  • Chip-caps unit test (test-chip-caps): 767/767 checks PASSED (verifying AGX_CAP_COMPUTE_SMART_WAITS = 1u << 27 and AGX_CAP_COMPUTE_HOIST_LOAD_ADDRS = 1u << 28 strictly on G14X, clear of merged #1219 1u << 25, unchanged on G13G/G13X/G14G/G14S/G14D).
  • Compiler unit tests (agx_tests): Full 154-suite agx_tests run on the exact tree (2cf39081, bb81a8ad8d4c atop aurora-wip@7617c835cd8b): 1722 passed, 0 failed, 1 pre-existing skip (test-rte-fma.cpp:245), including 16/16 HoistLoads.*:InsertWaits.* (0 ms, covering AddrProducerNeverMovesDownward, SmartWaitsAvoidsMidBurstOverflowOnG14X, SmartWaitsLinearOnLongIndependentLoadBlock, and ComputeSyncCrossesThreadgroupBarrierStopsAtMemoryBarrier).
  • Vulkan CTS (deqp-vk on Apple M2 Max G14C, MESA_SHADER_CACHE_DISABLE=true, cases-8bit.txt 440 cases):
    • aurora-wip base vs smart_waits: 440 total (111 Pass, 329 NotSupported, 0 Fail) vs 440 (111 Pass, 329 NotSupported, 0 Fail), diffs=0.
    • aurora-wip base vs hoist_addr + smart_waits (this PR, verified on both 3edbd1c4 and rebased a15657a3): 440 total (111 Pass, 329 NotSupported, 0 Fail) vs 440 (111 Pass, 329 NotSupported, 0 Fail), diffs=0.

Risk

Two-way · G14X (Apple M2 Max) compute shader scheduling and wait-slot assignment only; fragment shaders, G13G, G13X, G14G/G14S/G14D, and AGX3/Gen 15+ are unchanged.

@joshuaswarren
joshuaswarren requested review from a team and DjDeveloperr as code owners November 27, 2026 11:28
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-27T11:28:33.200942Z
We couldn’t complete this review. Comment @codex review to try again.
fdae4ff PR opened
🔒 Security Review ❌ Failed 2026-11-27T11:28:40.142697Z
We couldn’t complete this review. Comment @codex security review to try again.
fdae4ff PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@joshuaswarren

Copy link
Copy Markdown
Author

Rebased onto aurora-wip a15657a (head 7dc0f63) and renumbered caps to 1u << 27 (AGX_CAP_COMPUTE_SMART_WAITS) and 1u << 28 (AGX_CAP_COMPUTE_HOIST_LOAD_ADDRS) after #1219 took 1u << 25; test-chip-caps passes (767/767) and we are rerunning the Apple M2 Max benchmark row on the rebased head.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_first_use_pos() scans to the end of the block when a load has no nearby register use, and the 16-instruction lookahead can repeat that unbounded scan for several later operations. Long independent-load blocks can therefore make this scheduling pass quadratic. Precompute first-use positions or cap the scan consistently with the distances the heuristic uses. Add a long-block compile-time check, plus a compute synchronization case showing which threadgroup barriers device-load hoisting may cross safely.

@joshuaswarren

Copy link
Copy Markdown
Author

Matched interleaved ABBA verification on Apple M2 Max (G14C B1) directly comparing aurora-wip@a15657a362b7 base against this rebased head 7dc0f636a9ccd71b7ef1f2c03e8753973caf28c9 (MESA_SHADER_CACHE_DISABLE=1, MLX_OMARCHY_DEFER_TOKENS=0, omarchy-mlx ea110593a, zero driver env flags, /proc/self/maps + SHA-256 verified, 100% bit-exact greedy digests):

Model Context aurora-wip@a15657a3 Base Rebased #1224 (7dc0f636) Delta Pairs Greedy Digest
Qwen3.8-2B-mlx-4Bit 512 5.1440 ms (194.40 tok/s) 5.0796 ms (196.87 tok/s) +1.18% 5/5 4784df039da04560
Qwen3.8-2B-mlx-4Bit 2048 5.2240 ms (191.42 tok/s) 5.1784 ms (193.11 tok/s) +1.00% 5/5 c5fb4074d0b56223
Qwen3.5-9B-MLX-4bit 512 16.0900 ms (62.15 tok/s) 16.1592 ms (61.88 tok/s) -0.43% 0/3 cedd5549b251572a
  • Vulkan CTS (deqp-vk, MESA_SHADER_CACHE_DISABLE=true, cases-8bit.txt 440 cases): 440 (111 Pass, 329 NotSupported, 0 Fail) vs 440 (111 Pass, 329 NotSupported, 0 Fail), diffs=0.
  • Unit tests: test-chip-caps 767/767 PASS on 7dc0f636a9cc.

@joshuaswarren

Copy link
Copy Markdown
Author

CHANGES on 7dc0f63

[test] No CI checks are reported on this branch and the PR carries no full-suite receipt, so the change is unverifiable at head 7dc0f63 as filed; the diff itself reads clean (hoist dep-chain handling preserves def-before-use, hoist_can_cross blocks device stores/memory barriers/coherent loads, smart_waits is G14X-compute-gated with positive and negative unit tests on both passes), but merge needs CI or a suite receipt at this exact head.

@joshuaswarren

Copy link
Copy Markdown
Author

Addressed review feedback in 727e9dfb3663fba12f4a11b24213e5e88256458c:

  1. Linear-time first-use precomputation (agx_insert_waits.c): Replaced the repeated forward block scans in find_first_use_pos() with a single O(N) backward pass (compute_first_use_positions()) per compute block when AGX_CAP_COMPUTE_SMART_WAITS is set. Produces identical first-use positions and scoreboard slot assignments (zero codegen delta vs 7dc0f636a9cc) while eliminating quadratic scaling on long independent-load blocks.
  2. Added requested compiler unit tests:
    • InsertWaits.SmartWaitsLinearOnLongIndependentLoadBlock (test-insert-waits.cpp): 2048+ instruction block with 512 independent loads; verifies linear compile time (0 ms) and <= AGX_MAX_PENDING scoreboard occupancy.
    • HoistLoads.ComputeSyncCrossesThreadgroupBarrierStopsAtMemoryBarrier (test-hoist-loads.cpp): verifies non-coherent device_load hoists across threadgroup_barrier while stopping at a preceding memory_barrier.
  3. Full compiler test suite at exact head 727e9dfb3663fba12f4a11b24213e5e88256458c:
    • agx_tests (full 154-suite binary): 1714 passed, 0 failed, 1 pre-existing skip (test-rte-fma.cpp:245) in 2829 ms.
    • Targeted HoistLoads.*:InsertWaits.*: 13/13 passed (0 ms).
    • test-chip-caps: 767/767 checks passed.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The backward precomputation removes repeated suffix scans, resets both register and barrier boundaries, and preserves input positions because waits are inserted before the current instruction. An independent model agreed with the forward scan across 2,400 seeded blocks. The added tests cover the long-block case and distinguish the two barrier types. The author reports 1,714 compiler tests passed and one pre-existing skip at this head. Code approved. I did not run the full Mesa binary independently. Hosted checks are absent, so carry the exact suite receipt and have the landing owner confirm the G14X and required regression evidence.

@joshuaswarren
joshuaswarren force-pushed the agx/agx2-compute-hoist-addr-smart-waits branch from 727e9df to 2a02de4 Compare November 27, 2026 16:04
@joshuaswarren

Copy link
Copy Markdown
Author

Rebased onto aurora-wip 7617c83 (head 2a02de4, preserving #1232 drain_on_tg_barrier and #1233 G13X CDM defer flush): full 154-suite agx_tests 1722 passed / 0 failed / 1 pre-existing skip (16/16 HoistLoads+InsertWaits in 0 ms), test-chip-caps 767/767 passed.

@aurora-silicon-review aurora-silicon-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 2a02de4cc5b5

Blockers: Remove the prohibited attribution trailer from the rebased commit and provide a clean landing head with the required sign-off. Use a replacement branch or PR if cleaning the commit would require rewriting the published branch.

Checked: Confirmed the rebased commit's parent and message. The author reports 1,722 compiler tests and 767 chip-capability tests passed on this head, with one pre-existing skip. Carry the existing G14X and peer evidence to the clean head and obtain landing-owner confirmation.

Evidence

Reviewed PR source and recorded results at 2a02de4cc5b5.

…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>
@joshuaswarren
joshuaswarren force-pushed the agx/agx2-compute-hoist-addr-smart-waits branch from 2a02de4 to bb81a8a Compare November 27, 2026 16:37

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at bb81a8ad8d4c

Blockers: Landing-owner confirmation of the G14X and peer runtime evidence. Hosted checks are absent.

Checked: Code approved. The new head has the required sign-off and resolves the prior commit-message blocker. GitHub reports identical source tree and parent IDs for this head and the tested revision.

Evidence

The author reported 1,722 compiler passes, one pre-existing skip and 767 chip-capability passes on 2a02de4. The source tree and parent match bb81a8a exactly. I checked that identity and the new commit message.

@joshuaswarren

Copy link
Copy Markdown
Author

Updated commit trailer at bb81a8ad8d4c (identical tree 2cf39081e0e1 to 2a02de4cc5b5, where full 154-suite agx_tests 1722 passed / 0 failed and 767/767 test-chip-caps passed): removed Author-Model:, added human Signed-off-by:, cleaned PR body terminology per AGENTS.md, and added Assisted-by: google/gemini-4-neon to the PR body.

@RyanTheTide

Copy link
Copy Markdown

bb81a8ad8d4c J316s (M1 Pro, Apple M1 Pro / G13S C0, 7.3.0-aurora-fleet89) PASS: Borealis exact-head overlay ICD (VK_DRIVER_FILES, -Dbuildtype=release -Db_ndebug=false, stock /usr/lib64/libvulkan_asahi.so verified byte-identical before/after); AGX2 non-regression deqp-vk 1,977 PASS / 0 FAIL (api.smoke.* 8/8, compute.pipeline.basic.* 78/81, compute.* 1,10 328/5485, glsl.loops.* 1,5 138/138, spirv_assembly.instruction.compute.* 1,5 1425/1979); 0 GPU faults/recoveries, Enforcing, 0 failed units.

@joshuaswarren

Copy link
Copy Markdown
Author

GREEN on bb81a8a

GREEN on bb81a8a
Model: devin/swe-2-high

[test] Prior CHANGES resolved at head: agx_tests full 154-suite run (1722 pass / 0 fail / 1 pre-existing skip) documented in the PR body at tree 2cf39081e0e1, verified identical to head's tree (git rev-parse bb81a8a^{tree}). CTS 440-case runs show 0 diffs on both base commits; chip-caps 767/767; RyanTheTide cross-machine PASS comment at this head. The receipt attests that documented run - Mesa was not rebuilt locally.
[claim] agx_hoist_loads verified: SSA dep tracking is directionally correct (chain-src vs P-dest), pure-producer predicate (schedule_class NONE + can_reorder + can_eliminate + NORMAL dests + NORMAL/UNIFORM/IMMEDIATE srcs), reverse-order relink preserves def-before-use, device stores/memory barriers/doorbells block via schedule_class, 64-instr window + 3-producer cap bounded.
[claim] smart_waits verified: drain/wait-mask logic unchanged; the new code only picks WHICH scoreboard slot an async op takes, so first-use imprecision can cost perf but not correctness. compute_first_use_positions is O(N) backward, barrier-bounded (mem vs tg per memory_can_reorder).
[claim] Cap bits 1u<<27 / 1u<<28 do not collide with existing caps; gating is compute+AGX2+G14X only, fragment and other chips untouched.

Full-suite receipt: /tmp/receipt-1224.json

@RyanTheTide

Copy link
Copy Markdown

Forward-merged aurora-wip as 2d6602a16b82 (normal merge, no force push). aurora-wip took cap bits 26 and 27 (AGX_CAP_COMPUTE_COHERENT_STORE, AGX_CAP_PBE_QUEUED_BUFFER_COPY), so AGX_CAP_COMPUTE_SMART_WAITS and AGX_CAP_COMPUTE_HOIST_LOAD_ADDRS move to bits 28 and 29. The test-chip-caps.c all-caps mask and the test calls keep both sides. Host suite 316/342, every chip-table and Vulkan test passing (the 26 failures are the Gallium run-shim.py harness ones). The App approval was at the pre-merge head. This goes into the next combined lab row (M1 Pro G13S + M4 Pro G16S) before merge. @joshuaswarren, say if you want a different bit layout.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 2d6602a after the current-head hardware rows.

Checked: The forward merge keeps coherent store and queued buffer copy at 26/27 and moves the two G14X capabilities to distinct bits 28/29. The chip tests assert G14X scope and retain both base checks. The reported host suite passed Vulkan and chip-table tests. The prior target and regression results cover the previous head. Please refresh hardware evidence on this integration and recheck the shared chip table when the other branch lands.

@RyanTheTide

Copy link
Copy Markdown

@DjDeveloperr, code-owner heads-up: App approval at 2d6602a16b82 (different lane) plus the author's G14X rows. I plan to land it no earlier than 07:54Z, via --admin under the 6-point rule, after the combined A/B regression row (M1 Pro G13S + M4 Pro G16S). Please post a review here if you want it held.

@RyanTheTide

Copy link
Copy Markdown

Merge-train landing at 2d6602a16b82.

  • Review: aurora-silicon-review App APPROVE at 2d6602a (REVIEW6) (non-author).
  • Feature row: the author's exact-head hardware row on this PR.
  • Regression: combined A/B overlay of aurora-wip plus this PR and the other queued PRs, user space, default kernel command line. M1 Pro (G13S, fleet89): 0 status changes. M4 Pro (G16S, fleet89): 0 regressions. The only flips there are a few synchronization multi_queue timeouts under 4-job load, flipping in both directions. Every flipped case passes alone on both arms, and the base arm shows the same flake. Each Mac ran 26,595 dEQP-VK + 8,153 dEQP-GLES cases, with 0 GPU firmware crashes, Enforcing, 0 failed units. Evidence traces/gpu/20261128-mergetrain-mesa.
  • --admin under the 6-point rule: the App approval does not count toward the ruleset. Dj was pinged here more than 1 h ago, and no blocking review is open.

Revert: git revert -m 1 <merge commit> on aurora-wip. A regression gets reverted first and fixed after.

@RyanTheTide
RyanTheTide merged commit e0990ec into aurora-wip Nov 28, 2026
@RyanTheTide
RyanTheTide deleted the agx/agx2-compute-hoist-addr-smart-waits branch November 28, 2026 08:16
RyanTheTide pushed a commit that referenced this pull request Nov 28, 2026
… comments

Follow-up hygiene for #1224:
- Gate agx_hoist_loads on !(agx_compiler_debug & AGX_DBG_NOSCHED) in
  agx_compile_function_nir(), matching agx_pressure_schedule and
  agx_ilp_schedule so AGX_MESA_DEBUG=nosched disables all scheduling passes.
- Document in hoist_can_cross() why non-coherent device_loads may cross
  AGX_OPCODE_THREADGROUP_BARRIER without inspecting memory_can_reorder
  (global/device-scope barriers emit AGX_OPCODE_MEMORY_BARRIER first,
  where hoisting stops).
- Clarify AGX_CAP_COMPUTE_SMART_WAITS and AGX_CAP_COMPUTE_HOIST_LOAD_ADDRS
  comments in agx_chip_caps.h to reflect that AGX_CHIP_G14X covers gen-14
  Pro/Max/Ultra (G14S/G14C/G14D), with measurements collected on G14C.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@joshuaswarren

Copy link
Copy Markdown
Author

G13 measurement addendum (the G13X "until measured on aurora-wip" deference, now measured)

Branch w8B/agx-compute-hoist-loads (53926df751c, one commit on aurora-wip 822cf58723a, AGX_CAP_COMPUTE_HOIST_LOADS = 1u << 23 set on G13G and G13X), same-machine interleaved ABBA against base 822cf58723a ICDs: 5 pairs, 3 inner trials per leg, sha256-verified exact-head builds, isolated shader cache dirs, greedy decode of mlx-community/Qwen3-4B-Instruct-2507-4bit with deferral pinned off. Token IDs bit-exact on every pair.

G13G (13-inch M1, gen=128, ctx=512). Receipt: joshuaswarren/omarchy-mplus-private receipts/2026-11-26-w8b-agx-hoist-loads-parked.md.

cell base → hoist Δ pairs won bit-exact
decode 23.20 → 23.30 tok/s +0.46% 3/5 yes, all legs
prefill 136.2 → 134.9 tok/s −0.91% 0/5 yes

Per-pair decode: −0.02, +1.67, −1.95, +0.27, +2.13%. Prefill: −0.74, −0.91, −0.79, −0.67, −1.11%.

G13X (16-inch M1 Max, gen=64).

cell decode base → hoist Δ pairs won prefill base → hoist Δ bit-exact
ctx512 89.17 → 89.22 tok/s +0.06% 2/5 414.5 → 412.1 tok/s −0.59% yes, 5/5
ctx2048 66.90 → 66.77 tok/s −0.19% 2/5 493.6 → 487.4 tok/s −1.26% yes, 5/5

Correctness at the exact head (native aarch64, clang 18.1.3 release): asahi-agx-chip-caps 628/628, HoistLoads.* 10/10, meson test --suite asahi 212/212 — 0 fail/skip/timeout. Sync CTS on G13G (dEQP-VK.synchronization.*, synchronization2.*, memory_model.*, 16,421 cases): base 5,175 Pass / 11,246 NotSupported / 0 Fail, hoist identical, 0 status changes, 0 regressions.

Read: the G13 dies already take the load-latency win from agx_ilp_schedule's occupancy-capped intra-block hoisting (shared_compute_loads, agx_pressure_schedule.c:2102-2225, which skips has_cooperative_matrix for small_loop_loads). Unbounded post-schedule hoisting on top adds nothing measurable in decode (+0.46% G13G, +0.06%/−0.19% G13X — inside noise) and costs prefill (−0.91% G13G, −0.59%/−1.26% G13X). Recommendation from the numbers: keep AGX_CAP_COMPUTE_HOIST_LOADS closed on G13G/G13X; the cap and pass land here for the G14X result and as the off-switch, with the G13 negative result on record so it is not re-litigated.

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.

2 participants