Skip to content

agx: gate agx_hoist_loads on AGX_DBG_NOSCHED and clarify G14X/barrier comments - #1310

Merged
RyanTheTide merged 1 commit into
aurora-silicon:aurora-wipfrom
joshuaswarren:w88/agx-hoist-hygiene
Nov 28, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:aurora-wipfrom
joshuaswarren:w88/agx-hoist-hygiene

Conversation

@joshuaswarren

Copy link
Copy Markdown

What

Follow-up hygiene for #1224 (branch joshuaswarren:w88/agx-hoist-hygiene, head f04e68ec4edd atop aurora-wip 5b64e3c144d1):

  • src/asahi/compiler/agx_compile.c: gate agx_hoist_loads on !(agx_compiler_debug & AGX_DBG_NOSCHED), matching agx_pressure_schedule and agx_ilp_schedule immediately above it so AGX_MESA_DEBUG=nosched disables all scheduling/reordering passes.
  • src/asahi/compiler/agx_pressure_schedule.c: document in hoist_can_cross() why non-coherent device_load instructions may cross AGX_OPCODE_THREADGROUP_BARRIER without checking P->memory_can_reorder (unlike agx_insert_waits): any NIR barrier with global/device memory scope emits AGX_OPCODE_MEMORY_BARRIER first, which has a non-NONE schedule class and stops hoisting there; a bare threadgroup_barrier orders only workgroup execution and local memory.
  • src/asahi/lib/agx_chip_caps.h: clarify the AGX_CAP_COMPUTE_SMART_WAITS and AGX_CAP_COMPUTE_HOIST_LOAD_ADDRS comments to reflect that AGX_CHIP_G14X covers gen-14 Pro/Max/Ultra (G14S/G14C/G14D), with measurements collected on G14C (Apple M2 Max).

Tested

  • Unit tests (aarch64):
    • asahi-agx-chip-caps: 855/855 checks passed (GCC and Clang).
    • agx_tests (Clang): 1791 passed, 1 skipped, 0 failed (HoistLoads.* 11/11, InsertWaits.* 5/5).
  • Hardware verification on Apple M2 Max (G14C B1, aurora-wip 5b64e3c144d1 + f04e68ec4edd, default vs AGX_MESA_DEBUG=nosched):
    • Vulkan CTS (1,017 cases total: 1,000 Pass / 17 NotSupported / 0 Fail, 0 diffs between default and nosched):
      • dEQP-VK.synchronization2.*compute* (synccg.txt): 552/552 Pass, 0 diffs.
      • dEQP-VK.spirv_assembly.instruction.* (8-bit/storage corpus): 439 Pass / 1 NotSupported / 0 Fail, 0 diffs.
      • dEQP-VK.memory_model.message_passing.core11.u32.coherent.fence_fence.atomicwrite.workgroup.*: 9 Pass / 16 NotSupported / 0 Fail, 0 diffs.
    • Multi-workload LLM decode ABBA (3 pairs each, MLX_OMARCHY_DEFER_TOKENS=0, bit-exact greedy digests, AGX_MESA_DEBUG=nosched -> default):
      • Qwen3-4B ctx=512: 101.22 -> 104.35 tok/s (+3.09%, -0.296 ms, 3/3 disjoint).
      • Qwen3.5-9B ctx=512: 58.91 -> 60.16 tok/s (+2.13%, -0.354 ms, 3/3 disjoint).
      • Qwen3.8-2B ctx=512: 179.65 -> 185.43 tok/s (+3.22%, -0.174 ms, 3/3 disjoint).

Risk

Low. Two comment-only edits and one AGX_DBG_NOSCHED debug-flag guard; zero behavior change under default flags.

… 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
joshuaswarren requested review from a team and DjDeveloperr as code owners November 28, 2026 17:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 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-28T17:13:12.560119Z
We couldn’t complete this review. Comment @codex review to try again.
f04e68e PR opened
🔒 Security Review ❌ Failed 2026-11-28T17:13:19.701801Z
We couldn’t complete this review. Comment @codex security review to try again.
f04e68e 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.

@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 f04e68ec

Blockers: none

Checked:

  • src/asahi/compiler/agx_compile.c: verified agx_hoist_loads is gated behind likely(!(agx_compiler_debug & AGX_DBG_NOSCHED)), preserving default codegen while allowing AGX_MESA_DEBUG=nosched to disable load hoisting.
  • src/asahi/compiler/agx_hoist_loads.c and src/asahi/lib/agx_chip_caps.h: verified comments accurately explain hoist_can_cross() (AGX_OPCODE_THREADGROUP_BARRIER vs AGX_OPCODE_MEMORY_BARRIER) and AGX_CHIP_G14X capabilities.
  • Commit metadata and PR checklist (What/Tested/Risk two-way door, human Signed-off-by, MERGEABLE).
Evidence
  • Head: f04e68ec (+13/-6 across 3 files).
  • Author verification: asahi-agx-chip-caps (855/855), agx_tests (1791/1791), and M2 Max (G14C) CTS 1,000 Pass / 17 NS / 0 Fail (0 diffs default vs nosched) + LLM ABBA PASS.

@RyanTheTide

Copy link
Copy Markdown

@DjDeveloperr, code-owner heads-up: App approval at f04e68ec4edd from a different lane. It goes into the merge train's next combined A/B (aurora-wip 878ddc0c + #1301 #1307 #1309 #1310) on M1 Pro G13S + M4 G16G. If that row is clean, I plan to land it via --admin under the 6-point rule no earlier than one hour from now, unless you post a hold.

@RyanTheTide

Copy link
Copy Markdown

Merge-train landing at f04e68ec4edd.

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

@RyanTheTide
RyanTheTide merged commit 8c498ac into aurora-silicon:aurora-wip Nov 28, 2026
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