[KernelGen][MThreads] Add feature_dropout Moore Threads specialized operator - #300
Open
Yukun-Cui wants to merge 2 commits into
Open
[KernelGen][MThreads] Add feature_dropout Moore Threads specialized operator#300Yukun-Cui wants to merge 2 commits into
Yukun-Cui wants to merge 2 commits into
Conversation
Collaborator
|
/test | feature_dropout:mthreads |
❌ On-demand test failedOperator: The test failed to complete. Check the workflow run for details. |
Collaborator
|
/test | feature_dropout:mthreads |
Yukun-Cui
force-pushed
the
pr/mthreads-feature_dropout
branch
from
August 19, 2026 03:42
320c351 to
ba20180
Compare
Collaborator
|
LGTM |
The in-place feature_dropout_ in the mthreads specialized module duplicated the public fallback (which just calls feature_dropout then copy_). Remove the specialized variant: torch.feature_dropout_ now dispatches to the public implementation, which in turn reuses the mthreads-specialized feature_dropout (non-in-place). Matches the pattern of backends that do not specialize feature_dropout_ (e.g. nvidia).
Collaborator
|
/test | feature_dropout: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 feature_dropout Moore Threads specialized operator
Summary
Add a Moore Threads (MUSA) specialized Triton kernel for
feature_dropout, overriding the generic implementation viaruntime.replace_customized_ops(). The specialization uses three channel-keyed kernels: a scalar factor kernel for tiles aligned to one channel (feature_dropout_uniform_kernel), a straddle kernel for tiles that span channel boundaries (feature_dropout_straddle_kernel), and a per-element nibble-packed RNG kernel for thespatial == 1case (feature_dropout_channel1_kernel) that cuts RNG cost by 8x while keeping per-element determinism.Testing
tests/test_feature_dropout.py(-m feature_dropout)GEMS_MTHREADS FEATURE_DROPOUTdebug logPerformance
Compared against the generic FlagGems implementation on Moore Threads (MUSA).
feature_dropout
Files Changed
src/flag_gems/runtime/backend/_mthreads/ops/feature_dropout.py: Moore Threads Triton kernel + fallbacksrc/flag_gems/runtime/backend/_mthreads/ops/__init__.py: Register import and__all__