Meta project around MLIR
51
stars
220
commits
Python
primary language
Sep 8, 2026
updated
This project implements the RFC: https://discourse.llvm.org/t/rfc-mlir-project-lighthouse/86738
"In essence, this project should guide you through using MLIR for your own projects, showing the way, but not forcing you to follow a particular path. Essentially, the role of a lighthouse."
This project uses LLVM to test and validate various pipelines and assumptions about the MLIR project, but it is not part of any LLVM releases, nor is a dependency for MLIR to operate.
You should use this project to guide you through MLIR pipelines, schedules and transforms, as well as understanding how to connect ingress frameworks and how to execute the egress on appropriate hardware.
The project is separated into three parts:
The upstream lighthouse project needs to keep the three parts restricted to upstream / publicly available technology. In essence, public ingress and conversion projects, upstream MLIR dialects and transforms, and public execution engines that can be automatically installed and executed without going through private repositories, license agreement, etc.
A downstream fork of the lighthouse project could extend any and all of the three parts to reach private repositories and tools, execute downstream schedules, load private dialects, etc.
The main purposes of this project, in chronological order, are:
One key point in the proposal was to not hold "load bearing" code in this repository, but instead, upstream it to MLIR proper and use it here.
It should be fine to have schedule descriptions, aggregation transforms and passes that use the upstream MLIR transforms and passes, but we should not add actual transforms, dialects and passes here to complement the MLIR story.
As of June 2026, the project has achieved the first goal above (validation or assumptions), and has created key infrastructure to start the second goal: define common pipelines and develop reusable schedules.
There are four main parts of the project:
lh-opt, lh-run, lh-tune and kernel-bench. This should be the entry point of new users, and the inspiration to developers of other tools using Lighthouse.kernel-bench tool to go through all KernelBench models using various pipelines and supporting different targets.For the time being, lighthouse depends on just the Python bindings for mlir.
To install this dependency along with lighthouse python package, obtain the uv Python package manager and run the following in the root of the project:
$ uv venv # Create a .venv virtualenv
$ uv sync # Install the `mlir-python-bindings` and `lighthouse` into the virtualenv
$ uv sync --extra ingress-torch-cpu # Optionally install the dependencies for torch ingress
To run the Python programs in this repo, either enter the virtual environment ($ source .venv/bin/activate) and execute a program or execute each of the programs through uv (i.e. $ uv run $EXE), which will automatically run them inside the virtualenv.
You can install lighthouse as a Python package using uv or pip:
uvIf you've run the steps from the Getting up and running section,
you already have lighthouse installed in your virtual environment:
$ uv run python
Python 3.12.11 | (main, Jun 4 2025, 14:45:31) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lighthouse
>>> lighthouse.__version__
'0.1.0a1'
If you don't want to use the virtual environment created by uv, you can skip uv venv; uv sync steps and install Lighthouse in your current environment using:
$ source ../my_custom_venv/bin/activate # or conda activate my-venv
(my-venv) $ uv pip install . # installs Lighthouse along with its basic dependencies
(my-venv) $ uv pip install .[ingress_torch_cpu] # installs Lighthouse along with its torch-ingress dependencies
pipIf you don't want to use uv to install the package, you can install it directly with pip.
You'll need to specify the custom sources so pip can find all required dependencies (e.g., mlir-bindings). The sources are listed in the pyproject.toml file.
Here are some common installation examples:
pip install . \
--find-links https://llvm.github.io/eudsl/ \
--only-binary :all:
pip install .[ingress_torch_cpu] \
--find-links https://llvm.github.io/eudsl/ \
--find-links https://github.com/llvm/torch-mlir-release/releases/expanded_assets/dev-wheels \
--extra-index-url https://download.pytorch.org/whl \
--only-binary :all:
To install Lighthouse with Intel XeGPU support see examples/xegpu/README.md.
To make sure you create a clean PR, you should run the code formatter and tests before submitting it.
There's a script that helps you with this, assuming you have already set up your environment as described above.
At the root of the repository, run:
bash precommit.sh
This script runs all of the checks below, so you can just run it every time before a commit.
We have a formatting pre-commit check for every PR. To make sure you don't get PR check failures, you can run ruff:
At the root of the repository, run:
uv run pre-commit run --all-files
This will check for issues and fix them automatically, so if you commit after running this check, you'll always have correctly formatted Python code.
Running the tests is as simple as lit . in the root of the project (in a suitable Python environment):
At the root of the repository, run:
uv run lit .
We assume that the FileCheck and lit executables are available on the PATH.
FileCheck and lit.
lit, simply run uv sync (lit is included in the "dev" dependency group).
In case the FileCheck executable happens to be available under a different name/location, e.g. as FileCheck-18 from Ubuntu's llvm-dev package, set the FILECHECK environment variable when invoking lit.
Python
98.6%
MLIR
1.0%
Meta project around MLIR
51
stars
220
commits
Python
primary language
Sep 8, 2026
updated
This project implements the RFC: https://discourse.llvm.org/t/rfc-mlir-project-lighthouse/86738
"In essence, this project should guide you through using MLIR for your own projects, showing the way, but not forcing you to follow a particular path. Essentially, the role of a lighthouse."
This project uses LLVM to test and validate various pipelines and assumptions about the MLIR project, but it is not part of any LLVM releases, nor is a dependency for MLIR to operate.
You should use this project to guide you through MLIR pipelines, schedules and transforms, as well as understanding how to connect ingress frameworks and how to execute the egress on appropriate hardware.
The project is separated into three parts:
The upstream lighthouse project needs to keep the three parts restricted to upstream / publicly available technology. In essence, public ingress and conversion projects, upstream MLIR dialects and transforms, and public execution engines that can be automatically installed and executed without going through private repositories, license agreement, etc.
A downstream fork of the lighthouse project could extend any and all of the three parts to reach private repositories and tools, execute downstream schedules, load private dialects, etc.
The main purposes of this project, in chronological order, are:
One key point in the proposal was to not hold "load bearing" code in this repository, but instead, upstream it to MLIR proper and use it here.
It should be fine to have schedule descriptions, aggregation transforms and passes that use the upstream MLIR transforms and passes, but we should not add actual transforms, dialects and passes here to complement the MLIR story.
As of June 2026, the project has achieved the first goal above (validation or assumptions), and has created key infrastructure to start the second goal: define common pipelines and develop reusable schedules.
There are four main parts of the project:
lh-opt, lh-run, lh-tune and kernel-bench. This should be the entry point of new users, and the inspiration to developers of other tools using Lighthouse.kernel-bench tool to go through all KernelBench models using various pipelines and supporting different targets.For the time being, lighthouse depends on just the Python bindings for mlir.
To install this dependency along with lighthouse python package, obtain the uv Python package manager and run the following in the root of the project:
$ uv venv # Create a .venv virtualenv
$ uv sync # Install the `mlir-python-bindings` and `lighthouse` into the virtualenv
$ uv sync --extra ingress-torch-cpu # Optionally install the dependencies for torch ingress
To run the Python programs in this repo, either enter the virtual environment ($ source .venv/bin/activate) and execute a program or execute each of the programs through uv (i.e. $ uv run $EXE), which will automatically run them inside the virtualenv.
You can install lighthouse as a Python package using uv or pip:
uvIf you've run the steps from the Getting up and running section,
you already have lighthouse installed in your virtual environment:
$ uv run python
Python 3.12.11 | (main, Jun 4 2025, 14:45:31) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lighthouse
>>> lighthouse.__version__
'0.1.0a1'
If you don't want to use the virtual environment created by uv, you can skip uv venv; uv sync steps and install Lighthouse in your current environment using:
$ source ../my_custom_venv/bin/activate # or conda activate my-venv
(my-venv) $ uv pip install . # installs Lighthouse along with its basic dependencies
(my-venv) $ uv pip install .[ingress_torch_cpu] # installs Lighthouse along with its torch-ingress dependencies
pipIf you don't want to use uv to install the package, you can install it directly with pip.
You'll need to specify the custom sources so pip can find all required dependencies (e.g., mlir-bindings). The sources are listed in the pyproject.toml file.
Here are some common installation examples:
pip install . \
--find-links https://llvm.github.io/eudsl/ \
--only-binary :all:
pip install .[ingress_torch_cpu] \
--find-links https://llvm.github.io/eudsl/ \
--find-links https://github.com/llvm/torch-mlir-release/releases/expanded_assets/dev-wheels \
--extra-index-url https://download.pytorch.org/whl \
--only-binary :all:
To install Lighthouse with Intel XeGPU support see examples/xegpu/README.md.
To make sure you create a clean PR, you should run the code formatter and tests before submitting it.
There's a script that helps you with this, assuming you have already set up your environment as described above.
At the root of the repository, run:
bash precommit.sh
This script runs all of the checks below, so you can just run it every time before a commit.
We have a formatting pre-commit check for every PR. To make sure you don't get PR check failures, you can run ruff:
At the root of the repository, run:
uv run pre-commit run --all-files
This will check for issues and fix them automatically, so if you commit after running this check, you'll always have correctly formatted Python code.
Running the tests is as simple as lit . in the root of the project (in a suitable Python environment):
At the root of the repository, run:
uv run lit .
We assume that the FileCheck and lit executables are available on the PATH.
FileCheck and lit.
lit, simply run uv sync (lit is included in the "dev" dependency group).
In case the FileCheck executable happens to be available under a different name/location, e.g. as FileCheck-18 from Ubuntu's llvm-dev package, set the FILECHECK environment variable when invoking lit.
Python
98.6%
MLIR
1.0%