@@ -608,72 +608,13 @@ extern "C" {
608608 // KV cache
609609 //
610610
611- // TODO: start using struct llama_kv_cache
612-
613- // Information associated with an individual cell in the KV cache view.
614- struct llama_kv_cache_view_cell {
615- // The position for this cell. Takes KV cache shifts into account.
616- // May be negative if the cell is not populated.
617- llama_pos pos;
618- };
619-
620- // An updateable view of the KV cache.
621- struct llama_kv_cache_view {
622- // Number of KV cache cells. This will be the same as the context size.
623- int32_t n_cells;
624-
625- // Maximum number of sequences that can exist in a cell. It's not an error
626- // if there are more sequences in a cell than this value, however they will
627- // not be visible in the view cells_sequences.
628- int32_t n_seq_max;
629-
630- // Number of tokens in the cache. For example, if there are two populated
631- // cells, the first with 1 sequence id in it and the second with 2 sequence
632- // ids then you'll have 3 tokens.
633- int32_t token_count;
634-
635- // Number of populated cache cells.
636- int32_t used_cells;
637-
638- // Maximum contiguous empty slots in the cache.
639- int32_t max_contiguous;
640-
641- // Index to the start of the max_contiguous slot range. Can be negative
642- // when cache is full.
643- int32_t max_contiguous_idx;
644-
645- // Information for an individual cell.
646- struct llama_kv_cache_view_cell * cells;
647-
648- // The sequences for each cell. There will be n_seq_max items per cell.
649- llama_seq_id * cells_sequences;
650- };
651-
652- // Create an empty KV cache view. (use only for debugging purposes)
653- LLAMA_API struct llama_kv_cache_view llama_kv_cache_view_init (const struct llama_context * ctx, int32_t n_seq_max);
654-
655- // Free a KV cache view. (use only for debugging purposes)
656- LLAMA_API void llama_kv_cache_view_free (struct llama_kv_cache_view * view);
657-
658- // Update the KV cache view structure with the current state of the KV cache. (use only for debugging purposes)
659- // TODO: change signature to llama_kv_cache_view_update(struct llama_kv_cache_view * view, const struct llama_context * ctx)
660- LLAMA_API void llama_kv_cache_view_update (const struct llama_context * ctx, struct llama_kv_cache_view * view);
661-
662- // /
663-
664611 // Returns the number of tokens in the KV cache (slow, use only for debug)
665612 // If a KV cell has multiple sequences assigned to it, it will be counted multiple times
666613 LLAMA_API int32_t llama_kv_self_n_tokens (const struct llama_context * ctx);
667614
668- DEPRECATED (LLAMA_API int32_t llama_get_kv_cache_token_count (const struct llama_context * ctx),
669- "use llama_kv_self_n_tokens instead");
670-
671615 // Returns the number of used KV cells (i.e. have at least one sequence assigned to them)
672616 LLAMA_API int32_t llama_kv_self_used_cells (const struct llama_context * ctx);
673617
674- DEPRECATED (LLAMA_API int32_t llama_get_kv_cache_used_cells (const struct llama_context * ctx),
675- "use llama_kv_self_used_cells instead");
676-
677618 // Clear the KV cache - both cell info is erased and KV data is zeroed
678619 LLAMA_API void llama_kv_self_clear (
679620 struct llama_context * ctx);
@@ -756,61 +697,6 @@ extern "C" {
756697 // Apply the KV cache updates (such as K-shifts, defragmentation, etc.)
757698 LLAMA_API void llama_kv_self_update (struct llama_context * ctx);
758699
759- DEPRECATED (LLAMA_API void llama_kv_cache_clear (
760- struct llama_context * ctx),
761- "use llama_kv_self_clear instead");
762-
763- DEPRECATED (LLAMA_API bool llama_kv_cache_seq_rm (
764- struct llama_context * ctx,
765- llama_seq_id seq_id,
766- llama_pos p0,
767- llama_pos p1),
768- "use llama_kv_self_seq_rm instead");
769-
770- DEPRECATED (LLAMA_API void llama_kv_cache_seq_cp (
771- struct llama_context * ctx,
772- llama_seq_id seq_id_src,
773- llama_seq_id seq_id_dst,
774- llama_pos p0,
775- llama_pos p1),
776- "use llama_kv_self_seq_cp instead");
777-
778- DEPRECATED (LLAMA_API void llama_kv_cache_seq_keep (
779- struct llama_context * ctx,
780- llama_seq_id seq_id),
781- "use llama_kv_self_seq_keep instead");
782-
783- DEPRECATED (LLAMA_API void llama_kv_cache_seq_add (
784- struct llama_context * ctx,
785- llama_seq_id seq_id,
786- llama_pos p0,
787- llama_pos p1,
788- llama_pos delta),
789- "use llama_kv_self_seq_add instead");
790-
791- DEPRECATED (LLAMA_API void llama_kv_cache_seq_div (
792- struct llama_context * ctx,
793- llama_seq_id seq_id,
794- llama_pos p0,
795- llama_pos p1,
796- int d),
797- "use llama_kv_self_seq_div instead");
798-
799- DEPRECATED (LLAMA_API llama_pos llama_kv_cache_seq_pos_max (
800- struct llama_context * ctx,
801- llama_seq_id seq_id),
802- "use llama_kv_self_seq_pos_max instead");
803-
804- DEPRECATED (LLAMA_API void llama_kv_cache_defrag (struct llama_context * ctx),
805- "use llama_kv_self_defrag instead");
806-
807- DEPRECATED (LLAMA_API bool llama_kv_cache_can_shift (const struct llama_context * ctx),
808- "use llama_kv_self_can_shift instead");
809-
810- DEPRECATED (LLAMA_API void llama_kv_cache_update (struct llama_context * ctx),
811- "use llama_kv_self_update instead");
812-
813-
814700 //
815701 // State / sessions
816702 //
0 commit comments