Skip to content

Refactor files: tiled vs multi-level, pt.3 - #535

Merged
louisfd merged 8 commits into
mainfrom
refactor/tiled_split
Aug 25, 2026
Merged

Refactor files: tiled vs multi-level, pt.3#535
louisfd merged 8 commits into
mainfrom
refactor/tiled_split

Conversation

@louisfd

@louisfd louisfd commented Aug 24, 2026

Copy link
Copy Markdown
Member

No description provided.

louisfd and others added 8 commits August 24, 2026 10:24
gemv and quantized_matmul move to multi_level/eval/; gemm_cpu_tiled, split_k and
tile_quant_stage to tiled/eval/ (split_k and tile_quant_stage are written on the
tile DSL, not multi-level as the plan's sketch assumed).

gemm and gemm_cpu stay at the root: they exist to put both families on one table.
gemm's strategies() is now a concatenator over tiled::eval::gemm::strategies() and
multi_level::eval::gemm::strategies(), so each branch owns its own entries and the
root only decides that both appear. gemm_cpu filters gemm's list by id and needs no
change at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both on by default; either compiles without the other, and a build with neither
fails with a compile_error rather than a pile of missing items. `Strategy`'s two
variants, their `From`/`Display`/dispatch arms and the `gemm` catalogue's two
entry lists are cfg'd; `Auto` is SimpleCyclicCmma → SimpleUnit whenever
multi-level is compiled, and Cmma → CpuGemm in a tiled-only build.

Two items were on the wrong side of the seam, both found by the single-family
builds warning they were dead:

- `M`/`N`/`K`, `batch_axis` and `MatmulOperands` are tile-DSL vocabulary that only
  the tiled routines use. They move to `tiled/operands.rs`, which makes cubek-tile
  a tiled-only dependency (`tiled = ["dep:cubek-tile"]`).
- `MatmulPrecision` / `MatrixPrecision` and `MatmulElems::new_deprecated` are a pure
  element-type mapping that both families' harnesses launch through. They move to
  the shared `definition/precision.rs`. `MatmulTypes`/`MatrixTypes` and the alias zoo
  stay multi-level.

cubek-attention and cubek-convolution declare `features = ["multi-level"]`; the cubek
facade gains `matmul-tiled` / `matmul-multi-level` passthroughs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tests/{harness,tiled,multi_level}, with the `matmul/` level dropped. harness/ holds
the launcher plumbing, the problem builders and the stride-0 broadcast helpers, and
carries no test of its own. Every tier (basic/extended/full/benchmarks) now crosses
the branch axis inside its family.

Three files had to be cut in two: basic/plane_accelerated.rs at the tile-DSL comment,
extended/stride_zero.rs (the strategy table is multi-level, the CpuGemm entry tiled,
the helpers now harness/broadcast.rs), and bench_catalog.rs, which becomes a
per-family correctness file plus multi_level/comparison.rs for the dsl-vs-legacy
probes — those exist only while both families do, so they die with the island and
are cfg'd on `tiled` inside it.

Deviation from the plan's "zero #[test] outside tiled/ and multi_level/": the
`Strategy::Auto` suite belongs to neither island and correctly survives deleting
either, so it stays at tests/auto/ (a directory module, since a bare tests/*.rs
would become its own test binary).

All six {tiled,multi-level} x {basic,extended,extended+benchmarks} combos compile
and clippy clean; the basic tier runs the same 47 tests as before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`cargo xtask test` runs cubek-matmul twice more per backend, once with each family
alone, and CI clippies both single-family builds at the extended tier. Without a job
that compiles them, the cfg attributes rot.

The first tiled-only run showed the seam was not actually being tested: the package's
own dev-dependency (`cubek-matmul = { path = "." }`, for `cpu-reference`) carried
default features, so every test build unified both families back in. With
`default-features = false` on it, a tiled-only test binary really holds only the
tiled and Auto tests: 9 + 9 against the 15 + 47 of a full build, and 15 + 39 for
multi-level alone. All three pass on cubecl/cpu.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Against metabolic's contributor book:

- `mod.rs` holds no code: the Auto suite moves to `tests/auto/base.rs`.
- No doc dates itself: the three re-export comments that said "back-compat",
  "have always used" and "keep working" now state what the re-export is for.
- No analogy on my own initiative and no "legacy": the comparison probes name
  multi-level, and nothing in the code calls either family an island.
- No em dashes in comments.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`tiled` and `multi_level` are two architectures. "Family" is the other sense in
this crate: a trait with implementations (`BatchMatmulFamily`, the gemm family),
and one word cannot mean both. Renames the prose, the CI step names and the xtask
loop; leaves every pre-existing `*Family` alone.

The CI comment also said what the default is rather than what the steps do: every
other job compiles both architectures, so nothing else notices a `#[cfg]` that
stopped being true.

TILED_SPLIT_PLAN.md is deleted. The split is done and the code is the record.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
# Conflicts:
#	crates/cubek-matmul/src/definition/mod.rs
#	crates/cubek-matmul/src/eval/benchmarks/gemm/strategy.rs
@louisfd
louisfd merged commit 8345312 into main Aug 25, 2026
3 checks passed
@louisfd
louisfd deleted the refactor/tiled_split branch August 25, 2026 13:46
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