Fix compilation warnings and uninitialized variable in perplexity test

This commit is contained in:
leeetao 2025-06-22 06:58:12 +00:00
parent 2123879cfe
commit 4b823775ec
2 changed files with 14 additions and 13 deletions

View file

@ -691,23 +691,24 @@ static results_perplexity perplexity(llama_context * ctx, const gpt_params & par
}
}
if (my_rank == 0) {
// Required batch info: Operation scale, KV cache location, Logits calculation location
meta.n_ctx = n_ctx;
meta.n_tokens = batch.n_tokens;
meta.pos = batch.pos;
meta.logits = batch.logits;
meta.all_pos_0 = batch.all_pos_0;
meta.all_pos_1 = batch.all_pos_1;
meta.n_outputs = n_outputs;
meta.chunk_start_pos = start;
}
// other ranks need to know batch info
{
if (n_world > 1) {
meta.n_ctx = n_ctx;
if (my_rank == 0) {
// Required batch info: Operation scale, KV cache location, Logits calculation location
meta.n_tokens = batch.n_tokens;
meta.pos = batch.pos;
meta.logits = batch.logits;
meta.all_pos_0 = batch.all_pos_0;
meta.all_pos_1 = batch.all_pos_1;
meta.n_outputs = n_outputs;
meta.chunk_start_pos = start;
llama_send_meta(ctx, &meta);
} else {
if (llama_recv_meta(ctx, &meta) == -1) {

View file

@ -18316,8 +18316,8 @@ static int llama_decode_internal(
/* logits_all */ n_outputs == n_tokens_all);
// reserve output buffer
if (my_rank == 0 && llama_output_reserve(lctx, n_outputs) < n_outputs) {
LLAMA_LOG_ERROR("%s: could not reserve space for batch with %u outputs\n", __func__, n_outputs);
if (my_rank == 0 && llama_output_reserve(lctx, n_outputs) < (size_t)n_outputs) {
LLAMA_LOG_ERROR("%s: could not reserve space for batch with %llu outputs\n", __func__, n_outputs);
return -2;
};