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

convert aten kernel "index_add_" to linalg error: failed to legalize operation 'torch.constant.int' #3020

Open
ha-horse opened this issue Mar 13, 2024 · 0 comments

Comments

@ha-horse
Copy link

ha-horse commented Mar 13, 2024

please help me

// -----// IR Dump After FinalizingBackendTypeConversion Failed (torch-finalizing-backend-type-conversion) ('func.func' operation: @main) //----- //
module {
  ml_program.global private mutable @global_seed(dense<0> : tensor<i64>) : tensor<i64>
  func.func @main(%arg0: tensor<128x128xf32>, %arg1: i64, %arg2: tensor<3xi64>, %arg3: tensor<3x3xf32>) -> (tensor<128x128xf32>, tensor<128x128xf32>) {
    %int1 = torch.constant.int 1
    %int0 = torch.constant.int 0
    %0 = torch_c.from_builtin_tensor %arg3 : tensor<3x3xf32> -> !torch.vtensor<[3,3],f32>
    %1 = torch_c.from_builtin_tensor %arg2 : tensor<3xi64> -> !torch.vtensor<[3],si64>
    %2 = torch_c.from_builtin_tensor %arg0 : tensor<128x128xf32> -> !torch.vtensor<[128,128],f32>
    %3 = torch.operator "torch.aten.index_add"(%2, %int0, %1, %0, %int1) : (!torch.vtensor<[128,128],f32>, !torch.int, !torch.vtensor<[3],si64>, !torch.vtensor<[3,3],f32>, !torch.int) -> !torch.vtensor<[128,128],f32> 
    %4 = torch_c.to_builtin_tensor %3 : !torch.vtensor<[128,128],f32> -> tensor<128x128xf32>
    return %4, %4 : tensor<128x128xf32>, tensor<128x128xf32>
  }
}

python exception: Failure while executing pass pipeline:
error: unknown: failed to legalize operation 'torch.constant.int'
note: unknown: see current operation: %0 = "torch.constant.int"() <{value = 1 : i64}> : () -> !torch.int
@ha-horse ha-horse changed the title howto convert an aten kernel to linalg how to convert an aten kernel to linalg Mar 13, 2024
@ha-horse ha-horse changed the title how to convert an aten kernel to linalg convert aten kernelindex_add_ to linalg Mar 15, 2024
@ha-horse ha-horse changed the title convert aten kernelindex_add_ to linalg convert aten kernel "index_add_" to linalg error: failed to legalize operation 'torch.constant.int' Mar 15, 2024
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