Pull the max-prefix-len computation into its own helper and rename the matched-token argument#25728
Merged
fzyzcjy merged 1 commit intoMay 19, 2026
Conversation
…own helper and rename the matched-token argument In Req.init_next_round_input, the three-line max_prefix_len computation is moved into a small helper `_compute_max_prefix_len(input_len)` so the remaining body reads `fill_ids[:self._compute_max_prefix_len(input_len)]` in one line. The resulting slice is then bound to a more specific name `token_ids_to_match` (it is what gets passed as the prefix-match key on the radix tree) instead of the generic `token_ids`.
Collaborator
Author
|
/tag-and-rerun-ci |
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Collaborator
Author
❌
|
| SHA | Tree | |
|---|---|---|
PR head (tom/pr_chain/tom_refactor_202605a/primary/nonmech_scheduler/compute-max-prefix-len) |
1e5ab7e2667c |
975b53b68b7ce78962a895a304528c97d098cc65 |
Rebased source (tag verify/rebased/20260519T013515Z) |
e4d81e48c913 |
5c448ac374ef292d8333d48b293fcdbd9a228a21 |
Inspect the difference:
git fetch upstream 1e5ab7e2667c7ccf3ae9059770d1fcd1f3a3fae1
git diff e4d81e48c913 1e5ab7e2667c
git diff e4d81e48c913 1e5ab7e2667c -- <path> # per-fileTag verify/rebased/20260519T013515Z preserved for reproduction.
Generated by single_commit_pr_chain.py verify-rebased.
Collaborator
Author
✅
|
| SHA | Tree | |
|---|---|---|
Rebased source (tag verify/rebased/20260519T013859Z) |
c2a212bfe222 |
f8f47cec5a620aac42e07d0d07f9b282048ef2d3 |
PR head (tom/pr_chain/tom_refactor_202605a/primary/nonmech_scheduler/compute-max-prefix-len) |
1e5ab7e2667c |
975b53b68b7ce78962a895a304528c97d098cc65 |
upstream/main |
c2a212bfe222 |
f8f47cec5a620aac42e07d0d07f9b282048ef2d3 |
Reproduce locally (the rebase tag persists after this run):
git fetch upstream 1e5ab7e2667c7ccf3ae9059770d1fcd1f3a3fae1
REB_TREE=$(git rev-parse 'verify/rebased/20260519T013859Z^{tree}')
PR_TREE=$(git rev-parse '1e5ab7e2667c7ccf3ae9059770d1fcd1f3a3fae1^{tree}')
MAIN_TREE=$(git rev-parse 'upstream/main^{tree}')
echo "REB_TREE = $REB_TREE"
echo "PR_TREE = $PR_TREE"
echo "MAIN_TREE = $MAIN_TREE"Generated by single_commit_pr_chain.py verify-rebased.
This was referenced May 19, 2026
Shunkangz
pushed a commit
to Shunkangz/sglang
that referenced
this pull request
May 27, 2026
…e matched-token argument (sgl-project#25728)
alphabetc1
pushed a commit
to alphabetc1/sglang
that referenced
this pull request
Jun 4, 2026
…e matched-token argument (sgl-project#25728)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In Req.init_next_round_input, the three-line max_prefix_len computation is
moved into a small helper
_compute_max_prefix_len(input_len)so theremaining body reads
fill_ids[:self._compute_max_prefix_len(input_len)]in one line. The resulting slice is then bound to a more specific name
token_ids_to_match(it is what gets passed as the prefix-match key onthe radix tree) instead of the generic
token_ids.CI States
Latest PR Test (Base): ⏳ Run #26070393056⚠️ Not enabled -- add
Latest PR Test (Extra):
run-ci-extralabel to opt in.