From d32ec5232c9eef1a4172e461f9c482b094416079 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Sun, 27 Nov 2022 13:32:18 -0800 Subject: [PATCH] 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 --- mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp index b5105ca..771548b 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 +static std::optional getMemrefConstantHorizontalStride(ShapedType type) { auto memrefType = type.dyn_cast(); 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 +static std::optional convertElementwiseOpToMMA(Operation *op) { if (isa(op)) return gpu::MMAElementwiseOp::ADDF; @@ -431,7 +431,7 @@ static void convertTransferReadOp(vector::TransferReadOp op, llvm::DenseMap &valueMapping) { assert(op.getTransferRank() > 0 && "unexpected 0-d transfer"); assert(transferReadSupportsMMAMatrixType(op, /*useNvGpu=*/false)); - Optional stride = + std::optional 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 &valueMapping) { assert(transferWriteSupportsMMAMatrixType(op)); - Optional stride = + std::optional stride = getMemrefConstantHorizontalStride(op.getShapedType()); assert(stride); OpBuilder b(op); -- 2.7.4