Only tested in 18.04. In principle it should work on higher versions too, but no guarantees
Currently the build system does not automatically pull the LLVM dependencies so we need to manually install them
# Download precompiled LLVM 10 binaries wget -c https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xztar xf clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz -C /my/llvm/install/dir --strip-components=1# (Optional) Create `$LLVM_HOME` env var pointing to the llvm installationecho -eexport LLVM_HOME=$( realpath /my/llvm/install/dir) >> ~ /.bashrcsource ~ /.bashrc(we should really have CMake configure this but for now its ok)
sudo apt updatesudo apt install libcxxtools-dev
sudo apt install graphvizsudo apt install doxygen
cd kermamkdir buildcd build && cmake ..make -j4
If all went well there should be a directoryout
underbuild
with the following structure:
out/├── bin/├── docs/├── include/├── lib/└── rt/
This is the directory to use asKERMA_HOME
in KermaView, meaning that in KermaView you should setKERMA_HOME=path/to/kerma/build/out
in the.env
file.
Cuda Instrumentation pipeline +---------------+ | Device IR | |Instrumentation| +----+----+-----+ ^ | | | | | | | clang + v llc ptxas fatbinary +---------------> device.bc +-------> device.ptx +-------> device.o +---------> device.fatbin | + + |program.cu | + | | clang clang clang | +---------------> host.cu.inc +-------> host.bc +-------> host.o +---------------->+ clang (link) (host src w. + ^ | Cuda wrappers) | | | | | v | | program.exe v | +----+---+------+ | Host IR | |Instrumentation| +----+---+------+
TODO: Add flags for each step
Step 0
clang++ -std=c++11 -c -S -g -O0 -emit-llvm -fno-discard-value-names \ -Xclang -disable-O0-optnone \ <file> -cuda-gpu-arch=<arch>
Step 1
opt -S -mem2reg -instnamer <file>.ll > <file>.1.ll
Step 2
opt -S -load <KermaTransformPlugin> --kerma-md --kerma-mi [<kerma-md options>] [<kerma-mi-options>] <file>.1.ll > <file>.2.ll