Repository navigation
feat: support packed TND context parallelism for KDA and GDN - #1263
Merged
liuchongming74 merged 1 commit intoOct 31, 2026
Merged
Conversation
xuxl1008
requested review from
liuchongming74,
suteng,
yangzhenzhang02 and
yaoyifanx
as code owners
October 21, 2026 09:18
Contributor
Author
|
/check-pr |
Contributor
Author
|
/retest |
|
|
@xuxl1008, your gate pipeline failed at the code check stage. You can configure some code check tools locally following the (pre-push quick guide), to enable automatic checking when you push your code every time. Tools included are: Check_CMakelint, Check_Codespell, Check_Cpplint, Check_Lizard, Check_Pylint, Check_ClangFormat, Check_ShellCheck. |
This was referenced Oct 22, 2026
xuxl1008
force-pushed
the
feat/linear-attention-tnd-cp
branch
from
October 26, 2026 12:17
e93792b to
0a80a0b
Compare
Contributor
Author
|
/retest |
|
|
@xuxl1008, your gate pipeline failed at the code check stage. You can configure some code check tools locally following the (pre-push quick guide), to enable automatic checking when you push your code every time. Tools included are: Check_CMakelint, Check_Codespell, Check_Cpplint, Check_Lizard, Check_Pylint, Check_ClangFormat, Check_ShellCheck. |
26 tasks
xuxl1008
force-pushed
the
feat/linear-attention-tnd-cp
branch
from
October 26, 2026 15:19
0a80a0b to
198eb3e
Compare
Contributor
Author
|
/check-pr |
Contributor
Author
|
/retest |
|
xuxl1008
commented
Oct 29, 2026
xuxl1008
commented
Oct 29, 2026
xuxl1008
commented
Oct 29, 2026
xuxl1008
commented
Oct 29, 2026
xuxl1008
commented
Oct 29, 2026
xuxl1008
commented
Oct 29, 2026
xuxl1008
commented
Oct 30, 2026
xuxl1008
commented
Oct 30, 2026
5 tasks done
xuxl1008
force-pushed
the
feat/linear-attention-tnd-cp
branch
from
October 30, 2026 15:02
31f8997 to
88757bc
Compare
xuxl1008
force-pushed
the
feat/linear-attention-tnd-cp
branch
from
October 30, 2026 16:25
88757bc to
ae728e2
Compare
Contributor
Author
|
/retest |
|
|
yangzhenzhang02
approved these changes
Oct 31, 2026
This was referenced Nov 10, 2026
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.
Paired: GitHub #1263 ↔ GitCode !1818
What type of PR is this?
/kind feature
What does this PR do / why do we need it:
Enable existing KDA and GDN context-parallel implementations to train on packed TND token streams. ShortConv and recurrent state reset at real document boundaries, while artificial CP cuts preserve state continuity. For example, with CP4, 4096 local tokens and a document boundary at global token 6145, rank 1 continues rank 0 for its first fragment and independently resets for its final fragment.
adapter/distributed/context_parallel.py.backendfor attention and ShortConv in pure Ulysses. This PR exposes eager/Triton layer execution; Ascend C attention is the dependent increment in Add Ascend C backends for KDA state CP and KDA/GDN Ulysses #1331. The common convolution helper handles dense/packed layouts and per-invocation saved tensors.is_flat_inputrestores the caller's physical[T,D]or[B,T,D]layout; explicit offsets determine document boundaries.match: "*.self_attn.forward",replace.kind: method, andreplace.implementation. Decoder overrides must target linear-attention layers, not indiscriminately replace full-attention layers.Configuration is documented in
docs/guide/linear_attention_tnd_cp.mdanddocs/guide/kda_context_parallel.md. Dense/packed eager P2P consolidation and functional-module renaming remain separate work.Validation:
e0cdf62c9d66f1f9ec48c6f15df87dcf4ce80a5f. The rebased TND tree passes 6 existing packed-metadata tests. All 4 YAML blocks pass the actual Trainer resolver, including CP activation/deactivation and method-wrapper binding. AST, diff, catalog, changed documentation links and the repository's existing Pylint/Lizard rules pass. No new production test files were added in this follow-up.The supported scope is natural temporal ordering, contiguous equal-length nonempty CP shards, packed B1, TP=1 and training without inference caches. Full-attention layers in hybrid models need their own TND backend. Existing dense/packed convolution rounding differences are separate from the core comparison above. Numerical thresholds were not relaxed to obtain passing results.
Which issue(s) this PR fixes:
Fixes #1262