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] Transform dialect interpreter crashed on unregistered ops #117281

Open
kuhar opened this issue Nov 22, 2024 · 3 comments
Open

[mlir] Transform dialect interpreter crashed on unregistered ops #117281

kuhar opened this issue Nov 22, 2024 · 3 comments
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir:transform_dialect

Comments

@kuhar
Copy link
Member

kuhar commented Nov 22, 2024

Repro:

// RUN: mlir-opt %s --transform-interpreter --allow-unregistered-dialect

module @named attributes { transform.with_named_sequence } {
  transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) -> () {
    "test.op_a"() : () -> ()
    transform.yield
  }
}

Error message:

mlir-opt: /home/jakub/iree/iree/third_party/llvm-project/llvm/include/llvm/Support/Casting.h:572: decltype(auto) llvm::cast(From &) [To = mlir::transform
::TransformOpInterface, From = mlir::Operation]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.                         
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.                                              
Stack dump:                                                                                                                                              
0.      Program arguments: llvm-project/bin/mlir-opt /home/jakub/iree/iree/compiler/src/iree/compiler/Codegen/Common/test/link_transform_named_sequences.
mlir --transform-interpreter --allow-unregistered-dialect                                                                                                
 #0 0x0000641bfd1562be llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/jakub/iree/iree/third_party/llvm-project/llvm/lib/Support/Unix/Signals.i
nc:723:13                                                                                                                                                
 #1 0x0000641bfd154595 llvm::sys::RunSignalHandlers() /home/jakub/iree/iree/third_party/llvm-project/llvm/lib/Support/Signals.cpp:106:18                 
 #2 0x0000641bfd15699d SignalHandler(int) /home/jakub/iree/iree/third_party/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1                         
 #3 0x00007620e1442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)                                                                                         
 #4 0x00007620e14969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76                                                                         
 #5 0x00007620e14969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10                                                                               
 #6 0x00007620e14969fc pthread_kill ./nptl/pthread_kill.c:89:10                                                                                          
 #7 0x00007620e1442476 gsignal ./signal/../sysdeps/posix/raise.c:27:6                                                                                    
 #8 0x00007620e14287f3 abort ./stdlib/abort.c:81:7                                                                                                       
 #9 0x00007620e142871b _nl_load_domain ./intl/loadmsgcat.c:1177:9                                                                                        
#10 0x00007620e1439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)                                                                                         
#11 0x0000641bff2385ca mlir::detail::Interface<mlir::transform::TransformOpInterface, mlir::Operation*, mlir::transform::detail::TransformOpInterfaceInte
rfaceTraits, mlir::Op<mlir::transform::TransformOpInterface>, mlir::OpTrait::TraitBase>::Interface(mlir::Operation*) /home/jakub/iree/iree/third_party/ll
vm-project/mlir/include/mlir/Support/InterfaceSupport.h:97:5                                                                                             
#12 0x0000641bff2385ca mlir::OpInterface<mlir::transform::TransformOpInterface, mlir::transform::detail::TransformOpInterfaceInterfaceTraits>::OpInterfac
e(mlir::Operation*) /home/jakub/iree/iree/third_party/llvm-project/mlir/include/mlir/IR/OpDefinition.h:2086:24                                           
#13 0x0000641bff2385ca mlir::transform::TransformOpInterface::TransformOpInterface(mlir::Operation*) /home/jakub/iree/build/relass/llvm-project/tools/mli
r/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h.inc:50:97                                                                              
#14 0x0000641bff2385ca llvm::CastInfo<mlir::transform::TransformOpInterface, mlir::Operation, void>::doCast(mlir::Operation&) /home/jakub/iree/iree/third
_party/llvm-project/mlir/include/mlir/IR/Operation.h:1125:52                                                                                             
#15 0x0000641bff2385ca decltype(auto) llvm::cast<mlir::transform::TransformOpInterface, mlir::Operation>(mlir::Operation&) /home/jakub/iree/iree/third_party/llvm-project/llvm/include/llvm/Support/Casting.h:573:10
#16 0x0000641bff2385ca applySequenceBlock(mlir::Block&, mlir::transform::FailurePropagationMode, mlir::transform::TransformState&, mlir::transform::TransformResults&) /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/IR/TransformOps.cpp:1786:30
#17 0x0000641bff23c06e mlir::transform::NamedSequenceOp::apply(mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/IR/TransformOps.cpp:0:10
#18 0x0000641bff1ea512 mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Model<mlir::transform::NamedSequenceOp>::apply(mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) /home/jakub/iree/build/relass/llvm-project/tools/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h.inc:477:3
#19 0x0000641bff9d0303 mlir::transform::TransformState::applyTransform(mlir::transform::TransformOpInterface) /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp:952:3
#20 0x0000641bff9dad61 mlir::transform::applyTransforms(mlir::Operation*, mlir::transform::TransformOpInterface, mlir::RaggedArray<llvm::PointerUnion<mlir::Operation*, mlir::Attribute, mlir::Value>> const&, mlir::transform::TransformOptions const&, bool, llvm::function_ref<void (mlir::transform::TransformState&)>, llvm::function_ref<llvm::LogicalResult (mlir::transform::TransformState&)>) /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp:2018:39
#21 0x0000641bff26b828 mlir::transform::applyTransformNamedSequence(mlir::RaggedArray<llvm::PointerUnion<mlir::Operation*, mlir::Attribute, mlir::Value>>, mlir::transform::TransformOpInterface, mlir::ModuleOp, mlir::transform::TransformOptions const&) /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterUtils.cpp:234:10
#22 0x0000641bff2669b3 (anonymous namespace)::InterpreterPass::runOnOperation() /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/Transforms/InterpreterPass.cpp:147:16

