| Issue |
52887
|
| Summary |
[MLIR] Inliner Segfaults
|
| Labels |
mlir:core
|
| Assignees |
|
| Reporter |
wsmoses
|
Input:
```
module {
func @_ZZN2at6native21smooth_l1_kernel_cudaEvENKUlvE_clEv(%arg0: !llvm.ptr<struct<(i8)>>) {
%c0_i32 = arith.constant 0 : i32
%0 = memref.alloca() : memref<1x1xi16>
%1 = memref.cast %0 : memref<1x1xi16> to memref<?x1xi16>
%2 = arith.sitofp %c0_i32 : i32 to f32
call @_ZN3c104HalfC1Ef(%1, %2) : (memref<?x1xi16>, f32) -> ()
return
}
func @_ZZZN2at6native21smooth_l1_kernel_cudaEvENKUlvE_clEvENKUlN3c104HalfES3_E_clES3_S3_(%arg0: !llvm.ptr<struct<(i8)>>, %arg1: memref<?x1xi16>, %arg2: memref<?x1xi16>, %arg3: memref<?x1xi16>) {
call @_ZN3c10miERKNS_4HalfES2_(%arg1, %arg2, %arg3) : (memref<?x1xi16>, memref<?x1xi16>, memref<?x1xi16>) -> ()
return
}
func @_ZN3c104HalfC1Ef(%arg0: memref<?x1xi16>, %arg1: f32) {
%0 = call @_ZN3c106detail25fp16_ieee_from_fp32_valueEf(%arg1) : (f32) -> i16
return
}
func private @fabs(f64) -> f64
func private @_ZNK3c104HalfcvfEv(%arg0: memref<?x1xi16>) -> f32 {
%c0 = arith.constant 0 : index
%0 = memref.load %arg0[%c0, %c0] : memref<?x1xi16>
%1 = call @_ZN3c106detail23fp16_ieee_to_fp32_valueEt(%0) : (i16) -> f32
return %1 : f32
}
func private @_ZN3c10miERKNS_4HalfES2_(%arg0: memref<?x1xi16>, %arg1: memref<?x1xi16>, %arg2: memref<?x1xi16>) {
%0 = memref.alloca() : memref<1x1xi16>
%1 = memref.cast %0 : memref<1x1xi16> to memref<?x1xi16>
%2 = call @_ZNK3c104HalfcvfEv(%arg0) : (memref<?x1xi16>) -> f32
call @_ZN3c104HalfC1Ef(%1, %2) : (memref<?x1xi16>, f32) -> ()
return
}
func @_ZN3c106detail25fp16_ieee_from_fp32_valueEf(%arg0: f32) -> i16 {
%c1_i16 = arith.constant 1 : i16
%0 = call @fabsf(%arg0) : (f32) -> f32
return %c1_i16 : i16
}
func @_ZN3c106detail23fp16_ieee_to_fp32_valueEt(%arg0: i16) -> f32 {
%c1_i32 = arith.constant 1 : i32
%0 = call @_ZN3c106detail14fp32_from_bitsEj(%c1_i32) : (i32) -> f32
return %0 : f32
}
func private @fabsf(f32) -> f32
func @_ZN3c106detail14fp32_from_bitsEj(%arg0: i32) -> f32 {
%cst = arith.constant 0.000000e+00 : f32
return %cst : f32
}
}
```
Steps to reproduce and backtrace:
```
$ ~/git/Polygeist/mlir-build/bin/mlir-opt det2.mlir -inline
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/wmoses/git/Polygeist/mlir-build/bin/mlir-opt det2.mlir -inline
#0 0x0000556e5e4d3f46 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/wmoses/git/Polygeist/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:0
#1 0x0000556e5e4d3ffd PrintStackTraceSignalHandler(void*) /home/wmoses/git/Polygeist/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:0
#2 0x0000556e5e4d1cac llvm::sys::RunSignalHandlers() /home/wmoses/git/Polygeist/llvm-project/llvm/lib/Support/Signals.cpp:96:0
#3 0x0000556e5e4d38c7 SignalHandler(int) /home/wmoses/git/Polygeist/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:0
#4 0x00007f6f09c22980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#5 0x0000556e604fa7ee mlir::Region::getParentRegion() /home/wmoses/git/Polygeist/llvm-project/mlir/lib/IR/Region.cpp:47:0
#6 0x0000556e604fa855 mlir::Region::isProperAncestor(mlir::Region*) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/IR/Region.cpp:55:0
#7 0x0000556e5e5fcc8b mlir::Region::isAncestor(mlir::Region*) /home/wmoses/git/Polygeist/llvm-project/mlir/include/mlir/IR/Region.h:217:0
#8 0x0000556e6028492f shouldInline((anonymous namespace)::ResolvedCall&) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Transforms/Inliner.cpp:422:0
#9 0x0000556e60284b4d inlineCallsInSCC((anonymous namespace)::Inliner&, (anonymous namespace)::CGUseList&, (anonymous namespace)::CallGraphSCC&) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Transforms/Inliner.cpp:461:0
#10 0x0000556e602855f5 (anonymous namespace)::InlinerPass::inlineSCC((anonymous namespace)::Inliner&, (anonymous namespace)::CGUseList&, (anonymous namespace)::CallGraphSCC&, mlir::MLIRContext*) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Transforms/Inliner.cpp:633:0
#11 0x0000556e60285309 (anonymous namespace)::InlinerPass::runOnOperation()::'lambda'((anonymous namespace)::CallGraphSCC&)::operator()((anonymous namespace)::CallGraphSCC&) const /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Transforms/Inliner.cpp:615:0
#12 0x0000556e60287921 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult ((anonymous namespace)::CallGraphSCC&)>::callback_fn<(anonymous namespace)::InlinerPass::runOnOperation()::'lambda'((anonymous namespace)::CallGraphSCC&)>(long, (anonymous namespace)::CallGraphSCC&) /home/wmoses/git/Polygeist/llvm-project/llvm/include/llvm/ADT/STLExtras.h:234:0
#13 0x0000556e60286871 llvm::function_ref<mlir::LogicalResult ((anonymous namespace)::CallGraphSCC&)>::operator()((anonymous namespace)::CallGraphSCC&) const /home/wmoses/git/Polygeist/llvm-project/llvm/include/llvm/ADT/STLExtras.h:256:0
#14 0x0000556e602840c2 runTransformOnCGSCCs(mlir::CallGraph const&, llvm::function_ref<mlir::LogicalResult ((anonymous namespace)::CallGraphSCC&)>) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Transforms/Inliner.cpp:296:0
#15 0x0000556e602854c8 (anonymous namespace)::InlinerPass::runOnOperation() /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Transforms/Inliner.cpp:615:0
#16 0x0000556e60225129 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Pass/Pass.cpp:393:0
#17 0x0000556e602253fb mlir::detail::OpToOpPassAdaptor::runPipeline(llvm::iterator_range<llvm::pointee_iterator<std::unique_ptr<mlir::Pass, std::default_delete<mlir::Pass> >*, mlir::Pass> >, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Pass/Pass.cpp:452:0
#18 0x0000556e60226af0 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Pass/Pass.cpp:697:0
#19 0x0000556e60226938 mlir::PassManager::run(mlir::Operation*) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Pass/Pass.cpp:676:0
#20 0x0000556e601d2919 performActions(llvm::raw_ostream&, bool, bool, llvm::SourceMgr&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Support/MlirOptMain.cpp:80:0
#21 0x0000556e601d2c69 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool&, llvm::function_ref<void (mlir::MLIRContext&)>) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Support/MlirOptMain.cpp:123:0
#22 0x0000556e601d3055 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, llvm::function_ref<void (mlir::MLIRContext&)>) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Support/MlirOptMain.cpp:166:0
#23 0x0000556e601d32d8 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, bool, bool, bool, bool, bool, llvm::function_ref<void (mlir::MLIRContext&)>) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Support/MlirOptMain.cpp:186:0
#24 0x0000556e601d3fa6 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool, llvm::function_ref<void (mlir::MLIRContext&)>) /home/wmoses/git/Polygeist/llvm-project/mlir/lib/Support/MlirOptMain.cpp:289:0
#25 0x0000556e5e46d413 main /home/wmoses/git/Polygeist/llvm-project/mlir/tools/mlir-opt/mlir-opt.cpp:216:0
#26 0x00007f6f08ababf7 __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#27 0x0000556e5e46d0da _start (/home/wmoses/git/Polygeist/mlir-build/bin/mlir-opt+0x43a0da)
Segmentation fault (core dumped)
```
cc @ftynse
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs