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

Support hcl.assert_ in SHLS backend #458

Closed zzzDavid closed 2 years ago

zzzDavid commented 2 years ago

Description

hcl.assert_ raises an exception for the StratusHLS backend:

heterocl.tvm._ffi.base.TVMError: [15:49:14] include/tvm/ir_functor_ext.h:262: Do not have a default for Assert

Example

def test1():
    # generates: assert ((uint32)0 < uint32(A[0]));
    # the second uint32 is oddly specified ...
    def func(A):
        hcl.assert_(A[0] > 0, "")

    A = hcl.placeholder((2,), "A", dtype=hcl.UInt(16))
    s = hcl.create_schedule([A], func)

    m = hcl.build(s, "shls")