Project Structure
env: Contains the environment setup for building project dependencies, such as LLVM and Flatbuffersinclude/ttmlir: Public headers for the TTMLIR libraryDialect: MLIR dialect interfaces and definitions, dialects typically follow a common directory tree structure:IR: MLIR operation/type/attribute interfaces and definitionsPasses.[h|td]: MLIR pass interfaces and definitionsTransforms: Common MLIR transformations, typically invoked by passes
Target: Flatbuffer schema definitions. This defines the binary interface between the compiler and the runtime
lib: TTMLIR library implementationCAPI: C API for interfacing with the TTMLIR library, note this is needed for implementing the python bindings. Read more about it here: https://mlir.llvm.org/docs/Bindings/Python/#use-the-c-apiDialect: MLIR dialect implementations
runtime: Device runtime implementationinclude/tt/runtime: Public headers for the runtime interfacelib: Runtime implementationtools/python: Python bindings for the runtime, currently this is wherettrtis implemented
test: Test suitetools/ttmlir-opt: TTMLIR optimizer driver
Namespaces
mlir: On the compiler side, we use the MLIR namespace for all MLIR types and operations and subnamespace for our dialects.mlir::tt: Everything ttmlir related is underneath this namespace. Since we need to subnamespace undermlir, justmlir::ttseemed better thanmlir::ttmlirwhich feels redundant.mlir::tt::ttir: The TTIR dialect namespacemlir::tt::ttnn: The TTNN dialect namespacemlir::tt::ttmetal: The TTMetal dialect namespacemlir::tt::ttkernel: The TTKernel dialect namespace
tt::runtime: On the runtime side, we use thett::runtimenamespace for all runtime types and operations.tt::runtime::ttnn: The TTNN runtime namespacett::runtime::ttmetal: The TTMetal runtime namespace (not implemented)