Skip to content

[Model]Force use triton compressed_tensor_moe instead of cutlass#22345

Closed
access2rohit wants to merge 4 commits intovllm-project:mainfrom
access2rohit:llama4
Closed

[Model]Force use triton compressed_tensor_moe instead of cutlass#22345
access2rohit wants to merge 4 commits intovllm-project:mainfrom
access2rohit:llama4

Conversation

@access2rohit
Copy link

@access2rohit access2rohit commented Aug 6, 2025

… this improves performance for llama4

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Purpose

This PR is to improve performance of LLama 4 by force use triton based compressed tensor MOE kernel with the help of a flagh. Changed the following files:

envs.py: added environment varaibles
compressed_tensors_moe.py: logic to force override triton kernel 

Test Plan

an with a uploaded scout based eagle to test E2E
Example cmd

CUDA_VISIBLE_DEVICES=4,5,6,7 VLLM_USE_V1=1 python examples/offline_inference/spec_decode.py --num_spec_tokens 7 --num_prompts 1 --method eagle --model_dir /home/$USER/local/models/scout_base_HF_20250605_201140 --eagle_dir /home/$USER/local/models/scout_draft_HF_20250605_202942 --tp 4

unit test: python -m pytest tests/v1/e2e/test_spec_decode.py

vllm serve + benchmarking
EAGLE server cmd

#!/bin/bash

Configuration of environment variables

export CUDA_VISIBLE_DEVICES=4,5,6,7
export VLLM_USE_V1=1

Command to run the vllm server

spec_dec_config='{"method": "eagle", "model": "/home/$USER/local/models/scout_draft_HF_20250605_202942", "prefill_token_shift": false, "num_speculative_tokens": 3, "draft_tensor_parallel_size": 4, "max_model_len": 32768}'
vllm serve /home/$USER/local/models/scout_base_HF_20250605_201140 --disable-log-requests
-tp 4
--max-num-seqs 128
--max_num_batched_tokens=80000
--max-model-len=32768
--no-enable-prefix-caching
--trust-remote-code
--speculative-config="$spec_dec_config"
--num-lookahead-slots=3
2>&1 | tee /data/users/$USER/logs/server/vllm_17b16e_vllm_serving$(date +%Y%m%d_%H%M%S).log

base cmd = eagle server cmd, removing --speculative-config="$spec_dec_config" \

benchmarking

python benchmarks/benchmark_serving.py --backend vllm --model /home/$USER/local/models/scout_base_HF_20250605_201140 --dataset-name hf --dataset-path philschmid/mt-bench --seed 0 --max-concurrency 16 2>&1 | tee /data/users/$USER/tmp/vllm_17b16e_vllm_loadgen$(date +%Y%m%d_%H%M%S).log\n

Test Result

[WIP]

(Optional) Documentation Update

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new environment variable, VLLM_TRITON_COMPRESSED_TENSORS_MOE_KERNEL, to allow forcing the use of the Triton-based kernel for compressed tensor Mixture of Experts (MoE) layers. This is intended to improve performance for certain models. The implementation correctly adds the environment variable and uses it to control the kernel selection logic. My main feedback concerns the robustness of parsing this new environment variable, as the current method can lead to a ValueError if an invalid string is provided, causing a crash. I've suggested a safer parsing method to prevent this.

@github-actions
Copy link

github-actions bot commented Aug 6, 2025

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@access2rohit access2rohit force-pushed the llama4 branch 3 times, most recently from 3aad897 to 2a2a3c1 Compare August 12, 2025 18:06
Copy link
Member

@yewentao256 yewentao256 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work!
Could you show more data about performance improvement? Not sure if this is actually needed

@mergify
Copy link

mergify bot commented Aug 18, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @access2rohit.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Aug 18, 2025
access2rohit and others added 4 commits September 11, 2025 11:29
… cutlass this improves performance for llama4

Signed-off-by: Rohit Kumar Srivastava <srivastava.141@osu.edu>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Rohit Kumar Srivastava <141.srivastava@gmail.com>
Signed-off-by: Rohit Kumar Srivastava <srivastava.141@osu.edu>
Signed-off-by: Rohit Kumar Srivastava <srivastava.141@osu.edu>
Signed-off-by: Rohit Kumar Srivastava <srivastava.141@osu.edu>
@chenxi-yang
Copy link
Contributor

Hi @access2rohit , I had a similar purpose PR here: #23442
May I ask why you want to use fused moe? Did you see performance gain compared with cutlass? Thank you!

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you!

@github-actions github-actions bot added the stale Over 90 days of inactivity label Dec 20, 2025
@access2rohit
Copy link
Author

This change is no longer needed since vllm automatically defaults to triton instead of cutlass. Perhaps the next stage could be to simply run perf benchamrks to see if triton still outperforms cutlass or not

@github-actions github-actions bot added unstale Recieved activity after being labelled stale and removed stale Over 90 days of inactivity labels Jan 6, 2026
@mergify mergify bot added the nvidia label Jan 6, 2026
@mergify
Copy link

mergify bot commented Jan 6, 2026

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @access2rohit.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@hmellor
Copy link
Member

hmellor commented Mar 4, 2026

Thanks for the contribution! As you noted, this change is no longer needed since vLLM now automatically defaults to triton instead of cutlass. We're closing this PR accordingly. Thank you for your work on improving Llama 4 performance!

@hmellor hmellor closed this Mar 4, 2026
@github-project-automation github-project-automation bot moved this to Done in NVIDIA Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase nvidia unstale Recieved activity after being labelled stale

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants