| Issue |
178820
|
| Summary |
mlir-opt --canonicalize crashes when folding shape.from_extents with ub.poison, triggered by smt.solver
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
compilerStudyer
|
mlir-opt version: -22.1.0-rc1
mlir-opt crashes when folding a shape.from_extents operation containing a ub.poison operand, and the crash is triggered when the result is used by an smt.solver operation. The assertion failure is: llvm::cast<mlir::IntegerAttr>() argument of incompatible type!.
Notably, if the **smt.solver** operation is commented out, the crash does not occur.
```mlir
module {
func.func @main() {
%0 = ub.poison : index
%1 = gpu.dynamic_shared_memory : memref<?xi8, #gpu.address_space<workgroup>>
%2 = llvm.inline_asm "gpu.barrier", "" : () -> !llvm.struct<(f32, f32)>
%3 = shape.from_extents %0 : index
smt.solver(%0, %1, %2, %3) : (index, memref<?xi8, #gpu.address_space<workgroup>>, !llvm.struct<(f32, f32)>, !shape.shape) -> () {
^bb0(%arg0: index, %arg1: memref<?xi8, #gpu.address_space<workgroup>>, %arg2: !llvm.struct<(f32, f32)>, %arg3: !shape.shape):
smt.yield
}
return
}
}
```
```
mlir-opt --canonicalize test.mlir
```
```
mlir-opt: /llvm-project-llvmorg-22.1.0-rc1/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(From&) [with To = mlir::IntegerAttr; From = mlir::Attribute]: 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 and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /llvmorg-22.1.0-install/bin/mlir-opt --canonicalize test.mlir
#0 0x00006182209f0e32 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/llvmorg-22.1.0-install/bin/mlir-opt+0x252fe32)
#1 0x00006182209ed5af llvm::sys::RunSignalHandlers() (/llvmorg-22.1.0-install/bin/mlir-opt+0x252c5af)
#2 0x00006182209ed6fc SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007e9890245330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x00007e989029eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007e989029eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x00007e989029eb2c pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x00007e989024527e raise ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007e98902288ff abort ./stdlib/abort.c:81:7
#9 0x00007e989022881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007e989023b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#11 0x00006182241a66a3 mlir::shape::FromExtentsOp::fold(mlir::shape::FromExtentsOpGenericAdaptor<llvm::ArrayRef<mlir::Attribute>>) (/llvmorg-22.1.0-install/bin/mlir-opt+0x5ce56a3)
#12 0x00006182241a67a9 llvm::LogicalResult llvm::detail::UniqueFunctionBase<llvm::LogicalResult, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&>::CallImpl<mlir::Op<mlir::shape::FromExtentsOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<mlir::shape::ShapeType>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::VariadicOperands, mlir::OpTrait::OpInvariants, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait, mlir::InferTypeOpInterface::Trait>::getFoldHookFn()::'lambda'(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) const>(void*, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/llvmorg-22.1.0-install/bin/mlir-opt+0x5ce57a9)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs