Skip to content

Commit

Permalink
fix out of bounds array access in TilingParameters::bufferSizeOfLeaf()
Browse files Browse the repository at this point in the history
  • Loading branch information
ge0mk committed Sep 16, 2024
1 parent dcd57f8 commit f776a07
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cinnamon/lib/Dialect/Cinm/Interfaces/TilingInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ int64_t TilingParameters::bufferSizeOfLeaf() {
int64_t bufSize = 0;
int i = 0;
do {
int lastIdx = bufferSizesInBytes.size() - 1 - i;
size_t lastIdx = bufferSizesInBytes.size() - 1 - i;
bufSize += bufferSizesInBytes[lastIdx] / numLeafsInDim;
numLeafsInDim *= workgroupShape[lastIdx];
numLeafsInDim *=
lastIdx < workgroupShape.size() ? workgroupShape[lastIdx] : 1;
i++;
} while (i < static_cast<int64_t>(bufferSizesInBytes.size()));
return bufSize;
Expand Down

0 comments on commit f776a07

Please sign in to comment.