You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def test_if_LogicalOr():
hcl.init()
def kernel():
a = hcl.scalar(0, "a", dtype=hcl.UInt(8))
b = hcl.scalar(0, "a", dtype=hcl.UInt(8))
# this generates the following error:
# File "hcl-dialect-prototype/build/tools/hcl/python_packages/hcl_core/hcl_mlir/build_ir.py", line 2630, in make_if
# raise HCLValueError("`if` operation condition should be CmpOp")
# hcl_mlir.exceptions.HCLValueError: [Value Error] `if` operation condition should be CmpOp
with hcl.if_(hcl.or_(a.v == 0, b.v == 0)):
pass
# this generates the following error:
# File "hcl-dialect-prototype/build/tools/hcl/python_packages/hcl_core/hcl_mlir/build_ir.py", line 1726, in build
# raise APIError("Do not build logical_or op")
# hcl_mlir.exceptions.APIError: [API] Do not build logical_or op
with hcl.if_(hcl.or_(a.v == 0, b.v == 0) != 0):
pass
s = hcl.create_schedule([], kernel)
Very similar to #135 (which is about hcl.while_ and hcl.and_)
The text was updated successfully, but these errors were encountered:
My plan is to first add hcl.and and hcl.or representing logical operations with short-circuit evaluation, and then use nested scf.if to implement them in LLVM backend. We will decouple condition evaluation and if/while operations, see details at #65.
The new frontend build SCF operations for and/or, so there is no problem with affine_set not being able to support or anymore, and the above test case works.
We have not yet added logic operation that supports short-circuit evaluation yet.
Test case added by cornell-zhang/heterocl@9f7212f
Closing this thread because the issue has been resolved. Short-circuit logic op will be discussed in thread #65
Very similar to #135 (which is about hcl.while_ and hcl.and_)
The text was updated successfully, but these errors were encountered: