Skip to content

Commit e4bd39a

Browse files
authored
Fix coverity issues (#2382)
`Coverity` see the INTEGER_OVERFLOW error for the following line when rank == 1: https://github.com/intel/intel-xpu-backend-for-triton/blob/361dfa7105ecc8ded76803623d4e066fac1297e8/third_party/intel/lib/TritonIntelGPUTransforms/RewriteTensorPointer.cpp#L82 I believe by using an additional assert we can secure the code (at least, we'll show the limitations we rely on in the code more explicitly) and get rid of the error `Coverity` shows. Signed-off-by: Anatoly Myachev <[email protected]>
1 parent 361dfa7 commit e4bd39a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

third_party/intel/lib/TritonIntelGPUTransforms/RewriteTensorPointer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ bool shouldRemove(tt::MakeTensorPtrOp &op, bool isUsedByStoreOp) {
5252
TypedValue<triton::PointerType> base = op.getBase();
5353
Operation::operand_range shape = op.getShape();
5454
unsigned rank = shape.size();
55+
assert(rank > 1 && "Expecting tensor with rank > 1");
5556
Operation::operand_range strides = op.getStrides();
5657
Operation::operand_range offsets = op.getOffsets();
5758
ArrayRef<int32_t> order = op.getOrder();

0 commit comments

Comments
 (0)