Skip to content

specs-feup/clava-scalehls-integration

Repository files navigation

clava-scalehls-integration

An extension of the Clava C/C++ source-to-source compiler to programatically compile functions in the AST with ScaleHLS, a state-of-the-art MLIR-based C/C++ optimizer for HLS.

How to install

This package is available on NPM. Assuming you already have a Clava-based NPM project setup, you can install the latest stable release with:

npm install @specs-feup/clava-scalehls-integration@latest

If you want to use unstable and experimental features, use the staging or nightly tags instead, as they are both built using the most recent commit in the repository. Nightly builds are built automatically every day, while staging builds are built on-demand:

npm install @specs-feup/clava-scalehls-integration@nightly

Basic usage

To compile a function and obtain the optimized C/C++ code, you can do something like:

import { FileJp } from "@specs-feup/clava/api/Joinpoints.js";
import Query from "@specs-feup/lara/api/weaver/Query.js";
import { ScaleHlsConfig } from "@specs-feup/clava-scalehls-integration/ScaleHlsConfig";
import { ScaleHls } from "@specs-feup/clava-scalehls-integration/ScaleHls";

const file = Query.search(FileJp).first()!;
const scaleHlsConfig = new ScaleHlsConfig("rgbToGrayscale");

const scaleHls = new ScaleHls(scaleHlsConfig, file).setOutputDir(`output_scalehls`);
scaleHls.compile();

// Work-in-progress: parse the optimized code back into Clava
// TBD

Also see:

  • clava-vitis-integration, a similar NPM package to synthesize C/C++ code using Vitis, and programatically explore the design space
  • hoopa, a collection of CPU-FPGA partitioning algorithms that rely on both Vitis and ScaleHLS

About

A Clava extension to interact with ScaleHLS

Resources

Stars

0 stars

Watchers

4 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors