Skip to content

feat(npu): Ascend platform, MindIE attention, and Ulysses SP for v1 - #270

Open
Chitandaaaaa wants to merge 5 commits into
modelscope:v1from
Chitandaaaaa:feat/npu-ulysses4-v1
Open

feat(npu): Ascend platform, MindIE attention, and Ulysses SP for v1#270
Chitandaaaaa wants to merge 5 commits into
modelscope:v1from
Chitandaaaaa:feat/npu-ulysses4-v1

Conversation

@Chitandaaaaa

@Chitandaaaaa Chitandaaaaa commented Aug 12, 2026

Copy link
Copy Markdown

Summary

Port Ascend NPU support onto the v1 architecture (capability-level migration from fork PR #11 on main; not a cherry-pick).

  1. Platform + MindIE attention — add platforms/ (Ascend capability probes, HCCL, MindIE compile backend), extend utils/platform.py for NPU/HCCL/get_compile_kwargs(), and register a mindie attention backend for Qwen-Image.
  2. Multi-card Ulysses SP — bind Ascend devices before init_process_group (HCCL), align/bind config.device in engine/worker, and reject MindIE attention with ring > 1.
  3. Qwen DiT micro-opts — always use addcmul for gated residual/modulate; gate MindIE RoPE / layernorm_scale_shift behind USE_MINDIESD_FUSE=1.

Commits

  • bf49ef1 feat(npu): add Ascend platform abstraction and MindIE attention
  • 8c1e61c feat(npu): enable Ulysses SP with CFG parallel on Ascend
  • 0cf05b6 feat(npu): fuse Qwen DiT addcmul, MindIE RoPE, and LN modulate

Notes

  • Default inference does not enable compile (use_torch_compile=False); compile kwargs are injected only when compile is on.
  • USE_MINDIESD_FUSE only gates MindIE RoPE / LN fuse; addcmul is always on (generic torch op).
  • CUDA / NCCL paths are unchanged; Ascend is selected when NPU is available or device/device_type is explicit.

Test plan

  • GPU: existing single/multi-card paths still use CUDA/NCCL (no behavior change).
  • NPU single-card smoke with --attn-type mindie (and without).
  • NPU 4-card: ASCEND_RT_VISIBLE_DEVICES=0,1,2,3, Ulysses SP (sp_ulysses_degree=4, sp_ring_degree=1) + CFG parallel.
  • Optional: USE_MINDIESD_FUSE=1 for RoPE / LN fuse path.
  • Confirm MindIE + ring > 1 is rejected with a clear error.

hammer and others added 3 commits August 13, 2026 12:07
Add platforms registry with Ascend capability probes, extend
utils/platform for npu/hccl/compile kwargs, and register a MindIE
attention backend for Qwen-Image on the v1 layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
Bind Ascend devices before HCCL init_process_group, align/bind
config.device across engine workers, and reject MindIE with ring SP.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use addcmul for gated residual/modulate micro-opts, and gate MindIE
RoPE / layernorm_scale_shift behind USE_MINDIESD_FUSE.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Chitandaaaaa Chitandaaaaa changed the title Feat/npu ulysses4 v1 feat(npu): Ascend platform, MindIE attention, and Ulysses SP for v1 Aug 13, 2026
root added 2 commits August 13, 2026 20:28
under Ulysses SP, hiding all-to-all latency behind FA compute
(compute-communication overlap).

- Ulysses flow via all_to_all_4D_pre/single/after (SeqAllToAll4D).
- FA_ALLTOALL_CUT/OVERLAP count semantics (0/1 off, >1 on, CUT
  wins): baseline single round trip; cut = head-chunked round trips;
  overlap = all-to-all on side stream2 overlapped with FA on main
  stream via npu Event/Stream sync.
- current_stream refreshed at forward time.
- Ulysses-only; falls back to USPAttention when not available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant