MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / common_batch_add

Function common_batch_add

smallthinker/common/common.cpp:1181–1198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1179}
1180
1181void common_batch_add(
1182 struct llama_batch & batch,
1183 llama_token id,
1184 llama_pos pos,
1185 const std::vector<llama_seq_id> & seq_ids,
1186 bool logits) {
1187 GGML_ASSERT(batch.seq_id[batch.n_tokens] && "llama_batch size exceeded");
1188
1189 batch.token [batch.n_tokens] = id;
1190 batch.pos [batch.n_tokens] = pos;
1191 batch.n_seq_id[batch.n_tokens] = seq_ids.size();
1192 for (size_t i = 0; i < seq_ids.size(); ++i) {
1193 batch.seq_id[batch.n_tokens][i] = seq_ids[i];
1194 }
1195 batch.logits [batch.n_tokens] = logits;
1196
1197 batch.n_tokens++;
1198}
1199
1200//
1201// Token utils

Callers 15

mainFunction · 0.85
generate_responseFunction · 0.85
mainFunction · 0.85
perplexity_v2Function · 0.85
hellaswag_scoreFunction · 0.85
winogrande_scoreFunction · 0.85
multiple_choice_scoreFunction · 0.85
kl_divergenceFunction · 0.85
update_slotsMethod · 0.85
compute_imatrixFunction · 0.85
mainFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by 3

mainFunction · 0.68
mainFunction · 0.68