From b067fbe946d24be5a6a39c551421227b2d637a9a Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Tue, 12 Oct 2021 14:21:18 +0100 Subject: Add more detailed instructions on installation --- README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) (limited to 'README.md') 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. -- cgit