8000 avoid redundant event records and event blocks · pytorch/pytorch@e52245b · GitHub
[go: up one dir, main page]

Skip to content

Commit e52245b

Browse files
taozhiweipytorchmergebot
authored andcommitted
avoid redundant event records and event blocks
1 parent becfda0 commit e52245b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

aten/src/ATen/core/ivalue_inl.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -947,9 +947,11 @@ struct C10_EXPORT ivalue::Future final : c10::intrusive_ptr_target {
947947
currentDevice_ = impl_.getDevice();
948948
storages_ = std::move(actualStorages);
949949
for (const c10::Device& device : usedDevices) {
950-
c10::Event event(impl_.type());
951-
event.record(impl_.getStream(device));
952-
events_.push_back(std::move(event));
950+
if (impl_.getDevice() != device) {
951+
c10::Event event(impl_.type());
952+
event.record(impl_.getStream(device));
953+
events_.push_back(std::move(event));
954+
}
953955
}
954956

955957
std::vector<FutureCallback> cbs;

0 commit comments

Comments
 (0)
0