All Projects → hanchenye → scalehls

hanchenye / scalehls

Licence: other
A scalable High-Level Synthesis framework on MLIR

Programming Languages

C++
36643 projects - #6 most used programming language
MLIR
15 projects
CMake
9771 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to scalehls

Pp4fpgas Cn
中文版 Parallel Programming for FPGAs
Stars: ✭ 339 (+446.77%)
Mutual labels:  fpga, hls
Pp4fpgas Cn Hls
HLS Project of pp4fpgas - https://github.com/xupsh/pp4fpgas-cn
Stars: ✭ 97 (+56.45%)
Mutual labels:  fpga, hls
Hls4ml
Machine learning in FPGAs using HLS
Stars: ✭ 467 (+653.23%)
Mutual labels:  fpga, hls
hwt
VHDL/Verilog/SystemC code generator, simulator API written in python/c++
Stars: ✭ 145 (+133.87%)
Mutual labels:  fpga, hls
Openwifi Hw
FPGA/hardware design of openwifi
Stars: ✭ 181 (+191.94%)
Mutual labels:  fpga, hls
Pipecnn
An OpenCL-based FPGA Accelerator for Convolutional Neural Networks
Stars: ✭ 775 (+1150%)
Mutual labels:  fpga, hls
Halide Hls
HLS branch of Halide
Stars: ✭ 59 (-4.84%)
Mutual labels:  fpga, hls
Gemm hls
Scalable systolic array-based matrix-matrix multiplication implemented in Vivado HLS for Xilinx FPGAs.
Stars: ✭ 134 (+116.13%)
Mutual labels:  fpga, hls
Fpga readings
Recipe for FPGA cooking
Stars: ✭ 164 (+164.52%)
Mutual labels:  fpga, hls
Openwifi
open-source IEEE 802.11 WiFi baseband FPGA (chip) design
Stars: ✭ 2,257 (+3540.32%)
Mutual labels:  fpga, hls
systemc-compiler
This tool translates synthesizable SystemC code to synthesizable SystemVerilog.
Stars: ✭ 128 (+106.45%)
Mutual labels:  hls, llvm
Limago
Limago: an FPGA-based Open-source 100 GbE TCP/IP Stack
Stars: ✭ 95 (+53.23%)
Mutual labels:  fpga, hls
PandA-bambu
PandA-bambu public repository
Stars: ✭ 129 (+108.06%)
Mutual labels:  fpga, hls
prjxray-db
Project X-Ray Database: XC7 Series
Stars: ✭ 52 (-16.13%)
Mutual labels:  fpga
HPS2FPGAmapping
SoCFPGA: Mapping HPS Peripherals, like I²C or CAN, over the FPGA fabric to FPGA I/O and using embedded Linux to control them (Intel Cyclone V)
Stars: ✭ 27 (-56.45%)
Mutual labels:  fpga
UA3REO-DDC-Transceiver
DDC/DUC SDR Tranceiver project
Stars: ✭ 93 (+50%)
Mutual labels:  fpga
zed face
zedboard上基于FPGA+ARM的人脸识别智能监控系统。关键词:linux,zedboard,arm,fpga,人脸检测,人脸识别。
Stars: ✭ 38 (-38.71%)
Mutual labels:  fpga
vidi
<video> playback simplified
Stars: ✭ 31 (-50%)
Mutual labels:  hls
Clio
Clio, ASPLOS'22.
Stars: ✭ 37 (-40.32%)
Mutual labels:  fpga
shapool-core
FPGA core for SHA256d mining targeting Lattice iCE40 devices.
Stars: ✭ 19 (-69.35%)
Mutual labels:  fpga

ScaleHLS Project

Build and Test

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 Xilinx 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}
}

Framework Architecture

Setting this up

Prerequisites

  • python3
  • cmake
  • ninja
  • clang and lld

Optionally, the following packages are required for the Python binding.

  • pybind11
  • numpy

Clone ScaleHLS

$ git clone --recursive [email protected]:hanchenye/scalehls.git
$ cd scalehls

Build ScaleHLS

Run the following script to build ScaleHLS. Optionally, add -p ON to enable the Python binding and -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 optimize C/C++ kernels with the design space exploration (DSE) engine, run:

$ cd samples/polybench/gemm

$ # Parse C/C++ kernel into MLIR.
$ mlir-clang test_gemm.c -function=test_gemm -S \
    -memref-fullrank -raise-scf-to-affine > test_gemm.mlir

$ # Launch the DSE and emit the optimized design as C++ code.
$ scalehls-opt test_gemm.mlir -debug-only=scalehls \
    -scalehls-dse-pipeline="top-func=test_gemm target-spec=../config.json" \
    | scalehls-translate -emit-hlscpp > test_gemm_dse.cpp

If Python binding is enabled, we provide a pyscalehls tool to showcase the scalehls Python library:

$ pyscalehls.py test_gemm.c -f test_gemm > test_gemm_pyscalehls.cpp

Compiling PyTorch Model

If you have installed Torch-MLIR with SHA ea371a9, you should be able to run the following test:

$ cd samples/pytorch/resnet18

$ # Parse PyTorch model to TOSA dialect (with Torch-MLIR mlir_venv activated).
$ # This may take several minutes to compile due to the large amount of weights.
$ python3 export_resnet18_mlir.py | torch-mlir-opt \
    -torchscript-module-to-torch-backend-pipeline="optimize=true" \
    -torch-backend-to-tosa-backend-pipeline="optimize=true" > resnet18.mlir

$ # Optimize the model and emit C++ code.
$ scalehls-opt resnet18.mlir \
    -scalehls-pytorch-pipeline-v2="top-func=forward loop-tile-size=4 loop-unroll-factor=2" \
    | scalehls-translate -emit-hlscpp > resnet18.cpp

Repository Layout

The project follows the conventions of typical MLIR-based projects:

  • include/scalehls and lib for C++ MLIR dialects/passes.
  • polygeist for the C/C++ front-end.
  • samples for C/C++ and PyTorch examples.
  • test for holding regression tests.
  • tools for command line tools.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].