https://github.com/e3m3/mlir-rust
Rust bindings over the MLIR C API from mlir-sys
https://github.com/e3m3/mlir-rust
compiler library mlir mlir-dialect rust rust-lang
Last synced: about 1 year ago
JSON representation
Rust bindings over the MLIR C API from mlir-sys
- Host: GitHub
- URL: https://github.com/e3m3/mlir-rust
- Owner: e3m3
- License: bsd-3-clause
- Created: 2024-10-21T06:08:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-01T20:59:25.000Z (over 1 year ago)
- Last Synced: 2025-04-12T21:58:23.607Z (about 1 year ago)
- Topics: compiler, library, mlir, mlir-dialect, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 756 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Copyright
Copyright 2024-2025, Giordano Salvador
SPDX-License-Identifier: BSD-3-Clause
Author/Maintainer: Giordano Salvador <73959795+e3m3@users.noreply.github.com>
# Description
[](https://github.com/e3m3/mlir-rust/actions/workflows/fedora-41.yaml)
[](https://github.com/e3m3/mlir-rust/actions/workflows/macos-14.yaml)
Rust library and bindings implementing the [MLIR][1] [[1]] ([license][2] [[2]]) compiler framework.
Uses the C API bindings from the `mlir_sys` crate ([site][3] [[3]] and [license][4] [[4]]).
## Documentation
Read the API at [https://e3m3.github.io/mlir-rust/mlir/](https://e3m3.github.io/mlir-rust/mlir/index.html).
## Prerequisites
* rust-2024
* llvm-19, clang-19, and mlir-sys (or llvm version matching mlir-sys)
* libxml2 and libz headers (for testing)
* num_cpus (for testing)
* python3-lit, FileCheck (for testing)
* By default, `tests/lit-tests.rs` will search for the lit executable in
`$PYTHON_VENV_PATH/bin` (if it exists) or the system's `/usr/bin`.
* [docker|podman] (for testing/containerization)
* A [Fedora][5] [[5]] image can be built using `containers/Containerfile.fedora*`.
## Setup
* Native build:
```shell
cargo build
```
* Build Rust lit tests:
```shell
cargo build --manifest-path tests/lit-tests-rust/Cargo.toml
```
* Run Rust lit test (e.g., `tests/lit-tests-rust/src/.lit-rs`:
```shell
cargo run --manifest-path tests/lit-tests-rust/Cargo.toml --
```
* Build and run lit test suite (MLIR + Rust):
```shell
cargo test -- --nocapture
```
* Container build and test [podman][6] [[6]]:
```shell
podman build -t mlir-rust -f container/Containerfile .
```
* Container build and test [docker][7] [[7]]:
```shell
docker build -t mlir-rust -f container/Dockerfile .
```
* If `make` is installed, you can build the image by running:
```shell
make
```
# References
[1]: https://mlir.llvm.org/
[2]: https://github.com/llvm/llvm-project/blob/main/mlir/LICENSE.TXT
[3]: https://crates.io/crates/mlir-sys
[4]: https://github.com/mlir-rs/mlir-sys/blob/main/LICENSE
[5]: https://fedoraproject.org/
[6]: https://podman.io/
[7]: https://www.docker.com/
1. `https://mlir.llvm.org/`
1. `https://github.com/llvm/llvm-project/blob/main/mlir/LICENSE.TXT`
1. `https://crates.io/crates/mlir-sys`
1. `https://github.com/mlir-rs/mlir-sys/blob/main/LICENSE`
1. `https://fedoraproject.org/`
1. `https://podman.io/`
1. `https://www.docker.com/`