[Mlir-commits] [mlir] a7759fb - Apply clang-tidy fixes for performance-unnecessary-value-param in NVGPUTransformOps.cpp (NFC)

Mehdi Amini llvmlistbot at llvm.org
Thu Jan 25 11:33:38 PST 2024


Author: Mehdi Amini
Date: 2024-01-25T11:33:05-08:00
New Revision: a7759fb0f8ce28a53a38a6e0ba6b7105f3d6781a

URL: https://github.com/llvm/llvm-project/commit/a7759fb0f8ce28a53a38a6e0ba6b7105f3d6781a
DIFF: https://github.com/llvm/llvm-project/commit/a7759fb0f8ce28a53a38a6e0ba6b7105f3d6781a.diff

LOG: Apply clang-tidy fixes for performance-unnecessary-value-param in NVGPUTransformOps.cpp (NFC)

Added: 
    

Modified: 
    mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp b/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp
index 4cfec26c87440b..c81742233e6d0e 100644
--- a/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp
+++ b/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp
@@ -606,7 +606,7 @@ struct MmaSyncBuilder {
   /// IndexCalculator callback.
   SmallVector<Value> buildMemRefLoads(OpBuilder &b, Location loc,
                                       OpFoldResult laneId, Value memref,
-                                      IndexCalculator indexFn);
+                                      const IndexCalculator &indexFn);
 
   /// Perform a distributed load of a vector operand of `vectorShape` for a
   /// particular MMA instruction whose `(row, col)` indices are specified via
@@ -625,7 +625,7 @@ struct MmaSyncBuilder {
   SmallVector<Operation *> buildMemRefStores(OpBuilder &b, Location loc,
                                              ValueRange toStore,
                                              OpFoldResult laneId, Value memref,
-                                             IndexCalculator indexFn);
+                                             const IndexCalculator &indexFn);
 
   /// Perform a distributed store of a vector operand of `vectorShape` for a
   /// particular MMA instruction whose `(row, col)` indices are specified via
@@ -660,10 +660,10 @@ static void foreachIndividualVectorElement(Value vector, ApplyFn applyFn,
   }
 }
 
-SmallVector<Value> MmaSyncBuilder::buildMemRefLoads(OpBuilder &b, Location loc,
-                                                    OpFoldResult laneId,
-                                                    Value memref,
-                                                    IndexCalculator indexFn) {
+SmallVector<Value>
+MmaSyncBuilder::buildMemRefLoads(OpBuilder &b, Location loc,
+                                 OpFoldResult laneId, Value memref,
+                                 const IndexCalculator &indexFn) {
   auto aff = [&](AffineExpr e) {
     return affine::makeComposedFoldedAffineApply(b, loc, e, laneId);
   };
@@ -681,7 +681,7 @@ SmallVector<Value> MmaSyncBuilder::buildMemRefLoads(OpBuilder &b, Location loc,
 Value MmaSyncBuilder::buildMmaSyncMemRefLoadOperand(
     OpBuilder &b, Location loc, OpFoldResult laneId, Value memref,
     IndexCalculator indexFn, ArrayRef<int64_t> vectorShape) {
-  auto loads = buildMemRefLoads(b, loc, laneId, memref, indexFn);
+  auto loads = buildMemRefLoads(b, loc, laneId, memref, std::move(indexFn));
 
   Type elementType = getElementTypeOrSelf(memref.getType());
   auto vt = VectorType::get(vectorShape, elementType);
@@ -700,10 +700,9 @@ Value MmaSyncBuilder::buildMmaSyncMemRefLoadOperand(
   return res;
 }
 
-SmallVector<Operation *>
-MmaSyncBuilder::buildMemRefStores(OpBuilder &b, Location loc,
-                                  ValueRange toStore, OpFoldResult laneId,
-                                  Value memref, IndexCalculator indexFn) {
+SmallVector<Operation *> MmaSyncBuilder::buildMemRefStores(
+    OpBuilder &b, Location loc, ValueRange toStore, OpFoldResult laneId,
+    Value memref, const IndexCalculator &indexFn) {
   auto aff = [&](AffineExpr e) {
     return affine::makeComposedFoldedAffineApply(b, loc, e, laneId);
   };
@@ -734,7 +733,7 @@ SmallVector<Operation *> MmaSyncBuilder::buildMmaSyncMemRefStoreOperand(
       [&](Value v, int64_t linearIdx, ArrayRef<int64_t> indices) {
         toStore.push_back(v);
       });
-  return buildMemRefStores(b, loc, toStore, laneId, memref, indexFn);
+  return buildMemRefStores(b, loc, toStore, laneId, memref, std::move(indexFn));
 }
 
 static std::tuple<SmallVector<int64_t>, SmallVector<int64_t>,


        


More information about the Mlir-commits mailing list