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] scf-forall-to-for pass triggers Segmentation Fault. #130015

Closed
RiRi114 opened this issue Mar 6, 2025 · 1 comment
Closed

[MLIR] scf-forall-to-for pass triggers Segmentation Fault. #130015

RiRi114 opened this issue Mar 6, 2025 · 1 comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] duplicate Resolved as duplicate mlir:scf

Comments

@RiRi114
Copy link

RiRi114 commented Mar 6, 2025

Test on commit: 0f9720a

steps to reproduce:
mlir-opt temp.mlir -pass-pipeline='builtin.module(func.func(scf-forall-to-for))'

test case:

module {
  func.func @example_function(%upper_bound: index) {
    scf.forall (%i) in (%upper_bound) {
      // Possible processing can happen here, like a function call or operation
      // Here's a sample operation for illustration
      affine.yield %i : index
    }
    return
  }
}

crash trace:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/fuzzing/llvm-project/build/bin/mlir-opt temp.mlir -pass-pipeline=builtin.module(func.func(scf-forall-to-for))
1.      MLIR Parser: custom op parser 'builtin.module'
2.      MLIR Parser: custom op parser 'func.func'
3.      MLIR Parser: custom op parser 'scf.forall'
 #0 0x000000000113ce77 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x113ce77)
 #1 0x000000000113aa0e llvm::sys::RunSignalHandlers() (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x113aa0e)
 #2 0x000000000113d855 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007b4f87119520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000000003046fc7 mlir::scf::ForallOp::ensureTerminator(mlir::Region&, mlir::OpBuilder&, mlir::Location) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x3046fc7)
 #5 0x0000000003046d37 mlir::scf::ForallOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x3046d37)
 #6 0x00000000069b881e (anonymous namespace)::OperationParser::parseOperation() Parser.cpp:0:0
 #7 0x00000000069c3d01 (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&) Parser.cpp:0:0
 #8 0x00000000069c1b2a (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) Parser.cpp:0:0
 #9 0x00000000069bfbf9 (anonymous namespace)::CustomOpAsmParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) Parser.cpp:0:0
#10 0x00000000069bfc3c (anonymous namespace)::CustomOpAsmParser::parseOptionalRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) Parser.cpp:0:0
#11 0x0000000006ac872b mlir::function_interface_impl::parseFunctionOp(mlir::OpAsmParser&, mlir::OperationState&, bool, mlir::StringAttr, llvm::function_ref<mlir::Type (mlir::Builder&, llvm::ArrayRef<mlir::Type>, llvm::ArrayRef<mlir::Type>, mlir::function_interface_impl::VariadicFlag, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)>, mlir::StringAttr, mlir::StringAttr) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x6ac872b)
#12 0x00000000017e4928 mlir::func::FuncOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x17e4928)
#13 0x00000000069b881e (anonymous namespace)::OperationParser::parseOperation() Parser.cpp:0:0
#14 0x00000000069c3d01 (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&) Parser.cpp:0:0
#15 0x00000000069c198e (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) Parser.cpp:0:0
#16 0x00000000069bfbf9 (anonymous namespace)::CustomOpAsmParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) Parser.cpp:0:0
#17 0x00000000043648ce mlir::ModuleOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x43648ce)
#18 0x00000000069b881e (anonymous namespace)::OperationParser::parseOperation() Parser.cpp:0:0
#19 0x00000000069b7108 mlir::parseAsmSourceFile(llvm::SourceMgr const&, mlir::Block*, mlir::ParserConfig const&, mlir::AsmParserState*, mlir::AsmParserCodeCompleteContext*) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x69b7108)
#20 0x000000000424207f mlir::parseSourceFile(std::shared_ptr<llvm::SourceMgr> const&, mlir::Block*, mlir::ParserConfig const&, mlir::LocationAttr*) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x424207f)
#21 0x0000000004240f8e mlir::parseSourceFileForTool(std::shared_ptr<llvm::SourceMgr> const&, mlir::ParserConfig const&, bool) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x4240f8e)
#22 0x0000000004240793 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#23 0x0000000004240503 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&)::$_3>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#24 0x00000000042ec4e8 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) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x42ec4e8)
#25 0x000000000423a151 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x423a151)
#26 0x000000000423a403 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x423a403)
#27 0x000000000423a612 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x423a612)
#28 0x000000000111a8d7 main (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x111a8d7)
#29 0x00007b4f87100d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#30 0x00007b4f87100e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#31 0x000000000111a435 _start (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x111a435)
Segmentation fault (core dumped)
@llvmbot llvmbot added the mlir label Mar 6, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 6, 2025

@llvm/issue-subscribers-mlir

Author: None (RiRi114)

Test on commit: 0f9720a

steps to reproduce:
mlir-opt temp.mlir -pass-pipeline='builtin.module(func.func(scf-forall-to-for))'

test case:

module {
  func.func @<!-- -->example_function(%upper_bound: index) {
    scf.forall (%i) in (%upper_bound) {
      // Possible processing can happen here, like a function call or operation
      // Here's a sample operation for illustration
      affine.yield %i : index
    }
    return
  }
}

crash trace:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/fuzzing/llvm-project/build/bin/mlir-opt temp.mlir -pass-pipeline=builtin.module(func.func(scf-forall-to-for))
1.      MLIR Parser: custom op parser 'builtin.module'
2.      MLIR Parser: custom op parser 'func.func'
3.      MLIR Parser: custom op parser 'scf.forall'
 #<!-- -->0 0x000000000113ce77 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x113ce77)
 #<!-- -->1 0x000000000113aa0e llvm::sys::RunSignalHandlers() (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x113aa0e)
 #<!-- -->2 0x000000000113d855 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #<!-- -->3 0x00007b4f87119520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->4 0x0000000003046fc7 mlir::scf::ForallOp::ensureTerminator(mlir::Region&amp;, mlir::OpBuilder&amp;, mlir::Location) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x3046fc7)
 #<!-- -->5 0x0000000003046d37 mlir::scf::ForallOp::parse(mlir::OpAsmParser&amp;, mlir::OperationState&amp;) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x3046d37)
 #<!-- -->6 0x00000000069b881e (anonymous namespace)::OperationParser::parseOperation() Parser.cpp:0:0
 #<!-- -->7 0x00000000069c3d01 (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&amp;) Parser.cpp:0:0
 #<!-- -->8 0x00000000069c1b2a (anonymous namespace)::OperationParser::parseRegion(mlir::Region&amp;, llvm::ArrayRef&lt;mlir::OpAsmParser::Argument&gt;, bool) Parser.cpp:0:0
 #<!-- -->9 0x00000000069bfbf9 (anonymous namespace)::CustomOpAsmParser::parseRegion(mlir::Region&amp;, llvm::ArrayRef&lt;mlir::OpAsmParser::Argument&gt;, bool) Parser.cpp:0:0
