[PATCH] D80017: [mlir] Fix incorrect indexing of subview in DimOp folding.
Nicolas Vasilache via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 15 10:51:41 PDT 2020
nicolasvasilache marked 2 inline comments as done.
nicolasvasilache added inline comments.
================
Comment at: mlir/lib/Dialect/StandardOps/IR/Ops.cpp:1344
if (auto subview = dyn_cast_or_null<SubViewOp>(memref)) {
- auto sizes = subview.sizes();
- if (!sizes.empty())
- return *(sizes.begin() + getIndex());
+ assert(subview.isDynamicSize(getIndex()) &&
+ "Expected dynamic subview size");
----------------
mravishankar wrote:
> Does this has to be an assert? Is it possible that the subview op has been canonicalized, but the dim op hasnt in which case the subview op will have a static size. You can just return {} if it is not dynamic for now.
I think so: if the size was static we would have been done at the beginning gettin the information from the memref type.
If not, then we expect to have a dynamic index.
Otherwise the subview itself would be inconsistent and we'd definitely want to fail hard there.
I note however I also need to update the comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80017/new/
https://reviews.llvm.org/D80017
More information about the llvm-commits
mailing list