Fix: Resolve parameter mismatch between TE_FL and NVTE functions#34
Merged
lxd-cumt merged 7 commits intoFeb 10, 2026
Merged
Conversation
045cfd6 to
06d0554
Compare
…tensor_adam_param_remainder tests
lxd-cumt
reviewed
Feb 9, 2026
| # Write back | ||
| flag_gems.copy_(p, param_bf16) | ||
| flag_gems.copy_(p_remainder, remainder_int16) | ||
| p.view(torch.int16).copy_(new_p) |
Collaborator
There was a problem hiding this comment.
use flag_gems to replace torch?
lxd-cumt
reviewed
Feb 9, 2026
| # Write back | ||
| p.view(torch.int16).copy_(new_p) | ||
| p_remainder.copy_(new_p_rem) | ||
| flag_gems.copy_(p, new_p.view(torch.bfloat16)) |
lxd-cumt
approved these changes
Feb 9, 2026
zhaoyinglia
reviewed
Feb 9, 2026
Author
|
Remove optimizer changes for single-purpose PR |
lxd-cumt
approved these changes
Feb 10, 2026
lxd-cumt
left a comment
Collaborator
There was a problem hiding this comment.
Based on this PR, locally verified the qwen3, deepseek_v3, and aquila models, and they can train correctly.
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.
Description
Align TE_FL backend interface signatures with the upstream NVTE (NVIDIA TransformerEngine) C++ pybind API to
resolve parameter mismatches that cause runtime failures when TE_FL dispatches operations to different backends.
Motivation
The TEFLBackendBase abstract class and its concrete implementations (FlagOS, Reference, CUDA, Hygon, Iluvatar, MetaX) had function signatures that
diverged from the NVTE pybind interface defined in transformer_engine/pytorch/csrc/extensions/pybind.cpp. This caused parameter name/type
mismatches when the plugin layer forwarded calls to vendor backends, leading to TypeError exceptions at runtime.
Changes
comm_type typed as CommOverlapType). Changed bias_type from Any to DType and return type from Any to List[Any].
a keyword default in the FlagOS impl for backward compatibility.
NVTE return convention.
itself when called with no arguments) — these methods now always execute the operation directly.
torch.dtype before computation.
raising NotImplementedError or holding dummy state.
operations that the reference backend cannot implement (NVSHMEM, THD, FP8, RoPE, MOE aux loss, etc.).
directly), matching the new non-callable-return interface.
test_normalization.py: Use DType.kFloat32 instead of torch.float32 for norm forward/backward calls. Removed eps from rmsnorm_bwd test calls.
test_operations.py: Use DType.kFloat32 for GEMM and pass explicit None for dropout optional params.
test_optimizer.py: Renamed eps→epsilon in multi_tensor_adam test. Added comprehensive multi_tensor_adam_param_remainder tests with
FP32↔BF16+int16 split/reconstruct verification.
Documentation change (change only to the documentation, either a fix or a new content)
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to not work as expected)
Infra/Build change
Code refactoring
Changes
Please list the changes introduced in this PR:
Checklist: