Closed hecmay closed 4 years ago
The test cases can pass successfully on MacOS catalina (my local laptop), Ubuntu LTS 18.04 (CircleCI servers). Will check whether other Linux distributions in WSL have the same problem.
As discussed with Hongzheng, the issue is caused by the GenerateReuseBuffer IR Pass. The allocate Stmt in Reuse node was optimized away somehow, so the Pass got a null ptr to it, and thus Segfault.
Root cause: the Reuse Buffer stage is not successfully attached to the right place indicated by attach_scope, as a result, there is no Allocate IR Node in the Reuse IR Node's body. This error occurred from the op scheduling process...
The scheduling function was not able to find the child stage, most likely because of buffer pointer mismatching. I ran into some similar issues before, and I used some quick-and-dirty solution to circumvent it (i.e. matching the buffers based on their names instead of pointer), but I do not think it to be a good way to solve this issue...
@seanlatias please take a look after Thursday. This seems to have become a blocking issue.
Seems like it is still an OS-dependent issue. I take a closer look.
@seanlatias @zhangzhiru This issue only occurs on WSL Ubuntu (I am also trying out other WSL Linux distributions including WSL CentOS). We cannot reproduce it on other commercial or private servers.
This is basically the same issue as Hongzhen mentioned in: #222. There problem is that, as you can see, the WB stage is not attached properly in the IR:
// attr [extern(WB, 0x7fffdb49f6e0)] realize_scope = ""
realize WB() {
// attr [[buffer(A, 0x7fffdb285480), Tensor(shape=[6, 6], op.name=A)]] buffer_bind_scope = tvm_tuple(0, 6, 0, 6) // attr [[buffer(WB, 0x7fffdb125ac0), Tensor(shape=[], op.name=WB)]] buffer_bind_scope = tvm_tuple()
produce WB {
// attr [0] extern_scope = 0
0
}
// attr [extern(_top, 0x7fffdb490a30)] realize_scope = "" realize _top() {
// attr [[buffer(F, 0x7fffdaf39240), Tensor(shape=[3, 3], op.name=F)]] buffer_bind_scope = tvm_tuple(0, 3, 0, 3)
// attr [[buffer(A, 0x7fffdb285480), Tensor(shape=[6, 6], op.name=A)]] buffer_bind_scope = tvm_tuple(0, 6, 0, 6)
// attr [[buffer(_top, 0x7fffdb496230), Tensor(shape=[], op.name=_top)]] buffer_bind_scope = tvm_tuple()
produce _top {
// attr [0] extern_scope = 0
// attr [extern(B, 0x7fffdb484090)] realize_scope = ""
realize B([0, 4], [0, 4]) {
// attr [[buffer(A, 0x7fffdb285480), Tensor(shape=[6, 6], op.name=A)]] buffer_bind_scope = tvm_tuple(0[110/1983]
// attr [[buffer(B, 0x7fffdb465ca0), Tensor(shape=[4, 4], op.name=B)]] buffer_bind_scope = tvm_tuple(0, 4, 0, 4) produce B {
// attr [0] extern_scope = 0
for (y, 0, 4) {
for (x, 0, 4) {
reuse A
// attr [ for (y, 0, 4) {
// attr [iter_var(y, Range(min=0, extent=4))] loop_scope = y
for (x, 0, 4) {
// attr [iter_var(x, Range(min=0, extent=4))] loop_scope = x
// attr [buffer(sum, 0x7fffdb480620)] attach_scope = "B"
for (ra2, 0, 3) {
// attr [iter_var(ra2, Range(min=0, extent=3))] loop_scope = ra2
for (ra3, 0, 3) {
// attr [iter_var(ra3, Range(min=0, extent=3))] loop_scope = ra3
if (1) {
sum[0] = int32((int65((int64(A[((x + ra3) + ((y + ra2)*6))])*int64(F[(ra3 + (ra2*3))]))) + int65(sum[0])))
}
}
}
B[(x + (y*4))] = int32(sum[0])
}
}
] attach_scope = "B" // attr [extern(sum, 0x7fffdb46f740)] realize_scope = ""
realize sum([0, 1]) {
// attr [[buffer(sum, 0x7fffdb480620), Tensor(shape=[1], op.name=sum)]] buffer_bind_scope = tvm_tuple(0, 1)
produce sum {
// attr [0] extern_scope = 0
for (x, 0, 1) {
sum[x] = int32(0)
}
}
for (ra2, 0, 3) {
for (ra3, 0, 3) {
if (1) {
sum[0] = int32((int65((int64(A[((x + ra3) + ((y + ra2)*6))])*int64(F[(ra3 + (ra2*3))]))) + int65(sum[0])))
}
}
}
B[(x + (y*4))] = int32(sum[0])
} }
}
}
}
}
}
}
Solved by #226.
Environment: WSL 1.0 (Ubuntu 18.04 LTS) running on Windows 10. Many test cases failed with Segfault, including memory customization primitives and data packing primitives. The error message is as followed: