mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
patch small pool init
This commit is contained in:
@@ -30,8 +30,11 @@ SmallSizePool::SmallSizePool() {
|
|||||||
next_free_ = buffer_;
|
next_free_ = buffer_;
|
||||||
|
|
||||||
CHECK_CUDA_ERROR(cudaMallocManaged(&data_, small_pool_size));
|
CHECK_CUDA_ERROR(cudaMallocManaged(&data_, small_pool_size));
|
||||||
CHECK_CUDA_ERROR(
|
auto status =
|
||||||
cudaMemAdvise(data_, small_pool_size, cudaMemAdviseSetReadMostly, 0));
|
cudaMemAdvise(data_, small_pool_size, cudaMemAdviseSetReadMostly, 0);
|
||||||
|
if (status != cudaSuccess && status != cudaErrorInvalidValue) {
|
||||||
|
throw std::runtime_error("Unable to initialize small allocator pool");
|
||||||
|
}
|
||||||
|
|
||||||
auto curr = next_free_;
|
auto curr = next_free_;
|
||||||
for (size_t i = 1; i < num_blocks; ++i) {
|
for (size_t i = 1; i < num_blocks; ++i) {
|
||||||
|
|||||||
Reference in New Issue
Block a user