Repository navigation
[Refactor] Drop model placement attributes and parameters nothing reads - #41812
Merged
Merged
Conversation
ch-wan
requested review from
Fridge003,
fzyzcjy,
ispobock,
kpham-sgl,
merrymercy and
pyc96
as code owners
September 30, 2026 03:07
This was referenced Sep 30, 2026
ch-wan
force-pushed
the
cheng/refactor/drop-unread-placement
branch
from
September 30, 2026 04:24
52fc839 to
02fdd93
Compare
ch-wan
requested review from
Qiaolin-Yu,
Ying1123,
alexnails,
hanming-lu,
hnyls2002,
hzh0425,
liusy58,
xiezhq-hermann and
yizhang2077
as code owners
September 30, 2026 04:24
ch-wan
requested review from
1am9trash,
Alisehen,
ByronHsu,
Duyi-Wang,
HaiShaw,
OrangeRedeng,
ShangmingCai,
YAMY1234,
b8zhong,
hebiao064,
hubertlu-tw,
kkHuang-amd,
mickqian,
mmangkad,
rainj-me,
sogalin,
yhyang201 and
yuan-luo
as code owners
September 30, 2026 04:24
ch-wan
force-pushed
the
cheng/refactor/drop-unread-model-placement
branch
from
September 30, 2026 04:24
0a98d71 to
791b0e2
Compare
ch-wan
force-pushed
the
cheng/refactor/drop-unread-placement
branch
from
September 30, 2026 05:05
02fdd93 to
87b938b
Compare
ch-wan
force-pushed
the
cheng/refactor/drop-unread-model-placement
branch
from
September 30, 2026 05:05
791b0e2 to
134ee9d
Compare
ch-wan
force-pushed
the
cheng/refactor/drop-unread-placement
branch
from
September 30, 2026 20:26
87b938b to
80e6449
Compare
Base automatically changed from
cheng/refactor/drop-unread-placement
to
main
September 30, 2026 20:26
Model modules copied parallel ranks and sizes onto `self` (`self.tp_size = get_parallel().tp_size` and similar) in 97 places where no method of the class, its subclasses or its bases reads the attribute back, and no other code reads it off an instance. Remove those assignments across 53 model files. The Dots Note omni wrapper's `tp_size`, copied from its language model and itself never read, goes with the language model's.
`Step3p5MLP` accepted `tp_size` / `tp_rank` only to forward them to its linear layers, and neither caller passes them, so the layers always got their own defaults. `OlmoeMoE`, `Grok1MoE` and `MixtralMoE` accepted a `tp_size` they never use. Remove the parameters; every caller already passes by keyword without them.
ch-wan
force-pushed
the
cheng/refactor/drop-unread-model-placement
branch
from
September 30, 2026 20:27
134ee9d to
afcf208
Compare
This was referenced Oct 5, 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.
This PR is part of a stack (oldest at bottom):
Motivation
Model modules copy parallel ranks and sizes onto
self(self.tp_size = get_parallel().tp_sizeand similar). In 97 places no method of the class, its subclasses or its bases reads the attribute back, and no other code reads it off an instance. A few constructors also accept placement parameters that no caller sets.Modifications
tp_size, copied from its language model and itself never read, goes with the language model's. ThreeTODOs that only annotated a removed assignment go with it.Step3p5MLPacceptedtp_size/tp_rankonly to forward them to its linear layers, and neither caller passes them, so the layers always got their own defaults.OlmoeMoE,Grok1MoEandMixtralMoEaccepted atp_sizethey never use. Remove these parameters; every caller already passes by keyword without them.Code outside the tree that read one of the removed attributes, for example
model.tp_size, should readget_parallel()instead.Accuracy Tests
Not applicable: nothing that is read changes.
test/registered/unitat this PR's head, compared withmain: no new failures.Speed Tests and Profiling
Not applicable.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): 🚫 Run #36772717146
Latest PR Test (Extra): 🚫 Run #36772716531
Latest PR Test (AMD ROCm 10): ❌ Run #36772717248