Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit b8922a4

Browse files
committed
add cmae instructions to readme
1 parent f5e384b commit b8922a4

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

README.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,47 @@ In general, PI is very alpha; to get a rough idea of the current status check th
7878

7979
Currently, we're passing ~650 out of 786 of Torch-MLIR's test-suite (`torch-mlir==20230127.731`).
8080

81-
# Build Wheel
81+
# Development
82+
83+
Spin up a venv (or conda environment) with `pip install -r requirements.txt ` and configure CMake with
84+
85+
```shell
86+
cmake \
87+
-DCMAKE_INSTALL_PREFIX=$PI_SRC_DIR/pi \
88+
-DPython3_EXECUTABLE=$(which python) \
89+
-S $PI_SRC_DIR \
90+
-B $PI_BUILD_DIR
91+
```
92+
93+
where `$PI_SRC_DIR` is the path to the checkout of this repo and `$PI_BUILD_DIR` is where you want to build into. Then
94+
95+
```shell
96+
cmake --build $PI_BUILD_DIR --target install
97+
```
98+
99+
which will install `_mlir_libs`, `dialects`, and `runtime` underneath `$PI_SRC_DIR/mlir`.
100+
Then add `$PI_SRC_DIR` to your `PYTHONPATH` and you're good to go. E.g.,
101+
102+
```shell
103+
PYTHONPATH=$PI_SRC_DIR pytest ../tests/unit/*
104+
```
105+
106+
**Why build the `install` target?** Because you can't do a `pip install . -e` (editable install) because of the pybind/C-extension so this is the next best thing.
107+
108+
Note, if you're using CLion and you're getting something like
109+
110+
```shell
111+
Process finished with exit code 127
112+
```
113+
114+
you need to disable `Add content roots to PYTHONPATH` and `Add source roots to PYTHONPATH` [in Run/Debug Configurations](https://stackoverflow.com/a/48471173).
115+
116+
If you're fancy you can add these CMake flags:
82117

83118
```shell
84-
pip install -r requirements.txt
85-
pip wheel . --no-build-isolation -w wheelhouse --no-deps
119+
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld"
120+
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld"
121+
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld"
122+
-DCMAKE_C_COMPILER_LAUNCHER=ccache
123+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
86124
```

0 commit comments

Comments
 (0)