Repository navigation
Add entrypoint for flagos multi-backend plugin system - #3401
Merged
Merged
Conversation
Port plugin system changes from backend_rc2.14: - common/__init__.py: load plugin after framework extension init - dot_product_attention.py: override FlashAttention and get_attention_backend when plugin is active Signed-off-by: Xianduo Li <lixianduo@mail.nankai.edu.cn>
…to backend_main
Contributor
Comment on lines
+198
to
+206
| _nvte_plugin = os.environ.get("NVTE_PLUGIN") | ||
| if _nvte_plugin and framework == "torch": | ||
| _original_module = sys.modules.get(module_name) | ||
| try: | ||
| # Register _nv alias BEFORE importing the plugin, because the | ||
| # plugin module may import transformer_engine_torch_nv at top level. | ||
| sys.modules[module_name + "_nv"] = solib | ||
| _plugin = importlib.import_module(_nvte_plugin) | ||
| _plugin.load_plugins() |
Contributor
There was a problem hiding this comment.
Document the plugin API contract
NVTE_PLUGIN introduces a user-facing configuration interface, but the required load_plugins(), flash_attention, and get_attention_backend contracts are not documented. Plugin implementers must infer their signatures and return values from source, leaving incompatible implementations to fail through import-time warnings or attention-time exceptions.
Knowledge Base Used:
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
ptrendx
previously approved these changes
Aug 20, 2026
Member
|
/te-ci pytorch |
Member
|
@lxd-cumt Please fix the lint issue (the one with too broad Exception catch). |
ptrendx
approved these changes
Sep 8, 2026
Member
|
/te-ci pytorch |
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.
FlagOS Proposal: Plugin Architecture & Device-Agnostic Abstraction for TransformerEngine
Plugin System: Initialization-time Backend Loading
We propose a plugin architecture where TransformerEngine (TE) loads backend implementations at initialization time via an explicit plugin interface, while the actual multi-backend plugins reside in a separate repository (
TransformerEngine-Plugin-FL).TransformerEngine-Plugin-FL: https://github.com/lxd-cumt/TransformerEngine-Plugin-FL
Proposed Design
load_framework_extension()time, if a plugin is present, TE dispatches backend calls through the plugin registry; otherwise it falls back to the native te implementation.TransformerEngine-Plugin-FLrepository is independently installable and contains multiple backend implementations for diverse accelerators, and support more training scenarios.