From 60d6249fbd7873a822b255f5a83608b329c5c4fe Mon Sep 17 00:00:00 2001 From: Geoffrey Martin-Noble Date: Thu, 30 May 2019 16:02:49 -0700 Subject: [PATCH] Replace checks against numDynamicDims with hasStaticShape -- PiperOrigin-RevId: 250782165 --- mlir/lib/Analysis/Utils.cpp | 2 +- mlir/lib/ExecutionEngine/MemRefUtils.cpp | 2 +- mlir/lib/Transforms/DmaGeneration.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mlir/lib/Analysis/Utils.cpp b/mlir/lib/Analysis/Utils.cpp index 3026074..59ab8f7 100644 --- a/mlir/lib/Analysis/Utils.cpp +++ b/mlir/lib/Analysis/Utils.cpp @@ -365,7 +365,7 @@ Optional MemRefRegion::getRegionSize() { /// size of the vector as well. // TODO(mlir-team): improve/complete this when we have target data. Optional mlir::getMemRefSizeInBytes(MemRefType memRefType) { - if (memRefType.getNumDynamicDims() > 0) + if (!memRefType.hasStaticShape()) return None; auto elementType = memRefType.getElementType(); if (!elementType.isIntOrFloat() && !elementType.isa()) diff --git a/mlir/lib/ExecutionEngine/MemRefUtils.cpp b/mlir/lib/ExecutionEngine/MemRefUtils.cpp index 280fb0d..5163603 100644 --- a/mlir/lib/ExecutionEngine/MemRefUtils.cpp +++ b/mlir/lib/ExecutionEngine/MemRefUtils.cpp @@ -41,7 +41,7 @@ allocMemRefDescriptor(Type type, bool allocateData = true, auto memRefType = type.dyn_cast(); if (!memRefType) return make_string_error("non-memref argument not supported"); - if (memRefType.getNumDynamicDims() != 0) + if (!memRefType.hasStaticShape()) return make_string_error("memref with dynamic shapes not supported"); auto elementType = memRefType.getElementType(); diff --git a/mlir/lib/Transforms/DmaGeneration.cpp b/mlir/lib/Transforms/DmaGeneration.cpp index 1436627..1ead2e5 100644 --- a/mlir/lib/Transforms/DmaGeneration.cpp +++ b/mlir/lib/Transforms/DmaGeneration.cpp @@ -186,7 +186,7 @@ static bool getFullMemRefAsRegion(Operation *opInst, unsigned numParamLoopIVs, return false; } auto memRefType = region->memref->getType().cast(); - if (memRefType.getNumDynamicDims() > 0) + if (!memRefType.hasStaticShape()) return false; auto *regionCst = region->getConstraints(); -- 2.7.4