未验证 提交 c5786be1 编写于 作者: R ronnywang 提交者: GitHub

[CustomDevice] Fix error that query a destroyed event (#56745)

上级 31a96888
...@@ -88,8 +88,7 @@ bool StreamSafeCustomDeviceAllocation::CanBeFreed() { ...@@ -88,8 +88,7 @@ bool StreamSafeCustomDeviceAllocation::CanBeFreed() {
} }
std::call_once(once_flag_, [this] { phi::DeviceManager::SetDevice(place_); }); std::call_once(once_flag_, [this] { phi::DeviceManager::SetDevice(place_); });
for (auto it = outstanding_event_map_.begin(); for (auto it = outstanding_event_map_.begin();
it != outstanding_event_map_.end(); it != outstanding_event_map_.end();) {
++it) {
auto& event = it->second; auto& event = it->second;
if (!event->Query()) { if (!event->Query()) {
VLOG(9) << "Event " << event->raw_event() << " for " << ptr() VLOG(9) << "Event " << event->raw_event() << " for " << ptr()
...@@ -98,6 +97,7 @@ bool StreamSafeCustomDeviceAllocation::CanBeFreed() { ...@@ -98,6 +97,7 @@ bool StreamSafeCustomDeviceAllocation::CanBeFreed() {
} }
VLOG(8) << "Destroy event " << event->raw_event(); VLOG(8) << "Destroy event " << event->raw_event();
event->Destroy(); event->Destroy();
it = outstanding_event_map_.erase(it);
} }
outstanding_event_map_.clear(); outstanding_event_map_.clear();
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册