[Mlir-commits] [llvm] [mlir] MathExtras: avoid unnecessarily widening types (PR #95426)
Ramkumar Ramachandra
llvmlistbot at llvm.org
Fri Jun 14 02:56:41 PDT 2024
================
@@ -986,7 +986,9 @@ unsigned getMaxFlatWorkGroupSize(const MCSubtargetInfo *STI) {
unsigned getWavesPerWorkGroup(const MCSubtargetInfo *STI,
unsigned FlatWorkGroupSize) {
- return divideCeil(FlatWorkGroupSize, getWavefrontSize(STI));
+ // divideCeil will overflow, unless FlatWorkGroupSize is cast.
+ return divideCeil(static_cast<uint64_t>(FlatWorkGroupSize),
+ getWavefrontSize(STI));
----------------
artagnon wrote:
Oh, right. There's no way to avoid overflowing, as the final `* Align` may overflow.
https://github.com/llvm/llvm-project/pull/95426
More information about the Mlir-commits
mailing list