[NPU][Bug fix] context parallel bug fix (#19820)
This commit is contained in:
@@ -12,7 +12,6 @@ from sglang.srt.hardware_backend.npu.attention.mla_preprocess import (
|
||||
)
|
||||
from sglang.srt.layers.attention.nsa.nsa_indexer import scattered_to_tp_attn_full
|
||||
from sglang.srt.layers.attention.nsa.utils import (
|
||||
cp_split_and_rebuild_position,
|
||||
nsa_use_prefill_cp,
|
||||
)
|
||||
from sglang.srt.layers.communicator import ScatterMode, get_attn_tp_context
|
||||
@@ -224,12 +223,9 @@ def forward_mla_prepare_npu(
|
||||
|
||||
q_nope_out = q_nope_out.transpose(0, 1)
|
||||
|
||||
if nsa_use_prefill_cp(forward_batch, m.nsa_enable_prefill_cp):
|
||||
positions = cp_split_and_rebuild_position(forward_batch, positions)
|
||||
|
||||
q_pe, k_pe = m.rotary_emb(positions, q_pe, k_pe)
|
||||
|
||||
if nsa_use_prefill_cp(forward_batch, m.nsa_enable_prefill_cp):
|
||||
if nsa_use_prefill_cp(forward_batch):
|
||||
# support allgather+rerrange
|
||||
k_nope, k_pe = m.rebuild_cp_kv_cache(
|
||||
latent_cache, forward_batch, k_nope, k_pe
|
||||
@@ -367,12 +363,9 @@ def forward_dsa_prepare_npu(
|
||||
|
||||
q_nope_out = q_nope_out.transpose(0, 1)
|
||||
|
||||
if nsa_use_prefill_cp(forward_batch, m.nsa_enable_prefill_cp):
|
||||
positions = cp_split_and_rebuild_position(forward_batch, positions)
|
||||
|
||||
q_pe, k_pe = m.rotary_emb(positions, q_pe, k_pe)
|
||||
|
||||
if nsa_use_prefill_cp(forward_batch, m.nsa_enable_prefill_cp):
|
||||
if nsa_use_prefill_cp(forward_batch):
|
||||
# support allgather+rerrange
|
||||
k_nope, k_pe = m.rebuild_cp_kv_cache(
|
||||
latent_cache, forward_batch, k_nope, k_pe
|
||||
|
||||
Reference in New Issue
Block a user