[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)
|
q_rope, k_rope = self.rotary_emb(positions, q_rope, k_rope)
|
||||||
|
|
||||||
query[..., : self.rope_head_dim] = q_rope
|
query[..., : self.rope_head_dim] = q_rope.clone()
|
||||||
key[..., : self.rope_head_dim] = k_rope
|
key[..., : self.rope_head_dim] = k_rope.clone()
|
||||||
|
|
||||||
if enable_dual_stream:
|
if enable_dual_stream:
|
||||||
current_stream = torch.cuda.current_stream()
|
current_stream = torch.cuda.current_stream()
|
||||||
@@ -352,7 +352,7 @@ class Indexer(MultiPlatformOp):
|
|||||||
)
|
)
|
||||||
|
|
||||||
_, k_rope = self.rotary_emb(positions, k_rope, k_rope)
|
_, 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)
|
key = rotate_activation(key)
|
||||||
|
|
||||||
return key
|
return key
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ class DeepseekMHAForwardMixin:
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
latent_cache[:, :, : self.kv_lora_rank] = kv_a.unsqueeze(1)
|
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
|
# Save latent cache
|
||||||
forward_batch.token_to_kv_pool.set_kv_buffer(
|
forward_batch.token_to_kv_pool.set_kv_buffer(
|
||||||
|
|||||||
Reference in New Issue
Block a user