MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / split_simple

Method split_simple

subprojects/llama.cpp/src/llama-batch.cpp:472–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470}
471
472llama_ubatch llama_batch_allocr::split_simple(uint32_t n_ubatch) {
473 // find the first unused token
474 uint32_t cur_idx = 0;
475 while (cur_idx < used.size() && used[cur_idx]) {
476 ++cur_idx;
477 }
478
479 // we are done
480 if (cur_idx >= used.size()) {
481 return {};
482 }
483
484 std::vector<int32_t> idxs;
485
486 while (true) {
487 idxs.push_back(cur_idx);
488
489 used[cur_idx] = true;
490 ++n_used;
491
492 ++cur_idx;
493
494 if (cur_idx >= used.size()) {
495 break;
496 }
497
498 if (idxs.size() >= n_ubatch) {
499 break;
500 }
501 }
502
503 return ubatch_add(idxs, idxs.size(), false);
504}
505
506llama_ubatch llama_batch_allocr::split_equal(uint32_t n_ubatch, bool sequential) {
507 if (sequential && has_cpl) {

Callers 3

init_batchMethod · 0.80
encodeMethod · 0.80
init_batchMethod · 0.80

Calls 2

sizeMethod · 0.65
push_backMethod · 0.45

Tested by

no test coverage detected