This repository includes the code for SQL2FPGA. SQL2FPGA is a hardware-aware SQL query compilation framwork for translating and efficiently mapping SQL queries on the modern heterogeneous CPU-FPGA platforms. SQL2FPGA takes the optimized query execution plans of SQL queries from big data query processing engines (Spark SQL for now); performs hardware-aware optimizations to map query operations to FPGA accelerators (AMD/Xilinx Vitis database overlays for now); and lastly generates the deployable CPU host code and the associated FPGA accelerator configuration code.
If you find this project useful in your research, please consider citing:
@inproceedings{lu2023sql2fpga,
title={SQL2FPGA: Automatic Acceleration of SQL Query Processing on Modern CPU-FPGA Platforms},
author={Lu, Alec and Fang, Zhenman},
booktitle={Proceedings of the 31st IEEE International Symposium On Field-Programmable Custom Computing Machines},
year={2023}
}
git clone https://github.com/SFU-HiAccel/SQL2FPGA.git
Hardware platforms (evaluated):
Software tools (evaluated):
Import SQL2FPGA Project using IntelliJ
Scala
pluginpom.xml
project fileSQL2FPGA_Top
Run SQL2FPGA Project on TPC-H Dataset
git clone https://github.com/electrum/tpch-dbgen.git
cd tpch-dbgen/
make
./dbgen -s <#>
SQL2FPGA_Top.scala
)
INPUT_DIR_TPCH
and OUTPUT_DIR_TPCH
with the generated TPC-H datasetqConfig.tpch_queryNum_start
and qConfig.tpch_queryNum_end
to specifiy the range of queries to generate codeqConfig.pure_sw_mode = 1
indicates all operators are executed on CPU and qConfig.pure_sw_mode = 0
indicates a hybrid execution mode where both CPU and FPGA accelerators are used for execution qConfig.scale_factor = 1
specifies the scale factor (SF)SQL2FPGA_Top
test_q#.cpp
cfgFunc_q#.hpp
q#.hpp
Build AMD-Xilinx's Database Accelerator Overlay Designs
git clone https://github.com/Xilinx/Vitis_Libraries.git
2020.1
branch
cd Vitis_Libraries
git checkout 2020.1
cd database/L2/demos
make -C build_join_partition/ TARGET=hw xclbin DEVICE=xilinx_u280_xdma_201920_3
make -C build_aggr_partition/ TARGET=hw xclbin DEVICE=xilinx_u280_xdma_201920_3
Run SQL2FPGA-generated Designs on Device
makefile
at /Vitis_Libraries/database/L2/demos
with the <$SQL2FPGA_HOME>/makefile
/Vitis_Libraries/database/L2/demos/host/q#/sfsql2fpga_fpga
/Vitis_Libraries/database/L2/demos
make clean
make run TARGET=hw MODE=FPGA TB=Q# DEVICE=xilinx_u280_xdma_201920_3 TEST=SQL2FPGA
Now you have compeletd the entire tool flow of SQL2FPGA. Hack the code and have fun!
SQL2FPGA is currently maintained by Alec Lu.
Besides, we thank AMD-Xilinx Vitis DB team, Prof. Jiannan Wang and Dr. Jinglin Peng from Simon Fraser University, for their insightful discussion and technical support.
More implementation details of SQL2FPGA are covered in our paper.