llama: remove redundant loop when constructing ubatch

This commit is contained in:
shankarg87 2024-09-20 18:50:38 -07:00
parent 63351143b2
commit 9e07236444

View File

@ -3056,18 +3056,14 @@ struct llama_sbatch {
} else { } else {
// simple split // simple split
if (batch->n_seq_id) { 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 { } else {
for (size_t i = 0; i < length; ++i) { for (size_t i = 0; i < length; ++i) {
ubatch.n_seq_id[ubatch.n_seqs + i] = 1; ubatch.n_seq_id[ubatch.n_seqs + i] = 1;
} }
} }
if (batch->seq_id) { 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 { } else {
for (size_t i = 0; i < length; ++i) { for (size_t i = 0; i < length; ++i) {
ubatch.seq_id[ubatch.n_seqs + i] = &seq.all_seq_id; ubatch.seq_id[ubatch.n_seqs + i] = &seq.all_seq_id;