llama_decode_ext

This commit is contained in:
Xuan Son Nguyen
2025-02-24 17:01:20 +01:00
parent aed4a8e980
commit 4bf7ca3943
3 changed files with 8 additions and 8 deletions

View File

@ -3149,7 +3149,7 @@ struct server_context {
llama_batch_ext_ptr batch_view(llama_batch_ext_get_view(batch.get(), i, n_tokens)); llama_batch_ext_ptr batch_view(llama_batch_ext_get_view(batch.get(), i, n_tokens));
const int ret = llama_text_decode(ctx, batch_view.get()); const int ret = llama_decode_ext(ctx, batch_view.get());
metrics.on_decoded(slots); metrics.on_decoded(slots);
if (ret != 0) { if (ret != 0) {
@ -3294,7 +3294,7 @@ struct server_context {
SLT_DBG(slot, "decoding speculative batch, size = %d\n", llama_batch_ext_get_n_tokens(slot.batch_spec.get())); SLT_DBG(slot, "decoding speculative batch, size = %d\n", llama_batch_ext_get_n_tokens(slot.batch_spec.get()));
llama_text_decode(ctx, slot.batch_spec.get()); llama_decode_ext(ctx, slot.batch_spec.get());
// the accepted tokens from the speculation // the accepted tokens from the speculation
const auto ids = common_sampler_sample_and_accept_n(slot.smpl, ctx, draft); const auto ids = common_sampler_sample_and_accept_n(slot.smpl, ctx, draft);

View File

@ -944,7 +944,7 @@ extern "C" {
DEPRECATED(LLAMA_API int32_t llama_encode( DEPRECATED(LLAMA_API int32_t llama_encode(
struct llama_context * ctx, struct llama_context * ctx,
struct llama_batch batch), "use llama_batch_ext API instead"); struct llama_batch batch), "use llama_batch_ext API instead");
LLAMA_API int32_t llama_text_encode( LLAMA_API int32_t llama_encode_ext(
struct llama_context * ctx, struct llama_context * ctx,
struct llama_batch_ext * batch); struct llama_batch_ext * batch);
@ -955,7 +955,7 @@ extern "C" {
DEPRECATED(LLAMA_API int32_t llama_decode( DEPRECATED(LLAMA_API int32_t llama_decode(
struct llama_context * ctx, struct llama_context * ctx,
struct llama_batch batch), "use llama_batch_ext API instead"); struct llama_batch batch), "use llama_batch_ext API instead");
LLAMA_API int32_t llama_text_decode( LLAMA_API int32_t llama_decode_ext(
struct llama_context * ctx, struct llama_context * ctx,
struct llama_batch_ext * batch); struct llama_batch_ext * batch);

View File

@ -9977,7 +9977,7 @@ int32_t llama_encode(
// also convert llama_batch to llama_batch_ext // also convert llama_batch to llama_batch_ext
llama_batch_allocr batch_allocr(batch, batch.pos ? -1 : ctx->kv_self.max_pos() + 1); llama_batch_allocr batch_allocr(batch, batch.pos ? -1 : ctx->kv_self.max_pos() + 1);
llama_batch_ext * batch_ext = batch_allocr.batch; llama_batch_ext * batch_ext = batch_allocr.batch;
return llama_text_encode(ctx, batch_ext); return llama_encode_ext(ctx, batch_ext);
} }
// DEPRECATED // DEPRECATED
@ -9988,10 +9988,10 @@ int32_t llama_decode(
// also convert llama_batch to llama_batch_ext // also convert llama_batch to llama_batch_ext
llama_batch_allocr batch_allocr(batch, batch.pos ? -1 : ctx->kv_self.max_pos() + 1); llama_batch_allocr batch_allocr(batch, batch.pos ? -1 : ctx->kv_self.max_pos() + 1);
llama_batch_ext * batch_ext = batch_allocr.batch; llama_batch_ext * batch_ext = batch_allocr.batch;
return llama_text_decode(ctx, batch_ext); return llama_decode_ext(ctx, batch_ext);
} }
int32_t llama_text_encode( int32_t llama_encode_ext(
struct llama_context * ctx, struct llama_context * ctx,
struct llama_batch_ext * batch) { struct llama_batch_ext * batch) {
const int ret = llama_encode_impl(*ctx, *batch); const int ret = llama_encode_impl(*ctx, *batch);
@ -10002,7 +10002,7 @@ int32_t llama_text_encode(
return ret; return ret;
} }
int32_t llama_text_decode( int32_t llama_decode_ext(
struct llama_context * ctx, struct llama_context * ctx,
struct llama_batch_ext * batch) { struct llama_batch_ext * batch) {
const int ret = llama_decode_impl(*ctx, *batch); const int ret = llama_decode_impl(*ctx, *batch);