Skip to content

Commit

Permalink
Merge pull request #18 from ge0mk/fix
Browse files Browse the repository at this point in the history
fix out of bounds array access in TilingParameters::bufferSizeOfLeaf()
  • Loading branch information
ge0mk authored Sep 28, 2024
2 parents c1da17b + f776a07 commit 649bb0d
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 @@ -120,9 +120,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 649bb0d

Please sign in to comment.