cornell-zhang/heterocl

Support static variables inside HCL module

Opened this issue · 0 comments

Now we have support for chained .to() and explicit unrolling with PR #256. To realize a weight stationary systolic array in HLS, we should also consider supporting static variable inside a HCL module (i.e. for initializing the updating the weight).

This should not be hard to support technically -- we can add a new attribute to the Allocate IR, and print the static keyword when the attribute is present. But I am still thinking about how we should expose this feature to users. This is one possible interface.

# declare the tensor A to be static 
A = hcl.compute((size, ), lambda, static=True)

# update the static variable in initialization
with hcl.if_():
    hcl.update(A, lambda)

Or should we design the interface in a decoupled way?