Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/StandardOps/Transforms/ComposeSubView.cpp | ||
---|---|---|
77 | FYI LLVM is still using C++14, this won't build with all of our supported platforms unfortunately (it is neat though!) |
mlir/lib/Dialect/StandardOps/Transforms/ComposeSubView.cpp | ||
---|---|---|
69 | Not sure about the math for strides != 1. It can have weird corner cases (I am not saying it doesnt work, or I have a specific flaw I see in the code here, but just an intuition). Unless really needed, maybe restrict to strides = 1 case in source and dest subviews? | |
117 | If one of the offsets is a constant then you can construct the affine map with the constant already. So do something like this AffineExpr expr; SmallVector<Value> operands; auto addValueOrAttr = [&](OpFoldResult valueOrAttr) { if (auto attr = valueOrAttr.dyn_cast<Attribute>()) { expr = expr + attr.cast<IntegerAttr>().getInt(); } else { expr = expr + getAffineSymbolExpr(operands.size()); operands.push_back(valueOrAttr.get<Value>()); } }; AffineMap map = AffineMap::get(0, operands.size(), expr); |
Thanks. Just a few minor nits, this time around.
mlir/lib/Dialect/StandardOps/Transforms/ComposeSubView.cpp | ||
---|---|---|
69 | Just to make it cleaner. Just add the strides == 1 check outside of the loop. You dont need to iterate over it here. Makes it simpler to read. Also you can just create the strides for the result later on. | |
84 | All the stride stuff is better checked before. You just need this check if (llvm::any_of(strides, [](OpFoldResult &valueOrAttr) { Attribute attr = valueOrAttr.dyn_cast<Attribute>(); return attr && attr.cast<IntegerAttr>().getInt() == 1; } So you ca | |
97 | Nit: I think you can drop the if here and get result below using Value result = affineMapToValues(rewriter, loc, AffineMap::get(0, affineApplyOperands.size(), expr), affineApplyOperands)[0]; More readable (to me). |
LGTM-ing this based on the strides being checked ahead of time (instead of in the loop)
mlir/lib/Dialect/StandardOps/Transforms/ComposeSubView.cpp | ||
---|---|---|
97 | Dropping this for now. |
Thanks. Can someone else please land this patch when it's ready? I don't have permissions.
Why it is located in MLIRStandardOpsTransforms, while operating in MemRef dialect? I would expect it to be a part of MLIRMemRefTransforms.
Not sure about the math for strides != 1. It can have weird corner cases (I am not saying it doesnt work, or I have a specific flaw I see in the code here, but just an intuition). Unless really needed, maybe restrict to strides = 1 case in source and dest subviews?