Skip to content

Add opt-in TP2 FP32 reduce-scatter before BF16 gathers - #49

Merged
Elevatormusic merged 10 commits into
Elevatormusic:deepseek-v41-tp2from
imD-5:perf/dsv41-reduce-scatter
Nov 6, 2026
Merged

Elevatormusic merged 10 commits into
Elevatormusic:deepseek-v41-tp2from
imD-5:perf/dsv41-reduce-scatter

Conversation

@imD-5

@imD-5 imD-5 commented Oct 28, 2026 •

Copy link
Copy Markdown

What this changes

Add the opt-in TF_DS_RS=1 prefill reducer. Eligible TP2 FP32 partials with an even row count use FP32 ReduceScatter, then BF16 AllGather. The existing mHC consumers already round their FP32 rank sum to BF16 before mixing. This is the intended two-operand rounding path; compiled GPU bit identity is not qualified.

The default stays off. TP1, unsupported dtypes, odd rows, and partials that fit RDMA retain the existing gather. Decode graphs and the head-logit gather remain unchanged.

Both ranks agree the reducer flag before warm-up, using the packet's actual element count for allocation and reshape. The local benchmark stand-ins now implement gather-preserving reduced methods. This keeps small_bench, small_prompt_check, and the grouped-model checker usable without pretending they implement NCCL transport.

The contributor's commits are preserved. Rank-agreement and benchmark compatibility repairs are separate maintainer commits.

Type

  • type: fix: a bug fix
  • type: feature: new code
  • type: docs: docs only
  • type: results: run results
  • type: research: research
  • type: spec: a plan

Current validation

  • Head: e2eb15b9a15e4d97c5d5fc60e3d87f2801d7e5fd; base: 8559c41c5c91f1f7181503c45a13dd72bb5c83b5 on deepseek-v41-tp2.
  • Focused CPU contracts: 31 passed in 4.93s. This includes all 18 original reducer cases and 13 tool/layout/prefill-dispatch cases.
  • Tool repair before proof: 8 failed, 23 passed. After repair: 31 passed, zero skipped, with actual CPU Torch.
  • Full isolated CPU plan: 3770 passed, 747 skipped, 138 deselected, 37 subtests passed in 158.60s (0:02:38). The 138 trusted-base exclusions are unchanged.
  • Python 3.12.15 and Torch 2.9.1+cpu; no GPU or checkpoint. CPU kernel substitutes test dispatch and layout, not GPU arithmetic.
  • Exact read-only source, frozen input hashes, and before/after manifests match. Containers were removed.
  • The full plan uses the separate approved fixed HTTP simulator in a fresh private network-none namespace.
  • Exact-head CI is green. Fresh Codex request completed without findings and has a new trusted thumbs-up. The benchmark finding is resolved on this commit.
  • Not run: compiled NCCL/Triton behavior, CUDA graph/PDL behavior, two-node inference, current-head token hashes, paired cold prefill/decode, memory headroom, or Metal.

Original contributor measurements

The original contribution reports these results on two GB10 nodes at TP2:

Measure Contributor report
Cold 64K prefill, reducer on 30.8–31.0 seconds
Cold 64K prefill, reducer off 31.7–32.0 seconds
Method Fresh prompts, spill off, restart each round, two alternating rounds per mode
Exactness 26 greedy prompts had byte-identical replies; the reported concurrent/solo comparison cells matched
Other lengths and decode Reported differences were within noise

These are the contributor's measurements. This repair pass did not repeat them or verify their raw receipts. They do not qualify the current commit. The exact checkpoint revision, raw paired run data, and current-head hardware checks remain needed for an independent speed or token-equivalence claim.

Checklist

  • The reducer is off by default; existing fallback paths remain.
  • Mixed-rank flag settings stop before warm-up.
  • Both local benchmark communicators preserve their old gather layout.
  • Contributor history and existing assertions/exclusions are preserved.
  • Current-head model exactness and paired performance are release-qualified.
  • No personal data, internal hosts, or local paths were added.
AI disclosure

AI: GPT-6 and GPT-6.1 Sol (sizes unavailable) via Codex Desktop. The original contributor reports Claude Opus 5.5 via Hermes Agent.
Checked: read the communicator, callers, mHC arithmetic, tool protocols and primary NCCL documentation; verified actual before/after CPU logs, manifests, frozen inputs, CI and Codex evidence. No hardware result is claimed.

…ts from 3/4 of the bytes

TF_DS_RS=1 (two ranks, off by default): a prompt chunk's attention and MoE partials reach the mHC post as
bf16(p0 + p1), from an fp32 reduce-scatter and a bf16 all-gather, instead of the fp32 all-gather. The post kernels
add the two ranks' rows and round to bf16; one fp32 add of two operands has the same bits in either order, so they
form the same y. Odd row counts, rows the RDMA gather holds, and one rank keep the gather.
@imD-5
imD-5 requested a review from Elevatormusic as a code owner October 28, 2026 06:08
@Elevatormusic Elevatormusic added the type: feature new code (feature, tool, add-on) label Nov 6, 2026 — with ChatGPT Codex Connector
@Elevatormusic

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T23:08:33.704691Z e2eb15b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 46493eb103

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Elevatormusic

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 40c431aa82

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Elevatormusic Elevatormusic changed the title perf(dsv41): prompt-chunk partials over a reduce-scatter, the same bits from 3/4 of the bytes Add opt-in TP2 FP32 reduce-scatter before BF16 gathers Nov 6, 2026
@Elevatormusic

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b3d452930b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Elevatormusic

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: e2eb15b9a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Elevatormusic
Elevatormusic merged commit 8115854 into Elevatormusic:deepseek-v41-tp2 Nov 6, 2026
3 checks passed

Copy link
Copy Markdown
Owner

Merged into deepseek-v41-tp2 at 8115854afb8cf82cc523664e6078023f1c52197c, with your commits preserved. The reducer remains opt-in and limited to eligible TP2 FP32 partials.

The integration adds mixed-rank startup agreement and repairs the local benchmark communicators, including the grouped-model checker. All 31 focused CPU contracts and the full CPU plan pass; current CI and the fresh Codex review are clean. The description and title now separate the intended arithmetic from unqualified compiled-GPU bit identity and your original performance reports. Current-head two-node exactness and paired speed remain release work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature new code (feature, tool, add-on)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants