nod-ai / SHARK-ModelDev

Unified compiler/runtime for interfacing with PyTorch Dynamo.
Apache License 2.0
95 stars 48 forks source link

crash for the use of onnx.Multinomial #854

Open pdhirajkumarprasad opened 1 month ago

pdhirajkumarprasad commented 1 month ago

for the given IR

module {
  func.func @"torch-jit-export"( %arg6: !torch.vtensor<[?,4],f32>) -> (!torch.vtensor<[?,1],si64>) attributes {torch.onnx_meta.ir_version = 6 : si64, torch.onnx_meta.opset_version = 21 : si64, torch.onnx_meta.producer_name = "pytorch", torch.onnx_meta.producer_version = "1.7"} {
    %82 = torch.operator "onnx.Multinomial"(%arg6) {torch.onnx.dtype = 7 : si64, torch.onnx.sample_size = 1 : si64} : (!torch.vtensor<[?,4],f32>) -> !torch.vtensor<[?,1],si64> 
    return %82: !torch.vtensor<[?,1],si64>
  }
}

seeing crash as

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: torch-mlir-opt --convert-torch-onnx-to-torch --torch-decompose-complex-ops -torch-backend-to-linalg-on-tensors-backend-pipeline t1.mlir
#0 0x0000564d19bf5060 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/proj/xhdhdstaff6/dhirajp/localBuild/torch-mlir/build/bin/torch-mlir-opt+0x1603060)
#1 0x0000564d19bf298e SignalHandler(int) Signals.cpp:0:0
#2 0x00007f333dfee520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x0000564d1baf4620 
Segmentation fault (core dumped)

command:

torch-mlir-opt -split-input-file -verify-diagnostics -convert-torch-onnx-to-torch t1.mlir