SILVIA is a set of LLVM transformation passes to automatically identify superword-level parallelism within an HLS FPGA design and exploit it by packing multiple operations, such as additions, multiplications, and multiply-and-adds, into a single DSP. It currently supports AMD Vitis HLS.
Install AMD Vitis and set it up via:
source ${INSTALL_PATH}/Vitis/${VERSION}/settings64.shWhere ${INSTALL_PATH} is the installation path of Vitis (e.g., /opt/Xilinx) and ${VERSION} is the version of Vitis (e.g., 2024.1).
The recommended installation method is to use the provided precompiled LLVM/SILVIA archive instead of rebuilding LLVM and the SILVIA passes from source.
From the root of this repository, extract the archive into the expected llvm-project/install layout:
mkdir -p llvm-project
tar -xzf silvia-llvm31-x86_64-vitis2024.2.tar.gz -C llvm-projectAfter extraction, the expected toolchain path is:
${SILVIA_ROOT}/llvm-project/installVerify the bundled tools and SILVIA passes are available:
./llvm-project/install/bin/opt --version
./llvm-project/install/bin/llvm-link --version
test -f ./llvm-project/install/lib/LLVMSILVIAAdd.so
test -f ./llvm-project/install/lib/LLVMSILVIAMuladd.soOnly use this path if the precompiled tarball is unavailable or incompatible with your system.
Build and install LLVM 3.1:
source install_llvm.shBuild and install the SILVIA LLVM passes:
source build_pass.shUpdate the Vitis HLS TCL synthesis script by:
- Importing the SILVIA APIs with:
source ${SILVIA_ROOT}/scripts/SILVIA.tcl, where${SILVIA_ROOT}points to the root of the SILVIA repository (e.g.,/home/user/SILVIA). - Setting
SILVIA::ROOTto${SILVIA_ROOT}andSILVIA::LLVM_ROOTto the precompiled toolchain path, normally${SILVIA_ROOT}/llvm-project/install. - Populating
SILVIA::PASSESwith the list of passes to run. Each pass is specified as adictwith a mandatoryOPkey, which selects the pass ("add"or"muladd"). Optional keys include:OP_SIZE, which defines the maximum size of the operands to pack (12or24for"add",4or8for"muladd").INST, which defines the instruction to pack ("add"or"sub"only whenOPis"add").MAX_CHAIN_LEN, which defines an upper limit to the number of cascaded DSPs (only whenOPis"muladd").
- Replacing the command
csynth_designwith the customSILVIA::csynth_design.
The following snippet shows the changes to a synthesis script to run the "muladd" pass and the "add" pass with operands of up to 12 bits:
- csynth_design
+ set SILVIA_ROOT "/path/to/SILVIA"
+ source ${SILVIA_ROOT}/scripts/SILVIA.tcl
+ set SILVIA::ROOT ${SILVIA_ROOT}
+ set SILVIA::LLVM_ROOT ${SILVIA_ROOT}/llvm-project/install
+ set SILVIA::PASSES \
+ [list [dict create OP "muladd"] \
+ [dict create OP "add" OP_SIZE 12]]
+ SILVIA::csynth_design