sampling: reuse token data buffer in llama_sampler_sample (#18365)

* sampling: reuse token data buffer in llama_sampler_sample

* move cur buffer before timing section, after samplers

* minor : fix build

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
This commit is contained in:
Jay ZenithandGeorgi Gerganov authored and GitHub committed 2025-12-30 16:27:49 +02:00
1 parent f14f4e421b
commit c32fa21db8
2 files changed
+47 -33

No files matched your search

+3
View File
@@ -16,6 +16,9 @@ struct llama_sampler_chain {
std::vector<struct llama_sampler *> samplers;
// pre-allocated buffer for llama_sampler_sample to avoid repeated allocations
std::vector<llama_token_data> cur;
// timing
mutable int64_t t_sample_us;