hcu: implement multi_tensor_scale_tensor using multi_tensor_scale in transformer_engine_hygon 2.13#85
Merged
Merged
Conversation
… to submodule search locations when origin is None
lihongyang1990
approved these changes
Jul 10, 2026
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
This PR fixes two compatibility issues in the Hygon backend.
First, it improves the package path resolution for
transformer_engine_hygon. In some environments,importlib.util.find_spec()may return aModuleSpecwithorigin=None, which causes the previous implementation to fail when resolving the package directory. This PR adds a fallback tosubmodule_search_locationsand reports an error if neither source is available.Second,
transformer_engine_hygoncurrently does not implement themulti_tensor_scale_tensorAPI (available in upstream NVIDIA TransformerEngine v2.14). This PR replaces the unsupported call with the existingmulti_tensor_scaleimplementation by extracting the scalar value from the input tensor, preserving equivalent functionality on the Hygon backend.Fixes # (issue)
Type of change
Changes
Please list the changes introduced in this PR:
transformer_engine_hygonpackage path resolution by handling the case whereModuleSpec.originisNone.submodule_search_locationswhen locating Hygon backend libraries.multi_tensor_scale_tensorcall withmulti_tensor_scaleby converting the scale tensor to a scalar value.Checklist: