cornell-zhang/heterocl

hcl-mlir llvm backend: `hcl_dtype_to_mlir` returns a mismatching data type

hecmay opened this issue · 1 comments

this error can be reproduced by running this test case: https://github.com/cornell-zhang/heterocl/blob/hcl-mlir/tests/mlir/hcl-mlir/test_stages.py#L125

Here is the complete error

Traceback (most recent call last):
  File "test_stages.py", line 191, in <module>
    test_outline_cpu()
  File "test_stages.py", line 144, in test_outline_cpu
    mod.modules[0](hcl_A, hcl_B, hcl_C)
  File "/heterocl/python/heterocl/module.py", line 51, in __call__
    argv[i].dtype, signless=True), "Input types: {} {}".format(memref_type.element_type, hcl_dtype_to_mlir(argv[i].dtype, signless=True))
AssertionError: Input types: i32 i32

I printed out these two types:

memref_type.element_type: <class 'hcl_mlir._mlir_libs._mlir.ir.Type'>
hcl_dtype_to_mlir(argv[i].dtype, signless=True)): <class 'hcl_mlir._mlir_libs._mlir.ir.IntegerType'>

We should probably introduce a HCLType.is_equal(...) function somewhere instead of using the ==