Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions vllm/lora/ops/triton_ops/README_TUNING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Multi-LoRA Tuning

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add a description of how to do tuning, so that users can perform tuning by reading this document, we can refer to https://github.com/sgl-project/sglang/blob/main/benchmark/kernels/fused_moe_triton/README.md#tuning-tool

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, I didn't submit my comment. After responding to the above comment, we can consider merging this PR.


**Note**: The lora config folder should be passed in by export VLLM_TUNED_CONFIG_FOLDER=/path/to/configs. Without it, the kernel would use default configs

## Tuning Process

Check failure on line 5 in vllm/lora/ops/triton_ops/README_TUNING.md

View workflow job for this annotation

GitHub Actions / pre-commit

Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## Tuning Process"]
Multi-lora shrink/expand Triton kernel tuning follows a similar methodology from [Triton MoE tuning](https://github.com/vllm-project/vllm/blob/main/benchmarks/kernels/benchmark_moe.py). An example searching space:

```

Check failure on line 8 in vllm/lora/ops/triton_ops/README_TUNING.md

View workflow job for this annotation

GitHub Actions / pre-commit

Fenced code blocks should have a language specified [Context: "```"]
block_m_range = [16, 32, 64, 128, 256]
block_n_range = [32, 64, 128, 256]
block_k_range = [32, 64, 128, 256]
num_warps_range = [4, 8]
num_stage_range = [2, 3, 4, 5]
num_ctas_range = [1]
split_k_range = [4, 8, 16, 32, 64]
```

Check failure on line 16 in vllm/lora/ops/triton_ops/README_TUNING.md

View workflow job for this annotation

GitHub Actions / pre-commit

Fenced code blocks should be surrounded by blank lines [Context: "```"]
Specifically for multi-lora, `num_slices = [1,2,3]` requires to be tuned sperately for different `MNK` shapes for both shrink and expand kernels.

## Config Files

Check failure on line 19 in vllm/lora/ops/triton_ops/README_TUNING.md

View workflow job for this annotation

GitHub Actions / pre-commit

Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## Config Files"]
### File Name

Check failure on line 20 in vllm/lora/ops/triton_ops/README_TUNING.md

View workflow job for this annotation

GitHub Actions / pre-commit

Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Above] [Context: "### File Name"]

For `shrink`, the config file is named as `{gpu_name}_SHRINK.json`, e.g. `NVIDIA_H200_SHRINK.json`.

Check failure on line 22 in vllm/lora/ops/triton_ops/README_TUNING.md

View workflow job for this annotation

GitHub Actions / pre-commit

Trailing spaces [Expected: 0 or 2; Actual: 1]

For `expand`, the config fileis named as `{gpu_name}_EXPAND_{add_input}.json`, e.g. `NVIDIA_H200_EXPAND_TRUE.json`.

`gpu_name` can be automatically detected by calling `torch.cuda.get_device_name()`

Check failure on line 26 in vllm/lora/ops/triton_ops/README_TUNING.md

View workflow job for this annotation

GitHub Actions / pre-commit

Trailing spaces [Expected: 0 or 2; Actual: 1]

### Json Structure

Check failure on line 28 in vllm/lora/ops/triton_ops/README_TUNING.md

View workflow job for this annotation

GitHub Actions / pre-commit

Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "### Json Structure"]
Optimial kernel config files are saved in Json file with a structure as `config_data[max_loras][num_slices][m][k][n]`
Loading
Loading