Skip to content

[Mthreads] Optimized mm addmm bmm with FlagOSTune - #2643

Merged
huangyiqun merged 14 commits into
flagos-ai:masterfrom
Fattysand:feature/mm-addmm-bmm-flagtune-support
Apr 27, 2026
Merged

[Mthreads] Optimized mm addmm bmm with FlagOSTune#2643
huangyiqun merged 14 commits into
flagos-ai:masterfrom
Fattysand:feature/mm-addmm-bmm-flagtune-support

Conversation

@Fattysand

@Fattysand Fattysand commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

PR Category

Operator

Type of Change

Performance Optimization

Description

  1. USE FlagOSTune to optimized mthreads mm/addmm.bmm performance
  2. Achieved 1.02x to 5.6x speedup for mm operator on MTT S5000;
  3. Achieved 1x to 2.82x speedup for addmm operator on MTT S5000;
  4. Achieved 1x to 1.19x speedup for bmm operator on MTT S5000;

Issue

Progress

  • Change is properly reviewed (1 reviewer required, 2 recommended).
  • Change is responded to an issue.
  • Change is fully covered by a UT.

Performance

Comment thread src/flag_gems/runtime/backend/_mthreads/addmm_mthreads_expand.yaml
Comment thread src/flag_gems/runtime/backend/_mthreads/ops/mm.py
@github-actions github-actions Bot added the tests label Apr 24, 2026
Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
- Add get_expand_config() to read YAML tuning configs
- Update @libtuner decorators with dynamic strategy and warmup/rep params
- Add SQMMA kernel pre-hooks using cached TMA descriptors
- Preserve master's fp32 support and transpose logic
- Add SQMMA_SWITCH control for mm (False) and addmm (True)

Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
@Fattysand
Fattysand force-pushed the feature/mm-addmm-bmm-flagtune-support branch from 06f63f4 to 0dcac0b Compare April 27, 2026 02:12
Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
@Fattysand Fattysand changed the title [Feature & Bugfix] mthreads mm addmm bmm flagtune support [Mthreads] mm addmm bmm flagtune support Apr 27, 2026
@Fattysand Fattysand changed the title [Mthreads] mm addmm bmm flagtune support [Mthreads] Optimized mm addmm bmm with FlagOSTune Apr 27, 2026
Signed-off-by: fattysand <44150064+Fattysand@users.noreply.github.com>
@Fattysand
Fattysand marked this pull request as ready for review April 27, 2026 04:37
Comment thread benchmark/test_blas_perf_parallel.py
@huangyiqun
huangyiqun merged commit 6fed5de into flagos-ai:master Apr 27, 2026
47 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants