Skip to content

Commit e302bef

Browse files
authored
Update README.md (#614)
1 parent 0d718ab commit e302bef

File tree

1 file changed

+57
-33
lines changed

1 file changed

+57
-33
lines changed

README.md

Lines changed: 57 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,62 @@
1-
## Setting up development environment
1+
# Intel MLIR Extensions (IMEX)
2+
IMEX is collection of MLIR dialects and passes from Intel for improving upstream MLIR.
3+
Current extensions covers.
4+
* Dialects and passes needed to lower and execute Linalg dialect on Intel GPU.
5+
* Wrapper libraries to inteface with level zero runtime and sycl runtime supporting Intel GPU.
6+
* PTensor: A high-level dialect for tensors and (numpy-like) tensor-operations allowing passes to create parallelism for GPU, OpenMP but also distributed memory while following the compute-follows-data concept.
7+
8+
## Requirements for building and development
9+
### For build
10+
* CMake > 3.14.3 (3.18 if using Conda)
11+
* Ninja
12+
* doxygen (Optional for building docs)
13+
### Additionals for development
14+
* pre-commit
15+
* clang-format
16+
* lit (If set up as an out-of-tree build of LLVM)
17+
18+
### Example: Setting up requirements using Conda
219
```sh
3-
conda create -n imex-dev -c intel -c defaults -c conda-forge pip">=21.2.4" pre-commit cmake clang-format tbb-devel lit doxygen
20+
conda create -n imex-dev -c intel -c defaults -c conda-forge pip">=21.2.4" pre-commit cmake clang-format lit doxygen
421

522
conda activate imex-dev
23+
```
24+
25+
### Setting up pre-commit
26+
```
627
pre-commit install -f -c ./scripts/.pre-commit-config.yaml
728
```
8-
Or make sure you have a working c++ compiler, python, clang-format and cmake>3.16 in your path.
929

10-
## Building
11-
### Linux
30+
## Building IMEX
31+
IMEX supports three different ways of building depending on how LLVM is set up.
32+
### Option 1: Build IMEX together with LLVM source as an LLVM external project
33+
IMEX can be treated like a sub-project of LLVM and built as part of LLVM by using an LLVM config option called LLVM_EXTERNAL_PROJECTS.
34+
```
35+
git clone https://github.com/intel/mlir-extensions.git
36+
git clone https://github.com/llvm/llvm-project.git
37+
cd llvm-project
38+
git checkout `cat ../mlir-extensions/build_tools/llvm_version.txt`
39+
cmake -G Ninja -B build -S llvm \
40+
-DLLVM_ENABLE_PROJECTS=mlir \
41+
-DLLVM_BUILD_EXAMPLES=ON \
42+
-DLLVM_TARGETS_TO_BUILD="X86" \
43+
-DCMAKE_BUILD_TYPE=Release \
44+
-DLLVM_ENABLE_ASSERTIONS=ON \
45+
-DLLVM_EXTERNAL_PROJECTS="Imex" \
46+
-DLLVM_EXTERNAL_IMEX_SOURCE_DIR=../mlir-extensions
47+
48+
cmake --build build --target check-imex
49+
```
50+
**Note**: `-DLLVM_INSTALL_UTILS=ON` is not needed for this build since all tests
51+
will run using `FileCheck` utility is available in the build tree.
52+
External `lit` is not needed as well since all tests will run using `llvm-lit`
53+
in the build tree.
54+
55+
### Option 2: Build IMEX with a separately built and installed LLVM
1256
**Note**: Make sure to pass `-DLLVM_INSTALL_UTILS=ON` when building LLVM with
1357
CMake so that it installs `FileCheck` to the chosen installation prefix.
1458

15-
#### Convenience Building LLVM/MLIR + IMEX
59+
#### Using bundled build script
1660

1761
The script `build_tools/build_imex.py` can build both LLVM/MLIR and IMEX for you. Use
1862
`build_imex.py -h` to look at all the options provided by the script. It is
@@ -56,30 +100,10 @@ CC=gcc-9 CXX=g++-9 MLIR_DIR=<llvm-install-directory> cmake .. -DSYCL_DIR=/PATH_T
56100
make -j 12
57101
```
58102

59-
#### Building as an LLVM external project
60-
You can also build IMEX as an LLVM external project.
61-
```
62-
git clone https://github.com/intel/mlir-extensions.git
63-
git clone https://github.com/llvm/llvm-project.git
64-
cd llvm-project
65-
git checkout `cat ../mlir-extensions/build_tools/llvm_version.txt`
66-
cmake -G Ninja -B build -S llvm \
67-
-DLLVM_ENABLE_PROJECTS=mlir \
68-
-DLLVM_BUILD_EXAMPLES=ON \
69-
-DLLVM_TARGETS_TO_BUILD="X86" \
70-
-DCMAKE_BUILD_TYPE=Release \
71-
-DLLVM_ENABLE_ASSERTIONS=ON \
72-
-DLLVM_EXTERNAL_PROJECTS="Imex" \
73-
-DLLVM_EXTERNAL_IMEX_SOURCE_DIR=../mlir-extensions
74-
75-
cmake --build build --target check-imex
76-
```
77-
**Note**: `-DLLVM_INSTALL_UTILS=ON` is not needed for this build since all tests
78-
will run using `FileCheck` utility in LLVM built tree.
79-
External `lit` is not needed as well since all tests will run using `llvm-lit`
80-
in the LLVM build tree.
103+
### Option 3: Build IMEX with LLVM build tree
104+
This is similar to Option 2. Instead of building and installing LLVM. Just build LLVM and set "MLIR_DIR" to the sub-directory in the LLVM build tree that has generated file MLIRConfig.cmake. Rest of the step is the same as Option 2.
81105

82-
#### Building docs
106+
### Building docs
83107
To build user documentation do
84108
```sh
85109
cd build
@@ -170,10 +194,6 @@ cmake --build . --target check-imex
170194
```
171195
Add '-v' to the above command-line to get verbose output.
172196

173-
## License
174-
This code is made available under the Apache License 2.0 with LLVM Exceptions.
175-
See the `LICENSE.txt` file for more details.
176-
177197
## Profiling kernel execute time
178198
### sycl event
179199
```sh
@@ -188,3 +208,7 @@ llc test.ll -filetype=obj -o test.o
188208
clang++ test.o {path}/libmlir_runner_utils.so {path}/libmlir_c_runner_utils.so {path}/libsycl-runtime.so -no-pie -o test
189209
ze_tracer ./test
190210
```
211+
212+
## License
213+
This code is made available under the Apache License 2.0 with LLVM Exceptions.
214+
See the `LICENSE.txt` file for more details.

0 commit comments

Comments
 (0)