[Cherry-Pick 2.4][BugFix] Fix get_padding_offset in empty run (#6461)

* fix empty get_padding_offset

* fix mtp padding
This commit is contained in:
sunxin
2026-02-11 20:19:56 +08:00
committed by GitHub
parent 436846e89c
commit 88fd9bac27
2 changed files with 72 additions and 69 deletions
+3
View File
@@ -88,6 +88,9 @@ std::vector<paddle::Tensor> GetPaddingOffset(const paddle::Tensor &input_ids,
paddle::empty({bsz + 1}, paddle::DataType::INT32, input_ids.place());
auto cu_seqlens_k =
paddle::empty({bsz + 1}, paddle::DataType::INT32, input_ids.place());
if (token_num_data == 0) {
return {x_remove_padding, batch_id_per_token, cu_seqlens_q, cu_seqlens_k};
}
#ifdef PADDLE_WITH_COREX
int blockSize =
std::min((token_num_data + WARP_SIZE - 1) / WARP_SIZE * WARP_SIZE, 128);