-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
correct sync behavior for XPU distributed training #47882
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
XPU support event mechanism similar to cuda event, so it is advisable to use an event to sync compute/comm streams for performance. However this mechanism is never fully tested, and inconsistent loss/ending_epochs are reported. Therefore, this PR replaces event sync with stream waiting as a temporary solution.
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
@@ -64,7 +64,7 @@ struct XPUContext::Impl { | |||
// manually destroy XPUStream here until xpu::api integrates this work | |||
// into Context dtor | |||
xpu_wait(context_->xpu_stream); | |||
PADDLE_ENFORCE_XPU_SUCCESS(xpu_stream_destroy(context_->xpu_stream)); | |||
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.
为什么去掉返回值判断?
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.
编译器会complain在析构函数里抛异常,(这里其实有个try catch所以运行时倒不会出现程序异常终止,但还是可能会导致内存泄露)
最佳方法还是直接不去判断,如果xpu_stream_destroy出错可以依赖runtime的log
你的PR已合入Paddle库,请关注后续测试结果。 |
PR types
Others
PR changes
Others
Describe
XPU support event mechanism similar to cuda event, so it is advisable to use an event to sync compute/comm streams for performance. However this mechanism is never fully tested, and inconsistent loss/ending_epochs are reported. Therefore, this PR replaces event sync with stream waiting as a temporary solution.