[PATCH] D135734: [NFC][mlir][MemRef] Make use of InferTypeOpInterface

Jacques Pienaar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 19:42:45 PDT 2022


jpienaar accepted this revision.
jpienaar added a comment.

LG thanks!

In D135734#3855171 <https://reviews.llvm.org/D135734#3855171>, @nicolasvasilache wrote:

> In D135734#3851289 <https://reviews.llvm.org/D135734#3851289>, @jpienaar wrote:
>
>> This seems like implementing the type inference trait would also result in this.
>
> Does implementing the type inference trait result in automatically emitted builders via Tablegen?
> If so, could we have some doc for this ?

It does yes, and let me follow up on docs (I thought it was but I'll check in morning).

> Generally, it would be good to have an Interface section in the docs mirrored on the MLIR website like we have for dialects so that a high-level overview gives the key information before digging into particulars.

Could you file an issue for this? This is good idea and we can autogenerate a lot of them ... We need to update a few things doc side (and definitely something which needs help and hands :-)).



================
Comment at: mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp:1257
+    SmallVectorImpl<Type> &inferredReturnTypes) {
+  auto sourceType = operands[0].getType().cast<MemRefType>();
+  unsigned sourceRank = sourceType.getRank();
----------------
You can use the OpAdaptor generated for this op if you want to use the generated accessor methods.


================
Comment at: mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp:1262
+      MemRefType::get({}, sourceType.getElementType(),
+                      MemRefLayoutAttrInterface{}, sourceType.getMemorySpace());
+  // Base.
----------------
It's been some time since I've worked with memrefs. To double check: they always have a memory space and rank? And it's fine to ignore layout here and just insert empty?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135734



More information about the llvm-commits mailing list