Go to file
Hanchen Ye f9bf38240e [ArrayPartition] impl of this pass; note that due to the insufficient AffineExpr simplification mechanism in MLIR, this pass can't handle too complicated cases 2020-12-07 23:24:15 -06:00
config [BenchmarkGen] update cnn-config.ini comments 2020-12-01 23:45:56 -06:00
include [ArrayPartition] impl of this pass; note that due to the insufficient AffineExpr simplification mechanism in MLIR, this pass can't handle too complicated cases 2020-12-07 23:24:15 -06:00
lib [ArrayPartition] impl of this pass; note that due to the insufficient AffineExpr simplification mechanism in MLIR, this pass can't handle too complicated cases 2020-12-07 23:24:15 -06:00
samples [Samples] fix bugs in ablation study script 2020-12-07 13:06:43 -06:00
test [ArrayPartition] impl of this pass; note that due to the insufficient AffineExpr simplification mechanism in MLIR, this pass can't handle too complicated cases 2020-12-07 23:24:15 -06:00
tools [Conversion] update all conversion passes definition to TableGen 2020-12-04 18:34:24 -06:00
.clang-format mechanical rename hlsld to scalehls; update file structure 2020-09-06 18:05:16 -05:00
.gitignore [Samples] add ablation test script; update Readme; bug fix in InsertPipelinePragma 2020-12-06 23:48:20 -06:00
CMakeLists.txt change lit report style 2020-09-14 19:56:06 -05:00
README.md [Readme] update ablation study part 2020-12-07 00:12:27 -06:00

README.md

ScaleHLS Project (scalehls)

This project aims to create a framework that ultimately converts an algorithm written in a high level language into an efficient hardware implementation. With multiple levels of intermediate representations (IRs), MLIR appears to be the ideal tool for exploring ways to optimize the eventual design at various levels of abstraction (e.g. various levels of parallelism). Our framework will be based on MLIR, it will incorporate a backend for high level synthesis (HLS) C/C++ code. However, the key contribution will be our parametrization and optimization of a tremendously large design space.

Quick Start

1. Install LLVM and MLIR

IMPORTANT This step assumes that you have cloned LLVM from (https://github.com/circt/llvm) to $LLVM_DIR. To build LLVM and MLIR, run

$ mkdir $LLVM_DIR/build
$ cd $LLVM_DIR/build
$ cmake -G Ninja ../llvm \
    -DLLVM_ENABLE_PROJECTS="mlir" \
    -DLLVM_TARGETS_TO_BUILD="X86;RISCV" \
    -DLLVM_ENABLE_ASSERTIONS=ON \
    -DCMAKE_BUILD_TYPE=DEBUG
$ ninja
$ ninja check-mlir

2. Install ScaleHLS

This step assumes this repository is cloned to $SCALEHLS_DIR. To build and launch the tests, run

$ mkdir $SCALEHLS_DIR/build
$ cd $SCALEHLS_DIR/build
$ cmake -G Ninja .. \
    -DMLIR_DIR=$LLVM_DIR/build/lib/cmake/mlir \
    -DLLVM_DIR=$LLVM_DIR/build/lib/cmake/llvm \
    -DLLVM_ENABLE_ASSERTIONS=ON \
    -DCMAKE_BUILD_TYPE=DEBUG
$ ninja check-scalehls

3. Try ScaleHLS

After the installation and test successfully completed, you should be able to play with

$ export PATH=$SCALEHLS_DIR/build/bin:$PATH
$ cd $SCALEHLS_DIR
$
$ benchmark-gen -type "cnn" -config "$SCALEHLS_DIR/config/cnn-config.ini" -number 1
$ scalehls-opt -hlskernel-to-affine test/Conversion/HLSKernelToAffine/test_*.mlir
$
$ scalehls-opt -convert-to-hlscpp test/Conversion/ConvertToHLSCpp/test_*.mlir
$ scalehls-opt -convert-to-hlscpp test/EmitHLSCpp/test_*.mlir | scalehls-translate -emit-hlscpp
$
$ scalehls-opt -qor-estimation test/Analysis/QoREstimation/test_for.mlir

4. Ablation study

If Vivado HLS (2019.1 tested) is installed on your machine, running the following script will report the HLS results for some benchmarks (around 2 hours on AMD Ryzen7 3800X for all 16 tests).

For the ablation_test_run.sh script, -n determines the number of tests to be processed, the maximum supported value of which is 16; -c determines whether to run Vivado HLS C synthesis; -r determines whether to run report generation. The generated C++ source code will be written to sample/cpp_src; the Vivado HLS project will be established in sample/hls_proj; the generated report will be written to sample/test_results.

$ cd $SCALEHLS_DIR/sample
$ ./ablation_test_run.sh -n 16 -c true -r true

References

  1. MLIR documents
  2. mlir-npcomp github
  3. onnx-mlir github
  4. circt github
  5. comba github
  6. dahlia github