Skip to content

feat(npu): add Ascend platform abstraction and Qwen-Image NPU support - #264

Open
Chitandaaaaa wants to merge 1 commit into
modelscope:mainfrom
Chitandaaaaa:npu-compile-rebased-main
Open

feat(npu): add Ascend platform abstraction and Qwen-Image NPU support#264
Chitandaaaaa wants to merge 1 commit into
modelscope:mainfrom
Chitandaaaaa:npu-compile-rebased-main

Conversation

@Chitandaaaaa

Copy link
Copy Markdown

Summary

Add an Ascend NPU platform abstraction on top of DiffSynth-Engine main, and wire Qwen-Image to MindIE-SD attention / compile backends for single-card inference.

Changes

  • Introduce diffsynth_engine/platforms/ with a device registry and auto_detect / resolve_platform for CPU / CUDA / ROCm / MPS / Ascend
  • Implement AscendPlatform with capability probing for mindie, mindie_attention, and mindie_compile
  • Add mindie attention backend (AttnImpl.MINDIE) and auto-select it when MindIE-SD is available
  • Update QwenImagePipeline.compile() to pass platform-specific compile_kwargs (MindIE-SD backend when supported)
  • Keep CUDA / existing attention paths unchanged when NPU / MindIE is not present

Scope

  • Single-card Ascend adaptation only (no multi-card / Ulysses / HCCL changes in this PR)
  • Long-context attention with attn_impl="mindie" is explicitly unsupported for now

Files

  • diffsynth_engine/platforms/{__init__,base,ascend}.py (new)
  • diffsynth_engine/utils/platform.py, utils/flag.py
  • diffsynth_engine/models/basic/attention.py
  • diffsynth_engine/configs/pipeline.py
  • diffsynth_engine/pipelines/qwen_image.py

Made with Cursor

1. Add NPU 950 platform abstraction layer with device registry and auto_detect_device
2. Support mindiesd_attention and mindiesd_compile with capability detection and compile_backend
3. Adapt Qwen-Image model to use platform compile kwargs and NPU attention backend
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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