[AMD] Fix Tensor Memory Aliasing (#19928)
This commit is contained in:
@@ -313,8 +313,8 @@ class Indexer(MultiPlatformOp):
|
||||
|
||||
q_rope, k_rope = self.rotary_emb(positions, q_rope, k_rope)
|
||||
|
||||
query[..., : self.rope_head_dim] = q_rope
|
||||
key[..., : self.rope_head_dim] = k_rope
|
||||
query[..., : self.rope_head_dim] = q_rope.clone()
|
||||
key[..., : self.rope_head_dim] = k_rope.clone()
|
||||
|
||||
if enable_dual_stream:
|
||||
current_stream = torch.cuda.current_stream()
|
||||
@@ -352,7 +352,7 @@ class Indexer(MultiPlatformOp):
|
||||
)
|
||||
|
||||
_, k_rope = self.rotary_emb(positions, k_rope, k_rope)
|
||||
key[..., : self.rope_head_dim] = k_rope
|
||||
key[..., : self.rope_head_dim] = k_rope.clone()
|
||||
key = rotate_activation(key)
|
||||
|
||||
return key
|
||||
|
||||
@@ -424,7 +424,7 @@ class DeepseekMHAForwardMixin:
|
||||
)
|
||||
else:
|
||||
latent_cache[:, :, : self.kv_lora_rank] = kv_a.unsqueeze(1)
|
||||
latent_cache[:, :, self.kv_lora_rank :] = k_pe
|
||||
latent_cache[:, :, self.kv_lora_rank :] = k_pe.clone()
|
||||
|
||||
# Save latent cache
|
||||
forward_batch.token_to_kv_pool.set_kv_buffer(
|
||||
|
||||
Reference in New Issue
Block a user