Add entrypoint for flagos multi-backend plugin system - #3107
Conversation
| from plugin import load_plugins | ||
| load_plugins() |
There was a problem hiding this comment.
Is the load_plugins performing a generic plugin discovery and loading? If so, we could have that in the main TE repo as well. If it is specific to FlagOS then I agree that it should live there.
There was a problem hiding this comment.
Thanks for the review. Two questions I'd like to confirm before deciding on the next step:
- Should the
load_pluginsentrypoint be merged into themainbranch, so it can follow future NVIDIA TE releases? - Should the generic framework components in
transformer_engine_plugin_fl(e.g.,OpManager,SelectionPolicy) also be upstreamed into TE, or should we keep the current approach where TE only exposes a minimalload_pluginshook and all dispatch logic stays external?
|
Hi @lxd-cumt , thank you for the contribution. A few things:
|
1886932 to
727a116
Compare
Signed-off-by: Xianduo Li <lixianduo@mail.nankai.edu.cn>
Signed-off-by: Xianduo Li <lixianduo@mail.nankai.edu.cn>
727a116 to
c590d4d
Compare
Thanks for the review! I've signed off on both commits and addressed the Greptile comments. |
3cbb72d to
9a869ec
Compare
Signed-off-by: Xianduo Li <lixianduo@mail.nankai.edu.cn>
|
The |
Replace hardcoded transformer_engine_plugin_fl with dynamic plugin module loaded from NVTE_PLUGIN env var, consistent with the top-level __init__.py change. Signed-off-by: Xianduo Li <lixianduo@mail.nankai.edu.cn>
Replace NVTE_ENABLE_PLUGIN=1 check with NVTE_PLUGIN existence check, consistent with the rest of the codebase. Signed-off-by: Xianduo Li <lixianduo@mail.nankai.edu.cn>
Move sys.modules[module_name + '_nv'] = solib before importlib.import_module(_nvte_plugin) so that the plugin can import transformer_engine_torch_nv at top level without hitting ImportError. Signed-off-by: Xianduo Li <lixianduo@mail.nankai.edu.cn>
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
|
Thanks for the review. Two questions I'd like to confirm before deciding on the next step:
|
|
/te-ci pytorch |
|
/te-ci pytorch |
|
Oh wait, this PR targets the wrong branch - release_v2.14, whereas it should be targeting main. I tried to change the branch to main in the PR but it actually needs a proper rebase in git. |
|
Ok, let me close this one then and will review the new one. |
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
Current State
TE already has a prototype (
NVTE_ENABLE_PLUGIN=1incommon/__init__.py) that registers the original CUDA pybind module astransformer_engine_torch_nvand delegates to an externalload_plugins()entry point.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.