Skip to content

Commit

Permalink
Apply clang-tidy fixes for performance-unnecessary-value-param in NVG…
Browse files Browse the repository at this point in the history
…PUTransformOps.cpp (NFC)
  • Loading branch information
joker-eph committed Jan 25, 2024
1 parent 70fdaef commit a7759fb
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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);
};
Expand All @@ -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);
Expand All @@ -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);
};
Expand Down Expand Up @@ -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>,
Expand Down

0 comments on commit a7759fb

Please sign in to comment.