iree: Failed to legalize operation 'stream.cmd.dispatch'
For IR provided here
with
iree-compile uncased_transpose_repro.mlir --iree-hal-target-backends="rocm" --iree-rocm-target-chip=gfx942 -o dump.vmfb
OR
iree-compile uncased_transpose_repro.mlir --iree-hal-target-backends=llvm-cpu -o dump.vmfb
We get the following error
uncased_transpose_repro.mlir:92:11: error: failed to legalize operation 'stream.cmd.dispatch' that was explicitly marked illegal
%88 = torch.operator "onnx.Transpose"(%87) {torch.onnx.perm = [0 : si64, 2 : si64, 1 : si64, 3 : si64]} : (!torch.vtensor<[?,?,?,?],f32>) -> !torch.vtensor<[?,?,?,?],f32>
^
cased_MM.mlir:92:11: note: see current operation: "stream.cmd.dispatch"(%17, %18, %5, %6, %106, %108, %78, %80, %82, %84, <<UNKNOWN SSA VALUE>>, <<UNKNOWN SSA VALUE>>, %66, %42, %7, %7, %66, %42) <{entry_points = [@torch_jit$async_dispatch_10::@embedded_elf_x86_64::@torch_jit$async_dispatch_10_transpose_Dx12xDx64_f32], operandSegmentSizes = array<i32: 4, 6, 2, 2, 2, 2>, resource_accesses = [1 : i32, 2 : i32]}> : (index, index, index, index, i32, i32, i32, i32, i32, i32, !stream.resource<transient>, !stream.resource<external>, index, index, index, index, index, index) -> ()
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (18 by maintainers)
Commits related to this issue
- [Flow] Convert from tensor.cast to flow.tensor.reshape early (#18256) The reason to do this is that tensor.cast's can end up in dispatch regions and break the logic there. If they are converted to ... — committed to nod-ai/SRT by nirvedhmeshram 2 years ago
- [mlir][DispatchCreation] Avoid cloning for ops that are index return type dispatch operands. (#18377) Such operations are shape computations that need to happen on host. Fixes: https://github.com/ir... — committed to nod-ai/SRT by nirvedhmeshram 2 years ago
- [mlir][DispatchCreation] Avoid cloning for ops that are index return type dispatch operands. (#18377) Such operations are shape computations that need to happen on host. Fixes: https://github.com/ir... — committed to josemonsalve2/iree by nirvedhmeshram 2 years ago
- Revert `tensor.cast` to flow reshape conversion (#18772) Revert `tensor.cast` to `flow.tensor.reshape` conversion because this is occurring too early. This happens as early as `GlobalOptimization` si... — committed to iree-org/iree by IanWood1 2 years ago
That’s good. I’m getting the new error for rocm mentioned in the above link.
For llvm-cpu, I am still getting the
cmd.stream.dispatcherror for all four test cases besides thetransposeone, so I’d like to keep this issue open for CPU.@zjgarvey with the recent gist https://gist.github.com/zjgarvey/1bf521f50d3928596c2198bf734eb973 is the failure
As mentioned in a previous issue that is to do with the wrong way of elliding variables in the repros?
Cross linking https://github.com/llvm/torch-mlir/issues/3647 as related issues
That might be tricky becuase tensors in the inner computation are also getting converted e.g
becomes
Edit: I see that the guard that should prevent this from happening just needs updating, I can do that.