aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2021-10-12 14:21:18 +0100
committerYann Herklotz <git@yannherklotz.com>2021-10-12 14:21:18 +0100
commitb067fbe946d24be5a6a39c551421227b2d637a9a (patch)
treea577e49234487cbf1920899e0d057c15e34a8102
parenta08f79d3e01c92859e6b33f602b2be2bb8c52e61 (diff)
downloadgsa-mlir-b067fbe946d24be5a6a39c551421227b2d637a9a.tar.gz
gsa-mlir-b067fbe946d24be5a6a39c551421227b2d637a9a.zip
Add more detailed instructions on installation
-rw-r--r--README.md54
1 files changed, 51 insertions, 3 deletions
diff --git a/README.md b/README.md
index b1ca627..6bb269f 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,66 @@
# An out-of-tree MLIR dialect
-This is an example of an out-of-tree [MLIR](https://mlir.llvm.org/) dialect along with a standalone `opt`-like tool to operate on that dialect.
+This is an example of an out-of-tree [MLIR](https://mlir.llvm.org/) dialect along with a standalone
+`opt`-like tool to operate on that dialect.
+
+## Setting up Docker
+
+First, set up docker volumes so that the installation persists across multiple images, and pull the
+right image.
+
+``` sh
+docker pull ymherklotz/polyhedral:1.0
+docker volume create llvm
+docker run -itd --name gsa-mlir -v llvm:/opt ymherklotz/polyhedral:1.0
+docker exec -it gsa-mlir /bin/bash
+```
+
+## Setting up LLVM
+
+First, download and install MLIR from the [`llvm-project`](https://github.com/llvm/llvm-project/)
+and compile it, installing it in `/`
+
+``` sh
+cd /opt
+git clone https://github.com/llvm/llvm-project.git
+mkdir llvm-project/build
+cd llvm-project/build
+cmake -G Ninja ../llvm \
+ -DLLVM_ENABLE_PROJECTS=mlir \
+ -DLLVM_BUILD_EXAMPLES=ON \
+ -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DLLVM_ENABLE_ASSERTIONS=ON \
+ -DLLVM_INSTALL_UTILS=ON \
+ -DCMAKE_INSTALL_PREFIX=/opt/llvm
+cmake --build . --target check-mlir
+mkdir -p /opt/llvm
+ninja install
+```
+
+This should create a `BUILD_DIR` under `/opt/llvm-project/build`, and install everything under
+`PREFIX` which is `/opt/llvm`.
## Building
-This setup assumes that you have built LLVM and MLIR in `$BUILD_DIR` and installed them to `$PREFIX`. To build and launch the tests, run
+These instructions are now to build this repository, which should be in a separate place to the
+directories above.
+
+This setup assumes that you have built LLVM and MLIR in `$BUILD_DIR` and installed them to
+`$PREFIX`. To build and launch the tests, run
+
```sh
mkdir build && cd build
cmake -G Ninja .. -DMLIR_DIR=$PREFIX/lib/cmake/mlir -DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit
cmake --build . --target check-standalone
```
+
To build the documentation from the TableGen description of the dialect operations, run
+
```sh
cmake --build . --target mlir-doc
```
-**Note**: Make sure to pass `-DLLVM_INSTALL_UTILS=ON` when building LLVM with CMake in order to install `FileCheck` to the chosen installation prefix.
+
+**Note**: Make sure to pass `-DLLVM_INSTALL_UTILS=ON` when building LLVM with CMake in order to
+install `FileCheck` to the chosen installation prefix.