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.
- Node.js 22 or newer
- Java 21 or newer
- AMD Vitis installed, with
v++on yourPATH
npm install
npm run buildWhile developing, you can have npm run build:watch running on a terminal to automatically build the application.
Both examples use CxxSources/dotprod.c, a dot product of two 1024-element arrays.
1. Synthesizing a function: src/SingleFunctionSynthesis.ts
npm run example:synthesisFinds 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-customTries 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-apiDescribes 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/unrollon loops,partitionArrayon function parameters,inlineon 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.sortByandprintResultsrank and show the collected reports.
Be aware that each design is a full Vitis run, so large search spaces take a long time.