Issue 208331
Summary [mlir](convert-shard-to-mpi) mlir-opt crashes at Casting.h:566 with assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
Labels mlir
Assignees
Reporter Aran-414
    git version: d9681a08a79dc6c57b542483e829dc13c38009cb

MLIR Program:
```mlir
module {
  func.func @m0(%arg0: memref<4xf32>) -> () {
 %cst_1 = arith.constant 0.000000e+00 : f32
    %36 = vector.constant_mask [8] : vector<8xi1>
    %cst_12 = arith.constant 0.000000e+00 : f32
    %37 = vector.broadcast %cst_12 : f32 to vector<8xf32>
    %38 = vector.mask %36 { vector.multi_reduction <add>, %37, %cst_12 [0] : vector<8xf32> to f32 } : vector<8xi1> -> f32
    %39 = arith.addf %38, %cst_12 : f32
    return 
 }
  func.func @m47(%arg0: tensor<4xf32>) -> () {
    %send = shard.send %arg0 on @m64 destination = [] : (tensor<4xf32>) -> tensor<4xf32>
    return 
  }
  shard.grid @m64(shape = 2)
}
```

Reproduce Command: `mlir-opt --convert-shard-to-mpi a.mlir`

StackTrace:
```
a.mlir:12:13: error: failed to legalize operation 'shard.send' that was explicitly marked illegal: %0 = "shard.send"(%arg0) <{destination = array<i64>, grid = @m64, grid_axes = array<i16>}> : (tensor<4xf32>) -> tensor<4xf32>
    %send = shard.send %arg0 on @m64 destination = [] : (tensor<4xf32>) -> tensor<4xf32>
 ^
a.mlir:12:13: note: see current operation: %0 = "shard.send"(%arg0) <{destination = array<i64>, grid = @m64, grid_axes = array<i16>}> : (tensor<4xf32>) -> tensor<4xf32>
mlir-opt: /data2/dependency/dev/llvm-project/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(From&) [with To = mlir::Attribute; From = mlir::OpFoldResult]: 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: /data2/dependency/dev/llvm-project/build/bin/mlir-opt --convert-shard-to-mpi a.mlir
 #0 0x0000562306c0771f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x256f71f)
 #1 0x0000562306c03efc llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x256befc)
 #2 0x0000562306c04097 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007f489dfb5420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f489daa000b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007f489da7f859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007f489da7f729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007f489da90fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x000056230fa5b02f (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
 #9 0x000056230fa5d466 mlir::applyPatternsGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3c5466)
#10 0x00005623086330c7 (anonymous namespace)::ConvertShardToMPIPass::runOnOperation() ShardToMPI.cpp:0:0
#11 0x000056230faf98d1 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb4618d1)
#12 0x000056230faf9c60 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb461c60)
#13 0x000056230fafbd14 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb463d14)
#14 0x000056230fafcd91 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb464d91)
#15 0x0000562306ccd79b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#16 0x0000562306cce223 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#17 0x0000562306cce4ab llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, 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&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#18 0x000056230fecc915 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::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb834915)
#19 0x0000562306cc44f4 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#20 0x0000562306cce9c7 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x26369c7)
#21 0x0000562306ccec03 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2636c03)
#22 0x0000562306b4ca9c main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x24b4a9c)
#23 0x00007f489da81083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#24 0x0000562306be3d6e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x254bd6e)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to