[KernelGen][MThreads] Add norm Moore Threads specialized operator - #261
Conversation
|
/test | norm:mthreads |
|
/test | norm:mthreads |
❌ On-demand test failedOperator: The test failed to complete. Check the workflow run for details. |
Dongxu-H
left a comment
There was a problem hiding this comment.
Logger should use MThreads backend-specific format: logging.getLogger(f"flag_gems.runtime.backend._mthreads.ops.{name.split(".")[-1]}") instead of logging.getLogger(name) in backend implementations.
|
/test | norm:mthreads |
Dongxu-H
left a comment
There was a problem hiding this comment.
PR contains large infrastructure changes (removing CODEOWNERS, modifying workflows, adding image-builder and sync-to-kernelgen workflows, modifying backends.yaml, fused_marlin_moe.py, adding unrelated operators and benchmarks) that should not be mixed with operator implementation. Infrastructure changes should be submitted as separate PR. Only operator-specific changes should remain: src/flag_gems/runtime/backend/_mthreads/ops/norm.py.
|
/test | zero_:thead |
❌ On-demand test failedOperator: The test failed to complete. Check the workflow run for details. |
|
/test | norm:mthreads |
Dongxu-H
left a comment
There was a problem hiding this comment.
PR contains large infrastructure changes (removing CODEOWNERS, modifying workflows, adding image-builder and sync-to-kernelgen workflows, modifying backends.yaml, fused_marlin_moe.py, adding unrelated operators and benchmarks) that should not be mixed with operator implementation. Infrastructure changes should be submitted as separate PR. Only operator-specific changes should remain: src/flag_gems/runtime/backend/_mthreads/ops/norm.py.
|
/test | norm:mthreads |
Dongxu-H
left a comment
There was a problem hiding this comment.
PR contains large infrastructure changes (removing CODEOWNERS, modifying workflows, adding image-builder and sync-to-kernelgen workflows, modifying backends.yaml, fused_marlin_moe.py, adding unrelated operators and benchmarks) that should not be mixed with operator implementation. Infrastructure changes should be submitted as separate PR. Only operator-specific changes should remain: src/flag_gems/runtime/backend/_mthreads/ops/norm.py and related init.py update. Merge conflict needs to be resolved.
|
/test | norm:mthreads |
1 similar comment
|
/test | norm:mthreads |
8d88268 to
4c0939e
Compare
|
/test | norm:mthreads |
[KernelGen][MThreads] Add norm Moore Threads specialized operator
Summary
Add a Moore Threads (MUSA) specialized Triton kernel for
norm(and itsnorm.Scalar/norm.ScalarOpt_dimfull-reduction dispatches), overriding the generic implementation via the vendor backend replacement system. The full-tensor reduction uses a grid-stride two-pass design (a bounded grid of programs each folding many tiles into a partial, then a small finalize pass) instead of the generic~sqrt(M)single-load-per-program layout, which collapses occupancy on large tensors. All supported orders (p = 2, +inf, -inf, 0, and general Lp) are handled; partial per-dim reductions defer to the generic path.Testing
tests/test_norm.py(-m norm): 45 passedGEMS_MTHREADS NORMdebug logPerformance
Compared against the generic FlagGems implementation on Moore Threads (MUSA). The benchmark exercises the p=2 full-tensor reduction.
norm
Files Changed
src/flag_gems/runtime/backend/_mthreads/ops/norm.py: Moore Threads Triton kernel + fallbacksrc/flag_gems/runtime/backend/_mthreads/ops/__init__.py: Register import and__all__