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

SegFault from `reuse_at` in HeteroCL module #154

Open hecmay opened 4 years ago

hecmay commented 4 years ago

A simple minimal test case to reproduce the error.

def kernel(A, B):
    @hcl.def_([(10,10), (10,10)])
    def test(A, B):
        hcl.update(B, lambda y, x: A[y,x] + A[y,x+1]+ A[y,x+2])
    test(A, B)

A = hcl.placeholder((10, 10))
B = hcl.placeholder((10, 10))
s = hcl.create_schedule([A, B], kernel)
s.reuse_at(kernel.test.A, s[kernel.test], kernel.test.axis[0])

The reuse_at primitive fails to locate the target buffer to be reused.

chhzh123 commented 4 years ago

This issue remains. I got a Segmentation Fault when running the example provided in Memory Customization.

A = hcl.placeholder((6, 6), "A")
F = hcl.placeholder((3, 3), "F")

def kernel(A, F):
    r = hcl.reduce_axis(0, 3)
    c = hcl.reduce_axis(0, 3)
    return hcl.compute((4, 4),
            lambda y, x: hcl.sum(A[y+r, x+c]*F[r, c], axis=[r, c]), "B")

s_xy = hcl.create_schedule([A, F], kernel)
LB = s_xy.reuse_at(A, s_xy[kernel.B], kernel.B.axis[0], "LB")
WB = s_xy.reuse_at(LB, s_xy[kernel.B], kernel.B.axis[1], "WB")
print(hcl.lower(s_xy))
hecmay commented 4 years ago

Still have this issue when re-running optical flow experiments. Not sure which part is wrong, cuz that I cannot run gdb on our severs (some libraries are missing)...