You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[KernelGen][MThreads] Add special_gammainc Moore Threads specialized operator
Summary
Add a Moore Threads (MUSA) specialized Triton kernel for special_gammainc, overriding the generic
implementation via runtime.replace_customized_ops(). Implements the special gammainc operation.
Testing
Reused the existing upstream accuracy tests tests/test_special_gammainc.py (-m special_gammainc)
Validated against reference on the MUSA device; specialization confirmed active via the GEMS_MTHREADS SPECIAL_GAMMAINC debug log
Falls back to the generic implementation for unsupported dtype/device/shape
(fp64/int64 are not supported on Moore Threads hardware)
Performance
Compared against the generic FlagGems implementation on Moore Threads (MUSA).
special_gammainc
dtype
Size
Torch Latency (ms)
Gems Latency (ms)
Speedup
TFLOPS
float32
1073741824
5504.079590
796.210022
6.913x
0.003
float32
64, 64
0.364200
0.090720
4.015x
0.000
float32
4096, 4096
86.118317
12.576401
6.848x
0.003
float32
64, 512, 512
86.612679
12.582640
6.884x
0.003
float32
1024, 1024, 1024
5506.935059
796.191467
6.917x
0.003
float32
1024, 1
0.367960
0.094920
3.877x
0.000
float32
1024, 16
0.401440
0.087040
4.612x
0.000
float32
1024, 256
1.465340
0.227680
6.436x
0.002
float32
1024, 4096
21.792620
3.249160
6.707x
0.003
float32
1024, 65536
344.749237
49.897400
6.909x
0.003
float32
64, 64, 1
0.361640
0.094320
3.834x
0.000
float32
64, 64, 16
0.396440
0.097960
4.047x
0.001
float32
64, 64, 256
5.551840
0.903320
6.146x
0.002
float32
64, 64, 4096
86.310165
12.580560
6.861x
0.003
float32
64, 64, 65536
1377.455444
199.172760
6.916x
0.003
Operator
Arithmetic Mean Speedup
special_gammainc
5.86x
Files Changed
src/flag_gems/runtime/backend/_mthreads/ops/special_gammainc.py: Moore Threads Triton kernel + fallback
src/flag_gems/runtime/backend/_mthreads/ops/__init__.py: Register import and __all__
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
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 special_gammainc Moore Threads specialized operator
Summary
Add a Moore Threads (MUSA) specialized Triton kernel for
special_gammainc, overriding the genericimplementation via
runtime.replace_customized_ops(). Implements the special gammainc operation.Testing
tests/test_special_gammainc.py(-m special_gammainc)GEMS_MTHREADS SPECIAL_GAMMAINCdebug log(fp64/int64 are not supported on Moore Threads hardware)
Performance
Compared against the generic FlagGems implementation on Moore Threads (MUSA).
special_gammainc
Files Changed
src/flag_gems/runtime/backend/_mthreads/ops/special_gammainc.py: Moore Threads Triton kernel + fallbacksrc/flag_gems/runtime/backend/_mthreads/ops/__init__.py: Register import and__all__