Skip to content

feat(runtime): add explicit asynchronous tensor copy support - #1457

Open
qinyiqun wants to merge 2 commits into
InfiniTensor:mainfrom
qinyiqun:decode
Open

feat(runtime): add explicit asynchronous tensor copy support#1457
qinyiqun wants to merge 2 commits into
InfiniTensor:mainfrom
qinyiqun:decode

Conversation

@qinyiqun

@qinyiqun qinyiqun commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

This PR adds explicit asynchronous tensor copy support required by overlapped
decode execution in InfiniLM.

It separates asynchronous transfer behavior from the existing synchronous
Tensor::copy_from API, keeping the common tensor runtime predictable and
backend-neutral.

@qinyiqun
qinyiqun requested a review from a team August 3, 2026 07:42
}

// ↑↑↑ 重新封装 cub api,减少模板参数,方便调用
// ↓↓↓ Random sampling keeps token indices in a 32-bit workspace and casts only at the output boundary.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么这个PR里有random sample的更改

if (this != &other) {
// Clean up current resources
if (event_ != nullptr) {
Device current_device = context::getDevice();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

和下面代码重复了,拆出来吧

@PanZezhong1725

Copy link
Copy Markdown
Collaborator

如果tensor涉及event同步,我建议直接给tensor加一个hook基建,如果tensor有event需要同步,在access data的时候自动调event同步,避免外部手动同步。这样可以无需增加新的copy from async

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants