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

Function llama_kv_cache_seq_cp

llama.cpp:1783–1799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1781}
1782
1783static void llama_kv_cache_seq_cp(
1784 struct llama_kv_cache & cache,
1785 llama_seq_id seq_id_src,
1786 llama_seq_id seq_id_dst,
1787 llama_pos p0,
1788 llama_pos p1) {
1789 if (p0 < 0) p0 = 0;
1790 if (p1 < 0) p1 = std::numeric_limits<llama_pos>::max();
1791
1792 cache.head = 0;
1793
1794 for (uint32_t i = 0; i < cache.size; ++i) {
1795 if (cache.cells[i].has_seq_id(seq_id_src) && cache.cells[i].pos >= p0 && cache.cells[i].pos < p1) {
1796 cache.cells[i].seq_id.insert(seq_id_dst);
1797 }
1798 }
1799}
1800
1801static void llama_kv_cache_seq_keep(struct llama_kv_cache & cache, llama_seq_id seq_id) {
1802 uint32_t new_head = cache.size;

Callers 5

mainFunction · 0.85
mainFunction · 0.85
update_system_promptMethod · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 3

maxFunction · 0.85
has_seq_idMethod · 0.45
insertMethod · 0.45

Tested by 1

mainFunction · 0.68