I'd expect this to exit with an error but not crash.

@kuhar
Copy link
Member Author

kuhar commented Nov 22, 2024

cc: @matthias-springer

@llvmbot
Copy link
Member

llvmbot commented Nov 22, 2024

@llvm/issue-subscribers-mlir

Author: Jakub Kuderski (kuhar)

Repro: ```mlir // RUN: mlir-opt %s --transform-interpreter --allow-unregistered-dialect

module @named attributes { transform.with_named_sequence } {
transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) -> () {
"test.op_a"() : () -> ()
transform.yield
}
}


Error message:

mlir-opt: /home/jakub/iree/iree/third_party/llvm-project/llvm/include/llvm/Support/Casting.h:572: decltype(auto) llvm::cast(From &) [To = mlir::transform
::TransformOpInterface, From = mlir::Operation]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: llvm-project/bin/mlir-opt /home/jakub/iree/iree/compiler/src/iree/compiler/Codegen/Common/test/link_transform_named_sequences.
mlir --transform-interpreter --allow-unregistered-dialect
#0 0x0000641bfd1562be llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/jakub/iree/iree/third_party/llvm-project/llvm/lib/Support/Unix/Signals.i
nc:723:13
#1 0x0000641bfd154595 llvm::sys::RunSignalHandlers() /home/jakub/iree/iree/third_party/llvm-project/llvm/lib/Support/Signals.cpp:106:18
#2 0x0000641bfd15699d SignalHandler(int) /home/jakub/iree/iree/third_party/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
#3 0x00007620e1442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007620e14969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007620e14969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x00007620e14969fc pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x00007620e1442476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007620e14287f3 abort ./stdlib/abort.c:81:7
#9 0x00007620e142871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007620e1439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x0000641bff2385ca mlir::detail::Interface<mlir::transform::TransformOpInterface, mlir::Operation*, mlir::transform::detail::TransformOpInterfaceInte
rfaceTraits, mlir::Op<mlir::transform::TransformOpInterface>, mlir::OpTrait::TraitBase>::Interface(mlir::Operation*) /home/jakub/iree/iree/third_party/ll
vm-project/mlir/include/mlir/Support/InterfaceSupport.h:97:5
#12 0x0000641bff2385ca mlir::OpInterface<mlir::transform::TransformOpInterface, mlir::transform::detail::TransformOpInterfaceInterfaceTraits>::OpInterfac
e(mlir::Operation*) /home/jakub/iree/iree/third_party/llvm-project/mlir/include/mlir/IR/OpDefinition.h:2086:24
#13 0x0000641bff2385ca mlir::transform::TransformOpInterface::TransformOpInterface(mlir::Operation*) /home/jakub/iree/build/relass/llvm-project/tools/mli
r/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h.inc:50:97
#14 0x0000641bff2385ca llvm::CastInfo<mlir::transform::TransformOpInterface, mlir::Operation, void>::doCast(mlir::Operation&) /home/jakub/iree/iree/third
_party/llvm-project/mlir/include/mlir/IR/Operation.h:1125:52
#15 0x0000641bff2385ca decltype(auto) llvm::cast<mlir::transform::TransformOpInterface, mlir::Operation>(mlir::Operation&) /home/jakub/iree/iree/third_party/llvm-project/llvm/include/llvm/Support/Casting.h:573:10
#16 0x0000641bff2385ca applySequenceBlock(mlir::Block&, mlir::transform::FailurePropagationMode, mlir::transform::TransformState&, mlir::transform::TransformResults&) /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/IR/TransformOps.cpp:1786:30
#17 0x0000641bff23c06e mlir::transform::NamedSequenceOp::apply(mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/IR/TransformOps.cpp:0:10
#18 0x0000641bff1ea512 mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Model<mlir::transform::NamedSequenceOp>::apply(mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) /home/jakub/iree/build/relass/llvm-project/tools/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h.inc:477:3
#19 0x0000641bff9d0303 mlir::transform::TransformState::applyTransform(mlir::transform::TransformOpInterface) /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp:952:3
#20 0x0000641bff9dad61 mlir::transform::applyTransforms(mlir::Operation*, mlir::transform::TransformOpInterface, mlir::RaggedArray<llvm::PointerUnion<mlir::Operation*, mlir::Attribute, mlir::Value>> const&, mlir::transform::TransformOptions const&, bool, llvm::function_ref<void (mlir::transform::TransformState&)>, llvm::function_ref<llvm::LogicalResult (mlir::transform::TransformState&)>) /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp:2018:39
#21 0x0000641bff26b828 mlir::transform::applyTransformNamedSequence(mlir::RaggedArray<llvm::PointerUnion<mlir::Operation*, mlir::Attribute, mlir::Value>>, mlir::transform::TransformOpInterface, mlir::ModuleOp, mlir::transform::TransformOptions const&) /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterUtils.cpp:234:10
#22 0x0000641bff2669b3 (anonymous namespace)::InterpreterPass::runOnOperation() /home/jakub/iree/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/Transforms/InterpreterPass.cpp:147:16


I'd expect this to exit with an error but not crash.
</details>

@EugeneZelenko EugeneZelenko added crash Prefer [crash-on-valid] or [crash-on-invalid] and removed mlir labels Nov 22, 2024
@CoTinker
Copy link
Contributor

I can't reproduce it. I get this.

test.mlir:3:5: error: 'test.op_a' op requires one result
    "test.op_a"() : () -> ()
    ^
test.mlir:3:5: note: see current operation: "test.op_a"() : () -> ()

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:transform_dialect
Projects
None yet
Development

No branches or pull requests

4 participants