Lines Matching +defs:region +defs:end
84 cleanupLbOperands.append(bumpValues.begin(), bumpValues.end());
234 if (forOp.getBody()->begin() == std::prev(forOp.getBody()->end()))
363 SmallVector<Operation *, 8> ops(input.begin(), input.end());
412 std::prev(ops.end()));
541 origUbMap.getResults().end());
756 origUbMap.getResults().end());
861 if (body.begin() != std::prev(body.end(), 2))
928 Block::iterator srcBlockEnd = std::prev(loopBodyBlock->end(), 2);
1138 // Get supported reductions to be used for creating reduction ops at the end.
1176 dupIterOperands.append(oldIterOperands.begin(), oldIterOperands.end());
1177 dupYieldOperands.append(oldYieldOperands.begin(), oldYieldOperands.end());
1220 // Builder to insert unroll-jammed bodies. Insert right at the end of
1305 std::prev(forOpABody.end()));
1309 std::prev(forOpBBody.end()));
1372 return secondOpIt != block->end() && &*secondOpIt == &block->back();
1419 std::prev(srcBody->end()));
1630 ub.getOperands().end());
1760 /// Given a memref region, determine the lowest depth at which transfers can be
1761 /// placed for it, and return the corresponding block, start and end positions
1763 /// respectively. The lowest depth depends on whether the region being accessed
1766 findHighestBlockForPlacement(const MemRefRegion ®ion, Block &block,
1767 Block::iterator &begin, Block::iterator &end,
1771 const auto *cst = region.getConstraints();
1777 // Walk up loop parents till we find an IV on which this region is
1794 *copyOutPlacementStart = end;
1805 /// Returns striding information for a copy/transfer of this region with
1807 /// n-dimensional region, there can be at most n-1 levels of striding
1810 static void getMultiLevelStrides(const MemRefRegion ®ion,
1819 int64_t dimSize = cast<MemRefType>(region.memref.getType()).getDimSize(d);
1822 // A stride is needed only if the region has a shorter extent than the
1840 /// The copy-in nest is generated as follows as an example for a 2-d region:
1922 /// Creates a buffer in the faster memory space for the specified memref region;
1924 /// loads/stores in the block range [`begin', `end') of `block' to load/store
1932 /// happens). Since outgoing copies could have been inserted at `end`, the
1933 /// output argument `nEnd` is set to the new end. `sizeInBytes` is set to the
1936 const MemRefRegion ®ion, Block *block, Block::iterator begin,
1937 Block::iterator end, Block *copyPlacementBlock,
1943 *nEnd = end;
1951 if (begin == end)
1954 // Is the copy out point at the end of the block where we are doing
1956 bool isCopyOutAtEndOfBlock = (end == copyOutPlacementStart);
1960 // Copies for write regions are going to be inserted at 'end'.
1962 OpBuilder &b = region.isWrite() ? epilogue : prologue;
1969 auto loc = region.loc;
1970 auto memref = region.memref;
1991 std::optional<int64_t> numElements = region.getConstantBoundingSizeAndShape(
1994 LLVM_DEBUG(llvm::dbgs() << "Non-constant region size not supported\n");
2005 region.getLowerAndUpperBound(i, lbMaps[i], ubMaps[i]);
2007 const FlatAffineValueConstraints *cst = region.getConstraints();
2008 // 'regionSymbols' hold values that this memory region is symbolic/parametric
2016 // subtracting out the lower bound on the original memref's data region
2044 // corresponding dimension on the memory region (stored in 'offset').
2094 getMultiLevelStrides(region, fastBufferShape, &dmaStrideInfos);
2111 // Record the last operation where we want the memref replacement to end. We
2115 auto postDomFilter = std::prev(end);
2129 /*isCopyOut=*/region.isWrite(), b);
2134 // Since new ops are being appended (for copy out's), adjust the end to
2135 // mark end of block range being processed if necessary.
2136 if (region.isWrite() && isCopyOutAtEndOfBlock)
2148 if (!region.isWrite()) {
2160 // Since new ops may be appended at 'end' (for outgoing DMAs), adjust the
2161 // end to mark end of block range being processed.
2172 if (*nEnd == end && isCopyOutAtEndOfBlock)
2173 // Since new ops are being appended (for outgoing DMAs), adjust the end to
2174 // mark end of range of the original.
2182 // the fast buffer (since it marks the new end insertion point).
2183 if (!copyOptions.generateDma && *nEnd == end && isCopyOutAtEndOfBlock)
2198 // which the memref region is parametric); then those corresponding to
2212 // *Only* those uses within the range [begin, end) of 'block' are replaced.
2225 /// Construct the memref region to just include the entire memref. Returns false
2227 /// enclosing loop IVs of `op` (starting from the outermost) that the region
2230 MemRefRegion *region) {
2234 region->memref = loadOp.getMemRef();
2235 region->setWrite(false);
2238 region->memref = storeOp.getMemRef();
2239 region->setWrite(true);
2244 auto memRefType = cast<MemRefType>(region->memref.getType());
2248 auto *regionCst = region->getConstraints();
2250 // Just get the first numSymbols IVs, which the memref region is parametric
2271 mlir::affine::affineDataCopyGenerate(Block::iterator begin, Block::iterator end,
2275 if (begin == end)
2278 assert(begin->getBlock() == std::prev(end)->getBlock() &&
2279 "Inconsistent block begin/end args");
2280 assert(end != end->getBlock()->end() && "end can't be the block terminator");
2291 LLVM_DEBUG(llvm::dbgs() << "to inclusive end: " << *std::prev(end) << "\n");
2307 block->walk(begin, end, [&](Operation *opInst) {
2330 auto region = std::make_unique<MemRefRegion>(opInst->getLoc());
2331 if (failed(region->compute(opInst, copyDepth, /*sliceState=*/nullptr,
2334 << "Error obtaining memory region: semi-affine maps?\n");
2336 if (!getFullMemRefAsRegion(opInst, copyDepth, region.get())) {
2350 // Add to the appropriate region if it's not already in it, or take a
2353 // region in the other list if one exists (write in case of read and vice
2357 // Attempts to update; returns true if 'region' exists in targetRegions.
2361 const auto *const it = targetRegions.find(region->memref);
2362 if (it == targetRegions.end())
2365 // Perform a union with the existing region.
2366 if (failed(it->second->unionBoundingBox(*region))) {
2368 << "Memory region bounding box failed; "
2371 if (!getFullMemRefAsRegion(opInst, copyDepth, region.get())) {
2378 *region->getConstraints());
2380 // Union was computed and stored in 'it->second': copy to 'region'.
2381 region->getConstraints()->clearAndCopyFrom(
2394 // Finally add it to the region list.
2395 if (region->isWrite() && !existsInWrite) {
2396 writeRegions[region->memref] = std::move(region);
2397 } else if (!region->isWrite() && !existsInRead) {
2398 readRegions[region->memref] = std::move(region);
2414 // For each region, hoist copy in/out past all hoistable
2419 *regionEntry.second, *block, begin, end, ©PlacementBlock,
2425 *regionEntry.second, block, begin, end, copyPlacementBlock,
2429 // begin/end could have been invalidated, and need update.
2431 end = nEnd;
2469 std::prev(forOp.getBody()->end()), copyOptions,
2478 auto end = std::next(begin);
2482 auto err = generateCopy(memrefRegion, block, begin, end, block, begin, end,
2484 &result.sizeInBytes, &begin, &end);
2490 if (en == fastBufferMap.end())
2591 fullTileLb.assign(fLb.begin(), fLb.end());
2592 fullTileUb.assign(fUb.begin(), fUb.end());
2723 std::prev(thenBlock->end()),
2730 elseBlock->getOperations().splice(std::prev(elseBlock->end()),
2765 for (unsigned end = loops.size(); end > 0; --end) {
2767 for (; start < end - 1; ++start) {
2770 std::next(operandsDefinedAbove.begin(), end));
2775 auto band = llvm::MutableArrayRef(loops.data() + start, end - start);
2782 if (start != end - 1)
2783 end = start + 1;