Skip to content

About

A base Clava project with some examples of how it can be used for HLS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

clava-hls-examples

This repo serves both as an all-batteries-included starting point for a new project, and as a series of examples of how to use Clava's HLS package.

Requirements

  • Node.js 22 or newer
  • Java 21 or newer
  • AMD Vitis installed, with v++ on your PATH

Setup

npm install
npm run build

While developing, you can have npm run build:watch running on a terminal to automatically build the application.

Examples

Both examples use CxxSources/dotprod.c, a dot product of two 1024-element arrays.

1. Synthesizing a function: src/SingleFunctionSynthesis.ts

npm run example:synthesis

Finds dotprod, configures Vitis (clock, board, output format), runs synthesis, and prints the parsed report (latency, resource usage, estimated clock).

2. Design space exploration (ad-hoc): src/DesignSpaceExplorationCustom.ts

npm run example:dse-custom

Tries to find the best factor for loop unrolling the dot product loop by building directives with different values and synthesizing each version.

3. Design space exploration (using the built-in API): src/DesignSpaceExplorationAPI.ts

npm run example:dse-api

Describes a search space with our built-in fluent API:

new DseEngine(fun)
    .on(loop)
        .alias("L1")
        .pipeline().withInitiationIntervals([1, 2, 3])
        .unroll().withFactors([2, 4, 8])
    .on(inputA)
        .partitionArray().withCyclicPartitioning([2, 4]).acrossDimensions([1])
    .synthesizeAll()
    .sortBy("latency")
    .printResults();
  • on(target) picks what to annotate, and the verbs you can use depend on the target: pipeline/unroll on loops, partitionArray on function parameters, inline on functions. Misuse is rejected with an error.
  • Every combination of the values you list is one design, each with a readable id such as L1.pipe-ii2-rw0-stp+L1.unr-f4-sk1+a.part-cyc-f2-d1.
  • synthesizeAll() inserts each design's pragmas, runs Vitis, removes the pragmas again and deletes the temporary Vitis project.
  • sortBy and printResults rank and show the collected reports.

Be aware that each design is a full Vitis run, so large search spaces take a long time.

About

A base Clava project with some examples of how it can be used for HLS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages