Skip to content

docs(roadmap): single S-series closure plan + Tier-0 compiler foundation + native fused-kernel inventory - #187

Merged
gstoner merged 4 commits into
mainfrom
s2/gap-closure-plan
Jun 28, 2026
Merged

gstoner merged 4 commits into
mainfrom
s2/gap-closure-plan

Conversation

@gstoner

@gstoner gstoner commented Jun 28, 2026

Copy link
Copy Markdown
Owner

One consolidated closure plan for driving the remaining S-series primitives to real, on-device-validated execution on the two devices this repo proves on today — x86 AVX-512 + ROCm gfx1151 (RDNA 3.5 WMMA). Adds docs/audit/roadmap/S_SERIES_GAP_CLOSURE_PLAN.md (§1–§8) and links it from ROADMAP_AUDIT.md. Docs-only; drift clean.

Framing correction (§1)

"144 reference" is the universal multi-target gate (backend_kernel=complete needs x86 and ROCm and NVIDIA and Apple → reads 0/474 by design). Per device: ~127 ops execute on both, ~171 on neither, ~10 ROCm-only (the WMMA attention lanes needing an x86 partner), ~1 x86-only. Counts stay dashboard-owned (Decision #25/#26).

Triage — Tiers 0–5 (§2), each with a disposition

  • Tier 0 — structural ops: a compiler-foundation workstream, not "just not_applicable." 28/33 have no Graph IR op. Kernel axis splits per sub-class: 0-view (reshape/transpose/…) → not_applicable after §6.B compiles them to stride rewrites; 0-move (gather/pad/cat/…) → a memory-movement primitive; 0-reduce (scatter_add, nonzero) → real kernels.
  • Tier 1 — transport: not greenfield — collective/moe already have ODS + mock-collective execution + the sharding contract; the only gap is real multi-GPU HW → stays partial, ungates at Phase H. No kernel.
  • Tier 2 — elementwise/predicate (~21): extend the proven unary/binary/compare/reduce lanes (+ new digamma/lgamma poly cores, atan2, popcount).
  • Tier 3 — composable: optimizer steps are stateful (m/v + step-counter runtime ABI) — the real work behind fused AdamW; norm composes on reduce; complex reuses the FFT interleaved-f32 substrate; EBM/diffusion losses split by RNG dependency.
  • Tier 4 — new kernel families: attention is mostly an x86-partner problem (the 10 ROCm-only ops are attention WMMA lanes); state-recurrence variants reuse the selective_ssm scan substrate; NSA depends on top_k; Philox RNG unblocks the sampling losses; + conv, sort/top_k, MLA loop_nest.
  • Tier 5 (NEW) — geometric algebra / Clifford (18): executes on neither device-native lane (CPU "complete" is numpy reference-tier). Own tier because the products are a table-driven bilinear contraction over the multivector Cayley table — not flat elementwise, not dense GEMM. ROCm is the headline gap.

§3 Planned fused-kernel inventory (native)

Per-device approach table (AVX-512 + gfx1151 WMMA 16×16×16) for matmul, flash_attn, MLA, NSA, lightning, kimi, swiglu_mlp, matmul_softmax_matmul, adamw_step, conv, quantized_matmul, Philox RNG, sort — the executable-now companion to the hardware-gated WGMMA/MFMA inventories, aligned to the canonical family names guarded by tests/unit/test_kernel_inventory_and_lit_fixtures.py (notes gfx1151 has no FP8/FP4 WMMA — that's CDNA4/RDNA4).

§6 Tier-0 compiler foundation (the structural substrate)

The compiler/runtime/stdlib detail, file-grounded (§6.0 current-state table):

  • 6.A Graph IR — ODS ops for the 28; reuse tensor/linalg (reshape→expand_shape, slice→extract_slice, pad→tensor.pad, gather/scatter); native tessera.layout/tessera.index only where upstream lacks it or a Tessera layout/distribution attr is needed; verifiers + canonicalizers + frontend emission.
  • 6.B view-vs-copy analysis → stride rewrite not copy; layout propagation; bufferization to strided memref; movement lowering.
  • 6.C backend-agnostic view descriptor (base, offset, shape, strides) in the C ABI; strided-copy movement lane; gather/scatter(+atomic) kernels via the feat(sparse): genuinely sparse kernels — spmm_csr/coo + sddmm + bsmm on both devices #180feat(moe): mixture-of-experts compute — routed expert GEMVs on both devices #186 cadence.
  • 6.D formalize the UNSPECIFIED vmap/batching rule + sharding propagation + flip transpose_rule (VJPs exist).
  • 6.E pack/unpack, gather lowering-class fix, forward-mode JVPs.
  • 6.F F1→F5 sequencing of the foundation.

§7 Per-tier deep dives + §8 consolidated order

§7 applies the §6 lens (compiler / runtime / stdlib + kernel + deps + validation + disposition) to Tiers 1–5. §8 is the authoritative P0–P15 order — it weaves the Tier-0 foundation steps F1–F5 inline with the compute phases (P1=F1 Graph IR; P4=F2/F3 view passes + runtime ABI; P8=F4 gather/scatter; P14=F5 contracts). Front-loads honesty → structural IR → elementwise → fused AdamW before the marquee attention/MLA work; transport (P15) is the only phase blocked on hardware this box lacks.

🤖 Generated with Claude Code

Plan for driving the remaining S-series primitives to real on-device execution
on the two devices we can prove on today — x86 AVX-512 + ROCm gfx1151 (RDNA 3.5
WMMA). Corrects the "144 reference" framing to the per-device truth (the
universal backend_kernel gate reads 0/474 by design): ~127 ops execute on both
devices, ~171 on neither, ~10 ROCm-only (WMMA attention lanes needing an x86
partner).

Triages the ~171 both-device gap into:
- Tier 0 host/structural (layout_transform/indexing) → classify not_applicable,
  no kernel;
- Tier 1 mesh-gated transport (collective/moe_transport) → stays gated;
- Tier 2 easy elementwise/predicate → extend existing lanes;
- Tier 3 composable (optimizer steps incl. fused AdamW, norm, complex/GA, losses);
- Tier 4 new kernel families (attention, conv, sort/top_k, MLA loop_nest, RNG).

Records the NATIVE (AVX-512 + RDNA WMMA) planned fused-kernel inventory —
flash_attn / MLA / NSA / lightning / kimi / swiglu / fused AdamW / conv / sort /
Philox RNG — the executable-now companion to the hardware-gated WGMMA/MFMA
inventories (nvidia_cuda13 / rocm_mfma), aligned to the canonical family names
guarded by test_kernel_inventory_and_lit_fixtures.py. Sequences phased PRs A→G
using the per-family cadence proven across #180#186. Linked from ROADMAP_AUDIT.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae4ed53ff0

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +50 to +51
is to mark `backend_kernel = not_applicable` per op (Decision #25 — only after
verifying zero FLOP content), which closes the open count without inflating it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not mark tensor movement kernels as not_applicable

If Phase A follows this directive for the listed reshape/cat/gather/scatter-style tensor ops, it will close backend_kernel rows without proving any x86/ROCm target path. The existing contract says backend_kernel stays partial until each backend ships a real hardware kernel (python/tessera/compiler/primitive_coverage.py), and the generated S-series status still treats every backend category as open by design; zero FLOPs is not the same as zero backend execution for copy/index/data-movement primitives. This would corrupt the generated counts instead of reflecting actual device coverage.

Useful? React with 👍 / 👎.

gstoner and others added 2 commits June 28, 2026 08:25
Reframe Tier 0 from "just mark not_applicable" to the compiler-foundation
workstream it actually is. Verified state: 28 of 33 structural ops have NO Graph
IR op (only transpose/reshape/cast/select/masked_fill do) — they live only in the
Python frontend + numpy runtime, so they can't enter a compiled pipeline, fuse,
or lower to device movement. Autodiff VJPs are largely complete (incl. gather/
scatter/masked_fill — corrected an earlier mis-read); JVP deferred.

§6 specifies what the compiler / runtime / stdlib each need:
- 6.A Graph IR: ODS ops (reuse tensor/linalg dialect where it models the op;
  native tessera.layout/index ops only for roll/flip/repeat/tile/pack + ops that
  must carry a Tessera layout/distribution attr) + shape verify + canonicalizers
  + frontend emission.
- 6.B Passes: view-vs-copy analysis, layout propagation/canonicalize,
  bufferization to strided memref, movement lowering — makes 0-view ops compile
  to stride rewrites (the real meaning of not_applicable).
- 6.C Runtime: a backend-agnostic view descriptor ABI (generalize the Apple-only
  reshape_view), a strided-copy movement lane (0-move), and gather/scatter(+atomic)
  kernels (0-reduce) on x86 + ROCm via the proven cadence.
- 6.D Contracts: formalize the UNSPECIFIED vmap/batching rule + sharding rule +
  flip transpose_rule (VJPs already exist).
- 6.E Stdlib: pack/unpack, gather lowering-class fix, JVPs.

Splits the kernel axis into 0-view (not_applicable), 0-move (movement lane),
0-reduce (real kernel) — so the disposition is honest per sub-class, not a blanket
not_applicable. Sequenced F1→F5 (Graph IR → view passes → runtime ABI → gather/
scatter kernels → contracts).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tier dives + Tier 5

Single closure plan: per-tier deep dives (§7) mirroring the §6 Tier-0
foundation lens (compiler / runtime / stdlib + kernel + deps + validation +
disposition), plus a consolidated P0–P15 phase order (§8) that folds the compute
phases together with the Tier-0 foundation steps F1–F5.

- Tier 1 (transport): NOT greenfield — collective/moe ops already have ODS +
  mock-collective execution + sharding contract; the ONLY gap is real multi-GPU
  HW. Stays partial (single-rank ref + mock-mesh), ungates at Phase H. No kernel.
- Tier 2 (elementwise/predicate): per-lane breakdown (unary+new digamma/lgamma
  poly cores, binary atan2/floor_div/mod, predicate isnan/isinf/isfinite float→i8,
  popcount VPOPCNTDQ, reduce/segment_reduce, ntk_rope on the rope lane).
- Tier 3: optimizer steps are STATEFUL (need an m/v + step-counter runtime ABI,
  in-place multi-output) — fused AdamW called out; norm composes on reduce;
  complex reuses the FFT interleaved-f32 substrate; EBM/diffusion losses split by
  RNG dependency.
- Tier 4: attention is mostly an x86-PARTNER problem (the 10 ROCm-only ops are
  attention WMMA lanes); state-recurrence variants reuse the selective_ssm scan
  substrate; NSA depends on top_k; RNG (Philox) unblocks the sampling losses.
- Tier 5 (NEW): geometric_algebra / Clifford (18 ops) — distinct kernel pattern
  (table-driven bilinear contraction over the multivector Cayley table, not flat
  elementwise nor dense GEMM). CPU reference exists; ROCm is the headline gap.

§8 P0–P15 front-loads honesty/structural-IR/elementwise/AdamW before the marquee
attention+MLA work (which sits behind its substrate); transport (P15) is the only
phase blocked on hardware this repo lacks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gstoner gstoner changed the title docs(roadmap): S-series gap-closure plan + native fused-kernel inventory docs(roadmap): single S-series closure plan + Tier-0 compiler foundation + native fused-kernel inventory Jun 28, 2026
last_updated / audit_role: plan / plan_state: open — satisfies the
test_audit_docs + test_docs_freshness frontmatter contract.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gstoner
gstoner merged commit ed48206 into main Jun 28, 2026
17 checks passed
@gstoner
gstoner deleted the s2/gap-closure-plan branch June 28, 2026 16:04
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