Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Inference] Update switch stream logical. #53589

Merged
merged 19 commits into from
May 12, 2023
Merged

Conversation

jiweibo
Copy link
Contributor

@jiweibo jiweibo commented May 8, 2023

PR types

Others

PR changes

Others

Description

refer #51412.

对切换stream的逻辑进行修改:

  1. ResourceManager不再对GPUResouce进行Rebind操作,内部仅维护 [stream -> resource] 的映射,如果map中缺失对应的stream,则进行Init创建操作;以上过程均被锁保护。
  2. predictor切换stream的过程,析构旧的device_context(轻量数据结构,内部仅包括资源指针),创建新的device_context(why:support resouce lazy init),并将GpuResource设到device_context内部;

单测中添加了模拟多线程并发,切换流的逻辑,单测通过,但发现一个问题,predictor需要在主线程先跑一遍才可以否则会挂,需后续修复。

@paddle-bot
Copy link

paddle-bot bot commented May 8, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot
Copy link

paddle-bot bot commented May 8, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

@jiweibo jiweibo requested a review from heavengate May 8, 2023 07:26
@jiweibo jiweibo changed the title A copy of Pr51412 [Inference] Update switch stream logical. May 11, 2023
@jiweibo jiweibo requested a review from zhangjun May 12, 2023 05:11
Copy link
Contributor

@zhangjun zhangjun left a comment

Choose a reason for hiding this comment

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

LGTM

@jiweibo jiweibo merged commit eb97f4f into PaddlePaddle:develop May 12, 2023
@jiweibo jiweibo deleted the pr51412 branch May 12, 2023 05:29
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