iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.
http://iree.dev/
Apache License 2.0
2.85k stars 614 forks source link

Failure : unimplemented: found unhandled case of expansion/collapse in `aten.view` #16887

Open gabeweisz opened 7 months ago

gabeweisz commented 7 months ago

What happened?

iree-compile: /_pathto/iree/third_party/llvm-project/mlir/include/mlir/IR/UseDefLists.h:198: mlir::IRObjectWithUseList::~IRObjectWithUseList() [OperandType = mlir::OpOperand]: Assertion `use_empty() && "Cannot destroy a value that still has uses!"' failed.

Steps to reproduce your issue

iree-build/tools/iree-compile model_small.mlir.txt model_small.mlir.txt

What component(s) does this issue relate to?

No response

Version information

No response

Additional context

No response

renxida commented 7 months ago

https://github.com/llvm/torch-mlir/pull/2969#issuecomment-2018724958

The above issue implements lowering for onnx.LSTM and i'm having similar issues lowering to linalg

renxida commented 7 months ago

from what @qedawkins told me, the "failure destroying a value" error might be a spurious error message generated by the unrolling process in the dialect conversion framework.

@gabeweisz could you post the full log & full error message of torch-mlir-opt?

gabeweisz commented 7 months ago

It might be - I'm actually running this in the iree compiler. I posted this here rather than in their github because that is what the instructions at the top of the error message told me to do

Full stack when running on the .mlir file attached: iree-compile: /path_to/iree/third_party/llvm-project/mlir/include/mlir/IR/UseDefLists.h:198: mlir::IRObjectWithUseList::~IRObjectWithUseList() [OperandType = mlir::OpOperand]: Assertion `use_empty() && "Cannot destroy a value that still has uses!"' failed. Please report issues to https://github.com/openxla/iree/issues and include the crash backtrace.

0 0x00007f776ed58e36 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /path_to/iree/third_party/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:13

1 0x00007f776ed56ff0 llvm::sys::RunSignalHandlers() /path_to/iree/third_party/llvm-project/llvm/lib/Support/Signals.cpp:106:18

2 0x00007f776ed594eb SignalHandler(int) /path_to/iree/third_party/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1

3 0x00007f7768c644d0 (/usr/lib64/libc.so.6+0x384d0)

4 0x00007f7768cb20bc (/usr/lib64/libc.so.6+0x860bc)

5 0x00007f7768c64432 raise (/usr/lib64/libc.so.6+0x38432)

6 0x00007f7768c4e4b2 abort (/usr/lib64/libc.so.6+0x224b2)

7 0x00007f7768c4e3d5 (/usr/lib64/libc.so.6+0x223d5)

8 0x00007f7768c5d362 (/usr/lib64/libc.so.6+0x31362)

9 0x00007f776eda662f mlir::IRObjectWithUseList::~IRObjectWithUseList() /path_to/iree/third_party/llvm-project/mlir/include/mlir/IR/UseDefLists.h:198:5

10 0x00007f776eda662f mlir::Block::~Block() /path_to/iree/third_party/llvm-project/mlir/lib/IR/Block.cpp:24:1

11 0x00007f7772700e69 (anonymous namespace)::CreateBlockRewrite::rollback() /path_to/iree/third_party/llvm-project/mlir/lib/Transforms/Utils/DialectConversion.cpp:286:7

