llama_model_loader: fail if backend cannot allocate buffer
This commit is contained in:
parent
1c931f3d4f
commit
d8b567d254
1 changed files with 6 additions and 0 deletions
|
@ -5155,6 +5155,8 @@ static bool llm_load_tensors(
|
|||
ggml_backend_buffer_get_size(buf));
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
throw std::runtime_error("failed to allocate cpu buffer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5168,6 +5170,8 @@ static bool llm_load_tensors(
|
|||
ggml_backend_buffer_t buf = ggml_backend_metal_buffer_from_ptr((char *) addr + first, last - first, max_size);
|
||||
if (buf != nullptr) {
|
||||
bufs.push_back(buf);
|
||||
} else {
|
||||
throw std::runtime_error("failed to allocate metal buffer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5182,6 +5186,8 @@ static bool llm_load_tensors(
|
|||
mlock_buf->grow_to(ggml_backend_buffer_get_size(buf));
|
||||
}
|
||||
bufs.push_back(buf);
|
||||
} else {
|
||||
throw std::runtime_error("failed to allocate backend buffer");
|
||||
}
|
||||
}
|
||||
if (bufs.empty()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue