From: Christian Sigg Date: Wed, 23 Dec 2020 10:37:49 +0000 (+0100) Subject: [mlir] Rename ConvertToLLVMPattern::isSupportedMemRefType() to isConvertibleAndHasIde... X-Git-Tag: llvmorg-13-init~2668 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19a0d0a40ce991836d930ecf8614ad21a1c3c32c;p=platform%2Fupstream%2Fllvm.git [mlir] Rename ConvertToLLVMPattern::isSupportedMemRefType() to isConvertibleAndHasIdentityMaps(). Reviewed By: ftynse, herhut Differential Revision: https://reviews.llvm.org/D93752 --- diff --git a/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h b/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h index 63547db..d5c1e92 100644 --- a/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h +++ b/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h @@ -512,8 +512,9 @@ protected: ValueRange indices, ConversionPatternRewriter &rewriter) const; - /// Returns if the givem memref type is supported. - bool isSupportedMemRefType(MemRefType type) const; + /// Returns if the given memref has identity maps and the element type is + /// convertible to LLVM. + bool isConvertibleAndHasIdentityMaps(MemRefType type) const; /// Returns the type of a pointer to an element of the memref. Type getElementPtrType(MemRefType type) const; diff --git a/mlir/lib/Conversion/GPUCommon/ConvertLaunchFuncToRuntimeCalls.cpp b/mlir/lib/Conversion/GPUCommon/ConvertLaunchFuncToRuntimeCalls.cpp index bbb2bf1..d35aa03 100644 --- a/mlir/lib/Conversion/GPUCommon/ConvertLaunchFuncToRuntimeCalls.cpp +++ b/mlir/lib/Conversion/GPUCommon/ConvertLaunchFuncToRuntimeCalls.cpp @@ -369,7 +369,7 @@ LogicalResult ConvertAllocOpToGpuRuntimeCallPattern::matchAndRewrite( MemRefType memRefType = allocOp.getType(); if (failed(areAllLLVMTypes(allocOp, operands, rewriter)) || - !isSupportedMemRefType(memRefType) || + !isConvertibleAndHasIdentityMaps(memRefType) || failed(isAsyncWithOneDependency(rewriter, allocOp))) return failure(); @@ -670,7 +670,7 @@ LogicalResult ConvertMemcpyOpToGpuRuntimeCallPattern::matchAndRewrite( auto memRefType = memcpyOp.src().getType().cast(); if (failed(areAllLLVMTypes(memcpyOp, operands, rewriter)) || - !isSupportedMemRefType(memRefType) || + !isConvertibleAndHasIdentityMaps(memRefType) || failed(isAsyncWithOneDependency(rewriter, memcpyOp))) return failure(); diff --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp index 97e763f..f4d1df8 100644 --- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp +++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp @@ -1087,7 +1087,8 @@ Value ConvertToLLVMPattern::getStridedElementPtr( // Check if the MemRefType `type` is supported by the lowering. We currently // only support memrefs with identity maps. -bool ConvertToLLVMPattern::isSupportedMemRefType(MemRefType type) const { +bool ConvertToLLVMPattern::isConvertibleAndHasIdentityMaps( + MemRefType type) const { if (!typeConverter->convertType(type.getElementType())) return false; return type.getAffineMaps().empty() || @@ -1105,7 +1106,7 @@ void ConvertToLLVMPattern::getMemRefDescriptorSizes( Location loc, MemRefType memRefType, ArrayRef dynamicSizes, ConversionPatternRewriter &rewriter, SmallVectorImpl &sizes, SmallVectorImpl &strides, Value &sizeBytes) const { - assert(isSupportedMemRefType(memRefType) && + assert(isConvertibleAndHasIdentityMaps(memRefType) && "layout maps must have been normalized away"); sizes.reserve(memRefType.getRank()); @@ -1977,7 +1978,7 @@ private: LogicalResult match(Operation *op) const override { MemRefType memRefType = getMemRefResultType(op); - return success(isSupportedMemRefType(memRefType)); + return success(isConvertibleAndHasIdentityMaps(memRefType)); } // An `alloc` is converted into a definition of a memref descriptor value and @@ -2411,7 +2412,7 @@ struct GlobalMemrefOpLowering : public ConvertOpToLLVMPattern { matchAndRewrite(GlobalMemrefOp global, ArrayRef operands, ConversionPatternRewriter &rewriter) const override { MemRefType type = global.type().cast(); - if (!isSupportedMemRefType(type)) + if (!isConvertibleAndHasIdentityMaps(type)) return failure(); LLVM::LLVMType arrayTy = @@ -3031,12 +3032,12 @@ struct RankOpLowering : public ConvertOpToLLVMPattern { template struct LoadStoreOpLowering : public ConvertOpToLLVMPattern { using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; - using ConvertOpToLLVMPattern::isSupportedMemRefType; + using ConvertOpToLLVMPattern::isConvertibleAndHasIdentityMaps; using Base = LoadStoreOpLowering; LogicalResult match(Derived op) const override { MemRefType type = op.getMemRefType(); - return isSupportedMemRefType(type) ? success() : failure(); + return isConvertibleAndHasIdentityMaps(type) ? success() : failure(); } };