[flang-commits] [llvm] [clang] [clang-tools-extra] [libc] [flang] [libcxx] [compiler-rt] [mlir] [mlir][Linalg] Support dynamic tiles in `lower_pack` transform (PR #76003)

via flang-commits flang-commits at lists.llvm.org
Thu Jan 4 10:34:52 PST 2024


srcarroll wrote:

It was suggested to me by @chelini to only have the `reshape` op to handle all cases and get rid of the `expand_shape` op.  We can then implement a canonicalizer to convert when valid.  I'm all for this, however want to make sure this is the direction we want to go before I start making test changes.  Because there will be a lot.  For each test there will be several extra lines for populating the `shape` operand of `reshape`, like (from the test i added in this PR)
```
// CHECK-DAG:   %[[C3:.*]] = arith.constant 3 : index
// CHECK-DAG:   %[[C2:.*]] = arith.constant 2 : index
// CHECK-DAG:  %[[DIM2:.*]] = tensor.dim %[[ARG1]], %[[C2]]
// CHECK-DAG:  %[[DIM3:.*]] = tensor.dim %[[ARG1]], %[[C3]]
// CHECK-NEXT:  %[[INIT_SHAPE:.*]] = tensor.empty() : tensor<4xindex>
// CHECK-NEXT:  %[[SHAPE0:.*]] = tensor.insert %[[DIM0]] into %[[INIT_SHAPE]][%[[C0]]]
// CHECK-NEXT:  %[[SHAPE1:.*]] = tensor.insert %[[DIM2]] into %[[SHAPE0]][%[[C1]]]
// CHECK-NEXT:  %[[SHAPE2:.*]] = tensor.insert %[[DIM1]] into %[[SHAPE1]][%[[C2]]]
// CHECK-NEXT:  %[[SHAPE3:.*]] = tensor.insert %[[DIM3]] into %[[SHAPE2]][%[[C3]]]
// CHECK-NEXT:  %[[EXPANDED:.*]] = tensor.reshape %[[PADDED]](%[[SHAPE3]])
```
Since this is a relatively expensive change, I'd like to get opinions before I do it.

https://github.com/llvm/llvm-project/pull/76003


More information about the flang-commits mailing list