12 0x00007f77726eacab bool std::operator==<std::unique_ptr<(anonymous namespace)::IRRewrite, std::default_delete<(anonymous namespace)::IRRewrite>>>(std::reverse_iterator<std::unique_ptr<(anonymous namespace)::IRRewrite, std::default_delete<(anonymous namespace)::IRRewrite>>> const&, std::reverse_iterator<std::unique_ptr<(anonymous namespace)::IRRewrite, std::default_delete<(anonymous namespace)::IRRewrite>>*> const&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_iterator.h:446:25

13 0x00007f77726eacab bool std::operator!=<std::unique_ptr<(anonymous namespace)::IRRewrite, std::default_delete<(anonymous namespace)::IRRewrite>>>(std::reverse_iterator<std::unique_ptr<(anonymous namespace)::IRRewrite, std::default_delete<(anonymous namespace)::IRRewrite>>> const&, std::reverse_iterator<std::unique_ptr<(anonymous namespace)::IRRewrite, std::default_delete<(anonymous namespace)::IRRewrite>>*> const&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_iterator.h:460:20

14 0x00007f77726eacab mlir::detail::ConversionPatternRewriterImpl::undoRewrites(unsigned int) /path_to/iree/third_party/llvm-project/mlir/lib/Transforms/Utils/DialectConversion.cpp:1224:22

15 0x00007f77726f0fd8 mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) /path_to/iree/third_party/llvm-project/mlir/lib/Transforms/Utils/DialectConversion.cpp:0:27

16 0x00007f77726f817c mlir::applyPartialConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) /path_to/iree/third_party/llvm-project/mlir/lib/Transforms/Utils/DialectConversion.cpp:3610:22

17 0x00007f77726f817c mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) /path_to/iree/third_party/llvm-project/mlir/lib/Transforms/Utils/DialectConversion.cpp:3616:10

18 0x00007f776f85700b (anonymous namespace)::ConvertTorchToLinalg::runOnOperation() /path_to/iree/third_party/torch-mlir/lib/Conversion/TorchToLinalg/TorchToLinalg.cpp:87:16

19 0x00007f776eeffc3f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass, mlir::Operation, mlir::AnalysisManager, bool, unsigned int)::$_1::operator()() const /path_to/iree/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:0:17

20 0x00007f776eeffc3f void llvm::function_ref<void ()>::callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass, mlir::Operation, mlir::AnalysisManager, bool, unsigned int)::$_1>(long) /path_to/iree/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12

21 0x00007f776eeffc3f llvm::function_ref<void ()>::operator()() const /path_to/iree/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12

22 0x00007f776eeffc3f void mlir::MLIRContext::executeAction<mlir::PassExecutionAction, mlir::Pass&>(llvm::function_ref<void ()>, llvm::ArrayRef, mlir::Pass&) /path_to/iree/third_party/llvm-project/mlir/include/mlir/IR/MLIRContext.h:275:7

23 0x00007f776eeffc3f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass, mlir::Operation, mlir::AnalysisManager, bool, unsigned int) /path_to/iree/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:513:21

24 0x00007f776ef00409 mlir::LogicalResult::failed() const /path_to/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:44:33

25 0x00007f776ef00409 mlir::failed(mlir::LogicalResult) /path_to/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:72:58

26 0x00007f776ef00409 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor, mlir::PassInstrumentation::PipelineParentInfo const*) /path_to/iree/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:585:9

27 0x00007f776ef05bbe mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const /path_to/iree/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:810:5

28 0x00007f776ef05c6e mlir::LogicalResult::failed() const /path_to/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:44:33

29 0x00007f776ef05c6e mlir::failed(mlir::LogicalResult) /path_to/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:72:58

30 0x00007f776ef05c6e mlir::LogicalResult mlir::failableParallelForEach<gnu_cxx::normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&>(mlir::MLIRContext, gnu_cxx::normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, __gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&)::'lambda'()::operator()() const /path_to/iree/third_party/llvm-project/mlir/include/mlir/IR/Threading.h:62:11

