Skip to content

Commit 235496e

Browse files
authored
[Backend] Assert that num threads is always power of 2 (NFC) (#7251)
1 parent b3b1b13 commit 235496e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/Conversion/TritonGPUToLLVM/Utility.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,9 @@ Value getThreadId(OpBuilder &rewriter, Location loc) {
264264
tid = rewriter.create<arith::SubIOp>(loc, tid, b.i32_val(*startId));
265265
}
266266

267-
if (llvm::isPowerOf2_32(upperBound)) {
268-
// help LLVM's known bits analysis:
269-
tid = b.and_(tid, b.i32_val(upperBound - 1));
270-
}
267+
assert(llvm::isPowerOf2_32(upperBound));
268+
// help LLVM's known bits analysis:
269+
tid = b.and_(tid, b.i32_val(upperBound - 1));
271270

272271
return tid;
273272
}

0 commit comments

Comments
 (0)