[PATCH] D159259: [mlir][vector] Use optional for outerproduct accumulator instead of variadic
Cullen Rhodes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 31 02:16:07 PDT 2023
c-rhodes created this revision.
c-rhodes added reviewers: nicolasvasilache, awarzynski, benmxwl-arm.
c-rhodes added a project: MLIR.
Herald added subscribers: bviyer, Moerafaat, zero9178, bzcheeseman, sunshaoce, ThomasRaoux, sdasgup3, wenzhicui, wrengr, jsetoain, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini.
Herald added a reviewer: aartbik.
Herald added a project: All.
c-rhodes requested review of this revision.
Herald added a subscriber: stephenneuendorffer.
Herald added a reviewer: dcaballe.
This was introduced before the Optional directive and uses Variadic, but
it's really optional.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D159259
Files:
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
mlir/lib/Dialect/Vector/IR/VectorOps.cpp
mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp
Index: mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp
===================================================================
--- mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp
+++ mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp
@@ -1129,7 +1129,7 @@
VectorType resType = op.getResultVectorType();
Type eltType = resType.getElementType();
bool isInt = isa<IntegerType, IndexType>(eltType);
- Value acc = (op.getAcc().empty()) ? nullptr : op.getAcc()[0];
+ Value acc = op.getAcc();
vector::CombiningKind kind = op.getKind();
// Vector mask setup.
Index: mlir/lib/Dialect/Vector/IR/VectorOps.cpp
===================================================================
--- mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+++ mlir/lib/Dialect/Vector/IR/VectorOps.cpp
@@ -2756,7 +2756,7 @@
void OuterProductOp::print(OpAsmPrinter &p) {
p << " " << getLhs() << ", " << getRhs();
- if (!getAcc().empty()) {
+ if (getAcc()) {
p << ", " << getAcc();
p.printOptionalAttrDict((*this)->getAttrs());
}
Index: mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
===================================================================
--- mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
+++ mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
@@ -897,7 +897,7 @@
TCresVTEtIsSameAsOpBase<0, 1>>,
DeclareOpInterfaceMethods<MaskableOpInterface>]>,
Arguments<(ins AnyVector:$lhs, AnyType:$rhs,
- Variadic<AnyVector>:$acc,
+ Optional<AnyVector>:$acc,
DefaultValuedAttr<Vector_CombiningKindAttr, "CombiningKind::ADD">:$kind)>,
Results<(outs AnyVector)> {
let summary = "vector outerproduct with optional fused add";
@@ -961,9 +961,9 @@
return getRhs().getType();
}
VectorType getOperandVectorTypeACC() {
- return getAcc().empty()
- ? VectorType()
- : ::llvm::cast<VectorType>((*getAcc().begin()).getType());
+ return getAcc()
+ ? ::llvm::cast<VectorType>(getAcc().getType())
+ : VectorType();
}
VectorType getResultVectorType() {
return ::llvm::cast<VectorType>(getResult().getType());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159259.554943.patch
Type: text/x-patch
Size: 2181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230831/0eeacaa2/attachment.bin>
More information about the llvm-commits
mailing list