nod-ai / SHARK-ModelDev

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

failed to legalize operation 'torch.operator' that was explicitly marked illegal : ONNX.Gather #853

Open pdhirajkumarprasad opened 1 month ago

pdhirajkumarprasad commented 1 month ago

for the given IR

module {
  func.func @"torch-jit-export"(%arg0: !torch.vtensor<[?,?],si64>, %arg1:!torch.vtensor<[28996,768],f16>) -> !torch.vtensor<[?,?,768],f16> attributes {torch.onnx_meta.ir_version = 7 : si64, torch.onnx_meta.opset_version = 12 : si64, torch.onnx_meta.producer_name = "onnxruntime.transformers", torch.onnx_meta.producer_version = "1.13.0"} {
    %362 = torch.operator "onnx.Gather"(%arg1, %arg0) : (!torch.vtensor<[28996,768],f16>, !torch.vtensor<[?,?],si64>) -> !torch.vtensor<[?,?,768],f16> 
    return %362 : !torch.vtensor<[?,?,768],f16>
  }
}

getting error as

t1.mlir:3:12: error: failed to legalize operation 'torch.operator' that was explicitly marked illegal

command:

torch-mlir-opt -split-input-file -verify-diagnostics -convert-torch-onnx-to-torch t1.mlir
zjgarvey commented 1 month ago

What models is this affecting? It seems like a versioning issue.