cornell-zhang/heterocl

Add burst mode for host-to-device data copy

Closed this issue · 0 comments

Burst read and write enables multiple items to be read from global memory to the kernel’s local memory. This is done to achieve low memory access latency and also for efficient use of bandwidth provided by the m_axi interface. Similarly, computation results are stored in a buffer and are written to global memory in a burst.

When moving data from the host to the device or the opposite, we should allow users to create a burst buffer inside the kernel, and copy the data from global memory to the kernel's local memory in bursts.

s.to(A, target.xcel, burst=True, max_burst_len=256)

The expected code generated should have the following interface:

extern "C" {
void vadd(int *A, int size, int inc_value) {
#pragma HLS INTERFACE m_axi port = A offset = slave bundle = gmem max_read_burst_length = 256 max_write_burst_length = 256

#pragma HLS INTERFACE s_axilite port = a
#pragma HLS INTERFACE s_axilite port = size
#pragma HLS INTERFACE s_axilite port = inc_value
#pragma HLS INTERFACE s_axilite port = return

  int A.burstbuffer[SIZE];
    // Auto-pipeline is going to apply pipeline to these loops
    for (int j = 0; j < chunk_size; j++) {
      A.burstbuffer[j] = A[j];
    }