This repository contains the source code for the compiler support component of the fine-trained CPU-FPGA task migration system. This compiler support was developed as part of an MInf Part 1 Dissertation titled "Compiler Support for Software Checkpoint-Restore for C/C++ Kernel Code, for Increased QoS in FPGA-Accelerated Systems in HPC Contexts" by Huang Zihan (University of Edinburgh) under the supervision of Dr. Maxime France-Pillois and Dr. Antonio Barbalace of ICSA, University of Edinburgh. This source code was developed under LLVM14, but is LLVM7-compatible. All commands use the Legacy Pass Manager.
The dissertation report accompanying this project can be found here.
main
:
- Is the most updated version of the compiler support source code.
- llvm14 (llvm7 compatible)
- user-directed checkpoint selection
- selective partial insertion of save/restore infrastructure.
- unified restoraiton policy
llvm_14_ver_full_save_restore_mixed_policy_multi_ckpt_propagation
:
- llvm14 (llvm7 compatible)
- user-directed checkpoint selection
- selective partial insertion of save/restore infrastructure
- mixed restoration policy.
llvm_14_ver_full_save_restore
:
- llvm14 (llvm7 compatible)
- user-directed checkpoint selection
- full insertion of both save and restore infrastructure.
llvm_14_ver_auto_select_ckpts
:
- llvm14
- auto-selection of checkpoints based on smallest live-out set size.
opt-7 -load=<path/to/compiled/pass>.so -<pass name> -disable-output <path/to/input/file>
- Use the
-fno-discard-value-names
flag & the-Xclang -disable-O0-optnone
flags, e.g.:clang++ -O0 -S -emit-llvm -fno-discard-value-names fno-discard-value-names -Xclang -disable-O0-optnone <path/to/cpp/file> -o <path/to/ll/file>
- We generate O0 IR because our analysis pass are desgiend to use IR with alloca instructions (pre-
mem2reg
).
-
Build
junco-compiler_assisted_checkpointing
:cd <path/to/junco-compiler_assisted_checkpointing>
mkdir <build/dir>
cd <build/dir>
cmake -DLT_LLVM_INSTALL_DIR=<installation/dir/of/llvm/14> <source/dir/of/junco-compiler_assisted_checkpointing>
make
-
Generate IR of target
.cpp
code:clang++ -O0 -S -emit-llvm -fno-discard-value-names -Xclang -disable-O0-optnone <path/to/cpp/file> -o <path/to/ll/file>
-
Pre-split conditional branch BBs:
cd <build/dir>/lib
opt -enable-new-pm=0 -load ./libSplitConditionalBB.so -split-conditional-bb -S <path/to/input/ll/file> -o <path/to/output/ll/file>
-
Run liveness analysis:
cd <build/dir>/lib
opt -enable-new-pm=0 -load ./libLiveValues.so -live-values -analyze <path/to/input/ll/file> -source <path/to/source/cpp/file/of/ll/file>
-
Run subroutine injection:
cd <build/dir>/lib
opt -enable-new-pm=0 -load ./libSubroutineInjection.so -subroutine-injection -S <path/to/input/ll/file> -o <path/to/output/ll/file> -source <path/to/source/cpp/file/of/ll/file> -inject <inject_option>
- Note:
<inject_options>
are:save
: injecting only saveBB (no propagate)restore
: injecting restoreBB and junctionBB (propagate)save_restore
: inject saveBB, restoreBB and junctionBB (propagate)
These test examples here are pre-configured to the default test cases, and will run out of the box. To modify the test setups, modify the relevant .h
/.hpp
and .cpp
files within the junco-compiler_assisted_checkpointing/examples/<kernel>/
directories for each kernel. Also modify the local_support
.h
/.cpp
files, and/or the local_support_sequential.cpp
files for each test case, where appropriate. Refer to the Makefile
for each test setup for information on which files are used.
cd junco-compiler_assisted_checkpointing/examples/lud_xrt/src/testing/
- Update paths used in
Makefile
to those used on your local machine. make clean && make
./ex
cd junco-compiler_assisted_checkpointing/examples/blur_xrt/src/testing/
- Update paths used in
Makefile
to those used on your local machine. make clean && make
./ex Bridge_2200x1650.jpg
cd junco-compiler_assisted_checkpointing/examples/cholesky/testing/
- Update paths used in
Makefile
to those used on your local machine. make clean && make
./ex
- The CMake files and high-level project directory layouts used in this repository are based on those used in https://github.com/banach-space/llvm-tutor.
- The LiveValues pass is adapted from https://github.com/ssrg-vt/popcorn-compiler.
- This project uses parts of the JsonCpp library from https://github.com/open-source-parsers/jsoncpp.