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

[compile][cpu]: failed to legalize operation 'torch.operator' that was explicitly marked illegal(onnx.Gather) #18295

Closed
pdhirajkumarprasad opened this issue Aug 20, 2024 · 2 comments
Labels
bug 🐞 Something isn't working

Comments

@pdhirajkumarprasad
Copy link

What happened?

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

model.torch_onnx.mlir:3:12: error: failed to legalize operation 'torch.operator' that was explicitly marked illegal
    %362 = torch.operator "onnx.Gather"(%arg1, %arg0) : (!torch.vtensor<[28996,768],f16>, !torch.vtensor<[?,?],si64>) -> !torch.vtensor<[?,?,768],f16> 
           ^
model.torch_onnx.mlir:3:12: note: see current operation: %0 = "torch.operator"(%arg1, %arg0) <{name = "onnx.Gather"}> : (!torch.vtensor<[28996,768],f16>, !torch.vtensor<[?,?],si64>) -> !torch.vtensor<[?,?,768],f16>
// -----// IR Dump After ConvertTorchOnnxToTorch Failed (convert-torch-onnx-to-torch) //----- //
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"} {
  %0 = torch.operator "onnx.Gather"(%arg1, %arg0) : (!torch.vtensor<[28996,768],f16>, !torch.vtensor<[?,?],si64>) -> !torch.vtensor<[?,?,768],f16> 
  return %0 : !torch.vtensor<[?,?,768],f16>
}

// -----// IR Dump After AutoInputConversionPipelinePass Failed (iree-auto-input-conversion) //----- //
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"} {
    %0 = torch.operator "onnx.Gather"(%arg1, %arg0) : (!torch.vtensor<[28996,768],f16>, !torch.vtensor<[?,?],si64>) -> !torch.vtensor<[?,?,768],f16> 
    return %0 : !torch.vtensor<[?,?,768],f16>
  }
}

Steps to reproduce your issue

Step to reproduce:

iree-compile model.torch_onnx.mlir --iree-hal-target-backends=llvm-cpu --iree-input-demote-i64-to-i32 --mlir-print-ir-after-all

IREE version:
IREE compiler version 20240819.990 @ aeda149
LLVM version 20.0.0git

What component(s) does this issue relate to?

Compiler

Version information

No response

Additional context

No response

@pdhirajkumarprasad pdhirajkumarprasad added the bug 🐞 Something isn't working label Aug 20, 2024
@nirvedhmeshram
Copy link
Contributor

I think you might want to file this in torch-mlir as this is failing in convert-torch-onnx-to-torch

@pdhirajkumarprasad
Copy link
Author

closing this as open in torch-mlir nod-ai/SHARK-ModelDev#853

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants