From d8762439a692bb0492a3febb51bbf6e3c719d95c Mon Sep 17 00:00:00 2001 From: Mike Date: Tue, 24 Sep 2024 16:10:58 -0700 Subject: [PATCH] legion: fix some races with handling profiling response unique fevents --- runtime/legion/legion_instances.cc | 4 +++- runtime/legion/runtime.cc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/runtime/legion/legion_instances.cc b/runtime/legion/legion_instances.cc index facdf739fe..ccc70e6bf8 100644 --- a/runtime/legion/legion_instances.cc +++ b/runtime/legion/legion_instances.cc @@ -3942,9 +3942,11 @@ namespace Legion { if (runtime->profiler != NULL) runtime->profiler->handle_failed_instance_allocation(); } + fevent = current_unique_event; // No matter what trigger the event + // Can't read anything after trigger the event as the object + // might be deleted after we do that Runtime::trigger_event(profiling_ready); - fevent = current_unique_event; return true; } diff --git a/runtime/legion/runtime.cc b/runtime/legion/runtime.cc index 90a8ac1a54..19d1d7bc1c 100644 --- a/runtime/legion/runtime.cc +++ b/runtime/legion/runtime.cc @@ -11029,8 +11029,10 @@ namespace Legion { assert(measured); #endif success.store(result.success); - Runtime::trigger_event(ready); fevent = unique_event; + // Can't read anything after trigger the event as the object + // might be deleted after we do that + Runtime::trigger_event(ready); return true; }