Skip to content

failed to legalize operation 'torch.constant.int' -> RoiAlign lowering support is missing #908

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

Open
pravg-amd opened this issue Feb 7, 2025 · 1 comment
Assignees

Comments

@pravg-amd
Copy link

pravg-amd commented Feb 7, 2025

For the below IR

func.func @main(%arg0: !torch.vtensor<[?,256,?,?],f32>, %arg1: !torch.vtensor<[?,4],f32>,  %arg2: !torch.vtensor<[?],si64>) ->  !torch.vtensor<[?,256,7,7],f32> attributes {torch.onnx_meta.ir_version = 4 : si64, torch.onnx_meta.opset_version = 21 : si64, torch.onnx_meta.producer_name = "pytorch", torch.onnx_meta.producer_version = "1.1"} {
  %0 = torch.operator "onnx.RoiAlign"(%arg0, %arg1, %arg2) {torch.onnx.coordinate_transformation_mode = "output_half_pixel", torch.onnx.output_height = 7 : si64, torch.onnx.output_width = 7 : si64, torch.onnx.sampling_ratio = 2 : si64, torch.onnx.spatial_scale = 1.250000e-01 : f32} : (!torch.vtensor<[?,256,?,?],f32>, !torch.vtensor<[?,4],f32>, !torch.vtensor<[?],si64>) -> !torch.vtensor<[?,256,7,7],f32>
  return %0 : !torch.vtensor<[?,256,7,7],f32>
}

Getting the error as

 error: failed to legalize operation 'torch.constant.int'
 note: see current operation: %1 = "torch.constant.int"() <{value = 2 : i64}> : () -> !torch.int

Command

 iree-compile --iree-hal-target-backends=llvm-cpu --iree-llvmcpu-target-cpu=host -o test.vmfb model_torch_onnx.mlir 

Models impacted:

MaskRCNN-10
MaskRCNN-12
MaskRCNN-12-qdq
fasterrcnn_mobilenet_v3_large_320_fpn_Opset16_torchvision
fasterrcnn_mobilenet_v3_large_320_fpn_Opset17_torchvision
fasterrcnn_mobilenet_v3_large_320_fpn_Opset18_torchvision
fasterrcnn_mobilenet_v3_large_fpn_Opset16_torchvision
fasterrcnn_mobilenet_v3_large_fpn_Opset17_torchvision
fasterrcnn_mobilenet_v3_large_fpn_Opset18_torchvision
FasterRCNN-10
FasterRCNN-12
FasterRCNN-12-qdq
fasterrcnn_resnet50_fpn_v2_Opset16_torchvision
fasterrcnn_resnet50_fpn_v2_Opset17_torchvision
fasterrcnn_resnet50_fpn_v2_Opset18_torchvision

@Muzammiluddin-Syed-ECE
Copy link

Error reproduced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants