适用于初学者的 MLIR 教程
This is the code repository for a series of articles on the MLIR framework for building compilers.
Bazel is one of two supported build systems for this tutorial. The other is CMake. If you're unfamiliar with Bazel, you can read the tutorials at https://bazel.build/start. Familiarity with Bazel is not required to build or test, but it is required to follow the articles in the tutorial series and explained in the first article, Build System (Getting Started). The CMake build is maintained, but was added at article 10 (Dialect Conversion) and will not be explained in the articles.
Note: This project has been upgraded to Bazel 8.3.1 and migrated to use
Bzlmod for dependency management, replacing the traditional WORKSPACE file
approach. Dependencies are now managed through MODULE.bazel using the
Bazel Central Registry (BCR) where possible.
Install Bazelisk via instructions at
https://github.com/bazelbuild/bazelisk#installation.
This should create the bazel command on your system.
You should also have a modern C++ compiler on your system, either gcc or
clang, which Bazel will detect.
Bazel Version: This project requires Bazel 8.3.1 or newer. The specific
version is pinned in .bazelversion.
Run
bazel build ...:all
bazel test ...:all
The project uses Bzlmod (MODULE.bazel) for dependency management:
This approach provides better dependency resolution, versioning, and compatibility compared to the legacy WORKSPACE approach.
CMake is one of two supported build systems for this tutorial. The other is Bazel. If you're unfamiliar with CMake, you can read the tutorials at https://cmake.org/getting-started/. The CMake build is maintained, but was added at article 10 (Dialect Conversion) and will not be explained in the articles.
Checkout the tutorial including the LLVM dependency (submodules):
git clone --recurse-submodules https://github.com/j2kun/mlir-tutorial.git
cd mlir-tutorial
Note: The following steps are suitable for macOs and use ninja as building system, they should not be hard to adapt for your environment.
Build LLVM/MLIR
…
…
暂无开放 Issues,或尚未同步最近议题。