[Mlir-commits] [mlir] [mlir] Add direct vectorization lowering for `tensor.pack` ops (PR #78660)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Feb 1 15:32:33 PST 2024
================
@@ -1585,6 +1727,32 @@ vectorizeLinalgOpPrecondition(LinalgOp linalgOp,
return success();
}
+/// TODO: Use a matcher to check for a constant padding value.
+static LogicalResult
+vectorizePackOpPrecondition(tensor::PackOp packOp,
+ ArrayRef<int64_t> inputVectorSizes) {
+ auto padValue = packOp.getPaddingValue();
+ if (padValue && !padValue.getDefiningOp<arith::ConstantOp>()) {
+ LDBG("pad value is not constant: " << packOp << "\n");
+ return failure();
+ }
+
----------------
Max191 wrote:
I realized there is no matcher for constant float values like there is for constant int values. I didn't know exactly how this should be done.
https://github.com/llvm/llvm-project/blob/07bf1ddb4eb0abfff20542fd4459bace1f72107f/mlir/lib/Dialect/Utils/StaticValueUtils.cpp#L108-L122
For int, getConstantIntValue passes an uninitialized APSInt. For the analogous float matcher, I'm not sure the best way to implement a similar function, since there are several possible floating point semantics. I suppose there could be a util function that simply checks if the value is constant and does not return the value. I think then an arbitrary float semantic could be used.
https://github.com/llvm/llvm-project/pull/78660
More information about the Mlir-commits
mailing list