Add python-level patches to supporting multiple platforms#49
Merged
Conversation
… cuda, musa, et.al support te platform support more device related debug log fix fix fix fix fix fix fix fix fix fix fix debug test fix expand change expand change expand changes
polish func code format fix circular import fix
aoyulong
reviewed
Mar 23, 2026
|
|
||
| # Apply MUSA (VENDOR) Patches, such as torch.cuda.device -> torch.musa.device | ||
| try: | ||
| from .plugin.core.backends.vendor.musa.musa_patches import apply_patch as _musa_apply_patch |
There was a problem hiding this comment.
Is it better to rename musa_patches to patches?
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.
TE-FL Python-level now supports multiple platforms, including the following two changes:
support for vendor-specific patches: vendors can now add their own patches, e.g., patching
torch.cudatotorch.musa. For patch implementation, please refer totransformer_engine/plugin/core/backends/vendor/musa/musa_patches.py; for patch integration, please refer totransformer_engine/__init__.py.abstraction of CUDA device references: files under
transformer_engine/now abstract CUDA device-related code intote_device_type. For example,torch.device("cuda")is now replaced withtorch.device(te_device_type).Fix
get_num_cublas_streamandget_cudnn_versionget_num_cublas_streamandscaled_mask_softmax_forward