Skip to content

Commit e5dda8b

Browse files
BabakkGraphcoreFindHao
authored andcommitted
[NFC] Fix signed/unsigned comparison. (triton-lang#6494)
Fixing a compiler warning generated from comparison of integers of different signs (int vs size_t) We build our backend with -Wextra which includes -Wsign-compare, so an accidental include of this header can break our build. # New contributor declaration - [ ] I am not making a trivial change, such as fixing a typo in a comment. - [x] I have written a PR description following these [rules](https://cbea.ms/git-commit/#why-not-how). - [x] I have run `pre-commit run --from-ref origin/main --to-ref HEAD`. - Select one of the following. - [ ] I have added tests. - `/test` for `lit` tests - `/unittest` for C++ tests - `/python/test` for end-to-end tests - [x] This PR does not need a test because `Fixing a compile time warning and is a non-functional change`. - Select one of the following. - [x] I have not added any `lit` tests. - [ ] The `lit` tests I have added follow these [best practices](https://mlir.llvm.org/getting_started/TestingGuide/#filecheck-best-practices), including the "tests should be minimal" section. (Usually running Python code and using the instructions it generates is not minimal.)
1 parent b489f34 commit e5dda8b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/triton/Tools/LinearLayout.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ class LinearLayout {
428428
ArrayRef<int32_t> getBasis(StringAttr inDim, int32_t pos) const {
429429
auto it = bases.find(inDim);
430430
assert(it != bases.end());
431-
assert(pos < it->second.size());
431+
assert(pos >= 0);
432+
assert(static_cast<size_t>(pos) < it->second.size());
432433
return it->second[pos];
433434
}
434435

0 commit comments

Comments
 (0)