3bea951beb | ||
---|---|---|
include | ||
lib | ||
polygeist@3a1b4e2377 | ||
samples | ||
test | ||
tools | ||
.clang-format | ||
.gitignore | ||
.gitmodules | ||
CMakeLists.txt | ||
LICENSE | ||
README.md | ||
build-scalehls.sh |
README.md
ScaleHLS Project
ScaleHLS is a High-level Synthesis (HLS) framework on MLIR. ScaleHLS can compile HLS C/C++ or PyTorch model to optimized HLS C/C++ in order to generate high-efficiency RTL design using downstream tools, such as Vivado HLS.
By using the MLIR framework that can be better tuned to particular algorithms at different representation levels, ScaleHLS is more scalable and customizable towards various applications coming with intrinsic structural or functional hierarchies. ScaleHLS represents HLS designs at multiple levels of abstraction and provides an HLS-dedicated analysis and transform library (in both C++ and Python) to solve the optimization problems at the suitable representation levels. Using this library, we've developed a design space exploration engine to generate optimized HLS designs automatically.
For more details, please see our HPCA'22 paper:
@article{ye2021scalehls,
title={ScaleHLS: A New Scalable High-Level Synthesis Framework on Multi-Level Intermediate Representation},
author={Ye, Hanchen and Hao, Cong and Cheng, Jianyi and Jeong, Hyunmin and Huang, Jack and Neuendorffer, Stephen and Chen, Deming},
journal={arXiv preprint arXiv:2107.11673},
year={2021}
}
Setting this up
Prerequisites
- cmake
- ninja
- clang and lld (recommended)
- pybind11
- python3 with numpy
Clone ScaleHLS
$ git clone --recursive git@github.com:hanchenye/scalehls.git
$ cd scalehls
Build ScaleHLS
Run the following script to build ScaleHLS. Note that you can use -j xx
to specify the number of parallel linking jobs.
$ ./build-scalehls.sh
After the build, we suggest to export the following paths.
$ export PATH=$PATH:$PWD/build/bin:$PWD/polygeist/build/bin
$ export PYTHONPATH=$PYTHONPATH:$PWD/build/tools/scalehls/python_packages/scalehls_core
Compiling HLS C/C++
To launch the automatic kernel-level design space exploration, run:
$ mlir-clang samples/polybench/gemm/test_gemm.c -function=test_gemm -memref-fullrank -raise-scf-to-affine -S \
| scalehls-opt -dse="top-func=test_gemm target-spec=samples/polybench/config.json" -debug-only=scalehls \
| scalehls-translate -emit-hlscpp > test_gemm_dse.cpp
$ mlir-clang samples/rosetta/spam-filter/sgd_sw.c -function=SgdLR_sw -memref-fullrank -raise-scf-to-affine -S \
| scalehls-opt -materialize-reduction -dse="top-func=SgdLR_sw target-spec=samples/rosetta/config.json" -debug-only=scalehls \
| scalehls-translate -emit-hlscpp > sgd_sw_dse.cpp
Meanwhile, we provide a pyscalehls
tool to showcase the scalehls
Python library:
$ pyscalehls.py samples/polybench/syrk/test_syrk.c -f test_syrk
Compiling PyTorch model
Repository Layout
The project follows the conventions of typical MLIR-based projects:
include/scalehls
andlib
for C++ MLIR compiler dialects/passes.polygeist
for the HLS C/C++ front-end.samples
for example test cases.test
for holding regression tests.tools
for command line tools, such asscalehls-opt
andpyscalehls
.