-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.txt
42 lines (28 loc) · 1.43 KB
/
run.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Build Enzyme:
CC=clang CXX=clang++ cmake .. -DCMAKE_BUILD_TYPE=Debug -DLLVM_DIR=/usr/lib/llvm-13
cmake .. -DLLVM_DIR=/usr/lib/llvm-13
Compile test:
clang-13 -Xclang -load -Xclang /home/leila/Enzyme/enzyme/buildglit/Enzyme/ClangEnzyme-13.so -O2 -flegacy-pass-manager test001.c
/*
We can generate LLVM from this code by calling clang as follows.
Note that clang should be the path to whatever clang you built Enzyme against.
clang test001.c -S -emit-llvm -o input.ll -O2 -fno-vectorize -fno-slp-vectorize -fno-unroll-loops
where
-S -emit-llvm -> we want to emit LLVM bitcode rather than an executable
-o input.ll -> we want the output to be in a file input.ll
-O2 -ffast-math -> runs optimizations (with fast-math) before we run Enzyme’s AD process
-fno-vectorize -fno-slp-vectorize -fno-unroll-loops ->
we don’t want to run vectorization or loop unrolling.
It is better for performance to only run these scheduling optimizations after AD.
Perfoming AD Enzyme:
opt input.ll -load=/path/to/Enzyme/enzyme/build/Enzyme/LLVMEnzyme-<VERSION>.so -enzyme -o output.ll -S
*/
/*
clang test001.c -S -emit-llvm -o input1.ll -O2 -fno-vectorize -fno-slp-vectorize -fno-unroll-loops
opt input1.ll -load=/home/leila/Enzyme/enzyme/build13/Enzyme/ClangEnzyme-13.so -enzyme -o output1.ll -S
opt output1.ll -O2 -o output_opt1.ll -S
clang output_opt1.ll -o a1.exe
./a1.exe
*/
Just a C code:
clang -O2 foo.c