Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Tensor Compiler

**Tensor Compiler** is a tool that converts models in the **ONNX** format into an intermediate representation (**IR**) using an **MLIR dialect**.

Currently, the project supports core neural network operations including:
- Conv
- Relu
- Add
- Mul
- MatMul
- Gemm
- Transpose

---

## Requirements

* LLVM + MLIR **version 20 or newer**
- either built from source, or
- installed system-wide

---

## Build Instructions

### 1. Create and activate a virtual environment

```bash
python -m venv venv
source venv/bin/activate
```

### 2. Install Conan

```bash
pip install conan
```

### 3. Install dependencies

```bash
conan install . --build=missing -s build_type=Release
```

### 4. Configure CMake

```bash
cmake --preset conan-release \
-DMLIR_DIR=/path/to/llvm-project/build/lib/cmake/mlir \
-DLLVM_DIR=/path/to/llvm-project/build/lib/cmake/llvm
```

❗ **Important:**
You must provide paths to your built LLVM and MLIR installations:

* `MLIR_DIR` — path to the `mlir` directory inside the LLVM build
* `LLVM_DIR` — path to the `llvm` directory inside the LLVM build

---

### 5. Build the project

```bash
cmake --build --preset conan-release
```

---

### 6. Run tests

```bash
ctest --test-dir build/Release
```

---

## Usage

After building, you can pass an ONNX model to the compiler to generate MLIR IR:

```bash
./build/Release/tensor-compiler <model.onnx>
```
---

## Maintainer
Developed and maintained by [ask0later](https://t.me/ask0later#). Feel free to open issues and contribute.

---