Schedule creation error with hcl.if_ and struct field access in the condition
Closed this issue · 3 comments
jcasas00 commented
def test_if_struct_access():
hcl.init()
def kernel():
tag = hcl.scalar(0, "tag", dtype='uint32')
stype = hcl.Struct({"x": hcl.UInt(8), "y": hcl.UInt(8)})
xy = hcl.scalar(0x1234, "xy", dtype=stype).v
with hcl.if_(xy.x==1): # use of struct field access causes a scheduler error
tag.v = 1
r = hcl.compute((2,), lambda i: tag.v, dtype=hcl.UInt(32))
return r
s = hcl.create_schedule([], kernel)
The above code generates the following runtime error:
error: 'affine.load' op operation destroyed but still has uses
LLVM ERROR: operation destroyed but still has uses
zzzDavid commented
Test case added here: https://github.com/cornell-zhang/heterocl/blob/9f7212f02dcf49e72fe6a980ace86e9f8b591f4d/tests/test_scalar.py#L87-L125
Closing the thread as the issue has been fixed