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

[TorchToLinalg] Issue Tracking for Convolution Support #3858

Open
5 tasks
zjgarvey opened this issue Nov 7, 2024 · 1 comment
Open
5 tasks

[TorchToLinalg] Issue Tracking for Convolution Support #3858

zjgarvey opened this issue Nov 7, 2024 · 1 comment

Comments

@zjgarvey
Copy link
Collaborator

zjgarvey commented Nov 7, 2024

There is some missing support for lowering aten.convolution to linalg:

Please feel free to file issues for individual items and link them here.

@pdhirajkumarprasad
Copy link
Contributor

pdhirajkumarprasad commented Dec 3, 2024

Here are the issues that we are seeing in models

1>

module {
  func.func @main_graph( %arg1: !torch.vtensor<[1,96,1,1],f32>) -> !torch.vtensor<[1,32,1,1],f32>  attributes {torch.onnx_meta.ir_version = 8 : si64, torch.onnx_meta.opset_version = 21 : si64, torch.onnx_meta.opset_versions = {ai.onnx.contrib = 1 : si64}, torch.onnx_meta.producer_name = "vai_q_onnx", torch.onnx_meta.producer_version = "1.17.0+5e1d84e"} {
    %54 = torch.operator "onnx.Constant"() {torch.onnx.value = dense<1.0> : tensor<32x24x1x1xf32>} : () -> !torch.vtensor<[32,24,1,1],f32> 
    %57 = torch.operator "onnx.Constant"() {torch.onnx.value = dense<1.0> : tensor<32xf32>} : () -> !torch.vtensor<[32],f32> 
    %1070 = torch.operator "onnx.Conv"(%arg1, %54, %57) {torch.onnx.dilations = [1 : si64, 1 : si64], torch.onnx.group = 4 : si64, torch.onnx.kernel_shape = [1 : si64, 1 : si64], torch.onnx.pads = [0 : si64, 0 : si64, 0 : si64, 0 : si64], torch.onnx.strides = [1 : si64, 1 : si64]} : (!torch.vtensor<[1,96,1,1],f32>, !torch.vtensor<[32,24,1,1],f32>, !torch.vtensor<[32],f32>) -> !torch.vtensor<[1,32,1,1],f32> 
    return %1070 : !torch.vtensor<[1,32,1,1],f32>
  }
}

error

model.torch_onnx.mlir:5:13: error: 'linalg.generic' op write affecting operations on global resources are restricted to workgroup distributed contexts.
    %1070 = torch.operator "onnx.Conv"(%arg1, %54, %57) {torch.onnx.dilations = [1 : si64, 1 : si64], torch.onnx.group = 4 : si64, torch.onnx.kernel_shape = [1 : si64, 1 : si64], torch.onnx.pads = [0 : si64, 0 : si64, 0 : si64, 0 : si64], torch.onnx.strides = [1 : si64, 1 : si64]} : (!torch.vtensor<[1,96,1,1],f32>, !torch.vtensor<[32,24,1,1],f32>, !torch.vtensor<[32],f32>) -> !torch.vtensor<[1,32,1,1],f32> 
            ^
model.torch_onnx.mlir:5:13: note: see current operation: 

2>

module {
  func.func @main_graph( %arg3: !torch.vtensor<[?,768,?],f32>) -> (!torch.vtensor<[?,768,?],f32> ) attributes {torch.onnx_meta.ir_version = 6 : si64, torch.onnx_meta.opset_version = 21 : si64, torch.onnx_meta.producer_name = "pytorch", torch.onnx_meta.producer_version = "2.4.0"} {
    %5 = torch.operator "onnx.Constant"() {torch.onnx.value = dense<1.0> : tensor<768x192x1xf32>} : () -> !torch.vtensor<[768,192,1],f32> 
    %6 = torch.operator "onnx.Constant"() {torch.onnx.value = dense<1.0> : tensor<768xf32>} : () -> !torch.vtensor<[768],f32> 
    %237 = torch.operator "onnx.Conv"(%arg3, %5, %6) {torch.onnx.dilations = [1 : si64], torch.onnx.group = 4 : si64, torch.onnx.kernel_shape = [1 : si64], torch.onnx.pads = [0 : si64, 0 : si64], torch.onnx.strides = [1 : si64]} : (!torch.vtensor<[?,768,?],f32>, !torch.vtensor<[768,192,1],f32>, !torch.vtensor<[768],f32>) -> !torch.vtensor<[?,768,?],f32> 
    return %237 : !torch.vtensor<[?,768,?],f32>
  }
}

error:

model.torch_onnx.mlir:5:12: error: failed to legalize operation 'torch.aten.convolution' that was explicitly marked illegal
    %237 = torch.operator "onnx.Conv"(%arg3, %5, %6) {torch.onnx.dilations = [1 : si64], torch.onnx.group = 4 : si64, torch.onnx.kernel_shape = [1 : si64], torch.onnx.pads = [0 : si64, 0 : si64], torch.onnx.strides = [1 : si64]} : (!torch.vtensor<[?,768,?],f32>, !torch.vtensor<[768,192,1],f32>, !torch.vtensor<[768],f32>) -> !torch.vtensor<[?,768,?],f32> 
           ^
model.torch_onnx.mlir:5:12: note: see current operation: %9 = "torch.aten.convolution"(%arg3, %3, %4, %7, %6, %7, %1, %8, %0) : (!torch.vtensor<[?,768,?],f32>, !torch.vtensor<[768,192,1],f32>, !torch.vtensor<[768],f32>, !torch.list<int>, !torch.list<int>, !torch.list<int>, !torch.bool, !torch.list<int>, !torch.int) -> !torch.vtensor<[?,768,?],f32>

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