]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
ggml : split graph allocations according to backend max buffer size (llama/15815)
authorAcly <redacted>
Wed, 24 Sep 2025 14:17:49 +0000 (16:17 +0200)
committerGeorgi Gerganov <redacted>
Mon, 29 Sep 2025 12:18:09 +0000 (15:18 +0300)
commit5069c0803421c004c234a3f66700692a55c47f84
treefb7da00d9074ee629b9d7ee6c2a854f85e8245fb
parent41245891c1d39570b9eab7c75c7f07f9eba7dcee
ggml : split graph allocations according to backend max buffer size (llama/15815)

* ggml : make gallocr respect the backend's max buffer size

* if the graph requires more memory than can fit into a single allocation, split it into multiple backend buffers
* vulkan: report the actual max  allocation size in buffer type  interface

* fix missing newline, apple-clang warning

* track size of individual chunks in ggml_dyn_tallocr and raise max chunks.
revert to use suballocation_block_size as max chunk size for vulkan.

* track (chunk, offset) pairs instead of "global" offsets through gallocr.

* simpler, don't need loops to map between local/global offsets
* touches more code

* fix dyn_tallocr_max_size and initialization

* fix memory leak when buffers are reused due to same buffer type appearing multiple times

* make vbuffer allocation follow the same logic as backend_buffer did before

* continue to use leftover unallocated space of previous chunks after a new one has been created

* treat free blocks of each chunk as separate list
* they're still allocated together, but start/end of each chunk is tracked, and allocate/free iterate over sub-ranges
* exhaust freed blocks of all chunks before considering their last blocks with unallocated space
* start with 0 chunks/blocks and create chunks as needed
* allow the last chunk to grow beyond max size

* refactor: move adding new free block and new chunk into separate functions

* allocate chunks individually with a separate free-blocks list for each one

* needs a bit more memory/allocations/indirections, but code is simpler

* fix warnings (missing static) & debug checks
ggml/src/ggml-alloc.c
ggml/src/ggml-impl.h