Skip to content

[draft] support ATOM plugin for qwen3.5 DPxTPx/DPxEPx - #1690

Draft
zovonoir wants to merge 5 commits into
mainfrom
qwen-dp
Draft

[draft] support ATOM plugin for qwen3.5 DPxTPx/DPxEPx#1690
zovonoir wants to merge 5 commits into
mainfrom
qwen-dp

Conversation

@zovonoir

@zovonoir zovonoir commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Add Qwen3.5 SGLang plugin support for DP-attention layouts, including DP+TP and DP+EP execution.

This change makes the Qwen3.5-specific language-model adapter use the same SGLangPluginRuntime lifecycle as the generic ATOM SGLang wrapper, and fixes the nested GDN context handling that previously caused rank-divergent collectives.

Problem

Qwen3.5 uses a dedicated SGLang language-model adapter instead of the generic ATOM causal-LM wrapper. As a result:

  • idle DP ranks could pass zero-token tensors into AITER GEMM kernels (M=0);
  • Qwen3.5-VL idle forwards could omit positions and input_ids;
  • mRoPE positions shaped [3, num_tokens] were interpreted as three tokens;
  • each rank could build a different physical DP token-count vector after idle batches were materialized;
  • the nested GDN binder rebuilt ForwardContext/DPMetadata and issued a second CPU all-reduce only on ranks with valid GDN metadata, while idle ranks skipped it and later waited in a different collective.

The last issue produced a deterministic distributed deadlock: active ranks waited in GDN DP metadata synchronization while idle ranks progressed to the logits all-gather.

Implementation

Qwen3.5 SGLang adapter

  • Wrap the Qwen3.5 language-model forward with plugin_runtime_scope and SGLangPluginRuntime.
  • Build SGLang metadata from the runtime-normalized batch.
  • Forward the normalized input_ids, positions, and input_embeds to the ATOM decoder.
  • Trim physical dummy-token outputs back to the logical SGLang token count.

SGLang forward-context bridge

  • Materialize an idle batch from any available tensor (positions, input_ids, or input_embeds).
  • Create fallback dummy positions/token IDs when Qwen3.5-VL does not provide them.
  • Normalize every zero entry in the cross-DP token-count vector to one physical dummy token so all ranks use identical DPMetadata.
  • Read the token dimension correctly for mRoPE [3, num_tokens] positions.
  • Propagate SGLang's global forward mode into dp_uniform_decode so mixed EXTEND/IDLE steps use the variable-length DP path.

GDN context handling

  • Reuse the cross-rank-consistent ForwardContext and DPMetadata already created by SGLangPluginRuntime.
  • Temporarily inject only GDN attention metadata and KV-cache data.
  • Restore the previous metadata/cache on exit instead of resetting the complete context.
  • Retain the previous standalone fallback when no outer context exists.

This prevents GDN from creating a second, rank-local DP synchronization point.

Parallel layouts covered

For the full-DP SGLang configurations used here:

  • TPN: attention/dense TP=N, expert TP=N.
  • DPNTPN: attention DP=N with physical attention TP=1; experts use logical TP=N over the DP ranks.
  • DPNEPN: attention DP=N with physical attention TP=1; experts use EP=N and TP=1. When MORI is available, expert tokens use MORI dispatch/combine.

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every eligible PR before approval:

  • ✅ Pre Checkin: Black, Ruff, catalog schema validation, non-GPU unit tests

Heavy model tests:

  • ✅ Run after the PR is approved and Pre Checkin passes
  • ✅ Run immediately when an approval review is submitted
  • ✅ Can be requested before approval with labels
Label Tests
ci:full Run all heavy PR model tests: native ATOM, vLLM, and SGLang
ci:atom Run native ATOM model accuracy tests
ci:vllm Run ATOM vLLM OOT model accuracy tests
ci:sglang Run ATOM SGLang model accuracy tests

Heavy jobs are skipped when the PR is not approved and no matching ci:* label is present.
Add labels via the sidebar or gh pr edit 1690 --add-label <label>

zovonoir and others added 4 commits July 27, 2026 11:24
Restore the original AITER MoE max_num_tokens sizing in moe.py while leaving the rest of 59fe613 intact.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sort imports and combine nested runtime contexts so the PR code style check can pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
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