Skip to content

Refactor: consolidate DSpark decode output projection - #945

Merged
zhangqi-chen merged 1 commit into
hw-native-sys:mainfrom
wangqin1723-max:refactor/clarify-dspark-decode-parallel-names
Aug 12, 2026
Merged

zhangqi-chen merged 1 commit into
hw-native-sys:mainfrom
wangqin1723-max:refactor/clarify-dspark-decode-parallel-names

Conversation

@wangqin1723-max

@wangqin1723-max wangqin1723-max commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator
  • Keep decode parallel configuration limited to TP, DP, and EP
  • Consolidate attention collectives and TP-sharded output projection
    in decode_o_proj.py

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b557971a-a25e-4100-85a3-a23156e3e35a

📥 Commits

Reviewing files that changed from the base of the PR and between 38c21b9 and 9e2b5e0.

📒 Files selected for processing (3)
  • models/deepseek_v4_flash_dspark/config.py
  • models/deepseek_v4_flash_dspark/decode_dsa_cp_collectives.py
  • models/deepseek_v4_flash_dspark/decode_sharded_o_projection.py

📝 Walkthrough

Walkthrough

The decode path now uses TP-based DSA-CP collectives and sharded O-projection naming. Configuration adds token-owner and output-weight shard constants. Collective dimensions, synchronization, fixture wiring, golden data, kernels, and tests use the new terminology.

Changes

DSA-CP TP migration

Layer / File(s) Summary
Parallelism contract
models/deepseek_v4_flash_dspark/config.py, models/deepseek_v4_flash_dspark/decode_dsa_cp_collectives.py
The configuration replaces SP-specific constants with TOKEN_OWNER_COUNT, O_A_WEIGHT_SHARDS, and O_B_WEIGHT_SHARDS. The collective module validates these values against TP.
TP collective execution
models/deepseek_v4_flash_dspark/decode_dsa_cp_collectives.py
Collective barriers, KV all-gather, grouped all-to-all, output reduce-scatter, fixture buffers, golden data, CLI validation, and JIT wiring now use TP-based dimensions and names.
Sharded O-projection integration
models/deepseek_v4_flash_dspark/decode_sharded_o_projection.py
The projection kernel, task names, test wrapper, golden reference, and comparison dimensions now use sharded TP terminology and TOKEN_OWNER_COUNT.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Poem

A rabbit saw TP ranks align,
While tokens crossed the signal line.
Shards gathered, projections grew,
Golden checks confirmed them true.
“Hop on,” said Bunny, “DSA-CP shines!”

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 76.47% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately identifies the DSpark decode output projection refactor, which is a central part of the changes.
Description check ✅ Passed The description relates to the parallel configuration, attention collectives, and output projection changes in the pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

DP = 4 # DP groups per node
EP = 16 # expert-parallel world size (moe overrides it from --ep)
TP = 4 # ranks in the model-sharding group for each DP rank
TOKEN_OWNER_COUNT = TP # the same ranks own disjoint decode-token rows

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line, keep only tp dp ep

Comment on lines -276 to -278
# Per-component TP degree, over the components that shard.
TP_Q_B = 1 # wq_b: replicated across the DSA-CP group
TP_O_A = TP # wo_a: ColumnParallel over o_groups

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these,

# -----------------------------------------------------------------------------------------------------------
# ci: devices=4
"""DeepSeek-V4 decode DSA-CP communication and grouped output-projection layouts."""
"""Collectives for the DeepSeek-V4 decode DSA-CP layout on one TP group."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never mention dsa-cp, which is a vllm config

# See LICENSE in the root of the software repository for the full text of the License.
# -----------------------------------------------------------------------------------------------------------
"""DeepSeek-V4 decode DSA-CP receive-side grouped output projection."""
"""DeepSeek-V4 decode TP-sharded grouped output projection."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename this file to decode_o_proj.py, move dsa_cp_collectives into this file, and also oproj(tp=1) in 3 attentions.

# See LICENSE in the root of the software repository for the full text of the License.
# -----------------------------------------------------------------------------------------------------------
# ci: devices=4
"""DeepSeek-V4 decode DSA-CP communication and grouped output-projection layouts."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this file, merge into decode_o_proj.py

@@ -7,18 +7,25 @@
# See LICENSE in the root of the software repository for the full text of the License.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this file, merge into decode_o_proj.py

@wangqin1723-max
wangqin1723-max force-pushed the refactor/clarify-dspark-decode-parallel-names branch from 9e2b5e0 to 0af34a9 Compare August 12, 2026 07:20
@wangqin1723-max wangqin1723-max changed the title Refactor: clarify DSpark decode parallel naming Refactor: consolidate DSpark decode output projection Aug 12, 2026
- Keep decode parallel configuration limited to TP, DP, and EP
- Consolidate attention collectives and TP-sharded output projection
  in decode_o_proj.py
@wangqin1723-max
wangqin1723-max force-pushed the refactor/clarify-dspark-decode-parallel-names branch from 0af34a9 to ffdb27b Compare August 12, 2026 07:40
@zhangqi-chen
zhangqi-chen merged commit 77c78c9 into hw-native-sys:main Aug 12, 2026
9 of 11 checks passed
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.

2 participants