Extending High-Level Synthesis for Task-Parallel Programs

Yuze Chi, Licheng Guo, Jason Lau, Young-kyu Choi, Jie Wang, Jason Cong

TL;DR

TAPA is a new C++ framework that significantly boosts productivity for designing task-parallel FPGA accelerators. By introducing a hierarchical programming model, a high-performance coroutine-based simulator, and a "compile-once, instantiate-many" RTL generation strategy, TAPA reduces code complexity and speeds up the development cycle by up to 6.8× compared to standard High-Level Synthesis (HLS) tools.

What Problem Does This Paper Address?

High-Level Synthesis (HLS) has revolutionized FPGA design by allowing developers to write C/C++ instead of low-level hardware description languages. However, HLS tools were primarily built for data-parallel programs (like simple loops). When it comes to task-parallel programs—where multiple independent modules (tasks) run concurrently and communicate via fine-grained channels—current tools fall short in three major ways:

  1. Poor Programmability: Developers often have to write "boilerplate" code to manage communication buffers or handle complex host-to-kernel interfaces. Simple operations like "peeking" at a data packet without consuming it require manual state machines.
  2. Restricted Simulation: Standard HLS software simulators often execute tasks sequentially. This can cause "false deadlocks" in programs with feedback loops (like Cannon’s matrix multiplication) that would actually work fine on real hardware.
  3. Slow Code Generation: Current compilers treat the entire design as a single monolithic block. If your design has 100 identical processing elements (PEs), the compiler synthesizes each one individually, leading to massive, redundant wait times.

Methods

The authors introduce TAPA, a framework that extends HLS C++ to better support task-parallelism through several novel features:

  • Hierarchical Programming Model: TAPA uses a parent-child task structure. A parent task defines the communication channels (FIFOs) and "invokes" child tasks. This allows the compiler to understand the system's topology clearly.
  • Enhanced APIs: TAPA provides built-in support for peek() (non-destructive reads) and eot (end-of-transaction) bits. This eliminates the need for manual buffer management.
  • Coroutine-Based Simulation: Instead of using heavy operating system threads (which take microseconds to switch), TAPA uses collaborative coroutines. These are lightweight (switching in nanoseconds) and allow the simulator to pause a task when a channel is empty/full and resume another, accurately simulating concurrent hardware behavior without the overhead of standard multi-threading.
  • Hierarchical RTL Generation: As shown in Figure 2, TAPA extracts metadata and runs the HLS compiler on each unique task only once. It then automatically generates the "glue logic" (state machines and controllers) to connect these modules into a complete kernel.
TAPA's automated code generation flow

Datasets

The researchers evaluated TAPA using a suite of seven real-world task-parallel benchmarks:

  • cannon: Cannon’s matrix multiplication algorithm (notable for its feedback loops).
  • cnn: A VGG convolutional neural network.
  • gaussian: A Gaussian stencil filter.
  • gcn: Graph convolutional network.
  • gemm: General matrix multiplication.
  • network: A bucket sort implementation using an Omega network.
  • page_rank: The PageRank citation ranking algorithm.

These benchmarks were compared against implementations in standard Xilinx Vivado HLS and Intel OpenCL.

Key Insights and Ideas

  • The "Peek" Advantage: In many network-on-chip designs, a node needs to see a packet header before deciding where to route it. Standard HLS forces you to "read" (and thus remove) the packet, then store it in a local buffer if you can't send it yet. TAPA’s peek() API handles this automatically, reducing code length and even improving hardware latency by removing unnecessary buffer stages.
  • Scaling Simulation: OS-level multi-threading doesn't scale well when you have hundreds of tasks (like in a large systolic array). By using coroutines and a thread pool bound to CPU cores, TAPA avoids the "preemption" overhead that slows down traditional simulators.
  • Modular Synthesis: By recognizing that many tasks are identical instances of the same function, TAPA avoids the "monolithic" compilation trap. This is the primary driver behind its massive speedup in RTL generation.

Key Results

TAPA demonstrated significant improvements across the board:

  • Code Reduction: On average, TAPA reduced kernel lines of code (LoC) by 22% and host-side code by 51% (see Figure 3 and 4).
  • Faster Verification: The coroutine-based simulator was 3.2× faster than existing multi-threaded simulators and successfully simulated designs that sequential simulators could not handle.
  • Rapid Compilation: RTL code generation was accelerated by 6.8× on average (see Figure 6). For large designs like the cnn benchmark, TAPA finished in minutes while other tools took hours.
  • Hardware Quality: TAPA achieved these productivity gains without sacrificing performance. In the network benchmark, TAPA actually used 40% fewer logic resources because its efficient APIs removed the need for manual, high-latency buffering.
Comparison of RTL code generation time

Limitations and Future Work

While TAPA currently targets Xilinx FPGAs (using Vivado HLS as a backend), the authors note that support for Intel devices is a planned future addition. Additionally, like most HLS tools, TAPA cannot strictly guarantee that a software description will produce deterministic output if non-blocking reads are used (as the arrival order of tokens can vary).

Looking ahead, the team plans to extend TAPA to support dynamic task scheduling, allowing FPGAs to handle even more complex, unpredictable workloads.

Summary updated

BibTeX
@inproceedings{chi2021extending,
  author = {Yuze Chi and Licheng Guo and Jason Lau and Young-kyu Choi and Jie Wang and Jason Cong},
  title = {{Extending High-Level Synthesis for Task-Parallel Programs}},
  booktitle = {FCCM},
  year = {2021},
  url = {https://openreview.net/forum?id=CYCoqZJeK_},
}
Figure