[KernelGen][MThreads] Add amp_foreach_non_finite_check_and_unscale_ Moore Threads specialized operator - #307
Open
Yukun-Cui wants to merge 2 commits into
Conversation
Collaborator
|
/test | amp_foreach_non_finite_check_and_unscale_:mthreads |
1 similar comment
Collaborator
|
/test | amp_foreach_non_finite_check_and_unscale_:mthreads |
❌ On-demand test failedOperator: The test failed to complete. Check the workflow run for details. |
Collaborator
|
/test | amp_foreach_non_finite_check_and_unscale_:mthreads |
3 similar comments
Collaborator
|
/test | amp_foreach_non_finite_check_and_unscale_:mthreads |
Collaborator
|
/test | amp_foreach_non_finite_check_and_unscale_:mthreads |
Collaborator
|
/test | amp_foreach_non_finite_check_and_unscale_:mthreads |
…oore Threads specialized operator
Yukun-Cui
force-pushed
the
pr/mthreads-amp_foreach_non_finite_check_and_unscale_
branch
from
August 19, 2026 03:41
e591fec to
8aae535
Compare
Dongxu-H
reviewed
Aug 19, 2026
Dongxu-H
left a comment
Collaborator
There was a problem hiding this comment.
all list order incorrect, amp_foreach_non_finite_check_and_unscale should be after amax in alphabetical order
…py to _amp_foreach_non_finite_check_and_unscale_.py Align the specialized op file name with the op symbol name _amp_foreach_non_finite_check_and_unscale_ (inherited from the upstream aten::_amp_foreach_non_finite_check_and_unscale_ op). Matches the naming used by the hygon and cambricon backends for the same op. Update the __init__ import path accordingly; isort moves it to the top of the relative-import block. No functional change.
Collaborator
|
/test | amp_foreach_non_finite_check_and_unscale_:mthreads |
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.
[KernelGen][MThreads] Add amp_foreach_non_finite_check_and_unscale_ Moore Threads specialized operator
Summary
Add a Moore Threads (MUSA) specialized Triton kernel for
amp_foreach_non_finite_check_and_unscale_, overriding the generic implementation viaruntime.replace_customized_ops(). This op checks for non-finite values in a list of gradient tensors and unscales them by a given scaler, used in automatic mixed-precision training.Testing
tests/test_amp_foreach_non_finite_check_and_unscale_.py(-m amp_foreach_non_finite_check_and_unscale_)GEMS_MTHREADS AMP_FOREACH_NON_FINITE_CHECK_AND_UNSCALE_debug logPerformance
Compared against the generic FlagGems implementation on Moore Threads (MUSA).
amp_foreach_non_finite_check_and_unscale_
Files Changed
src/flag_gems/runtime/backend/_mthreads/ops/amp_foreach_non_finite_check_and_unscale_.py: Moore Threads Triton kernel + fallbacksrc/flag_gems/runtime/backend/_mthreads/ops/__init__.py: Register import and__all__