Repository navigation
[FEATURE] Support Ascend 910B NPU runtime and Wan2.2 T2V with public vllm-omni image - #42
Merged
Merged
Conversation
This was referenced Sep 1, 2026
Collaborator
|
Please add the tutorial document on how to run with Ascend NPU. |
yx0716
force-pushed
the
feat/npu-adapt
branch
from
September 11, 2026 08:03
8a4220e to
54a2b94
Compare
Move Triton, torchao, and bitsandbytes into the optional cuda extra so non-CUDA platforms install cleanly. Defer Triton kernel imports in FP8 QKV quantization and sparse SageAttention until execution while keeping pure-PyTorch smoothing and native helpers identical to main.
… host queues Validate explicit accelerator devices before worker startup while letting unmounted NPU containers fall back cleanly to CpuPlatform. Default DeviceMesh and pipeline P2P receive buffers to current_platform, bind logical NPU ranks before HCCL init, reserve and recycle 16-port HCCL blocks via kernel file locks, and stage NPU tensors through host shared memory across worker queues and direct tensor channels.
…2 auto-device Keep contiguous NCDHW Conv3d activations on Ascend NPU while preserving channels_last_3d elsewhere, accept already-batched tensors in Wan22VideoVAE parallel decode, and default the Wan2.2 5B T2V example to current_platform.device_type.
…architecture diagram Layer docker/Dockerfile.ascend onto the public multi-arch quay.io/ascend/vllm-omni:v0.34.0 base image using an isolated --system-site-packages venv. Document container setup, device mapping, 1/2/4-card Wan2.2 T2V execution, hardware baselines, and the cross-device dispatch architecture in English and Chinese.
yx0716
force-pushed
the
feat/npu-adapt
branch
from
November 24, 2026 11:25
40ed354 to
b0e21eb
Compare
This was referenced Nov 26, 2026
lzx1413
pushed a commit
that referenced
this pull request
Nov 26, 2026
Eliminate major Ascend 910B2 bottlenecks under strict BF16 eager + SDPA +
model-level CPU offload parity (Wan2.2-TI2V-5B 864x480 121f 50-step UniPC):
- Keep scalar-timestep t_mod at seq_len=1 ([B, 1, 6, dim]) for broadcasting
instead of expanding and materializing [B, seq_len, 6, dim] per block
- Add RMSNorm.forward_npu via torch_npu.npu_rms_norm
- Add apply_rotary_emb NPU path via torch_npu.npu_rotary_mul(interleave)
and cache device RoPE cos/sin frequencies on WanModel
- Avoid redundant pure-BF16 torch.autocast('npu') upcasts in TI2V denoising
and VAE decode stages, and avoid float64 NPU fallbacks in sinusoidal
embeddings and UniPC linalg.solve
- Replace redundant einops.rearrange/double-reshapes with unflatten/flatten,
use torch.addcmul in GateModule and in-place modulation on NPU
- Add persistent pinned CPU parameter mirror and NPU non_blocking transfers
in BaseModel offload, plus device-side uint8 conversion before D2H in
tensor2video
Measured on Atlas 910B2 64GB (matched vllm-ascend v0.23.0.post1 / CANN 9.1.0,
4 runs: 1 cold + 3 warm):
- TeleFuser baseline (PR #42): 147.06s warm median (0.82 fps, ~132s denoise)
- vLLM-Omni 0.23.0rc1: 106.95s warm median (1.13 fps, ~96s denoise)
- TeleFuser optimized: 98.90s warm median (1.22 fps, ~90s denoise)
(1.49x faster than baseline; 8.05s / 7.5% faster than vLLM-Omni;
middle-frame PSNR 31.39 dB / Pearson r 0.9939 vs baseline)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Run
Wan2.2-TI2V-5Btext-to-video on Atlas 910B2 using TeleFuser's shared platform and operator interfaces. Container setup reuses the public multi-archquay.io/ascend/vllm-omni:v0.34.0(orvllm-ascend) image directly or layers TeleFuser in an isolated--system-site-packagesvenv viadocker/Dockerfile.ascend.Public vLLM-Omni NPU images · Dockerfile · Cross-device architecture · English guide · 中文手册
CUDA users who need Triton, torchao or bitsandbytes now install
telefuser[cuda]. ROCm users need the Triton build paired with their PyTorch distribution.Cross-Device Architecture: Shared Core & Hardware Switch Boundaries
Entrypoints, pipeline orchestration, stage state machines, diffusion schedulers, CPU offload, and DiT / VAE / T5 model definitions share 100% of their codebase across CUDA, ROCm, NPU, and CPU. Vendor differences are resolved once per process via
current_platform(telefuser/platforms/__init__.py) and isolated into four explicit runtime boundaries:flowchart TB subgraph Shared["100% Shared Device-Agnostic Core"] Entry["Entrypoints & Services (CLI / FastAPI / LiveKit / wan22_t2v_5b.py)"] Pipe["Pipeline & Stage Orchestration (BasePipeline / BaseStage / ModuleManager / Offload)"] Models["Model & Sampling Math (WanDiT / Wan22VideoVAE / T5 / UniPC)"] Entry --> Pipe --> Models end subgraph Platform["Platform Resolution Hub (telefuser/platforms/)"] Probe["Import-time probe _resolve_current_platform(): ROCm -> CUDA -> NPU -> CPU"] Validate["Pre-spawn check resolve_device(): verify visibility, index, and backend"] Probe --> Validate end Shared --> Platform Platform --> Sw1["Switch 1: Ops & Attention (telefuser/ops/)"] Platform --> Sw2["Switch 2: 3D Conv Layout (distributed/vae_spatial.py)"] Platform --> Sw3["Switch 3: Mesh, Collectives & Ports (distributed/ + platforms/hccl.py)"] Platform --> Sw4["Switch 4: Cross-Process Tensor Transport (worker/)"] Sw1 --> Cuda1["CUDA: forward_cuda + lazy Triton / tf-kernel / FlashAttn / FP8"] Sw1 --> Npu1["NPU: forward_npu -> forward_native + TORCH_SDPA (no Triton import)"] Sw2 --> Cuda2["CUDA / ROCm / CPU: channels_last_3d (NDHWC)"] Sw2 --> Npu2["NPU: contiguous_format (standard NCDHW)"] Sw3 --> Cuda3["CUDA / ROCm: NCCL / RCCL + MASTER_PORT"] Sw3 --> Npu3["NPU: pre-init set_device + HCCL + 16-port flock lease & recycle"] Sw4 --> Cuda4["CUDA: Direct device IPC + persistent CUDA IPC pool"] Sw4 --> Npu4["NPU: requires_host_tensor_queue -> CPU share_memory_() staging & sharding"]current_platform,resolve_device()(telefuser/platforms/)torch.version.hip) then CUDA (CudaPlatform)torch_npu+ visible device (NPUPlatform); validates rank indices before worker spawnCustomOp,CustomOpFunction, attention registry (telefuser/ops/)forward_cuda/forward_rocm; FP8 & Sparse SageAttention loadkernel/triton/*lazily on useforward_npu, otherwise falls back toforward_native+TORCH_SDPAwith zero Triton dependencyconv3d_activation_layout()(distributed/vae_spatial.py,wan_video_vae.py)torch.channels_last_3d(NDHWC for cuDNN 3D convs);Wan22VideoVAE.decodeaccepts batched tensors directlytorch.contiguous_format(NCDHW) to satisfy CANN contiguous memory rulescreate_device_mesh_from_config,PipelineP2PComm,ParallelWorkerdevice_type="cuda",ncclbackend,MASTER_PORTdevice_type="npu", bindsset_devicepre-init,hcclbackend +reserve_hccl_ports()16-portflocklease recycled on close/failurerequires_host_tensor_queue()(parallel_worker.py,tensor_channel.py)False: direct device IPC queues and_CudaIpcPayloadzero-copy poolTrue: bidirectional host staging viashare_memory_()across ordinary queues andWorkerTensorChannelValidation