File tree Expand file tree Collapse file tree 4 files changed +30
-38
lines changed Expand file tree Collapse file tree 4 files changed +30
-38
lines changed Original file line number Diff line number Diff line change
1
+ .vscode
2
+ .env
3
+
4
+ build
5
+ __pycache__
6
+
Original file line number Diff line number Diff line change 1
- To run examples you need to have:
2
- - tf-opt
3
- - mlir-hlo-opt
4
- - tf-mlir-translate
5
- - tf\_ to\_ kernel
6
- - tf\_ to\_ gpu\_ binary
7
- - kernel-gen-opt
8
- - mlir-opt
9
- - mlir-tranlsate
10
-
11
- using TF: da034876d3d1849f6328c9c05c918b506e62dd63\
12
- using LLVM: 0f6facca9701f6df87d13e55d70bd7111a0472aa
13
-
14
- ** Intalling TensorFlow Opt and Tools** :
15
- ``` sh
16
- git clone https://github.com/tensorflow/tensorflow
17
- cd tensorflow
18
- ./configure # say N to every [y/N] execpt CUDA(that's up to you :))
19
- bazel build //tensorflow/compiler/mlir:tf-mlir-translate && bazel build //tensorflow/compiler/mlir:tf
20
- -opt && bazel build //tensorflow/compiler/mlir/tools/kernel_gen:kernel-gen-opt && bazel build //tenso
21
- rflow/compiler/mlir/hlo:mlir-hlo-opt && bazel build //tensorflow/compiler/mlir/tools/kernel_gen:tf_to
22
- _kernel && bazel build //tensorflow/compiler/mlir/tools/kernel_gen:tf_to_gpu_binary
23
- ```
24
- ** Intalling MLIR Tools** :
25
- ``` sh
26
- git clone https://github.com/llvm/llvm-project.git
27
- mkdir llvm-project/build
28
- cd llvm-project/build
29
- cmake -G Ninja ../llvm \
30
- -DLLVM_ENABLE_PROJECTS=mlir \
31
- -DLLVM_BUILD_EXAMPLES=ON \
32
- -DLLVM_TARGETS_TO_BUILD=" X86;NVPTX;AMDGPU" \
33
- -DCMAKE_BUILD_TYPE=Release \
34
- -DLLVM_ENABLE_ASSERTIONS=ON \
35
- # -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON
36
- cmake --build . --target check-mlir
37
- ```
1
+ ** Install Deps**
2
+ See here to install deps via ./install_deps.sh
3
+ https://github.com/NodLabs/mlir-examples
38
4
39
5
### How to run:
40
6
** TF Absolute CPU example(![ #c5f015] ( https://via.placeholder.com/15/c5f015/000000?text=+ ) working)**
Original file line number Diff line number Diff line change @@ -11,5 +11,25 @@ A collection of MLIR End to End examples. We plan to add working examples of:
11
11
* Use mlir-npcomp to generate ATen Dialect.
12
12
* Lower to C++ / LLVM_IR (?)
13
13
14
+ ** Intalling LLVM/MLIR and TF Dependencies** :
15
+ ``` sh
16
+ git clone https://github.com/NodLabs/mlir-examples.git
17
+ mkdir mlir-examples/
18
+ ./install_deps.sh
19
+ ```
20
+ Export the pre-built binaries into your path (you can also directly call the binaries)
21
+
22
+ ```
23
+ export PATH=`pwd`/build/install/bin:$PATH
24
+ ```
25
+
26
+ Now cd into one of the examples and give it a try.
27
+
28
+ ```
29
+ ./build/install/bin/tf_to_kernel --input=LLVM-IR-E2E/tf_abs/tf_abs.mlir --output=abs_kernel.o
30
+
31
+ file abs_kernel.o
32
+ ```
33
+
14
34
# Other references
15
35
https://llvm.discourse.group/t/print-in-mlir/1701/13
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ if [ ! -f ".tf_configure.bazelrc" ]; then
59
59
./configure
60
60
fi
61
61
echo " TF configured... invoking bazel. If you dont have bazel .. download and install bazelisk"
62
- bazel build //tensorflow/compiler/mlir:tf-mlir-translate //tensorflow/compiler/mlir:tf-opt //tensorflow/compiler/mlir/tools/kernel_gen:kernel-gen-opt //tensorflow/compiler/mlir/hlo:mlir-hlo-opt //tensorflow/compiler/mlir/tools/kernel_gen:tf_to_kernel //tensorflow/compiler/mlir/tools/kernel_gen:tf_to_gpu_binary
62
+ bazel build --config=cuda //tensorflow/compiler/mlir:tf-mlir-translate //tensorflow/compiler/mlir:tf-opt //tensorflow/compiler/mlir/tools/kernel_gen:kernel-gen-opt //tensorflow/compiler/mlir/hlo:mlir-hlo-opt //tensorflow/compiler/mlir/tools/kernel_gen:tf_to_kernel //tensorflow/compiler/mlir/tools/kernel_gen:tf_to_gpu_binary
63
63
64
64
ln -s ${TF_SRC_DIR} /bazel-bin/tensorflow/compiler/mlir/tf-mlir-translate $install_mlir /bin/
65
65
ln -s ${TF_SRC_DIR} /bazel-bin/tensorflow/compiler/mlir/tf-opt $install_mlir /bin/
You can’t perform that action at this time.
0 commit comments