apache / tvm

Open deep learning compiler stack for cpu, gpu and specialized accelerators
https://tvm.apache.org/
Apache License 2.0
11.58k stars 3.43k forks source link

[Bug] error when exec tvm.build #15085

Open qzylalala opened 1 year ago

qzylalala commented 1 year ago

Thanks for participating in the TVM community! We use https://discuss.tvm.ai for any general usage questions and discussions. The issue tracker is used for actionable items such as feature proposals discussion, roadmaps, and bug tracking. You are always welcomed to post on the forum first :smile_cat:

Issues that are inactive for a period of time may get closed. We adopt this policy so that we won't lose track of actionable issues that may fall at the bottom of the pile. Feel free to reopen a new one if you feel there is an additional problem that needs attention when an old one gets closed.

Expected behavior

Get schedule s

Actual behavior

16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.Filter
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.BindTarget
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.LowerTVMBuiltin
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.LowerCustomDatatypes
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.LowerIntrin
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.LowerDeviceStorageAccessInfo
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.CombineContextCall
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.Filter
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.BindTarget
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.LowerWarpMemory
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.Simplify
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.LowerCustomDatatypes
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.LowerDeviceStorageAccessInfo
[16:45:36] /home/XXX/work_space/tvm/src/ir/transform.cc:440: Running pass tir.LowerIntrin
[1]    30284 segmentation fault (core dumped)  python te.py

And when I debuged, I found that it got an error at this line https://github.com/apache/tvm/blob/6c6ad6c43ad3cb378866683ed322316b173267aa/src/target/llvm/codegen_llvm.cc#L724

Environment

Operating System: Ubuntu1804 TVM version: Latet LLVM: llvm-17

Steps to reproduce

import tvm
import tvm.testing
from tvm import te
import numpy as np

tgt = tvm.target.Target(target="llvm")

n = te.var("n")
A = te.placeholder((n,), name="A")
B = te.placeholder((n,), name="B")

C = te.compute(A.shape, lambda i: A[i] + B[i], name="C")
s = te.create_schedule(C.op)

fadd = tvm.build(s, [A, B, C], tgt, name="myadd")

Triage

Please refer to the list of label tags here to find the relevant tags and add them below in a bullet format (example below).

quic-sanirudh commented 1 year ago

I tried reproducing this error and couldn't do so. I don't see anything obviously wrong with the TVM code, so my guess is that you're probably running into some LLVM bug.

Could you perhaps mention the exact LLVM commit in which you're seeing this error. For context, I used the latest LLVM main commit as of today and I don't see the issue with that commit

lss0510 commented 8 months ago

@qzylalala I have a similar problem with you. How did you solve it in the end?