[Mlir-commits] [mlir] [MLIR] Allowing unsupported conv2d op to fail gracefully from vectorization (PR #130181)
Han-Chung Wang
llvmlistbot at llvm.org
Mon Mar 10 15:50:28 PDT 2025
================
@@ -3865,27 +3923,13 @@ struct Conv1DGenerator
oper = Pool;
isPoolExt = true;
poolExtOp = feedOp->getName().getIdentifier();
- } else if (!((isa<arith::MulIOp, arith::MulFOp>(feedOp) ||
- (isa<arith::AndIOp>(feedOp) &&
- feedOp->getResultTypes()[0].isInteger(1))) &&
- llvm::all_of(feedOp->getOperands(), [](Value v) {
- if (isa<BlockArgument>(v))
- return true;
- if (Operation *op = v.getDefiningOp())
- return isCastOfBlockArgument(op);
- return false;
- }))) {
- return false;
+ } else {
+ oper = Conv;
----------------
hanhanW wrote:
Style nit: prefer early exit and continue to simplify the code. (IMO, it also saves the level of indents, which looks better to me.)
```cpp
if (numBlockArguments == 1) {
// ...
if (isCastOfBlockArgument(feedOp)) {
oper = Pool;
isPoolExt = true;
poolExtOp = feedOp->getName().getIdentifier();
return;
}
oper = Conv;
return;
}
oper = Pool;
isPoolExt = false;
```
https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code
https://github.com/llvm/llvm-project/pull/130181
More information about the Mlir-commits
mailing list