Skip to content

Assertion `result && "Zero-sized vectors are not allowed"' #913

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 10, 2025 · 1 comment
Open

Assertion `result && "Zero-sized vectors are not allowed"' #913

pravg-amd opened this issue Feb 10, 2025 · 1 comment

Comments

@pravg-amd
Copy link

For the below IR,

module {
  func.func @fcos_resnet50(%arg0: !torch.vtensor<[],i1>, %arg1: !torch.vtensor<[?,3],si64>) -> !torch.vtensor<[?],si64> attributes {torch.onnx_meta.ir_version = 8 : si64, torch.onnx_meta.opset_version = 21 : si64, torch.onnx_meta.opset_versions = {ai.onnx.ml = 5 : si64, ai.onnx.preview.training = 1 : si64, ai.onnx.training = 1 : si64, com.microsoft = 1 : si64, com.microsoft.experimental = 1 : si64, com.microsoft.nchwc = 1 : si64, org.pytorch.aten = 1 : si64}, torch.onnx_meta.producer_name = "pytorch", torch.onnx_meta.producer_version = "2.1.0"} {
    %1254 = torch.operator "onnx.If"(%arg0) : (!torch.vtensor<[],i1>) -> !torch.vtensor<[?],si64> {
      %1274 = torch.operator "onnx.Constant"() {torch.onnx.value = dense_resource<_3819> : tensor<1xsi64>} : () -> !torch.vtensor<[1],si64>
      %1277 = torch.operator "onnx.Constant"() {torch.onnx.value = dense_resource<_3817> : tensor<1xsi64>} : () -> !torch.vtensor<[1],si64>
      %1292 = torch.operator "onnx.Gather"(%arg1, %1277) {torch.onnx.axis = 1 : si64} : (!torch.vtensor<[?,3],si64>, !torch.vtensor<[1],si64>) -> !torch.vtensor<[?,1],si64>
      %1293 = torch.operator "onnx.Squeeze"(%1292, %1274) : (!torch.vtensor<[?,1],si64>, !torch.vtensor<[1],si64>) -> !torch.vtensor<[?],si64>
      torch.operator_terminator %1293 : !torch.vtensor<[?],si64>
    }, {
      %1273 = torch.operator "onnx.Constant"() {torch.onnx.value = dense_resource<_3790> : tensor<0xsi64>} : () -> !torch.vtensor<[0],si64>
      torch.operator_terminator %1273 : !torch.vtensor<[0],si64>
    }
    return %1254 : !torch.vtensor<[?],si64>
  }
}

{-#
  dialect_resources: {
    builtin: {
      _3819: "0x080000000100000000000000",
      _3817: "0x080000000200000000000000",
      _3790: "0x08000000"
    }
  }
#-}

Getting error as

iree-compile: ~/iree/third_party/llvm-project/mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp:57: void mlir::arith::ConstantOp::inferResultRanges(ArrayRef<ConstantIntRanges>, SetIntRangeFn): Assertion `result && "Zero-sized vectors are not allowed"' failed.

Command:

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

Models Impacted:

fcos_resnet50_fpn_Opset16_torchvision
fcos_resnet50_fpn_Opset17_torchvision
retinanet_resnet50_fpn_v2_Opset17_torchvision
retinanet_resnet50_fpn_v2_Opset18_torchvision
retinanet_resnet50_fpn_v2_Opset16_torchvision

@pravg-amd
Copy link
Author

The constant in the imported IR doesn't seem to be a valid number

%1273 = torch.operator "onnx.Constant"() {torch.onnx.value = dense_resource<_3790> : tensor<0xsi64>} : () -> !torch.vtensor<[0],si64>

{-#
  dialect_resources: {
    builtin: {
      _3790: "0x08000000"
    }
  }
#-}

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

1 participant