Uh oh!
There was an error while loading. Please reload this page.
Conversation
spike-zhuforce-pushed
the
issue/867
branch
4 times, most recently
from
January 8, 2026 03:26
b8c4b54 to
a236f24ComparePanZezhong1725
approved these changes
Jan 8, 2026
whjthu
requested changes
Jan 8, 2026
| // --- 该 token 在当前序列中的相对位置 | ||
| size_t q_token_idx = global_token_idx - offset_[seq_idx]; | ||
| const int64_t total_kv_len = total_kv_lens_[seq_idx]; |
Contributor
There was a problem hiding this comment.
为什么用 int64_t 而不是 size_t?size_t 和 int64_t 一个是有符号,一个是无符号,应该是有明确的功能区分的,且 size_t 严格定义的话并不一定是 64bit。 size_t 和 int64_t 肯定不能混用, size_t 和 uint64_t 应该也是尽量不混用的
Collaborator
There was a problem hiding this comment.
total_kv_lens是从python端传进来的,所以和pytorch默认int64的行为保持了一致。目前这几个跟index相关的参数只支持了int64类型,在创建的时候也做了限制。如果传入类型需要支持更多类型,可以增加模板参数。
在kernel内部如果需要规范可以强转:“size_t total_kv_len = size_t(total_kv_lens_[seq_idx]); ”,需要这么改吗?
| const int64_t causal_limit = history_len + q_token_idx; | ||
| const Tdata *q_ptr_base = q_ + global_token_idx * num_heads * head_size + head_idx * head_size; | ||
| // 4. 计算指针偏移 |
Contributor
There was a problem hiding this comment.
注释改英文,新加代码的注释全用英文,老的遗留问题现在不用改,后面集中改
| } | ||
| return INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED; | ||
| } | ||
| } No newline at end of file |
| if (!alibi_slopes.is_none()) { | ||
| alibi_slopes_tensor = alibi_slopes.cast<Tensor>(); | ||
| } | ||
| op::paged_attention_prefill_(out, q, k_cache, v_cache, block_tables, history_lens, cu_seqlens_q, alibi_slopes_tensor, scale); |
Collaborator
There was a problem hiding this comment.
现在没这个强制要求了,因为有些强行换行会影响阅读。现在写代码的人可以决定是否换行,这个需要换行吗?
whjthu
approved these changes
Jan 9, 2026
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
python 测试:
