[PATCH] D75963: [MLIR] Guard DMA-specific logic with DMA option

Tim Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 15:54:15 PDT 2020


timshen created this revision.
timshen added a reviewer: bondhugula.
Herald added subscribers: llvm-commits, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini, sanjoy.google, bixia.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75963

Files:
  mlir/lib/Transforms/Utils/LoopUtils.cpp


Index: mlir/lib/Transforms/Utils/LoopUtils.cpp
===================================================================
--- mlir/lib/Transforms/Utils/LoopUtils.cpp
+++ mlir/lib/Transforms/Utils/LoopUtils.cpp
@@ -1411,22 +1411,24 @@
   auto numElementsSSA =
       top.create<ConstantIndexOp>(loc, numElements.getValue());
 
-  SmallVector<StrideInfo, 4> strideInfos;
-  getMultiLevelStrides(region, fastBufferShape, &strideInfos);
-
-  // TODO(bondhugula): use all stride levels once DmaStartOp is extended for
-  // multi-level strides.
-  if (strideInfos.size() > 1) {
-    LLVM_DEBUG(llvm::dbgs() << "Only up to one level of stride supported\n");
-    return failure();
-  }
-
   Value stride = nullptr;
   Value numEltPerStride = nullptr;
-  if (!strideInfos.empty()) {
-    stride = top.create<ConstantIndexOp>(loc, strideInfos[0].stride);
-    numEltPerStride =
-        top.create<ConstantIndexOp>(loc, strideInfos[0].numEltPerStride);
+  if (copyOptions.generateDma) {
+    SmallVector<StrideInfo, 4> strideInfos;
+    getMultiLevelStrides(region, fastBufferShape, &strideInfos);
+
+    // TODO(bondhugula): use all stride levels once DmaStartOp is extended for
+    // multi-level strides.
+    if (strideInfos.size() > 1) {
+      LLVM_DEBUG(llvm::dbgs() << "Only up to one level of stride supported\n");
+      return failure();
+    }
+
+    if (!strideInfos.empty()) {
+      stride = top.create<ConstantIndexOp>(loc, strideInfos[0].stride);
+      numEltPerStride =
+          top.create<ConstantIndexOp>(loc, strideInfos[0].numEltPerStride);
+    }
   }
 
   // Record the last operation where we want the memref replacement to end. We


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75963.249508.patch
Type: text/x-patch
Size: 1646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200310/3795926b/attachment.bin>


More information about the llvm-commits mailing list