[NPU] Fix vit graph tnd cu seqlens (#31701)

This commit is contained in:
Jinyan Yi
2026-07-20 16:20:33 +08:00
committed by GitHub
parent 3f48245080
commit fce5c75a30
2 changed files with 4 additions and 3 deletions
@@ -164,8 +164,9 @@ class ViTNpuGraphRunner(ViTCudaGraphRunner):
self.sin_cos_ws[graph_key] = (rotary_pos_emb_cos, rotary_pos_emb_sin)
if graph_key not in self.cu_seq_lens:
seq_lens = cu_seqlens[1:] - cu_seqlens[:-1]
self.cu_seq_lens[graph_key] = seq_lens.to("cpu").to(torch.int32)
# TND fused attention expects cumulative seqlens (cu_seqlens[1:]),
# not per-sequence lengths.
self.cu_seq_lens[graph_key] = cu_seqlens[1:].to("cpu").to(torch.int32)
if rotary_pos_emb_cos is not None and rotary_pos_emb_sin is not None:
self._create_graph(
+1 -1
View File
@@ -800,7 +800,7 @@ def _get_chunked_prefill_embedding(
is_per_image = all(len(item.offsets) == 1 for item in embedding_items_per_req)
if is_per_image:
if _is_hip:
if _is_hip or _is_npu:
# ROCm CI regressed with one large cross-request ViT batch; keep
# the previous per-request path on HIP while CUDA uses batching.
chunk = _get_chunked_embedding_by_item(