Skip to content

[PD] reduce a D2D copy. #1462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: deepseek_r1
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ def recv_kv_caches_and_hidden_states_hpu(
block_indices_tensor = torch.tensor(block_indices_list[start_block_idx:end_block_idx], device="hpu", dtype=torch.int32 )
# we think this is a padding sequence, so we skip it. but we still need write kv cache
if slen == 1:
for i in range(model_executable.model.model.start_layer,
model_executable.model.model.end_layer):
current_layer_idx = i - model_executable.model.model.start_layer
for i in range(model_executable.model.start_layer,
model_executable.model.end_layer):
current_layer_idx = i - model_executable.model.start_layer
kv_cache = kv_caches[current_layer_idx]
# key_cache, value_cache = kv_cache[0], kv_cache[1]
key_cache = kv_cache[0]
Expand Down Expand Up @@ -371,8 +371,9 @@ def recv_kv_caches_and_hidden_states_hpu(
num_computed_tokens_list.append(num_computed_tokens)

# it's padded to block size now.
key_values = remote_kv.to("hpu")
keys = key_values
# key_values = remote_kv.to("hpu")
# TEST: use CPU kv cache directly
keys = remote_kv
# values = key_values[..., self.k_head_size:]

htorch.core.mark_step()
Expand Down
Loading