Lines Matching defs:loops

239   // better way to pipeline for such loops is to first tile them and extract
337 // and their loops completed.
395 LLVM_DEBUG(llvm::dbgs() << "input loops not perfectly nested");
428 // The outermost among the loops as we add more..
432 // Add intra-tile (or point) loops.
446 // Add tile space loops;
462 /// Set lower and upper bounds of intra-tile loops for parametric tiling.
477 "expected input loops to have constant lower bound.");
557 /// Set lower and upper bounds of inter-tile loops for parametric tiling.
563 // The lower bounds for inter-tile loops are same as the corresponding lower
564 // bounds of original loops.
567 // The new upper bound map for inter-tile loops, assuming constant lower
577 "expected input loops to have constant lower bound.");
670 // Set bounds for tile space loops.
675 // Set bounds for intra-tile loops.
697 // Bounds for tile space loops.
704 // tiling the tile space loops' step size becomes x*y.
707 // Bounds for intra-tile loops.
716 // The step sizes of intra-tile loops is just the original loops' step size.
811 /// Tiles the specified band of perfectly nested loops creating tile-space
812 /// loops and intra-tile loops, using SSA values as tiling parameters. A band
813 /// is a contiguous set of loops.
852 /// Get perfectly nested sequence of loops starting at root of loop nest
870 /// Identify valid and profitable bands of loops to tile. This is currently just
1085 /// Check if all control operands of all loops are defined outside of `forOp`
1131 // Collect loops with iter_args.
1238 // Fix iterOperands and yield op operands of newly created loops.
1320 ArrayRef<AffineForOp> loops, ArrayRef<unsigned> loopPermMap) {
1322 unsigned maxLoopDepth = loops.size();
1336 // This iterates through loops in the desired order.
1351 /// nested sequence of loops in 'loops' would violate dependences.
1353 ArrayRef<AffineForOp> loops, ArrayRef<unsigned> loopPermMap) {
1355 // rooted at 'loops[0]', at loop depths in range [1, maxLoopDepth].
1356 assert(loopPermMap.size() == loops.size());
1357 unsigned maxLoopDepth = loops.size();
1359 getDependenceComponents(loops[0], maxLoopDepth, &depCompsVec);
1360 return checkLoopInterchangeDependences(depCompsVec, loops, loopPermMap);
1363 /// Returns true if `loops` is a perfectly nested loop nest, where loops appear
1366 mlir::affine::isPerfectlyNested(ArrayRef<AffineForOp> loops) {
1367 assert(!loops.empty() && "no loops provided");
1375 auto enclosingLoop = loops.front();
1376 for (auto loop : loops.drop_front()) {
1455 // Sinks all sequential loops to the innermost levels (while preserving
1456 // relative order among them) and moves all parallel loops to the
1459 SmallVector<AffineForOp, 4> loops;
1460 getPerfectlyNestedLoops(loops, forOp);
1461 if (loops.size() < 2)
1465 // rooted at 'loops[0]', at loop depths in range [1, maxLoopDepth].
1466 unsigned maxLoopDepth = loops.size();
1468 getDependenceComponents(loops[0], maxLoopDepth, &depCompsVec);
1470 // Mark loops as either parallel or sequential.
1484 // Compute permutation of loops that sinks sequential loops (and thus raises
1485 // parallel loops) while preserving relative order.
1498 if (!checkLoopInterchangeDependences(depCompsVec, loops, loopPermMap))
1501 unsigned loopNestRootIndex = permuteLoops(loops, loopPermMap);
1502 return loops[loopNestRootIndex];
1527 // imperfectly nested loops.
1605 for (auto loops : tile(forOps, sizes, ArrayRef<AffineForOp>(target))) {
1606 assert(loops.size() == 1);
1607 res.push_back(loops[0]);
1612 LogicalResult mlir::affine::coalesceLoops(MutableArrayRef<AffineForOp> loops) {
1613 if (loops.size() < 2)
1616 AffineForOp innermost = loops.back();
1617 AffineForOp outermost = loops.front();
1622 for (AffineForOp loop : loops) {
1623 // We only work on normalized loops.
1641 // the number of iterations of all loops.
1642 for (AffineForOp loop : loops.drop_front()) {
1675 // the linearized loop by the total number of iterations of the loops nested
1677 // related to the outer loops):
1682 for (unsigned idx = loops.size(); idx > 0; --idx) {
1683 if (idx != loops.size()) {
1695 // Modified value of the induction variables of the nested loops after
1711 replaceAllUsesInRegionWith(loops[idx - 1].getInductionVar(),
1712 inductionVariable, loops.back().getRegion());
1717 AffineForOp secondOutermostLoop = loops[1];
1764 /// is hoistable with respect to one or more immediately surrounding loops.
2284 // Copies will be generated for this depth, i.e., symbolic in all loops
2489 // In some cases (empty loops), no copy generation would have happened.
2548 /// nest of loops. This is used to separate partial and full tiles if `loops`
2549 /// has the intra-tile loops. The affine.if op is inserted at the builder
2551 static AffineIfOp createSeparationCondition(MutableArrayRef<AffineForOp> loops,
2553 if (loops.empty())
2556 auto *context = loops[0].getContext();
2560 llvm::append_range(ops, loops);
2564 cst.removeIndependentConstraints(/*pos=*/0, /*num=*/loops.size());
2570 for (auto loop : loops) {
2617 // ifCondSet can be null if cst was empty -- this can happen if all loops
2625 return b.create<AffineIfOp>(loops[0].getLoc(), ifCondSet, setOperands,
2742 SmallVector<AffineForOp> loops;
2743 getPerfectlyNestedLoops(loops, op);
2744 if (loops.size() <= 1)
2747 // Look for a band of loops that can be coalesced, i.e. perfectly nested
2748 // loops with bounds defined above some loop.
2751 SmallVector<unsigned> operandsDefinedAbove(loops.size());
2752 for (unsigned i = 0, e = loops.size(); i < e; ++i) {
2755 if (areValuesDefinedAbove(loops[i].getOperands(), loops[j].getRegion())) {
2762 // 2. Identify bands of loops such that the operands of all of them are
2764 // so that modifications don't invalidate the inner loops.
2765 for (unsigned end = loops.size(); end > 0; --end) {
2775 auto band = llvm::MutableArrayRef(loops.data() + start, end - start);
2780 // If a band was found and transformed, keep looking at the loops above