docs: consolidate kernel roadmap, refresh architecture + crate READMEs - #284
docs: consolidate kernel roadmap, refresh architecture + crate READMEs#284ekryski wants to merge 6 commits into
Conversation
These two planning docs under crates/metaltile-std/src/convolution/ are duplicates of the canonical specs in docs/specs/: convolution/PATTERNS.md -> docs/specs/CONV_KERNEL_PATTERNS.md convolution/PLAN.md -> docs/specs/CONV_CONSOLIDATION_PLAN.md Keep the docs/specs/ copies as the single source of truth; nothing references the in-tree duplicates.
The doc described the pre-#275 single-backend, in-process-runner design. Bring it current: - Multi-backend codegen: the CodegenBackend seam (Target = Metal/Cuda/Hip/Spirv), TargetProfile (lane width, MmaStrategy), and the msl/cuda/hip/spirv generators. Metal is the default/mature backend; CUDA/HIP/Vulkan device execution is feature-gated and validated by the GPU-vs-GPU reference corpora. - Subprocess execution: the runner is no longer in-process — `tile` spawns `__tile_runner` (project-linked, inventory populated) and streams ProtocolMessage JSON lines. Rewrote the "subprocess readiness" section accordingly. - metaltile-std modules: mlx / ffai / convolution / quant (was mlx + ffai only). - Commands: added clean + config; clarified `emit` is `build --emit msl|metallib|swift|ir|all` and that --backend applies to bench/test only. - Fixed companion-doc links (../cli.md, ../developing.md) and the now-renamed metric path (to_gflops / estimate_profile / classify_bottleneck / device_specs::lookup → ProfileInfo; was derive_metrics / DerivedMetrics).
Three overlapping docs (KERNEL_ORGANIZATION, CONV_CONSOLIDATION_PLAN,
CONV_KERNEL_PATTERNS) collapse into one singular reference,
docs/specs/KERNEL_CONSOLIDATION_PLAN.md — the kernels/<family>/ target layout
(no more mlx/ + ffai/), the three LOC-reduction tools (shared primitives,
#[kernel(variants)], op×format merge), the proven conv/ exemplar, and the
family-by-family migration order.
STYLE_GUIDE.md moves crates/metaltile-std/ → docs/ and becomes the authoring
authority ("how we want kernels written post-consolidation"): de-mlx/ffai'd,
the removed #[bench] name key fixed, a shared-primitives section added, family
mod.rs paths. developing.md's kernel-writing-philosophy now links to it; the
authoring patterns from CONV_KERNEL_PATTERNS fold in here rather than the plan.
Also fixes the stale ../specs/ links in docs/README.md (specs live at
docs/specs/), repoints ARCHITECTURE.md, and indexes both new docs.
Roadmap (where files go) vs authoring (how to write one kernel) are now one doc
each, with the redundancy across the old four removed.
The crate READMEs had drifted across several big changes. Fixes: - metaltile-codegen / -runtime / metaltile (facade): no longer "Metal only". Codegen is multi-backend (CodegenBackend, Target = Metal/Cuda/Hip/Spirv, TargetProfile, the cuda/hip/spirv generators); runtime owns device/ (Metal + feature-gated cuda/hip/vulkan), dispatch/, cache/; the facade hosts harness/ + runner/ and runs GPU work in the __tile_runner subprocess. - metaltile-core: GpuFamily lives in src/protocol.rs (not src/gpu_family.rs); documents the protocol wire types. - metaltile-macros: corrected module paths (kernel/body.rs, kernel/sig.rs, bench.rs, derive/mod.rs), added kernel/variants.rs, and replaced the dead #[kernel(bench(op=,class=,mlx=))] system with the current #[bench] / #[test_kernel] / #[kernel(variants(...))]. - metaltile-std: rewritten — it's the kernel stdlib (mlx/ ffai/ convolution/ quant/ probe/ utils), not "benchmark metadata"; dropped the removed BenchSpec/bench_types/run_spec framing. - metaltile-cli: added the missing subcommands (test, clean, config, init, update, completions) and the --backend flag. Cross-doc links point at the relocated style guide / consolidation plan.
…uestions - BENCH_METRICS_SPEC.md: mark the metrics work + Appendix B precision support as implemented/complete; note M5 fp8/fp4 acceleration arrives with Metal 4.1; trim the stale capture context. - KERNEL_CONSOLIDATION_PLAN.md: turn §9 open questions into decisions — (1) rename ffai_/model-prefixed kernels to mt_<op> (the FFAI emit consumer is regenerated, so names are not pinned); (2) keep vision/ + audio/ folders; (3) f16-scale twins fold into a ScaleKind format axis, not separate kernels; (4) kernels that mirror an upstream reference keep their .with_reference() comparator indefinitely. Reconciled §6 (rename step), §7 (scale axis), and §8 (inventory names do change; emit is regenerated).
|
Strong consolidation. I went through each doc against the current code; notes below. What's implemented vs. aspirational, doc by doc. ARCHITECTURE.md is accurate to today's codebase: the subprocess runner is real ( Style guide content didn't make it into the diff. Kernel registry could use a paragraph in ARCHITECTURE.md while we're here. Registration spans three crates: Leftover dead-system refs. Two suggested additions. (1) §9.1 calls the Happy to take any of these as follow-ups if you'd rather land the bulk now. |
|
As per @0xClandestine's request, as relayed to me by @TheTom, closing in favour of moving rapid iteration to forks |
What this is
Docs-only. No code changes — consolidates the kernel-organization docs into one reference, brings the architecture/crate docs up to date with the current (multi-backend, subprocess-runner,
convolution/-consolidated) codebase, and removes a pile of redundancy.Kernel docs: 3 → 1 + a relocated style guide
The kernel-organization story was spread across three overlapping docs with heavy duplication (file skeleton,
variants, primitives, and block-scaled patterns each appeared 2–4×). Split cleanly by purpose:docs/specs/KERNEL_CONSOLIDATION_PLAN.md(new, the singular roadmap) ←KERNEL_ORGANIZATION.md+CONV_CONSOLIDATION_PLAN.md+ the structural parts ofCONV_KERNEL_PATTERNS.md. Covers thekernels/<family>/target layout (dropping themlx/+ffai/split), the three LOC-reduction tools (shared primitives →#[kernel(variants(...))]→ op×format merge), the provenconvolution/exemplar, and the family-by-family migration order.docs/STYLE_GUIDE.md(moved fromcrates/metaltile-std/, the authoring authority) ← the existing style guide +CONV_KERNEL_PATTERNS.md's authoring content. De-mlx/ffai'd, the removed#[bench] namekey fixed, a shared-primitives section added.docs/developing.mdnow links to it.KERNEL_ORGANIZATION.md,CONV_CONSOLIDATION_PLAN.md,CONV_KERNEL_PATTERNS.md, and the duplicateconvolution/PATTERNS.md+PLAN.md.Roadmap (where files go) vs authoring (how to write one kernel) are now one doc each.
ARCHITECTURE.mdupdated to today's codebaseCodegenBackendseam (Target= Metal/Cuda/Hip/Spirv,TargetProfile,MmaStrategy, the msl/cuda/hip/spirv generators); Metal default, CUDA/HIP/Vulkan feature-gated and validated by the GPU-vs-GPU reference corpora.tilespawns__tile_runnerand streamsProtocolMessages. Rewrote that section + the bench/test diagrams.metaltile-stdmodules (mlx/ffai/convolution/quant), the command set (clean/config,emit=build --emit,--backend), and the renamed metric path.Crate READMEs brought current
All seven
crates/*/README.mdaudited and fixed: codegen/runtime/facade no longer "Metal only";metaltile-core'sGpuFamilyis inprotocol.rs;metaltile-macrospaths corrected + the dead#[kernel(bench(op=,class=,mlx=))]system replaced with#[bench]/#[test_kernel]/variants;metaltile-stdrewritten as the kernel stdlib (not "benchmark metadata");metaltile-cligains the missing subcommands +--backend.Also
hip_vulkan_phase*/cuda_bench_reportmarkdown intodocs/specs/.This removes far more than it adds — +318 / −2866 lines, mostly redundancy. All internal doc links verified to resolve.