Skip to content

Commit

Permalink
llama: remove redundant loop when constructing ubatch (ggerganov#9574)
Browse files Browse the repository at this point in the history
  • Loading branch information
shankarg87 authored Sep 22, 2024
1 parent 2a63caa commit ecd5d6b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3056,18 +3056,14 @@ struct llama_sbatch {
} else {
// simple split
if (batch->n_seq_id) {
for (size_t i = 0; i < length; ++i) {
ubatch.n_seq_id = batch->n_seq_id + seq.offset;
}
ubatch.n_seq_id = batch->n_seq_id + seq.offset;
} else {
for (size_t i = 0; i < length; ++i) {
ubatch.n_seq_id[ubatch.n_seqs + i] = 1;
}
}
if (batch->seq_id) {
for (size_t i = 0; i < length; ++i) {
ubatch.seq_id = batch->seq_id + seq.offset;
}
ubatch.seq_id = batch->seq_id + seq.offset;
} else {
for (size_t i = 0; i < length; ++i) {
ubatch.seq_id[ubatch.n_seqs + i] = &seq.all_seq_id;
Expand Down

0 comments on commit ecd5d6b

Please sign in to comment.