Skip to content

Commit

Permalink
moved reset to end of llama_decode_internal
Browse files Browse the repository at this point in the history
  • Loading branch information
agray3 committed Apr 26, 2024
1 parent a2beaff commit 34847ca
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11205,6 +11205,10 @@ static int llama_decode_internal(
}
}

// Reset state for the next token before backend sync, to allow the CPU activities in the reset to
// overlap with device computation.
ggml_backend_sched_reset(lctx.sched);

return 0;
}

Expand Down Expand Up @@ -16773,11 +16777,6 @@ float * llama_get_logits(struct llama_context * ctx) {

float * llama_get_logits_ith(struct llama_context * ctx, int32_t i) {
int32_t j = -1;

// Reset state for the next run before the following backend sync,
// to allow the CPU activities in the reset to overlap with device computation.
ggml_backend_sched_reset(ctx->sched);

llama_synchronize(ctx);

try {
Expand Down

0 comments on commit 34847ca

Please sign in to comment.