未验证 提交 054f8e7a 编写于 作者: L Leo Chen 提交者: GitHub

change aclrtSynchronizeDevice to aclrtSynchronizeStream for better performance (#32196)

* change aclrtSynchronizeDevice to aclrtSynchronizeStream for better performace

* refine code
上级 7039c06d
...@@ -254,9 +254,8 @@ NPUDeviceContext::~NPUDeviceContext() { ...@@ -254,9 +254,8 @@ NPUDeviceContext::~NPUDeviceContext() {
void NPUDeviceContext::Wait() const { void NPUDeviceContext::Wait() const {
platform::RecordEvent record_event("NPUDeviceContext/wait"); platform::RecordEvent record_event("NPUDeviceContext/wait");
NPUDeviceGuard guard(place_.device);
VLOG(4) << "NPU context Wait"; VLOG(4) << "NPU context Wait";
PADDLE_ENFORCE_NPU_SUCCESS(aclrtSynchronizeDevice()); stream_->Wait();
} }
aclrtStream NPUDeviceContext::stream() const { return stream_->raw_stream(); } aclrtStream NPUDeviceContext::stream() const { return stream_->raw_stream(); }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册