Skip to content

Commit 4db5643

Browse files
Qualcomm AI Engine Direct - Fix sliding window attention (#20736)
### Summary When `n_past + n_update` exceeds the `available_cache_len` it should mask only the remain part. ### Test plan gemma3 CI in `TestExampleLLMScript.test_static_llm_model`
1 parent 17e1487 commit 4db5643

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

examples/qualcomm/oss_scripts/llama/runner/kv_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ void KVManager::update_attention_mask(
260260
fill_mask(
261261
attention_mask_dtype_,
262262
cur_ptr - n_past * getDtypeSize(attention_mask_dtype_),
263-
n_past + n_update,
263+
n_past + n_update - available_cache_len,
264264
/*use_pos_value=*/false);
265265
}
266266
cur_ptr += metadata_.context_len * getDtypeSize(attention_mask_dtype_);

0 commit comments

Comments
 (0)