Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/qualcomm/oss_scripts/llama/runner/kv_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ void KVManager<T>::rearrange_key(KVCache<T>& k_cache, int32_t ar_len_dst) {
}
// copy from first dimension
for (int i = 0; i < metadata_.head_dim; i++) {
std::memmove(k_cache_in_write_ptr, k_cache_in_read_ptr, dst_cache_num);
std::memmove(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see, makes sense

k_cache_in_write_ptr, k_cache_in_read_ptr, dst_cache_num * sizeof(T));
k_cache_in_read_ptr += src_cache_num;
k_cache_in_write_ptr += dst_cache_num;
}
Expand All @@ -378,7 +379,8 @@ void KVManager<T>::rearrange_key(KVCache<T>& k_cache, int32_t ar_len_dst) {
}
// copy from last dimension
for (int i = 0; i < metadata_.head_dim; i++) {
std::memmove(k_cache_in_write_ptr, k_cache_in_read_ptr, src_cache_num);
std::memmove(
k_cache_in_write_ptr, k_cache_in_read_ptr, src_cache_num * sizeof(T));
k_cache_in_read_ptr -= src_cache_num;
k_cache_in_write_ptr -= dst_cache_num;
}
Expand Down
Loading