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

[mlir] -convert-tensor-to-linalg crashes #120947

Open
wwy6191 opened this issue Dec 23, 2024 · 0 comments · May be fixed by #121205
Open

[mlir] -convert-tensor-to-linalg crashes #120947

wwy6191 opened this issue Dec 23, 2024 · 0 comments · May be fixed by #121205
Assignees
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir

Comments

@wwy6191
Copy link

wwy6191 commented Dec 23, 2024

git version: bc29fc9

system: Ubuntu 18.04.6 LTS

reproduce with: mlir-opt -convert-tensor-to-linalg a.mlir

a.mlir:

func.func @tensor_pad_constant(%t: tensor<?x10xindex>,%l2:index,%h1:index,%h3: index) -> tensor<?x?xindex> {
  %0= tensor.pad %t low[5, %l2] high[%h1, %h3] {
  ^bb0(%arg0: index, %arg1: index):
    %c = arith.constant 50 : index
    tensor.yield %c : index
  } : tensor<?x10xindex> to tensor<?x?xindex>
  return %0 : tensor<?x?xindex>
}

module attributes {transform.with_named_sequence} {
  transform.named_sequence @__transform_main(%arg1:!transform.any_op {transform.readonly}) {
    %0 = transform.structured.match ops{["tensor.pad"]} in %arg1
      : (!transform.any_op) ->!transform.any_op
    transform.structured.rewrite_in_destination_passing_style %0
      : (!transform.any_op) ->!transform.any_op
      transform.yield
  }
}

stack trace:

mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/mlir/lib/IR/PatternMatch.cpp:182: auto mlir::RewriterBase::eraseOp(Operation *)::(anonymous class)::operator()(Operation *) const: Assertion `mayBeGraphRegion(*op->getParentRegion()) && "expected that op has no uses"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -convert-tensor-to-linalg /data/szy/MLIR/seed/seed29/tmp.QEAQVRHJ7x.mlir
 #0 0x00005652d744c508 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11ef508)
 #1 0x00005652d744a01e llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11ed01e)
 #2 0x00005652d744ce9d SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f84ae664420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f84adca100b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f84adc80859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
 #6 0x00007f84adc80729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
 #7 0x00007f84adc80729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
 #8 0x00007f84adc91fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #9 0x00005652da567df3 (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x430adf3)
#10 0x00005652da56782f std::_Function_handler<void (mlir::Operation*), mlir::RewriterBase::eraseOp(mlir::Operation*)::$_1>::_M_invoke(std::_Any_data const&, mlir::Operation*&&) PatternMatch.cpp:0:0
#11 0x00005652da5662fc mlir::RewriterBase::eraseOp(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x43092fc)
#12 0x00005652da40c3dd mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41af3dd)
#13 0x00005652da41236b mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41b536b)
#14 0x00005652da25a8c8 (anonymous namespace)::ConvertTensorToLinalgPass::runOnOperation() TensorToLinalgPass.cpp:0:0
#15 0x00005652da3adec6 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4150ec6)
#16 0x00005652da3ae7f0 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41517f0)
#17 0x00005652da3b0dc2 mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4153dc2)
#18 0x00005652da3a953a performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#19 0x00005652da3a918d llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#20 0x00005652da454c65 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41f7c65)
#21 0x00005652da3a3175 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4146175)
#22 0x00005652da3a341f mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x414641f)
#23 0x00005652da3a374e mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x414674e)
#24 0x00005652d742cff7 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11cfff7)
#25 0x00007f84adc82083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#26 0x00005652d742cb6e _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11cfb6e)
@github-actions github-actions bot added the mlir label Dec 23, 2024
@EugeneZelenko EugeneZelenko added the crash Prefer [crash-on-valid] or [crash-on-invalid] label Dec 23, 2024
@CoTinker CoTinker self-assigned this Dec 24, 2024
@CoTinker CoTinker linked a pull request Dec 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants