[PATCH] D146724: [mlir][MemRef] Add patterns to extract address computations

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 09:12:57 PDT 2023


qcolombet marked 3 inline comments as done.
qcolombet added inline comments.


================
Comment at: mlir/lib/Dialect/MemRef/Transforms/ExtractAddressComputations.cpp:223
+template <typename LoadStoreLikeOp,
+          FailureOr<Value> (*getFailureOrSrcMemRef)(LoadStoreLikeOp),
+          LoadStoreLikeOp (*rebuildOpFromAddressAndIndices)(
----------------
qcolombet wrote:
> nicolasvasilache wrote:
> > llvm::function_ref instad of C style funptrs ?
> Good point, I always forgot about these!
> (I start with std::function, then remember that templates don't like them and resort to plain C. I need to update my mental model :)).
Alright looks like we can't use them either. They suffer the same issue as `std::function`:
```
error: non-type template parameters of class type only available with ‘-std=c++20’ or ‘-std=gnu++20’
```

Am I missing something?


================
Comment at: mlir/test/Dialect/MemRef/extract-address-computations.mlir:287
+  %vcf0 = arith.constant dense<0.000000e+00> : vector<4x2xf16>
+  %res = vector.transfer_write %vcf0, %base[%offset0, %offset1, %offset2] { permutation_map = affine_map<(d0,d1,d2) -> (d2,d0)> } : vector<4x2xf16>, tensor<?x?x?xf16>
+  return %res : tensor<?x?x?xf16>
----------------
qcolombet wrote:
> nicolasvasilache wrote:
> > some examples with strides please that mirror my previous comment
> 👍
Only did one for `vector.transfer_write` (see `test_transfer_write_op_with_strides`).
Let me know if you want some for the others.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146724/new/

https://reviews.llvm.org/D146724



More information about the llvm-commits mailing list