Skip to content

Unify canonical MoE folding across Qwen and GLM - #44

Closed
kiddyboots216 wants to merge 17 commits into
feature/qwen3-dense-exact-kernels-20260810from
feature/canonical-moe-fold-unification-20260810
Closed

Unify canonical MoE folding across Qwen and GLM#44
kiddyboots216 wants to merge 17 commits into
feature/qwen3-dense-exact-kernels-20260810from
feature/canonical-moe-fold-unification-20260810

Conversation

@kiddyboots216

@kiddyboots216 kiddyboots216 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Define trainer-side canonical_moe_fold_v1 as the versioned logical adjacent-pair BF16 tree.
  • Separate contributor transport from arithmetic so admitted Qwen, GLM, and downstream DSV4 paths share one reduction ABI.
  • Add Qwen CP8 row identity/padding, GDN prefix exchange, per-sample K3 reassembly, and exact-topology guards.
  • Admit GLM DP-owned rows while retaining its qualified CP16 transport and bounded row buffers.
  • Fix exact GDN CP parameter-gradient ownership and restore ring zigzag order before per-sample K3 reconstruction.

DSV4 consumes this primitive through #45. The former architecture-scoped combine divergence is gone; DSV4 retains only its variable-row transport before the shared fold.

Stack

Validation

  • Two-GPU exact GDN CP parameter/gradient ownership: 1 passed.
  • Per-sample K3 CP and sequence-shard collator suite: 12 passed.
  • Changed Python files: Ruff passed.
  • Range-diff preserves all 17 prior payload/repair commits; the only added commit pins the final restacked sampler Add the Qwen3.5 zero-K3 GDN contract #16 head.

@broly-code-security-scanner

Copy link
Copy Markdown

Broly Security Scan

Note

Clean scan
No vulnerabilities detected in this PR.

Note

Re-scan this PR anytime with /broly scan — useful after /broly undismiss, or to refresh findings without a new push.

Broly — SAST (zai-org/GLM-5.2) · Secrets · SCA · IaC · GH Actions · Base Images · Supply Chain Threats · Exploit Chains · Adversarial Verification

We're continuously improving Broly's accuracy and finding quality — your feedback is valuable. False positives, missed findings, bugs, and feature requests all welcome.

Ask in #security-engineering   Powered by Together AI

@kiddyboots216
kiddyboots216 force-pushed the feature/canonical-moe-fold-unification-20260810 branch from 8285fde to e08c0a4 Compare August 11, 2026 18:01
@kiddyboots216
kiddyboots216 changed the base branch from main to feature/qwen3-dense-exact-kernels-20260810 August 11, 2026 18:02
@kiddyboots216
kiddyboots216 force-pushed the feature/qwen3-dense-exact-kernels-20260810 branch from 61d8222 to f123869 Compare August 12, 2026 02:05
@kiddyboots216
kiddyboots216 force-pushed the feature/canonical-moe-fold-unification-20260810 branch from e08c0a4 to 5bb7a3f Compare August 12, 2026 02:29
@kiddyboots216
kiddyboots216 force-pushed the feature/canonical-moe-fold-unification-20260810 branch from 5bb7a3f to 0f41afe Compare August 12, 2026 03:15
@kiddyboots216
kiddyboots216 force-pushed the feature/canonical-moe-fold-unification-20260810 branch from 0f41afe to 65ae56a Compare August 12, 2026 03:19
@kiddyboots216
kiddyboots216 force-pushed the feature/canonical-moe-fold-unification-20260810 branch from 65ae56a to ecfe560 Compare August 12, 2026 04:02
kiddyboots216 added a commit that referenced this pull request Aug 12, 2026
The Qwen3.5/GLM exact lanes reduce MoE partials with the canonical
adjacent-pair BF16 fold (#44/#16); DSV4 reproduces the pinned NCCL-tree
contributor order [1..7, 0]. These are different byte programs, so the
DSV4 combine (and the variable-row gather primitives it needs) now lives
in dsv4_native_combine.py with the order baked in and the unification
hazard documented; ep_native_combine.py and its tests return to main's
content, removing the #44 -> #45 textual conflict entirely.

Pure code motion: the 4-decision base ruler replay was re-verified
byte-equal (K3 = 0 x4) after the relocation.
@kiddyboots216
kiddyboots216 requested a review from qywu August 12, 2026 04:11
@kiddyboots216

Copy link
Copy Markdown
Contributor Author

Superseded by #57, which consolidates the complete exact trainer-serving stack directly onto main.

@kiddyboots216
kiddyboots216 deleted the feature/canonical-moe-fold-unification-20260810 branch August 17, 2026 23:41
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