From 6f8e3978d376ad8fba80659eec809448021517be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20M=C3=BCller?= Date: Wed, 18 Jan 2023 16:30:53 +0000 Subject: [PATCH 1/6] [IREE] Update submodule to a version from January 10 (badd598f). --- third_party/iree | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/iree b/third_party/iree index 853dd6ead922..badd598fafe5 160000 --- a/third_party/iree +++ b/third_party/iree @@ -1 +1 @@ -Subproject commit 853dd6ead922cc0115beddc3d74b88af8b437172 +Subproject commit badd598fafe56577d6c96cc132da75ea27af7d36 From 2d022fbde664ffdb236169d6e5a6d7253513b4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20M=C3=BCller?= Date: Tue, 17 Jan 2023 22:02:12 +0000 Subject: [PATCH 2/6] Use only prefixed accessors, since raw accessors are now disabled. The switch was done in bb6d12b in the LLVM mono repo. --- lib/Dialect/VectorExt/IR/VectorExtOps.cpp | 10 +++++----- lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/Dialect/VectorExt/IR/VectorExtOps.cpp b/lib/Dialect/VectorExt/IR/VectorExtOps.cpp index 5fba2f6a92ea..fcfff665d635 100644 --- a/lib/Dialect/VectorExt/IR/VectorExtOps.cpp +++ b/lib/Dialect/VectorExt/IR/VectorExtOps.cpp @@ -100,15 +100,15 @@ ParseResult mlir::vector_ext::PredicateOp::parse(OpAsmParser &parser, void mlir::vector_ext::PredicateOp::print(OpAsmPrinter &p) { bool printBlockTerminators = false; - p << "(" << predicateMask() << ", [" << indices() << "], " << incomingMask() - << ") : " << predicateMask().getType(); - if (!results().empty()) { + p << "(" << getPredicateMask() << ", [" << getIndices() << "], " + << getIncomingMask() << ") : " << getPredicateMask().getType(); + if (!getResults().empty()) { p << " -> (" << getResultTypes() << ")"; // Print yield explicitly if the op defines values. printBlockTerminators = true; } p << " "; - p.printRegion(truePredicateRegion(), + p.printRegion(getTruePredicateRegion(), /*printEntryBlockArgs=*/true, /*printBlockTerminators=*/printBlockTerminators); @@ -132,7 +132,7 @@ void PredicateOp::getSuccessorRegions( // The `truePredicate` (and the future `falsePredicate` region) will always // be executed regardless of the condition since they are not modeling control // but data flow. - regions.push_back(RegionSuccessor(&truePredicateRegion())); + regions.push_back(RegionSuccessor(&getTruePredicateRegion())); } #define GET_OP_CLASSES diff --git a/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp b/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp index 0e6959d290ec..eee903b4c9c5 100644 --- a/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp +++ b/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp @@ -113,7 +113,7 @@ Optional mlir::vector_ext::predicateOp( en.value().replaceAllUsesWith(vecPredOp.getResult(en.index())); Operation *truePredTerminator = - &vecPredOp.truePredicateRegion().front().back(); + &vecPredOp.getTruePredicateRegion().front().back(); moveOperationsBefore(opsToMove, truePredTerminator); // The existing terminator of TruePredicateRegion doesn't yield any value. @@ -140,9 +140,9 @@ static void maskPredicateOp(OpBuilder &builder, PredicateOp predOp, // Actions before visiting the TruePredicateRegion: Generate the new active // mask (= predicate_mask & incoming_mask) influencing the region. if (stage.isBeforeAllRegions()) { - builder.setInsertionPointToStart(&predOp.truePredicateRegion().front()); + builder.setInsertionPointToStart(&predOp.getTruePredicateRegion().front()); Value trueMask = builder.create( - predOp.getLoc(), predOp.incomingMask(), predOp.predicateMask()); + predOp.getLoc(), predOp.getIncomingMask(), predOp.getPredicateMask()); activeMasks.push_back(trueMask); return; } @@ -167,7 +167,7 @@ static void maskPredicateOp(OpBuilder &builder, PredicateOp predOp, // Inline truePredicateRegion into parent op (except its terminator). // TODO: Move this to builder.inlineRegionBefore? - auto &blocksToMove = predOp.truePredicateRegion().getBlocks(); + auto &blocksToMove = predOp.getTruePredicateRegion().getBlocks(); assert(blocksToMove.size() == 1 && "Expected only one block"); assert(predOp.getResults().empty() && "TODO: Support vector.predicate with results"); From 88284b5dd0f7f0250e4e93bed9ef6e18c1056128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20M=C3=BCller?= Date: Wed, 18 Jan 2023 08:56:25 +0000 Subject: [PATCH 3/6] Follow change of file and dialect names of arith dialect. This was done in abc362a1 of the LLVM mono repo. --- lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp b/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp index eee903b4c9c5..e505cb23d1e4 100644 --- a/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp +++ b/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp @@ -8,7 +8,7 @@ #include "Dialect/VectorExt/VectorMaskingUtils.h" #include "Dialect/VectorExt/VectorExtOps.h" -#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h" +#include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/Linalg/IR/Linalg.h" #include "mlir/Dialect/Vector/IR/VectorOps.h" #include "mlir/IR/AffineMap.h" From 3d82c3689f0cac47fe900fe95363d3fe0af05d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20M=C3=BCller?= Date: Wed, 18 Jan 2023 13:32:34 +0000 Subject: [PATCH 4/6] [LinalgExt] Update usage of replaced side effect traits. The NoSideEffect and RecursiveSideEffect traits used until now were removed by 86771d0b in the LLVM mono repo. I *believe* that the new NoMemoryEffect and RecursiveMemoryEffect as used in this commit are conservative replacements, i.e., they will result in correct usages but may disallow optimizations that were previously possible. Since I do not understand the affected ops sufficiently, I do not dare to add the more poerful traits. --- include/Dialect/VectorExt/VectorExtOps.td | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/Dialect/VectorExt/VectorExtOps.td b/include/Dialect/VectorExt/VectorExtOps.td index e4c3e9629814..f807a4ad612c 100644 --- a/include/Dialect/VectorExt/VectorExtOps.td +++ b/include/Dialect/VectorExt/VectorExtOps.td @@ -20,7 +20,8 @@ class VectorExt_Op traits = []> : def VectorExt_PredicateOp : VectorExt_Op<"predicate", [DeclareOpInterfaceMethods, - SingleBlockImplicitTerminator<"vector_ext::YieldOp">, RecursiveSideEffects]> { + SingleBlockImplicitTerminator<"vector_ext::YieldOp">, + RecursiveMemoryEffects]> { let summary = "vector.predicate operation"; let description = [{ TODO }]; @@ -43,7 +44,7 @@ def VectorExt_PredicateOp : VectorExt_Op<"predicate", } def VectorExt_YieldOp : VectorExt_Op<"yield", [ - NoSideEffect, ReturnLike, Terminator]> { + NoMemoryEffect, ReturnLike, Terminator]> { let summary = "VectorExt yield op"; let description = [{ `vector_ext.yield` is a special terminator operation for blocks inside From 03bb117e6bcec8ab5e7f76cd1f46136b8242bf62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20M=C3=BCller?= Date: Wed, 18 Jan 2023 14:41:15 +0000 Subject: [PATCH 5/6] [VectorExtOps] Update usage of remove Optional::hasValue. That function has been deprecated for a while and removed in 4b6b248 in the LLVM mono repo. --- lib/Dialect/VectorExt/IR/VectorExtOps.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Dialect/VectorExt/IR/VectorExtOps.cpp b/lib/Dialect/VectorExt/IR/VectorExtOps.cpp index fcfff665d635..0a9a79687143 100644 --- a/lib/Dialect/VectorExt/IR/VectorExtOps.cpp +++ b/lib/Dialect/VectorExt/IR/VectorExtOps.cpp @@ -124,7 +124,7 @@ void PredicateOp::getSuccessorRegions( Optional index, ArrayRef operands, SmallVectorImpl ®ions) { // The `truePredicate` region branch back to the parent operation. - if (index.hasValue()) { + if (index.has_value()) { regions.push_back(RegionSuccessor(getResults())); return; } From 69aca2ce64315c550e983824196e59f313b55061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20M=C3=BCller?= Date: Wed, 18 Jan 2023 20:41:06 +0000 Subject: [PATCH 6/6] Use std::nullopt instead of llvm::None. llvm::None has been deprecated by bd6a170 in the LLVM mono repo. --- lib/Dialect/VectorExt/IR/VectorExtOps.cpp | 4 ++-- lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Dialect/VectorExt/IR/VectorExtOps.cpp b/lib/Dialect/VectorExt/IR/VectorExtOps.cpp index 0a9a79687143..6245cc17899d 100644 --- a/lib/Dialect/VectorExt/IR/VectorExtOps.cpp +++ b/lib/Dialect/VectorExt/IR/VectorExtOps.cpp @@ -28,7 +28,7 @@ void mlir::vector_ext::buildTerminatedBody(OpBuilder &builder, Location loc) { void PredicateOp::build(OpBuilder &builder, OperationState &result, Value predicateMask, ValueRange indices, Value incomingMask) { - build(builder, result, /*resultTypes=*/llvm::None, predicateMask, indices, + build(builder, result, /*resultTypes=*/std::nullopt, predicateMask, indices, incomingMask); } @@ -115,7 +115,7 @@ void mlir::vector_ext::PredicateOp::print(OpAsmPrinter &p) { p.printOptionalAttrDict(getOperation()->getAttrs()); } -/// Given the region at `index`, or the parent operation if `index` is None, +/// Given the region at `index`, or the parent operation if `index` is nullopt, /// return the successor regions. These are the regions that may be selected /// during the flow of control. `operands` is a set of optional attributes that /// correspond to a constant value for each operand, or null if that operand is diff --git a/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp b/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp index e505cb23d1e4..46dd7c44b8cb 100644 --- a/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp +++ b/lib/Dialect/VectorExt/Transform/VectorMaskingUtils.cpp @@ -77,7 +77,7 @@ Optional mlir::vector_ext::predicateOp( Optional maybeIncomingMask) { // TODO: Support multi-block regions. if (!regionToPredicate->hasOneBlock()) - return llvm::None; + return std::nullopt; // Compute the range of operations that will be moved within vector.predicate // and the definitions within the range with users outside the range. @@ -95,7 +95,7 @@ Optional mlir::vector_ext::predicateOp( builder.setInsertionPointToStart(&blockToPredicate); Value predicateMask = createPredicateMask(builder); if (!predicateMask) - return llvm::None; + return std::nullopt; // Generate the vector.predicate operation and move 'opsToMove' within its // truePredicateRegion. We have to rewire the def-use chain for those