mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-11-03 09:22:01 +00:00 
			
		
		
		
	llama : deprecate llama_kv_self_ API (#14030)
* llama : deprecate llama_kv_self_ API ggml-ci * llama : allow llama_memory_(nullptr) ggml-ci * memory : add flag for optional data clear in llama_memory_clear ggml-ci
This commit is contained in:
		@@ -194,7 +194,7 @@ Java_android_llama_cpp_LLamaAndroid_bench_1model(
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        batch->logits[batch->n_tokens - 1] = true;
 | 
			
		||||
        llama_kv_self_clear(context);
 | 
			
		||||
        llama_memory_clear(llama_get_memory(context), false);
 | 
			
		||||
 | 
			
		||||
        const auto t_pp_start = ggml_time_us();
 | 
			
		||||
        if (llama_decode(context, *batch) != 0) {
 | 
			
		||||
@@ -206,7 +206,7 @@ Java_android_llama_cpp_LLamaAndroid_bench_1model(
 | 
			
		||||
 | 
			
		||||
        LOGi("Benchmark text generation (tg)");
 | 
			
		||||
 | 
			
		||||
        llama_kv_self_clear(context);
 | 
			
		||||
        llama_memory_clear(llama_get_memory(context), false);
 | 
			
		||||
        const auto t_tg_start = ggml_time_us();
 | 
			
		||||
        for (i = 0; i < tg; i++) {
 | 
			
		||||
 | 
			
		||||
@@ -223,7 +223,7 @@ Java_android_llama_cpp_LLamaAndroid_bench_1model(
 | 
			
		||||
 | 
			
		||||
        const auto t_tg_end = ggml_time_us();
 | 
			
		||||
 | 
			
		||||
        llama_kv_self_clear(context);
 | 
			
		||||
        llama_memory_clear(llama_get_memory(context), false);
 | 
			
		||||
 | 
			
		||||
        const auto t_pp = double(t_pp_end - t_pp_start) / 1000000.0;
 | 
			
		||||
        const auto t_tg = double(t_tg_end - t_tg_start) / 1000000.0;
 | 
			
		||||
@@ -448,5 +448,5 @@ Java_android_llama_cpp_LLamaAndroid_completion_1loop(
 | 
			
		||||
extern "C"
 | 
			
		||||
JNIEXPORT void JNICALL
 | 
			
		||||
Java_android_llama_cpp_LLamaAndroid_kv_1cache_1clear(JNIEnv *, jobject, jlong context) {
 | 
			
		||||
    llama_kv_self_clear(reinterpret_cast<llama_context *>(context));
 | 
			
		||||
    llama_memory_clear(llama_get_memory(reinterpret_cast<llama_context *>(context)), true);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user