Skip to content

Commit

Permalink
[CustomDevice] Fix error that query a destroyed event (#56745)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronny1996 authored Aug 30, 2023
1 parent 31a9688 commit c5786be
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ bool StreamSafeCustomDeviceAllocation::CanBeFreed() {
}
std::call_once(once_flag_, [this] { phi::DeviceManager::SetDevice(place_); });
for (auto it = outstanding_event_map_.begin();
it != outstanding_event_map_.end();
++it) {
it != outstanding_event_map_.end();) {
auto& event = it->second;
if (!event->Query()) {
VLOG(9) << "Event " << event->raw_event() << " for " << ptr()
Expand All @@ -98,6 +97,7 @@ bool StreamSafeCustomDeviceAllocation::CanBeFreed() {
}
VLOG(8) << "Destroy event " << event->raw_event();
event->Destroy();
it = outstanding_event_map_.erase(it);
}
outstanding_event_map_.clear();
return true;
Expand Down

0 comments on commit c5786be

Please sign in to comment.