[Mlir-commits] [mlir] d32ec52 - mlir/VectorToGPU: use std::optional (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Sun Nov 27 13:32:31 PST 2022
Author: Ramkumar Ramachandra
Date: 2022-11-27T13:32:18-08:00
New Revision: d32ec5232c9eef1a4172e461f9c482b094416079
URL: https://github.com/llvm/llvm-project/commit/d32ec5232c9eef1a4172e461f9c482b094416079
DIFF: https://github.com/llvm/llvm-project/commit/d32ec5232c9eef1a4172e461f9c482b094416079.diff
LOG: mlir/VectorToGPU: use std::optional (NFC)
This is part of an effort to migrate from llvm::Optional to std::optional:
See also: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Signed-off-by: Ramkumar Ramachandra <r at artagnon.com>
Added:
Modified:
mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
index b5105cab2854c..771548b319b67 100644
--- a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
+++ b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
@@ -94,7 +94,7 @@ static bool contractSupportsMMAMatrixType(vector::ContractionOp contract,
// Return the stide for the dimension 0 of |type| if it is a memref and has a
// constant stride.
-static llvm::Optional<int64_t>
+static std::optional<int64_t>
getMemrefConstantHorizontalStride(ShapedType type) {
auto memrefType = type.dyn_cast<MemRefType>();
if (!memrefType)
@@ -172,7 +172,7 @@ static bool broadcastSupportsMMAMatrixType(vector::BroadcastOp broadcastOp) {
/// Return the MMA elementwise enum associated with `op` if it is supported.
/// Return `llvm::None` otherwise.
-static llvm::Optional<gpu::MMAElementwiseOp>
+static std::optional<gpu::MMAElementwiseOp>
convertElementwiseOpToMMA(Operation *op) {
if (isa<arith::AddFOp>(op))
return gpu::MMAElementwiseOp::ADDF;
@@ -431,7 +431,7 @@ static void convertTransferReadOp(vector::TransferReadOp op,
llvm::DenseMap<Value, Value> &valueMapping) {
assert(op.getTransferRank() > 0 && "unexpected 0-d transfer");
assert(transferReadSupportsMMAMatrixType(op, /*useNvGpu=*/false));
- Optional<int64_t> stride =
+ std::optional<int64_t> stride =
getMemrefConstantHorizontalStride(op.getShapedType());
AffineMap map = op.getPermutationMap();
// Handle broadcast by setting the stride to 0.
@@ -454,7 +454,7 @@ static void convertTransferReadOp(vector::TransferReadOp op,
static void convertTransferWriteOp(vector::TransferWriteOp op,
llvm::DenseMap<Value, Value> &valueMapping) {
assert(transferWriteSupportsMMAMatrixType(op));
- Optional<int64_t> stride =
+ std::optional<int64_t> stride =
getMemrefConstantHorizontalStride(op.getShapedType());
assert(stride);
OpBuilder b(op);
More information about the Mlir-commits
mailing list