[PATCH] D75963: [MLIR] Guard DMA-specific logic with DMA option
Tim Shen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 11 11:24:27 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGced0dd8e5104: [MLIR] Guard DMA-specific logic with DMA option (authored by timshen).
Changed prior to commit:
https://reviews.llvm.org/D75963?vs=249508&id=249701#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75963/new/
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 dmaStride = nullptr;
+ Value numEltPerDmaStride = nullptr;
+ if (copyOptions.generateDma) {
+ SmallVector<StrideInfo, 4> dmaStrideInfos;
+ getMultiLevelStrides(region, fastBufferShape, &dmaStrideInfos);
+
+ // TODO(bondhugula): use all stride levels once DmaStartOp is extended for
+ // multi-level strides.
+ if (dmaStrideInfos.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 (!dmaStrideInfos.empty()) {
+ dmaStride = top.create<ConstantIndexOp>(loc, dmaStrideInfos[0].stride);
+ numEltPerDmaStride =
+ top.create<ConstantIndexOp>(loc, dmaStrideInfos[0].numEltPerStride);
+ }
}
// Record the last operation where we want the memref replacement to end. We
@@ -1469,13 +1471,13 @@
b.create<AffineDmaStartOp>(loc, memref, memAffineMap, memIndices,
fastMemRef, bufAffineMap, bufIndices,
tagMemRef, tagAffineMap, tagIndices,
- numElementsSSA, stride, numEltPerStride);
+ numElementsSSA, dmaStride, numEltPerDmaStride);
} else {
// DMA non-blocking write from fast buffer to the original memref.
auto op = b.create<AffineDmaStartOp>(
loc, fastMemRef, bufAffineMap, bufIndices, memref, memAffineMap,
memIndices, tagMemRef, tagAffineMap, tagIndices, numElementsSSA,
- stride, numEltPerStride);
+ dmaStride, numEltPerDmaStride);
// Since new ops may be appended at 'end' (for outgoing DMAs), adjust the
// end to mark end of block range being processed.
if (isCopyOutAtEndOfBlock)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75963.249701.patch
Type: text/x-patch
Size: 2673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200311/07e2a1b6/attachment.bin>
More information about the llvm-commits
mailing list