#<!-- -->10 0x00000000069bfc3c (anonymous namespace)::CustomOpAsmParser::parseOptionalRegion(mlir::Region&amp;, llvm::ArrayRef&lt;mlir::OpAsmParser::Argument&gt;, bool) Parser.cpp:0:0
#<!-- -->11 0x0000000006ac872b mlir::function_interface_impl::parseFunctionOp(mlir::OpAsmParser&amp;, mlir::OperationState&amp;, bool, mlir::StringAttr, llvm::function_ref&lt;mlir::Type (mlir::Builder&amp;, llvm::ArrayRef&lt;mlir::Type&gt;, llvm::ArrayRef&lt;mlir::Type&gt;, mlir::function_interface_impl::VariadicFlag, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;&amp;)&gt;, mlir::StringAttr, mlir::StringAttr) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x6ac872b)
#<!-- -->12 0x00000000017e4928 mlir::func::FuncOp::parse(mlir::OpAsmParser&amp;, mlir::OperationState&amp;) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x17e4928)
#<!-- -->13 0x00000000069b881e (anonymous namespace)::OperationParser::parseOperation() Parser.cpp:0:0
#<!-- -->14 0x00000000069c3d01 (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&amp;) Parser.cpp:0:0
#<!-- -->15 0x00000000069c198e (anonymous namespace)::OperationParser::parseRegion(mlir::Region&amp;, llvm::ArrayRef&lt;mlir::OpAsmParser::Argument&gt;, bool) Parser.cpp:0:0
#<!-- -->16 0x00000000069bfbf9 (anonymous namespace)::CustomOpAsmParser::parseRegion(mlir::Region&amp;, llvm::ArrayRef&lt;mlir::OpAsmParser::Argument&gt;, bool) Parser.cpp:0:0
#<!-- -->17 0x00000000043648ce mlir::ModuleOp::parse(mlir::OpAsmParser&amp;, mlir::OperationState&amp;) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x43648ce)
#<!-- -->18 0x00000000069b881e (anonymous namespace)::OperationParser::parseOperation() Parser.cpp:0:0
#<!-- -->19 0x00000000069b7108 mlir::parseAsmSourceFile(llvm::SourceMgr const&amp;, mlir::Block*, mlir::ParserConfig const&amp;, mlir::AsmParserState*, mlir::AsmParserCodeCompleteContext*) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x69b7108)
#<!-- -->20 0x000000000424207f mlir::parseSourceFile(std::shared_ptr&lt;llvm::SourceMgr&gt; const&amp;, mlir::Block*, mlir::ParserConfig const&amp;, mlir::LocationAttr*) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x424207f)
#<!-- -->21 0x0000000004240f8e mlir::parseSourceFileForTool(std::shared_ptr&lt;llvm::SourceMgr&gt; const&amp;, mlir::ParserConfig const&amp;, bool) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x4240f8e)
#<!-- -->22 0x0000000004240793 performActions(llvm::raw_ostream&amp;, std::shared_ptr&lt;llvm::SourceMgr&gt; const&amp;, mlir::MLIRContext*, mlir::MlirOptMainConfig const&amp;) MlirOptMain.cpp:0:0
#<!-- -->23 0x0000000004240503 llvm::LogicalResult llvm::function_ref&lt;llvm::LogicalResult (std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt; &gt;, llvm::raw_ostream&amp;)&gt;::callback_fn&lt;mlir::MlirOptMain(llvm::raw_ostream&amp;, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt; &gt;, mlir::DialectRegistry&amp;, mlir::MlirOptMainConfig const&amp;)::$_3&gt;(long, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt; &gt;, llvm::raw_ostream&amp;) MlirOptMain.cpp:0:0
#<!-- -->24 0x00000000042ec4e8 mlir::splitAndProcessBuffer(std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt; &gt;, llvm::function_ref&lt;llvm::LogicalResult (std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt; &gt;, llvm::raw_ostream&amp;)&gt;, llvm::raw_ostream&amp;, llvm::StringRef, llvm::StringRef) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x42ec4e8)
#<!-- -->25 0x000000000423a151 mlir::MlirOptMain(llvm::raw_ostream&amp;, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt; &gt;, mlir::DialectRegistry&amp;, mlir::MlirOptMainConfig const&amp;) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x423a151)
#<!-- -->26 0x000000000423a403 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&amp;) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x423a403)
#<!-- -->27 0x000000000423a612 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&amp;) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x423a612)
#<!-- -->28 0x000000000111a8d7 main (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x111a8d7)
#<!-- -->29 0x00007b4f87100d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->30 0x00007b4f87100e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->31 0x000000000111a435 _start (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x111a435)
Segmentation fault (core dumped)

@EugeneZelenko EugeneZelenko added crash Prefer [crash-on-valid] or [crash-on-invalid] mlir:scf and removed mlir labels Mar 6, 2025
@EugeneZelenko EugeneZelenko added the duplicate Resolved as duplicate label Mar 24, 2025
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] duplicate Resolved as duplicate mlir:scf
Projects
None yet
Development

No branches or pull requests

4 participants