[AMD] support ROCm TE grouped expert LoRA - #29
Open
XinyuJiangCMU wants to merge 1 commit into
Open
Conversation
_forward_te_grouped_linear reads the non_tensor_args field order off the installed TE and builds the tuple from the available lookup, raising when a name it cannot supply shows up. ROCm's TE declares three fields CUDA's does not, so every grouped-expert LoRA run on a ROCm build stops there. Add the three names with the same defaults TE's own public GroupedLinear.forward declares for them. A TE that does not declare these names never selects them, so the tuple a CUDA build sees is unchanged. Co-authored-by: Zhiyao Jiang <jessicajiang324@gmail.com>
XinyuJiangCMU
force-pushed
the
amd/rocm-te-grouped-linear-fields-20260814
branch
from
August 14, 2026 09:14
51a8248 to
63b3920
Compare
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.
Co-author-with: @JessicaJiang-123
GroupedExpertLinearAdapter._forward_te_grouped_linearcalls TE's private_GroupedLinear.forward. It does not pin a version table:_te_grouped_linear_contract()reads thenon_tensor_argsfield order off the installed TE source, and the call site builds the tuple from theavailablelookup, raising when a name it cannot supply shows up. ROCm's TE unpacks three fields that CUDA's does not, and the lookup does not carry them, so every grouped-expert LoRA run on a ROCm build stops at:Against the CUDA TE this shim is known to work with (2.17/2.18), the ROCm build appends three fields after
debug:non_tensor_argsfields..., save_original_input, debugdev(2.17-based)..., save_original_input, debug, m_splits_tensor, actual_m_splits, unpad_outputactual_m_splitsandunpad_outputdrive ROCm's fused pad-cast-transpose path: the caller may hand TE a paddedm_splitsand the real row counts alongside it, and ask TE to drop the padding rows before returning.m_splits_tensoris unrelated to padding, it is the device-side group-size tensor ROCm's Triton grouped-GEMM kernel reads. All three are onROCm/TransformerEngine'sdevbranch, so this is the platform's contract rather than one wheel's local patch.Changes
Add the three names to
available, using the same defaults TE's own publicGroupedLinear.forwarddeclares for them:m_splits_tensor=None,actual_m_splits=None,unpad_output=False. That is what TE passes down when no padding is requested, so the shim keeps the unpadded path it already assumes.Why a CUDA build is unaffected
field_namescomes from the installed TE source and the tuple is built astuple(available[name] for name in field_names). A TE that does not unpack these names never selects them, so the tuple is element-for-element what it was before and the three entries are dead keys.Validation
Ran the GPT-OSS 20B MoE-LoRA end-to-end recipe on 4x MI355X with this change and the matching SGLang MoE-LoRA fix, against a ROCm TE 2.14-based wheel that carries the same three fields. Both serving combinations completed (rollout, two training steps, and the post-training LoRA weight update), with the Ray job reporting success for each. Before the change the run stopped at the RuntimeError above.