Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Blackwell] Prevent the tmem allocator bitmap to go out of bound #6032

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct MemoryBitMap {
}
void alloc(const TMemChunk &chunk) {
// Ensure the underlying data fits the allocation.
while ((chunk.startCol + chunk.numCols) * chunk.numRows >= elements.size())
while ((chunk.startCol + chunk.numCols) * kNumRows >= elements.size())
elements.resize(2 * elements.size(), false);

for (int i = 0; i < chunk.numCols; i++) {
Expand Down Expand Up @@ -92,8 +92,13 @@ struct MemoryBitMap {
}

private:
bool isUsed(int row, int col) const { return elements[row + col * kNumRows]; }
bool isUsed(int row, int col) const {
if (row + col * kNumRows >= elements.size())
return false;
return elements[row + col * kNumRows];
}
void setUsed(int row, int col, bool used) {
assert(row + col * kNumRows < elements.size());
elements[row + col * kNumRows] = used;
}

Expand Down
Loading