[BugFix] Fix limit_thinking early return logic in CUDA kernels#5471
Merged
yuanlehome merged 3 commits intodevelopfrom Dec 10, 2025
Merged
[BugFix] Fix limit_thinking early return logic in CUDA kernels#5471yuanlehome merged 3 commits intodevelopfrom
yuanlehome merged 3 commits intodevelopfrom
Conversation
|
|
|
Thanks for your contribution! |
Co-authored-by: yuanlehome <23653004+yuanlehome@users.noreply.github.com>
Co-authored-by: yuanlehome <23653004+yuanlehome@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Apply changes from PR 5469 to develop and release branches
[BugFix] Fix limit_thinking early return logic in CUDA kernels
Dec 9, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
这个PR将来自PR #5469的bug修复应用到develop和release分支。主要修复了4个GPU CUDA内核中的条件逻辑错误,将AND操作符改为OR操作符,并更新了相应的中文注释以匹配新的逻辑。
- 修复了思考内容长度限制的early-exit条件,从
&&(AND) 改为||(OR) - 在所有4个相关文件中一致地应用了此修复
- 更新了中文注释以准确反映OR逻辑
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| custom_ops/gpu_ops/limit_thinking_content_length_v1.cu | 修复early-exit条件逻辑 (status==2的情况) |
| custom_ops/gpu_ops/limit_thinking_content_length_v2.cu | 修复early-exit条件逻辑 (status==3的情况) |
| custom_ops/gpu_ops/speculate_decoding/speculate_limit_thinking_content_length_v1.cu | 修复speculative decoding版本的early-exit条件逻辑 (status==2) |
| custom_ops/gpu_ops/speculate_decoding/speculate_limit_thinking_content_length_v2.cu | 修复speculative decoding版本的early-exit条件逻辑 (status==3) |
freeliuzc
approved these changes
Dec 9, 2025
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.
Motivation
Cherry-pick fix from PR #5469. The limit_thinking kernels incorrectly used AND (
&&) logic for early return conditions, requiring bothcurrent_limit_think_statusmatch ANDstop_flags[bid]to be true. This prevented proper early return when only one condition was met.Modifications
Changed condition logic from AND to OR in 4 CUDA kernel files:
custom_ops/gpu_ops/limit_thinking_content_length_v1.cucustom_ops/gpu_ops/limit_thinking_content_length_v2.cucustom_ops/gpu_ops/speculate_decoding/speculate_limit_thinking_content_length_v1.cucustom_ops/gpu_ops/speculate_decoding/speculate_limit_thinking_content_length_v2.cuBefore:
After:
Updated Chinese comments from "且" (AND) to "或者" (OR) to match corrected logic.
Usage or Command
No API changes. Bug fix only affects internal kernel behavior.
Accuracy Tests
No unit tests added - cherry-pick of verified fix from #5469.
Checklist
pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.