iree: Failure in EliminateEmptyTensors pass fails
With this input
module {
func.func @_pad_1D_test_dispatch_0() {
%c7 = arith.constant 7 : index
%c0 = arith.constant 0 : index
%c0_i32 = arith.constant 0 : i32
%0 = hal.interface.binding.subspan set(0) binding(0) type(storage_buffer) offset(%c0) alignment(64) : !flow.dispatch.tensor<readonly:tensor<2xi32>>
%1 = hal.interface.binding.subspan set(0) binding(1) type(storage_buffer) offset(%c0) alignment(64) : !flow.dispatch.tensor<writeonly:tensor<7xi32>>
%workgroup_id_x = hal.interface.workgroup.id[0] : index
%workgroup_count_x = hal.interface.workgroup.count[0] : index
scf.for %arg0 = %workgroup_id_x to %c7 step %workgroup_count_x {
%2 = affine.max affine_map<(d0) -> (-d0 + 3, 0)>(%arg0)
%3 = affine.max affine_map<(d0) -> (0, d0 - 3)>(%arg0)
%4 = affine.min affine_map<(d0) -> (2, d0)>(%3)
%5 = affine.max affine_map<(d0) -> (0, d0 - 2)>(%arg0)
%6 = affine.min affine_map<(d0) -> (2, d0)>(%5)
%7 = affine.apply affine_map<(d0, d1) -> (d0 - d1)>(%6, %4)
%8 = arith.cmpi eq, %7, %c0 : index
%9 = affine.apply affine_map<(d0, d1, d2) -> (-d0 - d1 + d2 + 1)>(%2, %6, %4)
%10 = scf.if %8 -> (tensor<1xi32>) {
%generated = tensor.generate {
^bb0(%arg1: index):
tensor.yield %c0_i32 : i32
} : tensor<1xi32>
scf.yield %generated : tensor<1xi32>
} else {
%11 = flow.dispatch.tensor.load %0, offsets = [%4], sizes = [%7], strides = [1] : !flow.dispatch.tensor<readonly:tensor<2xi32>> -> tensor<?xi32>
%padded = tensor.pad %11 low[%2] high[%9] {
^bb0(%arg1: index):
tensor.yield %c0_i32 : i32
} : tensor<?xi32> to tensor<1xi32>
scf.yield %padded : tensor<1xi32>
}
flow.dispatch.tensor.store %10, %1, offsets = [%arg0], sizes = [1], strides = [1] : tensor<1xi32> -> !flow.dispatch.tensor<writeonly:tensor<7xi32>>
}
return
}
}
iree-opt --iree-eliminate-empty-tensors repro.mlir
fails with the following error
$ ~/iree/build_debug/tools/iree-opt --iree-eliminate-empty-tensors elimiate_empty_tensors.repro.mlir
elimiate_empty_tensors.repro.mlir:24:9: error: operand #0 of ReturnLike op does not satisfy destination passing style
scf.yield %generated : tensor<1xi32>
^
elimiate_empty_tensors.repro.mlir:24:9: note: see current operation: "scf.yield"(%16) : (tensor<1xi32>) -> ()
elimiate_empty_tensors.repro.mlir:31:9: error: operand #0 of ReturnLike op does not satisfy destination passing style
scf.yield %padded : tensor<1xi32>
^
elimiate_empty_tensors.repro.mlir:31:9: note: see current operation: "scf.yield"(%17) : (tensor<1xi32>) -> ()
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 22 (22 by maintainers)
Commits related to this issue
- [WIP] Data Tiling for GPU This is a WIP PR that shows first attempt for data tiling for GPUs. It implementes materialization for the encoding. Note that, PR cannot compile any program. Because it ge... — committed to grypp/iree by grypp a year ago
- Pad fusion bufferization workaround. It seems like handling the code generated by the tiling of pad operations needs more work in bufferization. To unblock the work of handling pad operations nativel... — committed to MaheshRavishankar/iree by deleted user a year ago
- Pad fusion bufferization workaround. (#12425) It seems like handling the code generated by the tiling of pad operations needs more work in bufferization. To unblock the work of handling pad operation... — committed to iree-org/iree by MaheshRavishankar a year ago
- Pad fusion bufferization workaround. (#12425) It seems like handling the code generated by the tiling of pad operations needs more work in bufferization. To unblock the work of handling pad operation... — committed to qedawkins/iree by MaheshRavishankar a year ago
- Pad fusion bufferization workaround. (#12425) It seems like handling the code generated by the tiling of pad operations needs more work in bufferization. To unblock the work of handling pad operation... — committed to iree-org/iree by MaheshRavishankar a year ago
- Pad fusion bufferization workaround. (#12425) It seems like handling the code generated by the tiling of pad operations needs more work in bufferization. To unblock the work of handling pad operation... — committed to plaidml/iree by MaheshRavishankar a year ago
- Pad fusion bufferization workaround. (#12425) It seems like handling the code generated by the tiling of pad operations needs more work in bufferization. To unblock the work of handling pad operation... — committed to NatashaKnk/iree by MaheshRavishankar a year ago
Step 3: https://reviews.llvm.org/D142480. This is a general CSE for
scf.if
branches. It can hoist+CSE anything, not justmemref.subview
.