cornell-zhang/hcl-dialect

[Frontend] Python int too large to convert to C long

Closed this issue · 4 comments

It seems we cannot support arrays whose element type's bitwidth is larger than 64? I got the following error when constructing a hcl.UInt(64) using hcl.asarray.

Traceback (most recent call last):
  File "main_packed.py", line 296, in <module>
    hcl_array.append(hcl.asarray(params[name], dtype=dtype))
  File "/scratch/users/hc676/heterocl/python/heterocl/mlir/operation.py", line 47, in asarray
    return Array(np_array, dtype)
  File "/scratch/users/hc676/heterocl/python/heterocl/mlir/tensor.py", line 316, in __init__
    np_array = np_array.astype(np.int64)
OverflowError: Python int too large to convert to C long

Fixed by HeteroCL 39f998.

Okay, this is not a sound fix. We still need to figure out whether the input array is unsigned or not, and use the corresponding np.uint64 or np.int64 to implement. Otherwise, some tests may fail.

Added output type casting in 6ee378.