diff --git a/examples/qualcomm/oss_scripts/llama/runner/kv_manager.cpp b/examples/qualcomm/oss_scripts/llama/runner/kv_manager.cpp index 7288ca5fbd1..6fb2255aa94 100644 --- a/examples/qualcomm/oss_scripts/llama/runner/kv_manager.cpp +++ b/examples/qualcomm/oss_scripts/llama/runner/kv_manager.cpp @@ -260,7 +260,7 @@ void KVManager::update_attention_mask( fill_mask( attention_mask_dtype_, cur_ptr - n_past * getDtypeSize(attention_mask_dtype_), - n_past + n_update, + n_past + n_update - available_cache_len, /*use_pos_value=*/false); } cur_ptr += metadata_.context_len * getDtypeSize(attention_mask_dtype_);