Skip to content

Commit 60c4154

Browse files
authored
Only request residency once (#2051)
1 parent f2c8530 commit 60c4154

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mlx/backend/metal/resident.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ResidencySet::ResidencySet(MTL::Device* d) {
2222
}
2323
throw std::runtime_error(msg.str());
2424
}
25+
wired_set_->requestResidency();
2526
}
2627
}
2728

@@ -32,7 +33,6 @@ void ResidencySet::insert(MTL::Allocation* buf) {
3233
if (wired_set_->allocatedSize() + buf->allocatedSize() <= capacity_) {
3334
wired_set_->addAllocation(buf);
3435
wired_set_->commit();
35-
wired_set_->requestResidency();
3636
} else {
3737
unwired_set_.insert(buf);
3838
}
@@ -76,7 +76,6 @@ void ResidencySet::resize(size_t size) {
7676
}
7777
}
7878
wired_set_->commit();
79-
wired_set_->requestResidency();
8079
} else if (current_size > size) {
8180
auto pool = new_scoped_memory_pool();
8281
// Remove wired allocations until under capacity

0 commit comments

Comments
 (0)