Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RaiseSpecialOps (iree-flow-raise-special-ops) causes compiler crash for some input #14933

Closed
dpackwood opened this issue Sep 8, 2023 · 7 comments · Fixed by #15002
Closed
Assignees
Labels
bug 🐞 Something isn't working

Comments

@dpackwood
Copy link

What happened?

SigAbort in the pass due to failed assertion.

In particular in tryRaiseToExtractSlice

iree-compile: /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:257: const T& llvm::ArrayRef<T>::operator[](size_t) const [with T = mlir::AffineExpr; size_t = long unsigned int]: AssertionIndex < Length && "Invalid index!"' failed.
Please report issues to https://github.com/openxla/iree/issues and include the crash backtrace.
Stack dump:
0. Program arguments: ./cmake-build-relwithdebinfo/_deps/iree-build/tools/iree-compile mini_reproducer.mlir -o bob.vmfb --mlir-print-ir-before-all
#0 0x00007f740a5eea0f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (.localalias) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/llvm/lib/Support/Unix/Signals.inc:727:3
#1 0x00007f740a5ec8c4 llvm::sys::RunSignalHandlers() (.localalias) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/llvm/lib/Support/Signals.cpp:105:20
#2 0x00007f740a5ecc16 SignalHandler(int) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
#3 0x00007f740550a520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f740555ea7c __pthread_kill_implementation ./nptl/./nptl/pthread_kill.c:44:76
#5 0x00007f740555ea7c __pthread_kill_internal ./nptl/./nptl/pthread_kill.c:78:10
#6 0x00007f740555ea7c pthread_kill ./nptl/./nptl/pthread_kill.c:89:10
#7 0x00007f740550a476 raise ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007f74054f07f3 abort ./stdlib/./stdlib/abort.c:81:7
#9 0x00007f74054f071b _nl_load_domain ./intl/./intl/loadmsgcat.c:1177:9
#10 0x00007f7405501e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x00007f740a614975 (/data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-build/lib/libIREECompiler.so.0+0x4f09975)
#12 0x00007f740a618adb (/data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-build/lib/libIREECompiler.so.0+0x4f0dadb)
#13 0x00007f740be73025 tryRaiseToExtractSlice /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/compiler/src/iree/compiler/Dialect/Flow/Transforms/RaiseSpecialOps.cpp:271:5
#14 0x00007f740be73025 tryRaiseToView /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/compiler/src/iree/compiler/Dialect/Flow/Transforms/RaiseSpecialOps.cpp:348:32
#15 0x00007f740be73025 operator() /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/compiler/src/iree/compiler/Dialect/Flow/Transforms/RaiseSpecialOps.cpp:377:25
#16 0x00007f740be73025 operator() /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/include/mlir/IR/Visitors.h:339:15
#17 0x00007f740be73025 ZN4llvm12function_refIFvPN4mlir9OperationEEE11callback_fnIZNS1_6detail4walkILNS1_9WalkOrderE1ENS1_15ForwardIteratorEZNS1_13iree_compiler4IREE4Flow12_GLOBAL__N_119RaiseSpecialOpsPass14runOnOperationEvEUlNS1_6linalg9GenericOpEE_SH_vEENSt9enable_ifIXaantsrSt11disjunctionIJSt7is_sameIT2_S3_ESL_ISM_PNS1_6RegionEESL_ISM_PNS1_5BlockEEEE5valuesrSL_IT3_vE5valueESV_E4typeES3_OT1_EUlS3_E_EEvlS3 /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:52
#18 0x00007f740be7380f void mlir::detail::walkmlir::ForwardIterator(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/include/mlir/IR/Visitors.h:180:7
#19 0x00007f740be7380f walk<> /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/include/mlir/IR/Visitors.h:341:32
#20 0x00007f740be7380f walk<> /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/include/mlir/IR/Operation.h:753:41
#21 0x00007f740be7380f mlir::iree_compiler::IREE::Flow::(anonymous namespace)::RaiseSpecialOpsPass::runOnOperation() /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/compiler/src/iree/compiler/Dialect/Flow/Transforms/RaiseSpecialOps.cpp:360:25
#22 0x00007f740a7d104e operator() /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:503:31
#23 0x00007f740a7d104e callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::<lambda()> > /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:52
#24 0x00007f740a7d104e llvm::function_ref<void ()>::operator()() const /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
#25 0x00007f740a7d104e void mlir::MLIRContext::executeAction<mlir::PassExecutionAction, mlir::Pass&>(llvm::function_ref<void ()>, llvm::ArrayRefmlir::IRUnit, mlir::Pass&) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/include/mlir/IR/MLIRContext.h:275:15
#26 0x00007f740a7d104e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (.localalias) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:497:55
#27 0x00007f740a7d1609 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (.localalias) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:569:5
#28 0x00007f740a7d1a5f std::vector<std::atomic, std::allocator<std::atomic > >::operator[](unsigned long) /usr/include/c++/11/bits/stl_vector.h:1046:25
#29 0x00007f740a7d1a5f mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:794:22
#30 0x00007f740a7d059d failableParallelForEach<__gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vectormlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo >, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::<lambda(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)>&> /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/include/mlir/IR/Threading.h:46:7
#31 0x00007f740a7d059d failableParallelForEach<std::vectormlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::<lambda(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)>&> /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/include/mlir/IR/Threading.h:92:33
#32 0x00007f740a7d059d mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (.localalias) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:799:13
#33 0x00007f740a7d0d82 operator() /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:504:22
#34 0x00007f740a7d0d82 callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::<lambda()> > /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:52
#35 0x00007f740a7d0d82 llvm::function_ref<void ()>::operator()() const /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
#36 0x00007f740a7d0d82 void mlir::MLIRContext::executeAction<mlir::PassExecutionAction, mlir::Pass&>(llvm::function_ref<void ()>, llvm::ArrayRefmlir::IRUnit, mlir::Pass&) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/include/mlir/IR/MLIRContext.h:275:15
#37 0x00007f740a7d0d82 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (.localalias) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:497:55
#38 0x00007f740a7d1609 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (.localalias) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:569:5
#39 0x00007f740a7d29b8 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:880:40
#40 0x00007f740a7d29b8 mlir::PassManager::run(mlir::Operation*) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:860:69
#41 0x00007f740a5364f0 mlir::iree_compiler::embed::(anonymous namespace)::Invocation::runPipeline(iree_compiler_pipeline_t) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/compiler/src/iree/compiler/API/Internal/CompilerDriver.cpp:795:13
#42 0x00007f740a786bea mlir::iree_compiler::runIreecMain(int, char**)::'lambda3'(iree_compiler_source_t*)::operator()(iree_compiler_source_t*) const /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/compiler/src/iree/compiler/Tools/iree_compile_lib.cc:242:7
#43 0x00007f740a789d7b mlir::iree_compiler::runIreecMain(int, char**) /data_sdb/PycharmProjects/vosa_private_testing/cmake-build-relwithdebinfo/_deps/iree-src/compiler/src/iree/compiler/Tools/iree_compile_lib.cc:332:5
#44 0x00007f74054f1d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#45 0x00007f74054f1e40 call_init ./csu/../csu/libc-start.c:128:20
#46 0x00007f74054f1e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#47 0x00005583d30d4765 _start (./cmake-build-relwithdebinfo/_deps/iree-build/tools/iree-compile+0x1765)
Aborted (core dumped)

