Limit max CUDA pinned host buffer size to 4 GB (#30449)

This commit is contained in:
Gaurav Garg authored and GitHub committed 2026-10-16 08:20:26 +05:30
1 parent e707790c73
commit b6334e37e6
2 files changed
+9 -2

No files matched your search

+2 -1
View File
@@ -1950,7 +1950,8 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) {
if (buf == nullptr) {
throw std::runtime_error(format("unable to allocate %s buffer", ggml_backend_buft_name(buft)));
}
if (use_mlock && ggml_backend_buffer_is_host(buf)) {
// a multi_buffer has no base to lock, its parts are usually pinned memory (host buffer types with a max size)
if (use_mlock && ggml_backend_buffer_is_host(buf) && ggml_backend_buffer_get_base(buf) != nullptr) {
pimpl->mlock_bufs.emplace_back(new llama_mlock);
auto & mlock_buf = pimpl->mlock_bufs.back();
mlock_buf->init (ggml_backend_buffer_get_base(buf));