High-Level Synthesis (HLS)

Overview

HLS is originally from High-Level Synthesis Performance Prediction using GNNs: Benchmarking, Modeling, and Advancing.

After HLS front-end compilation, six node features are extracted, as summarized in the table below:

Feature

Description

Values

Node type

Bitwidth

Opcode type

Opcode

Is start of path

Cluster group

General node type

Bitwidth of the node

Opcode categories based on LLVM

Opcode of the node

Whether the node is the starting node of a path

Cluster number of the node

operation nodes, blocks, ports, misc

0-256, misc

binary_unary, bitwise, memory, etc.

load, add, xor, icmp, etc.

0, 1, misc

-1 - 256, misc

Each edge has two features, the edge type represented in integers, and a binary value indicating whether this edge is a back edge. Each graph is labeled based on its post-implementation performance metrics, which are synthesized by Vitis HLS and implemented by Vivado. Three metrics are used for regression: DSP, LUT, and CP. The first two are integer numbers indicating the number of resources used in the final implementation; the last one is CP timing in fractional number, determining the maximum working frequency of FPGA. The DFG and CDFG datasets consists of 19,120 and 18,570 C programs, respectively. The figure below shows an example C program from the CDFG dataset, with the corresponding control dataflow graph shown in the right. More information can be found in the original paper.

../_images/HLS_cdfg.png ../_images/hls_example_program.png

Interface

Runner

class HLSRunner():
    def __init__(self, config):
      # init takes a config
    def train_ray(self, tune_parameter_config):
      # function to implement training when tuning with ray
    def train(self):
      # function to implement training when evaluation
    def train_one_epoch(self, data_loader, mode, epoch_idx):
      # function that do back propogation for one epoch
    def test(self, load_statedict = True, test_num_idx = 0):
      # function for testing
    def raytune(self, tune_config, num_samples, num_cpu, num_gpu_per_trial):
      # main function to take the hyper-parameter search space in RAY

Details are in ./runner/HLS_runner.py.

DataProcessor

class HLSDataProcessor(InMemoryDataset):
    def __init__(self, config, mode):
      # init takes a config, mode takes from `tune' for tuning, `get_result' for evaluation
    def process(self):
      # key functions to implement HLS data processing
    def read_csv_graph_raw(self, raw_dir, check_repeat_edge):
      # key function to process raw data into PyG data

Details are in ./data_processor/HLS_data_processor.py.