Move inbound_event to a larger scope so the destructor doesn't call clReleaseEvent too soon.

PiperOrigin-RevId: 347711458
Change-Id: Iefb107cdd8ca4e4b79dcb8187d72d2b58c6da028
This commit is contained in:
Robert David 2020-12-15 16:01:07 -08:00 committed by TensorFlower Gardener
parent 8e65c847a0
commit 8397a7b877

View File

@ -209,6 +209,7 @@ absl::Status GlInteropFabric::Start() {
// c) EglSync->CLEvent or GlSync->CLEvent mapping
// Fast, as it allows to map sync to CL event and use it as a dependency
// later without stalling GPU pipeline.
CLEvent inbound_event;
std::vector<cl_event> inbound_events;
if (is_egl_sync_supported_) {
EglSync sync;
@ -216,7 +217,6 @@ absl::Status GlInteropFabric::Start() {
if (is_egl_to_cl_mapping_supported_) {
// (c) EglSync->CLEvent or GlSync->CLEvent mapping
glFlush();
CLEvent inbound_event;
RETURN_IF_ERROR(CreateClEventFromEglSync(context_, sync, &inbound_event));
inbound_events.push_back(inbound_event.event());
} else {