Skip to content

Commit a3adef5

Browse files
authored
Fix coverity issues (#2530)
In the upstream: triton-lang/triton#4967 --------- Signed-off-by: Anatoly Myachev <[email protected]>
1 parent 6293c4b commit a3adef5

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

lib/Analysis/AxisInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ class ShLIOpAxisInfoVisitor final : public BinaryOpVisitorImpl<arith::ShLIOp> {
895895
lhsDivisibility = 1;
896896
}
897897
auto numBits = log2Int(lhsDivisibility);
898-
return multiplyDivisor(lhsDivisibility, 1 << shift);
898+
return multiplyDivisor(lhsDivisibility, 1ll << shift);
899899
}
900900

901901
int64_t getConstancy(arith::ShLIOp op, const AxisInfo &lhs,

lib/Conversion/TritonGPUToLLVM/ScanOpToLLVM.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static void warpScan(SmallVector<SmallVector<Value>> &srcValues,
7676
acc[j] = select(mask, tempAcc[j], acc[j]);
7777
}
7878
}
79-
srcValues[srcIndex] = acc;
79+
srcValues[srcIndex] = std::move(acc);
8080
}
8181
}
8282

@@ -128,8 +128,8 @@ static void AddPartialReduce(SmallVector<SmallVector<Value>> &srcValues,
128128
ConversionPatternRewriter &rewriter,
129129
const TargetInfoBase &targetInfo,
130130
ScanLoweringHelper &helper,
131-
SmallVector<Value> smemBases,
132-
SmallVector<Type> smemTypes, Value warpId,
131+
ArrayRef<Value> smemBases,
132+
ArrayRef<Type> smemTypes, Value warpId,
133133
Value laneIdAxis, Value parallelLaneId) {
134134
Location loc = helper.getLoc();
135135
unsigned numParallelLane = helper.getNonAxisNumThreadsPerCTA();
@@ -224,7 +224,7 @@ static void AddPartialReduce(SmallVector<SmallVector<Value>> &srcValues,
224224
srcValues[srcIndex - i * elementStride][j]);
225225
}
226226
}
227-
srcValues[srcIndex - i * elementStride] = laneValue;
227+
srcValues[srcIndex - i * elementStride] = std::move(laneValue);
228228
}
229229
// For the next chunk start back from the value containing the
230230
// accumulated value of all the warps.
@@ -303,7 +303,7 @@ static void AddPartialReduceOneWarp(SmallVector<SmallVector<Value>> &srcValues,
303303
srcValues[srcIndex - i * elementStride][j], laneValue[j]);
304304
}
305305
}
306-
srcValues[srcIndex - i * elementStride] = laneValue;
306+
srcValues[srcIndex - i * elementStride] = std::move(laneValue);
307307
}
308308
// For the next chunk start back from the value containing the
309309
// accumulated value of all the warps.

third_party/intel/lib/Analysis/AxisInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ class ShLIOpAxisInfoVisitor final : public BinaryOpVisitorImpl<arith::ShLIOp> {
900900
lhsDivisibility = 1;
901901
}
902902
auto numBits = log2Int(lhsDivisibility);
903-
return multiplyDivisor(lhsDivisibility, 1 << shift);
903+
return multiplyDivisor(lhsDivisibility, 1ll << shift);
904904
}
905905

906906
int64_t getConstancy(arith::ShLIOp op, const AxisInfo &lhs,

third_party/intel/lib/TritonIntelGPUToLLVM/ScanOpToLLVM.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static void warpScan(SmallVector<SmallVector<Value>> &srcValues,
7474
acc[j] = select(mask, tempAcc[j], acc[j]);
7575
}
7676
}
77-
srcValues[srcIndex] = acc;
77+
srcValues[srcIndex] = std::move(acc);
7878
}
7979
}
8080

@@ -126,8 +126,8 @@ static void AddPartialReduce(SmallVector<SmallVector<Value>> &srcValues,
126126
ConversionPatternRewriter &rewriter,
127127
const TargetInfoBase &targetInfo,
128128
ScanLoweringHelper &helper,
129-
SmallVector<Value> smemBases,
130-
SmallVector<Type> smemTypes, Value warpId,
129+
ArrayRef<Value> smemBases,
130+
ArrayRef<Type> smemTypes, Value warpId,
131131
Value laneIdAxis, Value parallelLaneId) {
132132
Location loc = helper.getLoc();
133133
unsigned numParallelLane = helper.getNonAxisNumThreadsPerCTA();
@@ -222,7 +222,7 @@ static void AddPartialReduce(SmallVector<SmallVector<Value>> &srcValues,
222222
srcValues[srcIndex - i * elementStride][j]);
223223
}
224224
}
225-
srcValues[srcIndex - i * elementStride] = laneValue;
225+
srcValues[srcIndex - i * elementStride] = std::move(laneValue);
226226
}
227227
// For the next chunk start back from the value containing the
228228
// accumulated value of all the warps.
@@ -301,7 +301,7 @@ static void AddPartialReduceOneWarp(SmallVector<SmallVector<Value>> &srcValues,
301301
srcValues[srcIndex - i * elementStride][j], laneValue[j]);
302302
}
303303
}
304-
srcValues[srcIndex - i * elementStride] = laneValue;
304+
srcValues[srcIndex - i * elementStride] = std::move(laneValue);
305305
}
306306
// For the next chunk start back from the value containing the
307307
// accumulated value of all the warps.

third_party/intel/lib/TritonIntelGPUTransforms/Coalesce.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct CoalescePass
4040
llvm::dbgs() << "\n";
4141
});
4242

43-
auto contiguity = axisInfoAnalysis.getAxisInfo(ptr)->getContiguity();
43+
const auto &contiguity = axisInfoAnalysis.getAxisInfo(ptr)->getContiguity();
4444
SmallVector<unsigned> order = argSort(contiguity);
4545
LDBG("order=[" << triton::join(order, ", ") << "]");
4646

0 commit comments

Comments
 (0)