iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.
http://iree.dev/
Apache License 2.0
2.86k stars 622 forks source link

[GPU]: error: <unknown>:0:0: in function main_graph$async_dispatch_2_softmax_Dx9xf32_dispatch_tensor_store void (ptr addrspace(1), ptr addrspace(1), ptr addrspace(1), i32, i32): unsupported dynamic alloca #19181

Open pdhirajkumarprasad opened 1 week ago

pdhirajkumarprasad commented 1 week ago

What happened?

For the given IR

module {
  func.func @main_graph(%arg0: !torch.vtensor<[?,?,54],f32>) -> (!torch.vtensor<[?,1,9],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"} {
    %1 = torch.operator "onnx.Constant"() {torch.onnx.value = dense<1.0> : tensor<54xf32>} : () -> !torch.vtensor<[54],f32> 
    %2 = torch.operator "onnx.Add"(%1, %arg0) : (!torch.vtensor<[54],f32>, !torch.vtensor<[?,?,54],f32>) -> !torch.vtensor<[?,?,54],f32> 
    %3 = torch.operator "onnx.Constant"() {torch.onnx.value = dense_resource<__22> : tensor<3xsi64>} : () -> !torch.vtensor<[3],si64> 
    %4 = torch.operator "onnx.Reshape"(%2, %3) : (!torch.vtensor<[?,?,54],f32>, !torch.vtensor<[3],si64>) -> !torch.vtensor<[?,9,1],f32> 
    %5 = torch.operator "onnx.Transpose"(%4) {torch.onnx.perm = [0 : si64, 2 : si64, 1 : si64]} : (!torch.vtensor<[?,9,1],f32>) -> !torch.vtensor<[?,1,9],f32> 
    %6 = torch.operator "onnx.Softmax"(%5) {torch.onnx.axis = -1 : si64} : (!torch.vtensor<[?,1,9],f32>) -> !torch.vtensor<[?,1,9],f32> 
    return %6: !torch.vtensor<[?,1,9],f32>
  }
}

getting error as

error: <unknown>:0:0: in function main_graph$async_dispatch_2_softmax_Dx9xf32_dispatch_tensor_store void (ptr addrspace(1), ptr addrspace(1), ptr addrspace(1), i32, i32): unsupported dynamic alloca

while the model works fine in CPU

Steps to reproduce your issue

command:

iree-compile --iree-hal-target-backends=rocm --iree-hip-target=gfx942 -o abc.vmfb model.torch_onnx.mlir

version : IREE compiler version 3.0.0rc20241117 @ 29c451b00ecc9f9e5466e9d1079e0d69147da700

detail log:

dump.log

What component(s) does this issue relate to?

Compiler

Version information

No response

Additional context

No response