bugfix revise interface get cpu copy for npu mem pool to align with gpu (#27802)
This commit is contained in:
@@ -245,7 +245,7 @@ class NPUMHATokenToKVPool(MHATokenToKVPool):
|
|||||||
# NPUMHATokenToKVPool stores buffers as
|
# NPUMHATokenToKVPool stores buffers as
|
||||||
# (num_pages, page_size, head_num, head_dim) # use_fia=False
|
# (num_pages, page_size, head_num, head_dim) # use_fia=False
|
||||||
# (num_pages*page_size, 1, head_num, head_dim) # use_fia=True
|
# (num_pages*page_size, 1, head_num, head_dim) # use_fia=True
|
||||||
def get_cpu_copy(self, indices):
|
def get_cpu_copy(self, indices, mamba_indices=None):
|
||||||
torch.npu.synchronize()
|
torch.npu.synchronize()
|
||||||
buf_of_layers = []
|
buf_of_layers = []
|
||||||
for local_layer_id in range(self.layer_num):
|
for local_layer_id in range(self.layer_num):
|
||||||
@@ -260,7 +260,7 @@ class NPUMHATokenToKVPool(MHATokenToKVPool):
|
|||||||
torch.npu.synchronize()
|
torch.npu.synchronize()
|
||||||
return kv_cache_cpu
|
return kv_cache_cpu
|
||||||
|
|
||||||
def load_cpu_copy(self, kv_cache_cpu, indices):
|
def load_cpu_copy(self, kv_cache_cpu, indices, mamba_indices=None):
|
||||||
torch.npu.synchronize()
|
torch.npu.synchronize()
|
||||||
chunk_size = self.cpu_offloading_chunk_size
|
chunk_size = self.cpu_offloading_chunk_size
|
||||||
for local_layer_id in range(self.layer_num):
|
for local_layer_id in range(self.layer_num):
|
||||||
|
|||||||
Reference in New Issue
Block a user