From c4a24d8f3104cad2180af24f3ee24a17e66cb413 Mon Sep 17 00:00:00 2001 From: Andrzej Koska Date: Mon, 23 Oct 2023 11:59:45 +0000 Subject: [PATCH] fix: Avoiding races when modifying queue and Tag data Related-To: NEO-8196 Signed-off-by: Andrzej Koska --- opencl/source/command_queue/command_queue_hw_base.inl | 1 + shared/source/utilities/tag_allocator.inl | 1 + 2 files changed, 2 insertions(+) diff --git a/opencl/source/command_queue/command_queue_hw_base.inl b/opencl/source/command_queue/command_queue_hw_base.inl index a262ed66f5..03b5d65831 100644 --- a/opencl/source/command_queue/command_queue_hw_base.inl +++ b/opencl/source/command_queue/command_queue_hw_base.inl @@ -172,6 +172,7 @@ bool CommandQueueHw::waitForTimestamps(Range copyEngine bool waited = false; if (isWaitForTimestampsEnabled()) { + TakeOwnershipWrapper queueOwnership(*this); waited = waitForTimestampsWithinContainer(mainContainer, getGpgpuCommandStreamReceiver(), status); if (waited) { diff --git a/shared/source/utilities/tag_allocator.inl b/shared/source/utilities/tag_allocator.inl index 4db1d542f0..94e528e0bd 100644 --- a/shared/source/utilities/tag_allocator.inl +++ b/shared/source/utilities/tag_allocator.inl @@ -15,6 +15,7 @@ template TagAllocator::TagAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, size_t tagCount, size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes, DeviceBitfield deviceBitfield) : TagAllocatorBase(rootDeviceIndices, memMngr, tagCount, tagAlignment, tagSize, doNotReleaseNodes, deviceBitfield) { + std::unique_lock lock(allocatorMutex); populateFreeTags(); }