-
Notifications
You must be signed in to change notification settings - Fork 156
[AMD][ROCM] GLM5/5.1 FP8 MTP Image Update and Search Space Optimization #1252
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
+20
−9
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 When
EVAL_ONLY=true,sglang.launch_servernow receives--context-lengthtwice: the new unconditional--context-length $CONTEXT_LENGTH(= ISL+OSL+32) at line 43, plus--context-length $EVAL_MAX_MODEL_LENfrom$EVAL_CONTEXT_ARGSat line 49. The siblingqwen3.5_bf16_mi355x_mtp.shmutually-excludes the two via an else branch (EVAL_CONTEXT_ARGS="--context-length $CONTEXT_LENGTH") — please follow that pattern so the eval value isn't quietly relying on argparse last-wins semantics.Extended reasoning...
What the bug is
After this PR,
benchmarks/single_node/glm5_fp8_mi355x_mtp.shdefinesCONTEXT_LENGTH=$((ISL + OSL + 32))(line 28) and unconditionally passes--context-length $CONTEXT_LENGTHtosglang.launch_server(line 43). However, the pre-existingEVAL_CONTEXT_ARGSblock (lines 30-33) still appends--context-length $EVAL_MAX_MODEL_LENwhenEVAL_ONLY=true, and that variable is still expanded on the launch line (line 49 in the new file). So in eval mode the launch command contains two--context-lengthflags with different values.Code path that triggers it
When the harness sets
EVAL_ONLY=true:CONTEXT_LENGTH = ISL + OSL + 32(e.g. 1024+1024+32 = 2080).setup_eval_contextruns andEVAL_MAX_MODEL_LENis computed (typically ISL+OSL+256 plus a per-model floor insidecompute_eval_context_length), andEVAL_CONTEXT_ARGS="--context-length $EVAL_MAX_MODEL_LEN".--context-length 2080.$EVAL_CONTEXT_ARGS, adding--context-length $EVAL_MAX_MODEL_LEN.Why existing code doesn't prevent it
The
EVAL_CONTEXT_ARGSindirection was originally designed to be the only place--context-lengthis set, with throughput mode leaving the flag off (defaulting to the model's max). The new unconditional flag broke that contract. The companionqwen3.5_bf16_mi355x_mtp.sh:26-31shows the canonical pattern — anelsebranch setsEVAL_CONTEXT_ARGS="--context-length $CONTEXT_LENGTH"and the launch line never repeats--context-length.Step-by-step proof (ISL=1024, OSL=1024, EVAL_ONLY=true)
CONTEXT_LENGTH = 1024 + 1024 + 32 = 2080.setup_eval_contextsetsEVAL_MAX_MODEL_LENto e.g. ISL+OSL+256 = 2304 (or larger with the GLM floor).EVAL_CONTEXT_ARGS="--context-length 2304".--context-lengtharguments are present.Impact
Python argparse takes the last occurrence, so at runtime the eval value (2304) currently wins — meaning the script happens to work today. But the duplicate flag is fragile (any reordering of the launch line, or a future SGLang argparse change to detect duplicate flags, would silently flip which value is used) and inconsistent with every other script in the directory using this idiom. It is also actively confusing in server logs.
How to fix
Mirror the qwen3.5 mtp pattern: add an
elsebranch and drop the unconditional flag, e.g.and remove the unconditional
--context-length $CONTEXT_LENGTHfrom the launch invocation.