`

Steps to reproduce your issue

Minimal input reproducer:

`
module {
func.func @A(%arg0: tensor<180x320x1xf32>) -> tensor<320xf32> attributes {llvm.emit_c_interface} {

%c0 = arith.constant 0 : index
%c179 = arith.constant 179 : index
%70 = tensor.empty() : tensor<320xf32>
%71 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>], iterator_types = ["parallel"]} outs(%70 : tensor<320xf32>) {
^bb0(%out: f32):
  %76 = linalg.index 0 : index
  %extracted = tensor.extract %arg0[%c0, %76, %c0] : tensor<180x320x1xf32>
  linalg.yield %extracted : f32
} -> tensor<320xf32> 
return %71 : tensor<320xf32>

}
}

`

What component(s) does this issue relate to?

Compiler

Version information

Checked on candidate-20230831.630 but pass does not seem to have been updated since then.

Additional context

No response

@dpackwood dpackwood added the bug 🐞 Something isn't working label Sep 8, 2023
@Groverkss Groverkss self-assigned this Sep 8, 2023
@Groverkss
Copy link
Contributor

Groverkss commented Sep 8, 2023

I wrote this part of the Pass. I'm off till Monday, so will have a look then.

Also, just curious, where did you generate this linalg operation from?

@dpackwood
Copy link
Author

I dragged this reproducer out of a much larger pipeline, its extracting the boundary region of a tensor.
More generally it extracts a larger boundary but in this special case it extracts a boundary of size one.

@banach-space
Copy link
Collaborator

@Groverkss Any updates on this? Perhaps we could help? This is affecting an important workload for us :(

@Groverkss
Copy link
Contributor

@Groverkss Any updates on this? Perhaps we could help? This is affecting an important workload for us :(

Hi sorry, will have a look today evening (in about 4-5h) and will try to send a fix today. Thanks for the ping.

@qedawkins
Copy link
Contributor

#14845 includes a fix that I can extract if that helps.

@Groverkss
Copy link
Contributor

@qedawkins Would be great if you can send that.

qedawkins added a commit to qedawkins/iree that referenced this issue Sep 20, 2023
fixes iree-org#14933

Additionally cleans up some of the lit testing to be clearer about the
extract_slice that is generated.
@qedawkins
Copy link
Contributor

#15002 should fix the above example.

qedawkins added a commit that referenced this issue Sep 21, 2023
Fixes #14933

Additionally cleans up some of the lit testing to be clearer about the
extract_slice that is generated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants