Lines Matching defs:loops

89   // The outer loops are modified by calling this method recursively
501 /// Check if bounds of all inner loops are defined outside of `forOp`
563 // Collect inner loops.
652 // Fix iterOperands and yield op operands of newly created loops.
839 /// the linearized loop by the total number of iterations of the loops nested
841 /// related to the outer loops):
902 MutableArrayRef<scf::ForOp> loops) {
903 if (loops.size() < 2)
906 scf::ForOp innermost = loops.back();
907 scf::ForOp outermost = loops.front();
909 // 1. Make sure all loops iterate from 0 to upperBound with step 1. This
911 for (auto loop : loops) {
934 // of the number of iterations of all loops.
939 loops, [](auto loop) { return loop.getUpperBound(); });
949 for (int i = loops.size() - 1; i > 0; --i) {
950 auto outerLoop = loops[i - 1];
951 auto innerLoop = loops[i];
979 LogicalResult mlir::coalesceLoops(MutableArrayRef<scf::ForOp> loops) {
980 if (loops.empty()) {
983 IRRewriter rewriter(loops.front().getContext());
984 return coalesceLoops(rewriter, loops);
989 SmallVector<scf::ForOp> loops;
990 getPerfectlyNestedLoops(loops, op);
992 // Look for a band of loops that can be coalesced, i.e. perfectly nested
993 // loops with bounds defined above some loop.
997 SmallVector<unsigned> operandsDefinedAbove(loops.size());
998 for (unsigned i = 0, e = loops.size(); i < e; ++i) {
1001 SmallVector<Value> boundsOperands = {loops[i].getLowerBound(),
1002 loops[i].getUpperBound(),
1003 loops[i].getStep()};
1004 if (areValuesDefinedAbove(boundsOperands, loops[j].getRegion())) {
1015 SmallVector<unsigned> iterArgChainStart(loops.size());
1017 for (unsigned i = 1, e = loops.size(); i < e; ++i) {
1020 auto outerloop = loops[i - 1];
1021 auto innerLoop = loops[i];
1036 // 3. Identify bands of loops such that the operands of all of them are
1038 // so that modifications don't invalidate the inner loops.
1039 for (unsigned end = loops.size(); end > 0; --end) {
1049 auto band = llvm::MutableArrayRef(loops.data() + start, end - start);
1054 // If a band was found and transformed, keep looking at the loops above
1063 RewriterBase &rewriter, scf::ParallelOp loops,
1066 rewriter.setInsertionPoint(loops);
1067 Location loc = loops.getLoc();
1076 for (unsigned i = 0, e = loops.getNumLoops(); i < e; ++i) {
1078 rewriter.setInsertionPoint(loops);
1079 Value lb = loops.getLowerBound()[i];
1080 Value ub = loops.getUpperBound()[i];
1081 Value step = loops.getStep()[i];
1084 rewriter, loops.getLoc(), newLoopRange.size));
1086 rewriter.setInsertionPointToStart(loops.getBody());
1087 denormalizeInductionVariable(rewriter, loc, loops.getInductionVars()[i], lb,
1125 replaceAllUsesInRegionWith(loops.getBody()->getArgument(idx), iv,
1126 loops.getRegion());
1136 replaceAllUsesInRegionWith(loops.getBody()->getArgument(idx),
1137 previous, loops.getRegion());
1142 loops.getBody()->back().erase();
1145 loops.getBody()->getOperations());
1146 loops.erase();
1151 // Ops that come from triangular loops (i.e. that belong to the program slice
1194 // Traverse the interTile and intraTile loops and try to hoist ops such that
1195 // bands of perfectly nested loops are isolated.
1215 /// Collect perfectly nested loops starting from `rootForOps`. Loops are
1217 /// in the parent loop. Collect at most `maxLoops` loops and append them to
1299 for (auto loops : tile(forOps, sizes, ArrayRef<scf::ForOp>(target))) {
1300 assert(loops.size() == 1);
1301 res.push_back(loops[0]);
1307 // Collect perfectly nested loops. If more size values provided than nested
1308 // loops available, truncate `sizes`.
1325 // Collect perfectly nested loops. If more size values provided than nested
1326 // loops available, truncate `sizes`.
1410 // Replace old loops by substituting their uses by results of the fused loop.
1460 // Replace old loops by substituting their uses by results of the fused loop.