diff options
author | slaren <slarengh@gmail.com> | 2024-01-26 18:59:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 18:59:43 +0100 |
commit | 62fead3ea0a30c8d424f4a8373fa14165c7c707f (patch) | |
tree | f3ef9ffe08008df108a099fc5828646c052e2a67 /ggml-backend.c | |
parent | 15b4538ff29b280a395a1406d711497d8eaa2564 (diff) |
cuda : fix tensor size calculation for non-split buffer (#5145)
Diffstat (limited to 'ggml-backend.c')
-rw-r--r-- | ggml-backend.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ggml-backend.c b/ggml-backend.c index 423512de..3fff5fc8 100644 --- a/ggml-backend.c +++ b/ggml-backend.c @@ -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); } |