Skip to content

Optimize routed-expert kernel launches and clean up code - #145

Merged
mikepapadim merged 3 commits into
beehive-lab:mainfrom
MRPRESIDENT66:moe-routed-expert-fusion
Aug 6, 2026
Merged

Optimize routed-expert kernel launches and clean up code#145
mikepapadim merged 3 commits into
beehive-lab:mainfrom
MRPRESIDENT66:moe-routed-expert-fusion

Conversation

@MRPRESIDENT66

Copy link
Copy Markdown
Contributor

Performance

Tested on an NVIDIA RTX 4090 using JDK 21, TornadoVM 5.2.1-dev, the CUDA backend, and --cuda-graphs.

Command:

./llama-tornado --gpu \
  --model Qwen1.5-MoE-A2.7B-Chat.Q8_0.gguf \
  --prompt "Explain briefly how mixture of experts routing works." \
  --max-tokens 64 \
  --temperature 0 \
  --seed 42 \
  --cuda-graphs

Five interleaved runs were performed after one warm-up run:

Version Run 1 Run 2 Run 3 Run 4 Run 5 Mean
Before fusion 129.17 129.92 128.11 129.92 130.52 129.53 tok/s
After fusion 143.93 144.26 143.11 145.59 144.22 144.22 tok/s

The fusion improved throughput by 11.34% with CUDA Graphs enabled.

@CLAassistant

CLAassistant commented Aug 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@mikepapadim
mikepapadim self-requested a review August 6, 2026 21:14
@mikepapadim

Copy link
Copy Markdown
Member

@MRPRESIDENT66 thank you, it LGTM. I would suggest to followup with prefill-decode batched.
Also, for a sanitiy check profile it once with JFR to analyze the host (java) for potential opts and then with nsys to check for potential gpu (cuda) opts.

You can have a look of what is supported from CUDA in tornado in beehive-lab/TornadoVM#1026.

@MRPRESIDENT66

Copy link
Copy Markdown
Contributor Author

@mikepapadim Thanks! I’m currently working on batched prefill-decode for Qwen2-MoE. I’ll also profile it with JFR and nsys as you suggested, and check the CUDA features in #1026.

@mikepapadim
mikepapadim merged commit 5ae026d into beehive-lab:main Aug 6, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants