[peft] fix: support ROCm TE grouped-linear fields - #28
Open
Arist12 wants to merge 3 commits into
Open
Conversation
…on AMD
_forward_te_grouped_linear reads the field order off the installed TE rather than
pinning a version, then builds non_tensor_args from a fixed `available` dict. The
dict covers upstream NVIDIA TE 2.14 / 2.15 / 2.17. ROCm/TransformerEngine carries
three extra fields -- m_splits_tensor, actual_m_splits, unpad_output -- so on AMD
the probe finds names the dict lacks and every MoE LoRA step dies with
RuntimeError: transformer_engine's _GroupedLinear.forward expects
non_tensor_args fields this shim does not supply: ['m_splits_tensor', ...]
All three are optional on the AMD fork too: GroupedLinear.forward defaults them to
None / None / False, and they only drive the fused row padding/unpadding path,
which this shim never uses because it does not pad the grouped input. Passing the
same defaults the public wrapper would pass is therefore a no-op on the compute
path and leaves CUDA untouched (the names are simply absent there).
Verified on 4x MI350X (gfx950, ROCm 7.2, TE 2.14.0.dev0 from ROCm/TransformerEngine)
with gpt-oss-20b-bf16 expert LoRA GRPO under miles: train_step reaches
outcome=NORMAL and the run completes.
Signed-off-by: Arist12 <ykzhang12@gmail.com>
Arist12
force-pushed
the
fix/te-grouped-linear-rocm-fields
branch
from
August 13, 2026 16:29
c4b0716 to
41ce53f
Compare
Arist12
marked this pull request as ready for review
August 13, 2026 23:02
Author
|
hi @yushengsu-thu, could you help review this when you got a time? Thanks! |
Keep the code comment focused on the cross-build selection rule; the PR body carries the detailed TE default-value rationale. Signed-off-by: Arist12 <ykzhang12@gmail.com>
Lock the ROCm-only field order to the public-wrapper defaults before invoking the TE private autograd entry point. Signed-off-by: Arist12 <ykzhang12@gmail.com>
Arist12
marked this pull request as draft
August 19, 2026 02:05
Arist12
marked this pull request as ready for review
August 19, 2026 23:46
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.
Problem
Megatron Bridge builds Transformer Engine's private grouped-linear
non_tensor_argstuple from the field names exposed by the installed TE build. ROCm TE can includem_splits_tensor,actual_m_splits, andunpad_output, but the value map lacked those names, so the existing missing-field check raised before grouped-linear execution.Change
Add values for the three ROCm fields:
None,None, andFalse. Tuple construction still selects only the installed contract's field names, so TE builds whose contracts omit these fields do not receive them.