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

#15407: manually release blocks on exit #15432

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions tt_metal/impl/allocator/algorithms/free_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,21 @@ FreeList::FreeList(DeviceAddr max_size_bytes, DeviceAddr offset_bytes, DeviceAdd
this->init();
}

FreeList::~FreeList() {
this->clear();
}

void FreeList::init() {
boost::local_shared_ptr<FreeList::Block> curr_block = this->block_head_;
while (curr_block != nullptr) {
auto next_block = curr_block->next_block;
curr_block->prev_block = nullptr;
curr_block->next_block = nullptr;
curr_block->prev_free = nullptr;
curr_block->next_free = nullptr;
curr_block = next_block;
}

this->shrink_size_ = 0;
auto block = boost::make_local_shared<Block>(0, this->max_size_bytes_);
this->block_head_ = block;
Expand Down
1 change: 1 addition & 0 deletions tt_metal/impl/allocator/algorithms/free_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class FreeList : public Algorithm {
};

FreeList(DeviceAddr max_size_bytes, DeviceAddr offset_bytes, DeviceAddr min_allocation_size, DeviceAddr alignment, SearchPolicy search_policy);
~FreeList();
void init();

std::vector<std::pair<DeviceAddr, DeviceAddr>> available_addresses(DeviceAddr size_bytes) const;
Expand Down
Loading