cornell-zhang / heterocl

HeteroCL: A Multi-Paradigm Programming Infrastructure for Software-Defined Heterogeneous Computing
https://cornell-zhang.github.io/heterocl/
Apache License 2.0
322 stars 92 forks source link

[Backend] Automatic loop labeling #259

Closed chhzh123 closed 3 years ago

chhzh123 commented 4 years ago

This PR enables automatic loop labeling for VHLS code, which would be useful for further analysis of the HLS report. The label is defined as <stage_name>_<variable_name>.

As an example, the generated code for GEMM is shown below.

    C_x: for (bit32 x = 0; x < 64; ++x) {
      C_y: for (bit32 y = 0; y < 64; ++y) {
        float sum;
        sum_x1: for (bit32 x1 = 0; x1 < 1; ++x1) {
          sum = 0.000000e+00f;
        }
        C_ra0: for (bit32 ra0 = 0; ra0 < 64; ++ra0) {
          sum = ((A[x][ra0] * B[ra0][y]) + sum);
        }
        C[x][y] = sum;
      }
    }
chhzh123 commented 4 years ago

The CI test of test_keras.py failed again. I got an error "Fatal Python error: Aborted". Could you help have a check? @Hecmay

seanlatias commented 4 years ago

Maybe the changes in file hlib/python/hlib/op/extern.py cause this? @Hecmay

hecmay commented 4 years ago

Maybe the changes in file hlib/python/hlib/op/extern.py cause this? @Hecmay

Maybe. I can remove it and see what would happen.