This is an early RFC, I haven’t fleshed out all the details but felt I’d be seeking feedback before spending too much time on this (and some help on figuring out the exact layout), so I’ll keep it short for now.
MLIR is both a compiler infrastructure and “batteries”, that is a collection of reusable blocks for compilers (mostly around CodeGen for Tensors, Dense and Sparse Linear Algebra and Affine/Polyhedral abstractions). We’re keeping expanding, and getting to the point where we’d like more “end-to-end” flow packaged in-tree.
I believe we reached the limit of our project structure, which is rather “flat” at the moment. It is hard to distinguish the “core” infrastructure from the more peripheral reusable components and compiler blocks. We also lack of a clear way to land more complete flow (for example it isn’t easy to land a TOSA or TACO like compiler right now).
So I’m proposing that we start reorganize the repo to account for this, as a first step here is a draft (it does not build, it’s a quick starts) that looks like this:
mlir/
core/ # Segregate the infrastructure from the myriad of dialects.
IR/
Interfaces/
Parser/
Pass/
PDL/
Rewrite/
Support/
TableGen/
include/ # public headers for `core/` libraries, installed in `#include "mlir/..."`
analysis/ # Generic analysis using core interfaces
AliasAnalysis
CallGraph
DataFlowAnalysis
DataLayout
include/ # Public headers for analysis, installed as `#include "mlir/Analysis/..."
transformations/ # Generic transformations using core interfaces.
Canonicalizer
Inliner
SCCP
SymbolDCE
include/ # Public headers for transformations libraries, installed as `#include "mlir/transformations/...`
dialects/ # Same content as current dialects.
Affine/
IR/
Transforms/
Utils/
include/ # Public headers for Affine dialect, will be installed as `#include "mlir/dialects/Affine/...`
AMX/
Arithmetic/
...
examples/
runtime/
# Runtime libraries are "special": they aren't compiled for the host
# like the rest of the compiler, but for the target.
targets/
Cpp
LLVMIR
SPIRV
compilers/ # does not exist in the repo right now, but possible addition!
PyTaco/
TOSA/
This both adds a level of nesting at the top-level, and allows us to add new directories more easily (experimental could be a possibility at some point as well).