cornell-zhang/heterocl

Weird segfault when adding two bit slice objects

Opened this issue · 5 comments

The following code leads to a segfault

def kernel(A):
  return hcl.compute(A.shape, lambda x: A[x][0:7] + A[x][8:15])

The segfault only happens when the bit slices are the exact numbers as shown in the above code. Other numbers don't seem to create a segfault.

We already know that the segfault happens in the Simplify pass, but the cause is still unknown.

The data type of A also doesn't seem to matter.

Just to confirm -- [0:7] means we are extracting the first 8 bits, right?
Last Wed, I saw Xiangyi/Alga use [0:8] and [8:16]

No, we will be extracting the first 7 bits, which is the same as Python's convention. For Python, the range is upper-bound exclusive.

Can you take a look at the bit slicing support in other HW-oriented Python DSLs, like PyMTL and PyRTL? See if they are following this convention.