Skip to content

[peft] fix: support ROCm TE grouped-linear fields - #28

Open
Arist12 wants to merge 3 commits into
radixark:bridgefrom
Arist12:fix/te-grouped-linear-rocm-fields
Open

[peft] fix: support ROCm TE grouped-linear fields#28
Arist12 wants to merge 3 commits into
radixark:bridgefrom
Arist12:fix/te-grouped-linear-rocm-fields

Conversation

@Arist12

@Arist12 Arist12 commented Aug 13, 2026

Copy link
Copy Markdown

Problem

Megatron Bridge builds Transformer Engine's private grouped-linear non_tensor_args tuple from the field names exposed by the installed TE build. ROCm TE can include m_splits_tensor, actual_m_splits, and unpad_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, and False. Tuple construction still selects only the installed contract's field names, so TE builds whose contracts omit these fields do not receive them.

…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
Arist12 force-pushed the fix/te-grouped-linear-rocm-fields branch from c4b0716 to 41ce53f Compare August 13, 2026 16:29
@Arist12
Arist12 marked this pull request as ready for review August 13, 2026 23:02
@Arist12

Arist12 commented Aug 18, 2026

Copy link
Copy Markdown
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>
@Arist12 Arist12 changed the title fix(peft): supply the ROCm TE grouped-linear fields so MoE LoRA runs on AMD [peft] fix: support ROCm TE grouped-linear fields Aug 18, 2026
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
Arist12 marked this pull request as draft August 19, 2026 02:05
@Arist12
Arist12 marked this pull request as ready for review August 19, 2026 23:46
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