-
Notifications
You must be signed in to change notification settings - Fork 293
[NVIDIA] Add MTP Benchmark Support for DeepSeek-R1 TRT #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6ce8779
Add refactored MTP benchmarks for dsr1 TRT
lishicheng1996-nv 92eca1a
Add --use-chat-template support for MTP benchmarks
lishicheng1996-nv fddf14e
Add MTP benchmark configurations to nvidia-master.yaml
lishicheng1996-nv 59b38b9
Refactor MTP benchmarks to receive EP_SIZE and DP_ATTENTION from env …
lishicheng1996-nv f385b80
Fix MTP benchmark configurations to match original script logic
lishicheng1996-nv c5f4550
Align MTP conc ranges to powers of 2
lishicheng1996-nv dd2a82e
Fix conc range overlaps in dsr1-fp4-b200-trt-mtp
lishicheng1996-nv b5c542b
larger h200 concurrency
lishicheng1996-nv cdebd62
fix runner
lishicheng1996-nv 835c156
fix typo
lishicheng1996-nv f879ca4
fix h200 runner
lishicheng1996-nv a5f5ebf
fix h200 runner
lishicheng1996-nv 92fe872
Add MTP support for single-node TRT configs and launch Scripts
Ankur-singh 48f17a7
Add MTP configs to perf-changelog
Ankur-singh 4b9fc2b
Merge branch 'main' into kepotdar-shicli-dsr1-trt-mtp-refactor
Ankur-singh 27834e0
Merge branch 'main' into kepotdar-shicli-dsr1-trt-mtp-refactor
Ankur-singh 71f5d4a
fix perf-changelog
Ankur-singh ba1a206
fix H200 config
lishicheng1996-nv d937147
Merge branch 'main' into kepotdar-shicli-dsr1-trt-mtp-refactor
Ankur-singh b1f04df
fix per-changelog
Ankur-singh c4cbd04
Merge branch 'main' into kepotdar-shicli-dsr1-trt-mtp-refactor
Ankur-singh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # === Required Env Vars === | ||
| # MODEL | ||
| # TP | ||
| # CONC | ||
| # ISL | ||
| # OSL | ||
| # MAX_MODEL_LEN | ||
| # RANDOM_RANGE_RATIO | ||
| # RESULT_FILENAME | ||
| # PORT_OFFSET | ||
| # DP_ATTENTION | ||
| # EP_SIZE | ||
|
|
||
| echo "JOB $SLURM_JOB_ID running on $SLURMD_NODENAME" | ||
|
|
||
| echo "TP: $TP, CONC: $CONC, ISL: $ISL, OSL: $OSL, EP_SIZE: $EP_SIZE, DP_ATTENTION: $DP_ATTENTION" | ||
|
|
||
| hf download $MODEL | ||
|
|
||
| # ========= Determine MOE_BACKEND and MTP based on DP_ATTENTION ========= | ||
| if [[ "$DP_ATTENTION" == "true" ]]; then | ||
| MOE_BACKEND="CUTLASS" | ||
| MTP=1 | ||
| else | ||
| MOE_BACKEND="TRTLLM" | ||
| MTP=3 | ||
| fi | ||
|
|
||
| echo "MOE_BACKEND='$MOE_BACKEND', MTP='$MTP'" | ||
|
|
||
| SERVER_LOG=$(mktemp /tmp/server-XXXXXX.log) | ||
| PORT=$(( 8888 + $PORT_OFFSET )) | ||
| EXTRA_CONFIG_FILE="dsr1-fp4-mtp.yml" | ||
|
|
||
| cat > $EXTRA_CONFIG_FILE << EOF | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 512 | ||
| enable_attention_dp: $DP_ATTENTION | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.8 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: $MOE_BACKEND | ||
| speculative_config: | ||
| decoding_type: MTP | ||
| num_nextn_predict_layers: ${MTP} | ||
| EOF | ||
|
|
||
| if [[ "$DP_ATTENTION" == "true" ]]; then | ||
| cat << EOF >> $EXTRA_CONFIG_FILE | ||
| attention_dp_config: | ||
| batching_wait_iters: 0 | ||
| enable_balance: true | ||
| timeout_iters: 60 | ||
| EOF | ||
| fi | ||
|
|
||
| if [[ "$DP_ATTENTION" == "true" ]]; then | ||
| MAX_BATCH_SIZE=$((CONC/TP)) | ||
| else | ||
| MAX_BATCH_SIZE=$CONC | ||
| fi | ||
|
|
||
| MAX_NUM_TOKENS=$(( ((MTP+1)*MAX_BATCH_SIZE+ISL+64+63)/64*64 )) | ||
|
|
||
| set -x | ||
| # Launch TRT-LLM server | ||
| mpirun -n 1 --oversubscribe --allow-run-as-root \ | ||
|
lishicheng1996-nv marked this conversation as resolved.
|
||
| trtllm-serve $MODEL --port=$PORT \ | ||
| --trust_remote_code \ | ||
| --backend=pytorch \ | ||
| --max_batch_size=$MAX_BATCH_SIZE \ | ||
| --max_seq_len=$MAX_MODEL_LEN \ | ||
| --max_num_tokens=$MAX_NUM_TOKENS \ | ||
| --tp_size=$TP --ep_size=$EP_SIZE \ | ||
| --extra_llm_api_options=$EXTRA_CONFIG_FILE \ | ||
| > $SERVER_LOG 2>&1 & | ||
|
|
||
| SERVER_PID=$! | ||
|
|
||
| # Source benchmark utilities | ||
| source "$(dirname "$0")/benchmark_lib.sh" | ||
|
|
||
| # Wait for server to be ready | ||
| wait_for_server_ready --port "$PORT" --server-log "$SERVER_LOG" --server-pid "$SERVER_PID" | ||
|
|
||
| run_benchmark_serving \ | ||
| --model "$MODEL" \ | ||
| --port "$PORT" \ | ||
| --backend openai \ | ||
| --input-len "$ISL" \ | ||
| --output-len "$OSL" \ | ||
| --random-range-ratio "$RANDOM_RANGE_RATIO" \ | ||
| --num-prompts $(( $CONC * 10 )) \ | ||
| --max-concurrency "$CONC" \ | ||
| --result-filename "$RESULT_FILENAME" \ | ||
| --result-dir /workspace/ \ | ||
| --use-chat-template | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.