diff --git a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp index bc0dc3329b..1b985bee63 100644 --- a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp +++ b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp @@ -4137,7 +4137,7 @@ HWTEST2_F(MultipleDevicePeerAllocationTest, HWTEST2_F(MultipleDevicePeerAllocationTest, whenFreeingNotKnownPointerThenInvalidArgumentIsReturned, MatchAny) { - void *ptr = malloc(1u); + void *ptr = calloc(1, 1u); ze_result_t result = context->freeMem(ptr); EXPECT_EQ(result, ZE_RESULT_ERROR_INVALID_ARGUMENT); free(ptr); diff --git a/level_zero/tools/source/metrics/metric_multidevice_programmable.inl b/level_zero/tools/source/metrics/metric_multidevice_programmable.inl index 139116b53c..6ad90ece23 100644 --- a/level_zero/tools/source/metrics/metric_multidevice_programmable.inl +++ b/level_zero/tools/source/metrics/metric_multidevice_programmable.inl @@ -107,26 +107,28 @@ ze_result_t MultiDeviceCreatedMetricGroupManager::createMultipleMetricGroupsFrom multiDeviceMetricImp.push_back(static_cast(Metric::fromHandle(hMetric))); } auto metricGroup = T::create(metricSource, metricGroupsAcrossSubDevices, multiDeviceMetricImp); - auto closeStatus = metricGroup->close(); - if (closeStatus != ZE_RESULT_SUCCESS) { - // Cleanup and exit - metricGroup->destroy(); - for (auto &metricGroupCreated : metricGroupList) { - MetricGroup::fromHandle(metricGroupCreated)->destroy(); - } - metricGroupList.clear(); - - // Delete the remaining subdevice groups - for (uint32_t subDevGroupIndex = groupIndex + 1; subDevGroupIndex < static_cast(metricGroupsPerSubDevice[0].size()); subDevGroupIndex++) { - for (uint32_t subDeviceIndex = 0; subDeviceIndex < subDeviceCount; subDeviceIndex++) { - [[maybe_unused]] auto status = zetMetricGroupDestroyExp(metricGroupsPerSubDevice[subDeviceIndex][subDevGroupIndex]); - DEBUG_BREAK_IF(status != ZE_RESULT_SUCCESS); + if (metricGroup) { + auto closeStatus = metricGroup->close(); + if (closeStatus != ZE_RESULT_SUCCESS) { + // Cleanup and exit + metricGroup->destroy(); + for (auto &metricGroupCreated : metricGroupList) { + MetricGroup::fromHandle(metricGroupCreated)->destroy(); } + metricGroupList.clear(); + + // Delete the remaining subdevice groups + for (uint32_t subDevGroupIndex = groupIndex + 1; subDevGroupIndex < static_cast(metricGroupsPerSubDevice[0].size()); subDevGroupIndex++) { + for (uint32_t subDeviceIndex = 0; subDeviceIndex < subDeviceCount; subDeviceIndex++) { + [[maybe_unused]] auto status = zetMetricGroupDestroyExp(metricGroupsPerSubDevice[subDeviceIndex][subDevGroupIndex]); + DEBUG_BREAK_IF(status != ZE_RESULT_SUCCESS); + } + } + *maxMetricGroupCount = 0; + return closeStatus; } - *maxMetricGroupCount = 0; - return closeStatus; + metricGroupList.push_back(metricGroup); } - metricGroupList.push_back(metricGroup); } *maxMetricGroupCount = static_cast(metricGroupList.size()); diff --git a/level_zero/tools/test/unit_tests/sources/debug/linux/prelim/test_debug_api_linux.cpp b/level_zero/tools/test/unit_tests/sources/debug/linux/prelim/test_debug_api_linux.cpp index 6833c1e62e..06a631677e 100644 --- a/level_zero/tools/test/unit_tests/sources/debug/linux/prelim/test_debug_api_linux.cpp +++ b/level_zero/tools/test/unit_tests/sources/debug/linux/prelim/test_debug_api_linux.cpp @@ -5909,7 +5909,7 @@ TEST_F(DebugApiLinuxTest, givenEnginesEventHandledThenLrcToContextHandleMapIsFil session->handleEvent(&client.base); unsigned char bytes1[sizeof(prelim_drm_i915_debug_event_engines) + 2 * sizeof(prelim_drm_i915_debug_engine_info)]; - prelim_drm_i915_debug_event_engines *engines1 = reinterpret_cast(bytes1); + prelim_drm_i915_debug_event_engines *engines1 = new (bytes1) prelim_drm_i915_debug_event_engines; engines1->base.type = PRELIM_DRM_I915_DEBUG_EVENT_ENGINES; engines1->base.flags = PRELIM_DRM_I915_DEBUG_EVENT_CREATE; engines1->client_handle = clientHandle; @@ -5919,7 +5919,7 @@ TEST_F(DebugApiLinuxTest, givenEnginesEventHandledThenLrcToContextHandleMapIsFil engines1->engines[1].lrc_handle = 2; unsigned char bytes2[sizeof(prelim_drm_i915_debug_event_engines) + 4 * sizeof(prelim_drm_i915_debug_engine_info)]; - prelim_drm_i915_debug_event_engines *engines2 = reinterpret_cast(bytes2); + prelim_drm_i915_debug_event_engines *engines2 = new (bytes2) prelim_drm_i915_debug_event_engines; engines2->base.type = PRELIM_DRM_I915_DEBUG_EVENT_ENGINES; engines2->base.flags = PRELIM_DRM_I915_DEBUG_EVENT_CREATE; engines2->client_handle = clientHandle; diff --git a/level_zero/tools/test/unit_tests/sources/debug/linux/prelim/tile_debug_session_linux_tests.cpp b/level_zero/tools/test/unit_tests/sources/debug/linux/prelim/tile_debug_session_linux_tests.cpp index 29b9cb1a03..25d8f3e6d6 100644 --- a/level_zero/tools/test/unit_tests/sources/debug/linux/prelim/tile_debug_session_linux_tests.cpp +++ b/level_zero/tools/test/unit_tests/sources/debug/linux/prelim/tile_debug_session_linux_tests.cpp @@ -112,7 +112,7 @@ TEST(TileDebugSessionLinuxi915Test, GivenTileDebugSessionWhenReadingContextState EXPECT_TRUE(session->stateSaveAreaHeader.empty()); const char *header = "cssa"; - rootSession->stateSaveAreaHeader.assign(header, header + sizeof(header)); + rootSession->stateSaveAreaHeader.assign(header, header + strlen(header) + 1); session->readStateSaveAreaHeader(); EXPECT_FALSE(session->stateSaveAreaHeader.empty()); @@ -134,7 +134,7 @@ TEST(TileDebugSessionLinuxi915Test, GivenTileDebugSessionWhenReadingContextState ASSERT_NE(nullptr, session); const char *header = "cssa"; - rootSession->stateSaveAreaHeader.assign(header, header + sizeof(header)); + rootSession->stateSaveAreaHeader.assign(header, header + strlen(header) + 1); rootSession->sipSupportsSlm = false; session->readStateSaveAreaHeader(); diff --git a/opencl/source/command_queue/enqueue_common.h b/opencl/source/command_queue/enqueue_common.h index 8be92fbd6b..3b1fcb9d72 100644 --- a/opencl/source/command_queue/enqueue_common.h +++ b/opencl/source/command_queue/enqueue_common.h @@ -1217,15 +1217,17 @@ CompletionStamp CommandQueueHw::enqueueCommandWithoutKernel( if (enqueueProperties.operation == EnqueueProperties::Operation::blit) { UNRECOVERABLE_IF(!enqueueProperties.blitPropertiesContainer); - const auto newTaskCount = bcsCsr->flushBcsTask(*enqueueProperties.blitPropertiesContainer, false, this->isProfilingEnabled(), getDevice()); - if (newTaskCount > CompletionStamp::notReady) { - CompletionStamp completionStamp{}; - completionStamp.taskCount = newTaskCount; + if (bcsCsr) { + const auto newTaskCount = bcsCsr->flushBcsTask(*enqueueProperties.blitPropertiesContainer, false, this->isProfilingEnabled(), getDevice()); + if (newTaskCount > CompletionStamp::notReady) { + CompletionStamp completionStamp{}; + completionStamp.taskCount = newTaskCount; - return completionStamp; + return completionStamp; + } + + this->updateBcsTaskCount(bcsCsr->getOsContext().getEngineType(), newTaskCount); } - - this->updateBcsTaskCount(bcsCsr->getOsContext().getEngineType(), newTaskCount); } return completionStamp; diff --git a/opencl/test/unit_test/mocks/mock_kernel.h b/opencl/test/unit_test/mocks/mock_kernel.h index 1b145f7103..baafeca9d5 100644 --- a/opencl/test/unit_test/mocks/mock_kernel.h +++ b/opencl/test/unit_test/mocks/mock_kernel.h @@ -191,8 +191,7 @@ class MockKernel : public Kernel { crossThreadDataSize = 0; } if (crossThreadDataPattern && (newCrossThreadDataSize > 0)) { - mockCrossThreadData.clear(); - mockCrossThreadData.insert(mockCrossThreadData.begin(), (char *)crossThreadDataPattern, ((char *)crossThreadDataPattern) + newCrossThreadDataSize); + mockCrossThreadData.assign((char *)crossThreadDataPattern, ((char *)crossThreadDataPattern) + newCrossThreadDataSize); } else { mockCrossThreadData.resize(newCrossThreadDataSize, 0); } diff --git a/shared/source/compiler_interface/linker.cpp b/shared/source/compiler_interface/linker.cpp index 67a2ac04e3..53f3b77f62 100644 --- a/shared/source/compiler_interface/linker.cpp +++ b/shared/source/compiler_interface/linker.cpp @@ -30,6 +30,8 @@ namespace NEO { +LinkerInput::~LinkerInput() = default; + SegmentType LinkerInput::getSegmentForSection(ConstStringRef name) { if (name == NEO::Zebin::Elf::SectionNames::dataConst || name == NEO::Zebin::Elf::SectionNames::dataGlobalConst) { return NEO::SegmentType::globalConstants; diff --git a/shared/source/compiler_interface/linker.h b/shared/source/compiler_interface/linker.h index 1a25e69770..4de855e7e7 100644 --- a/shared/source/compiler_interface/linker.h +++ b/shared/source/compiler_interface/linker.h @@ -109,7 +109,7 @@ struct LinkerInput { using SymbolMap = std::unordered_map; using RelocationsPerInstSegment = std::vector; - virtual ~LinkerInput() = default; + virtual ~LinkerInput(); static SegmentType getSegmentForSection(ConstStringRef name);