Skip to content

omarchy: 128-lane G18G builds for the float linalg kernels (M6X-08) - #677

Merged
joshuaswarren merged 1 commit into
mainfrom
w7X/m6x-08-linalg-wg128
Nov 22, 2026
Merged

joshuaswarren merged 1 commit into
mainfrom
w7X/m6x-08-linalg-wg128

Conversation

@joshuaswarren

Copy link
Copy Markdown
Owner

Summary

G18G runs the latency-bound float linalg kernels — eig, inverse, QR — at
128 lanes per the audit. Every other part keeps the 256-lane blobs.

  • linalg_*.comp: workgroup lane count moves into LINALG_WG (default
    256; -DLINALG_WG=128 for the G18G builds). Stride loops, the
    inverse/QR reduction butterflies (stride = LINALG_WG/2), and the
    publish slots (red[LINALG_WG-1], red[LINALG_WG-2]) all derive from
    it. linalg_eig's serial-sum reduction was already lane-agnostic.
  • CMakeLists.txt: three *_f32_g18 shader targets at -DLINALG_WG=128.
  • compute.h/compute.cpp: Linalg{Inverse,Qr,Eig}F32G18 kernels
    appended before Count (profile ids stable) and mapped in
    shader_bytes.
  • primitives.cpp: linalg_g18_kernel() picks the G18 kernels when
    capabilities().device_name contains G18G; same chip-scoped
    predicate style as the existing gates.

Evidence (m6, G18G B1)

  • SPIR-V check: all three *_g18 blobs declare LocalSize 128 1 1;
    the base blobs stay LocalSize 256.
  • omarchy_linalg_ops_tests: 31/31 cases, 181,183 assertions, 0
    failed
    — includes inverse/QR CPU-reference comparisons at the
    pinned float tolerances.
  • omarchy_eig_ops_tests: 9/9 cases, 264 assertions, 0 failed.
  • scripts/check_compute_kernel_wiring.py: ok (703 declared, 699
    referenced, 696 shader targets).
  • All six SPIR-V variants compile under glslc -O at both sizes.

Generated with Devin

The audit marks eig/inverse/qr latency-bound on G18G, so those parts
build the same shaders with -DLINALG_WG=128 while every other part
keeps the 256-lane blobs. The workgroup lane count moves into
LINALG_WG (strides, reduction butterflies and the publish slots), and
linalg_g18_kernel picks the *_G18 kernels on G18G device names.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 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-22T21:48:28.580165Z
We couldn’t complete this review. Comment @codex review to try again.
1432bd3 PR opened
🔒 Security Review ❌ Failed 2026-11-22T21:48:34.978875Z
We couldn’t complete this review. Comment @codex security review to try again.
1432bd3 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.

@kilo-code-bot

kilo-code-bot Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 0

Notes

The change is a mechanical, internally consistent parameterization of the float linalg shaders' workgroup lane count:

  • All three shaders (linalg_eig.comp, linalg_inverse.comp, linalg_qr.comp) derive shared array sizes, reduction butterfly strides (LINALG_WG/2), publish slots (red[LINALG_WG-1], red[LINALG_WG-2]), grid-stride loops, and the serial-sum bound (k < LINALG_WG) from LINALG_WG. A grep for stray hardcoded 256/128/255/254/127 found only the macro default and comments.
  • compute.h appends the three *F32G18 enum values before Count, keeping profile kernel ids stable; compute.cpp includes and shader_bytes mappings match the generated header/symbol names produced by omarchy_shader(name source) → ${name}.h / ${name} / ${name}_size.
  • primitives.cpp linalg_g18_kernel() gates on capabilities().device_name.find("G18G"), matching the existing chip-scoped predicate style, and is wired into the Inverse/QR/Eig eval paths.
  • CMakeLists.txt adds the three *_f32_g18 targets at -DLINALG_WG=128.

No issues found in changed code.

Files Reviewed (7 files)
  • overlay/mlx/backend/omarchy/CMakeLists.txt
  • overlay/mlx/backend/omarchy/compute.cpp
  • overlay/mlx/backend/omarchy/compute.h
  • overlay/mlx/backend/omarchy/primitives.cpp
  • overlay/mlx/backend/omarchy/shaders/linalg_eig.comp
  • overlay/mlx/backend/omarchy/shaders/linalg_inverse.comp
  • overlay/mlx/backend/omarchy/shaders/linalg_qr.comp

Reviewed by free · Input: 63K · Output: 6.2K · Cached: 284.2K

@joshuaswarren

Copy link
Copy Markdown
Owner Author

GREEN at 1432bd3
Model: xai-oauth/grok-4.7

The 128-lane path is wired and the shaders compile at both sizes.

  • shaders/linalg_{eig,inverse,qr}.comp: the only remaining 256 is the LINALG_WG default. Stride loops, shared red[], and the inverse/QR butterflies use LINALG_WG. glslangValidator -V is clean at 256 and 128. SPIR-V LocalSize is (256,1,1) and (128,1,1).
  • primitives.cpp:5002: device_name.find("G18G") selects the three G18 kernels. Inverse, QR, and eig all go through linalg_g18_kernel.
  • compute.h:1164: the three ids are appended before Count. scripts/check_compute_kernel_wiring.py is ok (703 declared, 696 shader targets).

I did not re-run the m6 GPU suites. This host has no G18G device.

@joshuaswarren
joshuaswarren merged commit 69799ea into main Nov 22, 2026
3 checks passed
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