cuda : fix tensor size calculation for non-split buffer (#5145)

This commit is contained in:
slaren 2024-01-26 18:59:43 +01:00 committed by GitHub
parent 15b4538ff2
commit 62fead3ea0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 15 deletions

View file

@ -30,7 +30,9 @@ size_t ggml_backend_buft_get_alignment(ggml_backend_buffer_type_t buft) {
GGML_CALL size_t ggml_backend_buft_get_alloc_size(ggml_backend_buffer_type_t buft, struct ggml_tensor * tensor) {
// get_alloc_size is optional, defaults to ggml_nbytes
if (buft->iface.get_alloc_size) {
return buft->iface.get_alloc_size(buft, tensor);
size_t size = buft->iface.get_alloc_size(buft, tensor);
assert(size >= ggml_nbytes(tensor));
return size;
}
return ggml_nbytes(tensor);
}