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

Method seq_cp

subprojects/llama.cpp/src/llama-memory-recurrent.cpp:213–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213void llama_memory_recurrent::seq_cp(llama_seq_id seq_id_src, llama_seq_id seq_id_dst, llama_pos p0, llama_pos p1) {
214 if (seq_id_src == seq_id_dst) {
215 return;
216 }
217
218 if (p0 < 0) {
219 p0 = 0;
220 }
221
222 if (p1 < 0) {
223 p1 = std::numeric_limits<llama_pos>::max();
224 }
225
226 if ((uint32_t) seq_id_dst < size && (uint32_t) seq_id_src < size) {
227 auto & tail_src = cells[seq_id_src];
228 auto & tail_dst = cells[seq_id_dst];
229 if (tail_dst.tail >= 0) {
230 // clear destination seq_id if it wasn't empty
231 auto & cell_dst = cells[tail_dst.tail];
232
233 cell_dst.seq_id.erase(seq_id_dst);
234 tail_dst.tail = -1;
235 if (cell_dst.seq_id.empty()) {
236 cell_dst.pos = -1;
237 cell_dst.src = -1;
238 used -= 1;
239 }
240 }
241 if (tail_src.tail >= 0) {
242 auto & cell_src = cells[tail_src.tail];
243
244 cell_src.seq_id.insert(seq_id_dst);
245 tail_dst.tail = tail_src.tail;
246 }
247 }
248}
249
250void llama_memory_recurrent::seq_keep(llama_seq_id seq_id) {
251 uint32_t new_head = size;

Callers

nothing calls this directly

Calls 3

maxFunction · 0.85
emptyMethod · 0.65
insertMethod · 0.45

Tested by

no test coverage detected