diff --git a/mlir/include/mlir/Transforms/LoopUtils.h b/mlir/include/mlir/Transforms/LoopUtils.h --- a/mlir/include/mlir/Transforms/LoopUtils.h +++ b/mlir/include/mlir/Transforms/LoopUtils.h @@ -178,6 +178,13 @@ Optional filterMemRef, DenseSet ©Nests); +/// A convenience version of affineDataCopyGenerate for all ops in the body of +/// an AffineForOp. +uint64_t affineDataCopyGenerate(AffineForOp forOp, + const AffineCopyOptions ©Options, + Optional filterMemRef, + DenseSet ©Nests); + /// Tile a nest of standard for loops rooted at `rootForOp` by finding such /// parametric tile sizes that the outer loops have a fixed number of iterations /// as defined in `sizes`. diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp --- a/mlir/lib/Transforms/Utils/LoopUtils.cpp +++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp @@ -1784,6 +1784,17 @@ return totalCopyBuffersSizeInBytes; } +// A convenience version of affineDataCopyGenerate for all ops in the body of +// an AffineForOp. +uint64_t mlir::affineDataCopyGenerate(AffineForOp forOp, + const AffineCopyOptions ©Options, + Optional filterMemRef, + DenseSet ©Nests) { + return affineDataCopyGenerate(forOp.getBody()->begin(), + std::prev(forOp.getBody()->end()), copyOptions, + filterMemRef, copyNests); +} + /// Gathers all AffineForOps in 'block' at 'currLoopDepth' in 'depthToLoops'. static void gatherLoopsInBlock(Block *block, unsigned currLoopDepth, diff --git a/mlir/test/lib/Transforms/TestAffineDataCopy.cpp b/mlir/test/lib/Transforms/TestAffineDataCopy.cpp --- a/mlir/test/lib/Transforms/TestAffineDataCopy.cpp +++ b/mlir/test/lib/Transforms/TestAffineDataCopy.cpp @@ -73,9 +73,7 @@ /*tagMemorySpace=*/0, /*fastMemCapacityBytes=*/32 * 1024 * 1024UL}; DenseSet copyNests; - affineDataCopyGenerate(loopNest.getBody()->begin(), - std::prev(loopNest.getBody()->end()), copyOptions, - memrefFilter, copyNests); + affineDataCopyGenerate(loopNest, copyOptions, memrefFilter, copyNests); } namespace mlir {