@@ -416,12 +416,11 @@ getMinTilingSizesForEachDim(mlir::FunctionOpInterface entryPointFn,
416416 if (minTileSizes[unrollDim] <= 1 ) {
417417 continue ;
418418 }
419- int64_t factor = seen ? 1LL : maxUnrollFactor;
419+ int64_t factor = seen ? 1 : maxUnrollFactor;
420420 seen = true ;
421421 LDBG () << " Adjusted min tile sizes: " << minTileSizes[unrollDim]
422422 << " with factor=" << factor << " \n " ;
423- minTileSizes[unrollDim] =
424- std::min<int64_t >(minTileSizes[unrollDim], factor);
423+ minTileSizes[unrollDim] = std::min (minTileSizes[unrollDim], factor);
425424 }
426425 };
427426
@@ -469,7 +468,7 @@ static void reduceDistributionWorkgroups(
469468 continue ;
470469 }
471470
472- int64_t newSize = std::min< int64_t > (currSize * 2 , workload[index]);
471+ int64_t newSize = std::min (currSize * 2 , workload[index]);
473472 int64_t vectorSize = vectorSizeHints ? vectorSizeHints.value ()[index] : 0 ;
474473
475474 // Chech if it's the ideal size with vector size hint. And skip if the new
@@ -558,14 +557,14 @@ getDefaultDistributionTileSizes(ArrayRef<int64_t> lbs, ArrayRef<int64_t> ubs,
558557 }
559558 // Fallback to power of 2 if there's no hint or can't find the ideal size.
560559 if (vectorSize <= 1 || candidateTileSize == 1 ) {
561- candidateTileSize = std::max<int64_t >(
562- llvm::bit_floor<uint64_t >(targetSize), minTileSizes[i]);
560+ candidateTileSize =
561+ std::max (static_cast <int64_t >(llvm::bit_floor<uint64_t >(targetSize)),
562+ minTileSizes[i]);
563563 }
564564
565565 // Limit the workload per workgroup to the default being the max to keep the
566566 // work per invocation reasonable.
567- distributedTileSizes[i] =
568- std::min<int64_t >(candidateTileSize, maxTileSizes[i]);
567+ distributedTileSizes[i] = std::min (candidateTileSize, maxTileSizes[i]);
569568 }
570569
571570 reduceDistributionWorkgroups (workload, distributedTileSizes, maxTileSizes,
@@ -791,7 +790,7 @@ static void limitVectorTileSizes(SmallVectorImpl<int64_t> &vecTileSizes,
791790 // Note that if `eachOperandMaxTileBits` falls below some element type bit
792791 // width, it will trigger an early-return above, so we don't need to worry
793792 // about that here.
794- if (std::reduce (tileBits. begin (), tileBits. end () ) > allOperandsMaxTileBits) {
793+ if (llvm::sum_of (tileBits) > allOperandsMaxTileBits) {
795794 limitVectorTileSizes (vecTileSizes, eachOperandMaxTileBits / 2 ,
796795 allOperandsMaxTileBits, operandTypes, indexingMaps,
797796 bounds);
@@ -939,11 +938,10 @@ static void splitParallelAndReductionTiles(
939938 SmallVectorImpl<int64_t > &reductionSizes,
940939 SmallVectorImpl<bool > *parallelScalableFlags = nullptr ,
941940 SmallVectorImpl<bool > *reductionScalableFlags = nullptr ) {
942- reductionSizes.assign (parallelSizes. begin (), parallelSizes. end () );
941+ reductionSizes.assign (parallelSizes);
943942 if (reductionScalableFlags) {
944943 assert (parallelScalableFlags && " expected parallel scalable flags!" );
945- reductionScalableFlags->assign (parallelScalableFlags->begin (),
946- parallelScalableFlags->end ());
944+ reductionScalableFlags->assign (*parallelScalableFlags);
947945 }
948946 TilingInterface tilingOp = cast<TilingInterface>(op);
949947 for (auto [index, iteratorType] :
@@ -984,19 +982,19 @@ class LoweringConfigGenerator {
984982
985983 void setDistributionTileSizes (ArrayRef<int64_t > tileSizes) {
986984 assert (distTileSizes.empty () && " expected to set only once" );
987- distTileSizes.assign (tileSizes. begin (), tileSizes. end () );
985+ distTileSizes.assign (tileSizes);
988986 }
989987
990988 void setCacheTileSizes (ArrayRef<int64_t > tileSizes) {
991989 assert (cacheTileSizes.empty () && " expected to set only once" );
992- cacheTileSizes.assign (tileSizes. begin (), tileSizes. end () );
990+ cacheTileSizes.assign (tileSizes);
993991 }
994992
995993 void setVectorTileSizes (ArrayRef<int64_t > tileSizes,
996994 ArrayRef<bool > scalableFlags = {}) {
997995 assert (vectorTileSizes.empty () && " expected to set only once" );
998- vectorTileSizes.assign (tileSizes. begin (), tileSizes. end () );
999- vectorScalableFlags.assign (scalableFlags. begin (), scalableFlags. end () );
996+ vectorTileSizes.assign (tileSizes);
997+ vectorScalableFlags.assign (scalableFlags);
1000998 }
1001999
10021000 // / Returns a `IREE::CPU::LoweringConfigAttr` that is constructed by the
@@ -1367,16 +1365,15 @@ setMatmulPeelingRootConfig(mlir::FunctionOpInterface entryPointFn,
13671365
13681366 // The LLVM backend struggles to legalize non-power-of-two scalable vectors,
13691367 // hence the extra rounding up.
1370- for (const auto & [index, size] : llvm::enumerate (roundedVecTileSizes)) {
1368+ for (auto [index, size] : llvm::enumerate (roundedVecTileSizes)) {
13711369 if (!size)
13721370 continue ;
13731371 roundedVecTileSizes[index] =
13741372 roundUpToPow2 (size,
13751373 /* predicate=*/ inputVecScalableTileFlags[index]);
13761374 }
13771375
1378- SmallVector<int64_t > vectorTileSizes (roundedVecTileSizes.begin (),
1379- roundedVecTileSizes.end ());
1376+ auto vectorTileSizes = llvm::to_vector_of<int64_t >(roundedVecTileSizes);
13801377 SmallVector<bool > vectorScalableFlags (inputVecScalableTileFlags.begin (),
13811378 inputVecScalableTileFlags.end ());
13821379 vectorScalableFlags.back () = false ;
@@ -1535,7 +1532,7 @@ static void getMatmulVectorSizesUsingFullVectorHeuristics(
15351532 mmType = shType.getElementType ();
15361533
15371534 if (mmType.isSignlessIntOrFloat ())
1538- minSize = std::min< int64_t > (minSize, mmType.getIntOrFloatBitWidth ());
1535+ minSize = std::min (minSize, int64_t { mmType.getIntOrFloatBitWidth ()} );
15391536 }
15401537
15411538 LDBG () << " Smallest type found: " << minSize << " bits" ;
@@ -1547,7 +1544,7 @@ static void getMatmulVectorSizesUsingFullVectorHeuristics(
15471544 constexpr int64_t byteSizeInBits = 8 ;
15481545 int64_t minNumElements =
15491546 (getNativeVectorSizeInBytes (entryPointFn) * byteSizeInBits) / minSize;
1550- sizes[1 ] = std::max< int64_t > (sizes[1 ], minNumElements);
1547+ sizes[1 ] = std::max (sizes[1 ], minNumElements);
15511548}
15521549
15531550// / Utility to compute the tile sizes for RISC-V Vector.
@@ -1729,7 +1726,7 @@ getMatmulVectorSizes(mlir::FunctionOpInterface entryPointFn,
17291726 if (numScalableDims >= 2 && scalableTileFlags[i]) {
17301727 continue ;
17311728 }
1732- tileSizes[i] = std::min< int64_t > (tileSize, dimSize);
1729+ tileSizes[i] = std::min (tileSize, dimSize);
17331730 }
17341731 }
17351732
@@ -1912,7 +1909,7 @@ getMmt4dLoweringConfig(linalg::LinalgOp op) {
19121909 int64_t targetRhsTileElems = targetTileBytes * 8 / bitWidth;
19131910 int64_t targetRhsTileNSize = targetRhsTileElems / reductionSize;
19141911 int64_t tileSize = llvm::divideCeil (targetRhsTileNSize, tile0Size);
1915- tileSize = std::max< int64_t > (tileSize, 1 );
1912+ tileSize = std::max (tileSize, int64_t { 1 } );
19161913 return tileSize;
19171914 };
19181915 int64_t tileBytes =
@@ -2024,7 +2021,7 @@ static LogicalResult setRootConfig(mlir::FunctionOpInterface entryPointFn,
20242021 if (distTileSizes[pos] == 0 || ShapedType::isDynamic (size))
20252022 continue ;
20262023 distTileSizes[pos] = distTileSizes[pos] / size;
2027- distTileSizes[pos] = std::max< int64_t > (distTileSizes[pos], 1 );
2024+ distTileSizes[pos] = std::max (distTileSizes[pos], int64_t { 1 } );
20282025 }
20292026
20302027 // Dynamic inner tiles lead to unbounded stack allocation (which is introduced
@@ -2410,7 +2407,7 @@ static void getTransposeX86VectorSizes(
24102407 }
24112408
24122409 // Replace dims to be vectorized with the new tile sizes.
2413- sizes.assign (minTileSizes. begin (), minTileSizes. end () );
2410+ sizes.assign (minTileSizes);
24142411 std::replace_if (
24152412 sizes.begin (), sizes.end (), [](int64_t tileSize) { return tileSize > 1 ; },
24162413 targetVectorSize);
@@ -2548,9 +2545,9 @@ static LogicalResult setElementwiseGenericOpRootConfig(
25482545 // prevents the runtime overheads domiating the execution time. The number is
25492546 // derived from experimients. We should be able to make it related to target.
25502547 constexpr int64_t kMinimumWorkload = 4096 ;
2551- auto shape = genericOp.getStaticLoopRanges ();
2548+ SmallVector< int64_t > shape = genericOp.getStaticLoopRanges ();
25522549 int64_t numWorkload = 1 ;
2553- for (const auto & [index, size] : llvm::enumerate (shape)) {
2550+ for (auto [index, size] : llvm::enumerate (shape)) {
25542551 if (ShapedType::isDynamic (size)) {
25552552 numWorkload = ShapedType::kDynamic ;
25562553 break ;
@@ -2566,7 +2563,7 @@ static LogicalResult setElementwiseGenericOpRootConfig(
25662563 currDim++;
25672564 continue ;
25682565 }
2569- int64_t newSize = std::min< int64_t > (currSize * 2 , shape[currDim]);
2566+ int64_t newSize = std::min (currSize * 2 , shape[currDim]);
25702567 numWorkload = numWorkload / currSize * newSize;
25712568 distTileSizes[currDim] = newSize;
25722569 }
@@ -3149,10 +3146,9 @@ void MultiLoweringConfigGenerator::loadRootLoweringConfig() {
31493146 if (rootLoweringConfig.hasTilingLevel (level)) {
31503147 auto attr = llvm::cast<IREE::Codegen::LoweringConfigTilingLevelAttr>(
31513148 rootLoweringConfig.getTilingLevelAttr (level));
3152- sizes.assign (attr.getSizes (). begin (), attr. getSizes (). end () );
3149+ sizes.assign (attr.getSizes ());
31533150 // Only `VectorCommonParallel` has scalable flags.
3154- flags.assign (attr.getScalableFlags ().begin (),
3155- attr.getScalableFlags ().end ());
3151+ flags.assign (attr.getScalableFlags ());
31563152 }
31573153 } else {
31583154 if (rootLoweringConfig.hasTilingLevel (level)) {
0 commit comments