mirror of
https://github.com/ml-explore/mlx.git
synced 2025-08-20 10:27:41 +08:00
remove unused function
This commit is contained in:
parent
f3c7a7c1e5
commit
58f3c15963
@ -81,24 +81,6 @@ void BufferCache::recycle_to_cache(MTL::Buffer* buf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferCache::release_cached_buffers(size_t min_bytes_to_free) {
|
|
||||||
if (min_bytes_to_free >= 0.9 * pool_size_) {
|
|
||||||
clear();
|
|
||||||
} else {
|
|
||||||
std::lock_guard<std::mutex> lk(cache_mutex_);
|
|
||||||
size_t total_bytes_freed = 0;
|
|
||||||
while (tail_ && (total_bytes_freed < min_bytes_to_free)) {
|
|
||||||
if (tail_->buf) {
|
|
||||||
total_bytes_freed += tail_->buf->length();
|
|
||||||
tail_->buf->release();
|
|
||||||
tail_->buf = nullptr;
|
|
||||||
}
|
|
||||||
remove_from_list(tail_);
|
|
||||||
}
|
|
||||||
pool_size_ -= total_bytes_freed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BufferCache::add_at_head(BufferCache::BufferHolder* to_add) {
|
void BufferCache::add_at_head(BufferCache::BufferHolder* to_add) {
|
||||||
if (!to_add)
|
if (!to_add)
|
||||||
return;
|
return;
|
||||||
|
@ -23,7 +23,6 @@ class BufferCache {
|
|||||||
|
|
||||||
MTL::Buffer* reuse_from_cache(size_t size);
|
MTL::Buffer* reuse_from_cache(size_t size);
|
||||||
void recycle_to_cache(MTL::Buffer* buf);
|
void recycle_to_cache(MTL::Buffer* buf);
|
||||||
void release_cached_buffers(size_t min_bytes_to_free);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct BufferHolder {
|
struct BufferHolder {
|
||||||
|
Loading…
Reference in New Issue
Block a user