Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/runtime/relax_vm/kv_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class AttentionKVCacheObj : public KVStateObj {
* This function is supposed to be invoked after calling BeginForward.
* \return The in-sequence query positions, in shape `(total_length,)`.
*/
virtual NDArray GetQueryPositions() const = 0;
virtual NDArray GetQueryPositions() = 0;

/************** Debug Helpers **************/

Expand Down
9 changes: 5 additions & 4 deletions src/runtime/relax_vm/paged_kv_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,11 @@ class PagedAttentionKVCacheObj : public AttentionKVCacheObj {
}
}

NDArray GetQueryPositions() const final {
CHECK(!dirty_aux_data_device_)
<< "The auxiliary arrays are not synchronized to device. Please call "
"`BeginForward` to synchronize before calling `GetQueryPositions`.";
NDArray GetQueryPositions() final {
// Sync the copy stream and the compute stream.
ComputeStreamWaitForCopyStream();
// The auxiliary data structure on device must have been synchronized.
ICHECK(!dirty_aux_data_device_);
return q_rope_position_map_view_;
};

Expand Down