Skip to content

Failed to compile onnx.Resize with dynamic shapes #3903

Open
@jinchen62

Description

Got the following error when lowering onnx.Resize with dynamic shapes.

error: failed to legalize operation 'arith.sitofp' that was explicitly marked illegal

Reproducer:

func.func @repro(%arg0: !torch.vtensor<[?,1280,?,?],f32>, %arg1: !torch.vtensor<[4],f32>) -> !torch.vtensor<[?,1280,?,?],f32> attributes {torch.onnx_meta.ir_version = 9 : si64, torch.onnx_meta.opset_version = 19 : si64, torch.onnx_meta.producer_name = "backend-test", torch.onnx_meta.producer_version = ""} {
  %none = torch.constant.none
  %0 = torch.operator "onnx.Resize"(%arg0, %none, %arg1) {torch.onnx.coordinate_transformation_mode = "asymmetric", torch.onnx.mode = "nearest", torch.onnx.nearest_mode = "floor"} : (!torch.vtensor<[?,1280,?,?],f32>, !torch.none, !torch.vtensor<[4],f32>) -> !torch.vtensor<[?,1280,?,?],f32>
  return %0 : !torch.vtensor<[?,1280,?,?],f32>
}

Commands:

torch-mlir-opt --torch-onnx-to-torch-backend-pipeline --convert-torch-to-linalg repro.mlir -o repro_linalg.mlir
iree-compile --iree-hal-target-backends=llvm-cpu --iree-llvmcpu-target-cpu=host repro_linalg.mlir -o test.vmfb

It's failing at https://github.com/llvm/torch-mlir/blob/main/lib/Conversion/TorchToLinalg/Uncategorized.cpp#L3187 when trying to convert the dynamic input shape to float for multiplying with scales.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions