Skip to content

Commit

Permalink
Fix coverity issues (#2530)
Browse files Browse the repository at this point in the history
In the upstream: triton-lang/triton#4967

---------

Signed-off-by: Anatoly Myachev <[email protected]>
  • Loading branch information
anmyachev authored Oct 22, 2024
1 parent 6293c4b commit a3adef5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/Analysis/AxisInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ class ShLIOpAxisInfoVisitor final : public BinaryOpVisitorImpl<arith::ShLIOp> {
lhsDivisibility = 1;
}
auto numBits = log2Int(lhsDivisibility);
return multiplyDivisor(lhsDivisibility, 1 << shift);
return multiplyDivisor(lhsDivisibility, 1ll << shift);
}

int64_t getConstancy(arith::ShLIOp op, const AxisInfo &lhs,
Expand Down
10 changes: 5 additions & 5 deletions lib/Conversion/TritonGPUToLLVM/ScanOpToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static void warpScan(SmallVector<SmallVector<Value>> &srcValues,
acc[j] = select(mask, tempAcc[j], acc[j]);
}
}
srcValues[srcIndex] = acc;
srcValues[srcIndex] = std::move(acc);
}
}

Expand Down Expand Up @@ -128,8 +128,8 @@ static void AddPartialReduce(SmallVector<SmallVector<Value>> &srcValues,
ConversionPatternRewriter &rewriter,
const TargetInfoBase &targetInfo,
ScanLoweringHelper &helper,
SmallVector<Value> smemBases,
SmallVector<Type> smemTypes, Value warpId,
ArrayRef<Value> smemBases,
ArrayRef<Type> smemTypes, Value warpId,
Value laneIdAxis, Value parallelLaneId) {
Location loc = helper.getLoc();
unsigned numParallelLane = helper.getNonAxisNumThreadsPerCTA();
Expand Down Expand Up @@ -224,7 +224,7 @@ static void AddPartialReduce(SmallVector<SmallVector<Value>> &srcValues,
srcValues[srcIndex - i * elementStride][j]);
}
}
srcValues[srcIndex - i * elementStride] = laneValue;
srcValues[srcIndex - i * elementStride] = std::move(laneValue);
}
// For the next chunk start back from the value containing the
// accumulated value of all the warps.
Expand Down Expand Up @@ -303,7 +303,7 @@ static void AddPartialReduceOneWarp(SmallVector<SmallVector<Value>> &srcValues,
srcValues[srcIndex - i * elementStride][j], laneValue[j]);
}
}
srcValues[srcIndex - i * elementStride] = laneValue;
srcValues[srcIndex - i * elementStride] = std::move(laneValue);
}
// For the next chunk start back from the value containing the
// accumulated value of all the warps.
Expand Down
2 changes: 1 addition & 1 deletion third_party/intel/lib/Analysis/AxisInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ class ShLIOpAxisInfoVisitor final : public BinaryOpVisitorImpl<arith::ShLIOp> {
lhsDivisibility = 1;
}
auto numBits = log2Int(lhsDivisibility);
return multiplyDivisor(lhsDivisibility, 1 << shift);
return multiplyDivisor(lhsDivisibility, 1ll << shift);
}

int64_t getConstancy(arith::ShLIOp op, const AxisInfo &lhs,
Expand Down
10 changes: 5 additions & 5 deletions third_party/intel/lib/TritonIntelGPUToLLVM/ScanOpToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void warpScan(SmallVector<SmallVector<Value>> &srcValues,
acc[j] = select(mask, tempAcc[j], acc[j]);
}
}
srcValues[srcIndex] = acc;
srcValues[srcIndex] = std::move(acc);
}
}

Expand Down Expand Up @@ -126,8 +126,8 @@ static void AddPartialReduce(SmallVector<SmallVector<Value>> &srcValues,
ConversionPatternRewriter &rewriter,
const TargetInfoBase &targetInfo,
ScanLoweringHelper &helper,
SmallVector<Value> smemBases,
SmallVector<Type> smemTypes, Value warpId,
ArrayRef<Value> smemBases,
ArrayRef<Type> smemTypes, Value warpId,
Value laneIdAxis, Value parallelLaneId) {
Location loc = helper.getLoc();
unsigned numParallelLane = helper.getNonAxisNumThreadsPerCTA();
Expand Down Expand Up @@ -222,7 +222,7 @@ static void AddPartialReduce(SmallVector<SmallVector<Value>> &srcValues,
srcValues[srcIndex - i * elementStride][j]);
}
}
srcValues[srcIndex - i * elementStride] = laneValue;
srcValues[srcIndex - i * elementStride] = std::move(laneValue);
}
// For the next chunk start back from the value containing the
// accumulated value of all the warps.
Expand Down Expand Up @@ -301,7 +301,7 @@ static void AddPartialReduceOneWarp(SmallVector<SmallVector<Value>> &srcValues,
srcValues[srcIndex - i * elementStride][j], laneValue[j]);
}
}
srcValues[srcIndex - i * elementStride] = laneValue;
srcValues[srcIndex - i * elementStride] = std::move(laneValue);
}
// For the next chunk start back from the value containing the
// accumulated value of all the warps.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct CoalescePass
llvm::dbgs() << "\n";
});

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

Expand Down

0 comments on commit a3adef5

Please sign in to comment.