-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[XPU] support python streams api for xpu #73924
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
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
069f46f to
90309e4
Compare
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (27.27%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #73924 +/- ##
==========================================
Coverage ? 27.27%
==========================================
Files ? 3
Lines ? 22
Branches ? 0
==========================================
Hits ? 6
Misses ? 16
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
133617d to
67f6f1b
Compare
|
|
||
| int64_t XPUContext::GetStreamNum() const { return impls_.size(); } | ||
|
|
||
| int XPUContext::SetCurrentStream(int idx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果 idx == prev_stream_idx,直接返回。
| int prev_stream_idx = current_stream_idx; | ||
| impls_[0]->SetStream(stream_pool[idx]); | ||
| current_stream_idx = idx; | ||
| idle_stream_flags[prev_stream_idx] = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idle_stream_flags[current_stream_idx] 设置为 false
| break; | ||
| } | ||
| } | ||
| if (found_idle_stream) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果 found,还需要把 idle_stream_flags 对应位置设置为 false
3f1f8c7 to
92bf114
Compare
469181a to
814126e
Compare
|
/re-run all-failed |
HarperCy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
python/paddle/device/xpu/__init__.py
Outdated
| Return the current CUDA stream by the device. | ||
| Args: | ||
| device(paddle.CUDAPlace()|int|None, optional): The device or the ID of the device which want to get stream from. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paddle.XPU**
cqulilujia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
/re-run all-failed |
1 similar comment
|
/re-run all-failed |
e68294a to
7a0e2cb
Compare
tianshuo78520a
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approve print
yongqiangma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
XiaoguangHu01
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
sunzhongkai588
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM。 记得补充中文文档
|
/re-run all-failed |
tizhou86
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| } else { | ||
| impls_.push_back(std::make_unique<Impl>()); | ||
| impls_[0]->Init(get_gm_size(0), get_l3_size(0)); | ||
| stream_pool.push_back(impls_[0]->context_->get_stream()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO:如果开启XPU_CDNN_CLUSTER_PARALLEL,则stream的相关接口就会有问题。
dynamicheart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| paddle::platform::GetXPUCurrentDeviceId(); | ||
| auto stream = paddle::platform::get_current_stream(device_id); | ||
| xpu_wait(stream); | ||
| xpu_wait(stream->raw_stream()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
未检查返回值,下个PR修复
| if (context_->xpu_stream != nullptr && stream_owned_) { | ||
| void SetStream(void* stream, bool clear = true) { | ||
| if (clear && context_->xpu_stream != nullptr && stream_owned_) { | ||
| xpu_stream_destroy(context_->xpu_stream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
未检查返回值,下个PR修复
| phi::backends::xpu::XPUDeviceGuard guard(dev_idx); | ||
| xpu_event_destroy(event); | ||
| if (xpu_event_query(event) == XPU_SUCCESS) { | ||
| xpu_event_destroy(event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
未检查返回值,下个PR修复
* [XPU] support python streams api for xpu * [XPU] support python streams api for xpu * [XPU] add stream & event unittests
PR Category
Custom Device
PR Types
New features
Description
支持python测调用xpu的stream、event等接口