31 0x00007f776ef05c6e gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>> std::invoke_impl<void, mlir::LogicalResult mlir::failableParallelForEach<gnu_cxx::normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&>(mlir::MLIRContext, gnu_cxx::normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, __gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&)::'lambda'()&>(std::__invoke_other, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/invoke.h:61:14

32 0x00007f776ef05c6e std::enable_if<is_invocable_r_v<gnu_cxx::normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&>, gnu_cxx::normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>>::type std::invoke_r<void, mlir::LogicalResult mlir::failableParallelForEach<__gnu_cxx::normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&>(mlir::MLIRContext, __gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, __gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&)::'lambda'()&>(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/invoke.h:111:2

33 0x00007f776ef05c6e std::_Function_handler<void (), mlir::LogicalResult mlir::failableParallelForEach<gnu_cxx::normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&>(mlir::MLIRContext, gnu_cxx::normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, __gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&)::'lambda'()>::_M_invoke(std::_Any_data const&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/std_function.h:290:9

34 0x00007f776ee61f48 std::future_base::_Task_setter<std::unique_ptr<std::future_base::_Result, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<std::function<void ()>>>, void>::operator()() const /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/future:1440:20

35 0x00007f776ee61f48 std::unique_ptr<std::future_base::_Result, std::future_base::_Result_base::_Deleter> std::invoke_impl<std::unique_ptr<std::future_base::_Result, std::future_base::_Result_base::_Deleter>, std::future_base::_Task_setter<std::unique_ptr<std::future_base::_Result, std::future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<std::function<void ()>>>, void>&>(std::__invoke_other, std::future_base::_Task_setter<std::unique_ptr<std::future_base::_Result, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<std::function<void ()>>>, void>&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/invoke.h:61:14

36 0x00007f776ee61f48 std::enable_if<is_invocable_r_v<std::unique_ptr<std::future_base::_Result_base, std::future_base::_Result_base::_Deleter>, std::future_base::_Task_setter<std::unique_ptr<std::future_base::_Result, std::future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<std::function<void ()>>>, void>&>, std::unique_ptr<std::__future_base::_Result_base, std::future_base::_Result_base::_Deleter>>::type std::invoke_r<std::unique_ptr<std::future_base::_Result_base, std::future_base::_Result_base::_Deleter>, std::future_base::_Task_setter<std::unique_ptr<std::future_base::_Result, std::future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<std::function<void ()>>>, void>&>(std::future_base::_Task_setter<std::unique_ptr<std::future_base::_Result, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<std::function<void ()>>>, void>&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/invoke.h:114:9

37 0x00007f776ee61f48 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::future_base::_Result_base::_Deleter> (), std::future_base::_Task_setter<std::unique_ptr<std::future_base::_Result, std::future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<std::function<void ()>>>, void>>::_M_invoke(std::_Any_data const&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/std_function.h:290:9

38 0x00007f776ee61e9a std::future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::future_base::_Result_base::_Deleter> ()>, bool) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/future:591:13

39 0x00007f7768cb5227 (/usr/lib64/libc.so.6+0x89227)

40 0x00007f776ee6227a void std::call_once<void (std::future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::future_base::_Result_base, std::future_base::_Result_base::_Deleter> ()>, bool), std::future_base::_State_baseV2, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool>(std::once_flag&, void (std::__future_base::_State_baseV2::&&)(std::function<std::unique_ptr<std::future_base::_Result_base, std::future_base::_Result_base::_Deleter> ()>, bool), std::future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::future_base::_Result_base::_Deleter> ()>&&, bool&&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/mutex:859:15

41 0x00007f776ee6227a std::future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::future_base::_Result_base::_Deleter> ()>, bool) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/future:426:2

42 0x00007f776ee6227a std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<std::function<void ()>>>, void>::_M_complete_async() /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/future:1703:9

43 0x00007f776ee62315 std::__atomic_base::load(std::memory_order) const /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/atomic_base.h:488:9

44 0x00007f776ee62315 std::__atomic_futex_unsigned<2147483648u>::_M_load(std::memory_order) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/atomic_futex.h:86:22

45 0x00007f776ee62315 std::__atomic_futex_unsigned<2147483648u>::_M_load_when_equal(unsigned int, std::memory_order) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/atomic_futex.h:208:22

46 0x00007f776ee62315 std::__future_base::_State_baseV2::wait() /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/future:351:12

47 0x00007f776ee62315 std::__basic_future::wait() const /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/future:714:19

48 0x00007f776ee62315 std::shared_future llvm::ThreadPoolInterface::asyncImpl(std::function<void ()>, llvm::ThreadPoolTaskGroup*)::'lambda'()::operator()() const /path_to/iree/third_party/llvm-project/llvm/include/llvm/Support/ThreadPool.h:114:38

49 0x00007f776ee62315 void std::invoke_impl<void, std::shared_future llvm::ThreadPoolInterface::asyncImpl(std::function<void ()>, llvm::ThreadPoolTaskGroup*)::'lambda'()&>(std::invoke_other, std::shared_future llvm::ThreadPoolInterface::asyncImpl(std::function<void ()>, llvm::ThreadPoolTaskGroup*)::'lambda'()&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/invoke.h:61:14

50 0x00007f776ee62315 std::enable_if<is_invocable_r_v<void, std::shared_future llvm::ThreadPoolInterface::asyncImpl(std::function<void ()>, llvm::ThreadPoolTaskGroup)::'lambda'()&>, void>::type std::__invoke_r<void, std::shared_future llvm::ThreadPoolInterface::asyncImpl(std::function<void ()>, llvm::ThreadPoolTaskGroup)::'lambda'()&>(std::shared_future llvm::ThreadPoolInterface::asyncImpl(std::function<void ()>, llvm::ThreadPoolTaskGroup*)::'lambda'()&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/invoke.h:111:2

51 0x00007f776ee62315 std::_Function_handler<void (), std::shared_future llvm::ThreadPoolInterface::asyncImpl(std::function<void ()>, llvm::ThreadPoolTaskGroup*)::'lambda'()>::_M_invoke(std::_Any_data const&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/std_function.h:290:9

52 0x00007f776ed11514 std::function<void ()>::operator()() const /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/std_function.h:0:9

53 0x00007f776ed11514 llvm::StdThreadPool::processTasks(llvm::ThreadPoolTaskGroup*) /path_to/iree/third_party/llvm-project/llvm/lib/Support/ThreadPool.cpp:100:5

54 0x00007f776ed12b27 std::default_delete<std::tuple<llvm::StdThreadPool::grow(int)::$_0>>::operator()(std::tuple<llvm::StdThreadPool::grow(int)::$_0>*) const /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/unique_ptr.h:95:2

55 0x00007f776ed12b27 std::unique_ptr<std::tuple<llvm::StdThreadPool::grow(int)::$_0>, std::default_delete<std::tuple<llvm::StdThreadPool::grow(int)::$_0>>>::~unique_ptr() /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/unique_ptr.h:396:4

56 0x00007f776ed12b27 void llvm::thread::GenericThreadProxy<std::tuple<llvm::StdThreadPool::grow(int)::$_0>>(void*) /path_to/iree/third_party/llvm-project/llvm/include/llvm/Support/thread.h:46:3

57 0x00007f776ed12b27 void llvm::thread::ThreadProxy<std::tuple<llvm::StdThreadPool::grow(int)::$_0>>(void) /path_to/iree/third_party/llvm-project/llvm/include/llvm/Support/thread.h:55:5

58 0x00007f7768cb03ac (/usr/lib64/libc.so.6+0x843ac)

59 0x00007f7768d3026c (/usr/lib64/libc.so.6+0x10426c)

renxida commented 7 months ago

@gabeweisz when i encountered this error, there were two error messages & two stack traces. do you see the same or is this all you got?

gabeweisz commented 7 months ago

This is all that I got - I'm running iree-compile (commit aa72368e1c9803ea1bfc37aac984d08a4c274cb4 from March 21) with the attached file and no other options. It is a "release with debug info" build

ScottTodd commented 7 months ago

If I were triaging this I'd run the reproducer .mlir file through the compiler with --mlir-print-before-all (and possibly also -debug, but start with just the IR) then attach the IR (and pass name) just before the crash to the issue.

gabeweisz commented 7 months ago

iree-build/tools/iree-compile model_small.mlir --print-before-all --debug >stdout.txt 2>stderr.txt Without --debug I did not get anything printed but the stack trace, This is what is right before the crash: //===-------------------------------------------===// Legalizing operation : 'torch.aten.view'(0x56194dc70670) { %182 = "torch.aten.view"(%168, %181) : (!torch.vtensor<[?,16,768],f32>, !torch.list) -> !torch.vtensor<[?,768],f32>

gabeweisz commented 7 months ago

If I add the right flag for "--mlir-print-ir-before-all" I get this stderr stderr.txt

The last thing printed was: // -----// IR Dump Before ConvertTorchToArith (convert-torch-to-arith) //----- // func.func @forward(%arg0: tensor<?x16xi32>) -> (tensor<?x16x50280xf32>, tensor<1x?x1536x16xf32>, tensor<1x?x1536x3xf32>) attributes {torch.args_schema = "[1, {\22type\22: \22builtins.tuple\22,iree-compile: /home/gweisz/iree/third_party/llvm-project/mlir/include/mlir/IR/UseDefLists.h:198: mlir::IRObjectWithUseList::~IRObjectWithUseList() [OperandType = mlir::OpOperand]: Assertion `use_empty() && "Cannot destroy a value that stil\l has uses!"' failed. 22coPlease report issues to https://github.com/openxla/iree/issues and include the crash backtrace. ntext\22: \22null\22, \22children_spec\22: [{\22type\22: \22builtins.list\22, \22context\22: \22null\22, \22children_spec\22: [{\22type\22: null, \22context\22: null, \22children_spec\22: []}]}, {\22type\22: \22builtins.dict\22, \22context\22: \22[]\22, \22children_spec\22: []}]}]", torch.assume_strict_symbolic_shapes, torch.return_schema = "[1, {\22type\22: \22builtins.tuple\22, \22context\22: \22null\22, \22children_spec\22: [{\22type\22: null, \22context\22: null, \22children_spec\22: []}, {\22type\22: null, \22context\22: null, \22children_spec\22: []}, {\22type\22: null, \22context\22: null, \22children_spec\22: []}]}]"} { %0 = torch_c.from_builtin_tensor %arg0 : tensor<?x16xi32> -> !torch.vtensor<[?,16],si32> %1:3 = call @forward$1(%0) : (!torch.vtensor<[?,16],si32>) -> (!torch.vtensor<[?,16,50280],f32>, !torch.vtensor<[1,?,1536,16],f32>, !torch.vtensor<[1,?,1536,3],f32>) %2 = torch_c.to_builtin_tensor %1#0 : !torch.vtensor<[?,16,50280],f32> -> tensor<?x16x50280xf32> %3 = torch_c.to_builtin_tensor %1#1 : !torch.vtensor<[1,?,1536,16],f32> -> tensor<1x?x1536x16xf32> %4 = torch_c.to_builtin_tensor %1#2 : !torch.vtensor<[1,?,1536,3],f32> -> tensor<1x?x1536x3xf32> return %2, %3, %4 : tensor<?x16x50280xf32>, tensor<1x?x1536x16xf32>, tensor<1x?x1536x3xf32> }

gabeweisz commented 7 months ago

Still fails with commit 5cd0a0ccd941db51936a059ed9f096717a8312e5

Some more from the log (with --mlir-print-ir-before-all --debug) : //===-------------------------------------------===//

//===-------------------------------------------===// Legalizing operation : 'torch.aten.mul.int'(0x556fc1511760) { %180 = "torch.aten.mul.int"(%55, %24) : (!torch.int, !torch.int) -> !torch.int

//===-------------------------------------------===// Legalizing operation : 'torch.prim.ListConstruct'(0x556fc1511da0) { %181 = "torch.prim.ListConstruct"(%180, %12) : (!torch.int, !torch.int) -> !torch.list

//===-------------------------------------------===// Legalizing operation : 'torch.aten.view'(0x556fc1511eb0) { %182 = "torch.aten.view"(%168, %181) : (!torch.vtensor<[?,16,768],f32>, !torch.list) -> !torch.vtensor<[?,768],f32>