Skip to content

Commit fd45b28

Browse files
fix: neo ULT build with optimizations disabled 1/n
Related-To: NEO-8116 Signed-off-by: Oskar Hubert Weber <[email protected]>
1 parent 94d28f3 commit fd45b28

File tree

8 files changed

+37
-32
lines changed

8 files changed

+37
-32
lines changed

level_zero/core/test/unit_tests/sources/memory/test_memory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4137,7 +4137,7 @@ HWTEST2_F(MultipleDevicePeerAllocationTest,
41374137
HWTEST2_F(MultipleDevicePeerAllocationTest,
41384138
whenFreeingNotKnownPointerThenInvalidArgumentIsReturned,
41394139
MatchAny) {
4140-
void *ptr = malloc(1u);
4140+
void *ptr = calloc(1, 1u);
41414141
ze_result_t result = context->freeMem(ptr);
41424142
EXPECT_EQ(result, ZE_RESULT_ERROR_INVALID_ARGUMENT);
41434143
free(ptr);

level_zero/tools/source/metrics/metric_multidevice_programmable.inl

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -107,26 +107,28 @@ ze_result_t MultiDeviceCreatedMetricGroupManager::createMultipleMetricGroupsFrom
107107
multiDeviceMetricImp.push_back(static_cast<MultiDeviceMetricImp *>(Metric::fromHandle(hMetric)));
108108
}
109109
auto metricGroup = T::create(metricSource, metricGroupsAcrossSubDevices, multiDeviceMetricImp);
110-
auto closeStatus = metricGroup->close();
111-
if (closeStatus != ZE_RESULT_SUCCESS) {
112-
// Cleanup and exit
113-
metricGroup->destroy();
114-
for (auto &metricGroupCreated : metricGroupList) {
115-
MetricGroup::fromHandle(metricGroupCreated)->destroy();
116-
}
117-
metricGroupList.clear();
118-
119-
// Delete the remaining subdevice groups
120-
for (uint32_t subDevGroupIndex = groupIndex + 1; subDevGroupIndex < static_cast<uint32_t>(metricGroupsPerSubDevice[0].size()); subDevGroupIndex++) {
121-
for (uint32_t subDeviceIndex = 0; subDeviceIndex < subDeviceCount; subDeviceIndex++) {
122-
[[maybe_unused]] auto status = zetMetricGroupDestroyExp(metricGroupsPerSubDevice[subDeviceIndex][subDevGroupIndex]);
123-
DEBUG_BREAK_IF(status != ZE_RESULT_SUCCESS);
110+
if (metricGroup) {
111+
auto closeStatus = metricGroup->close();
112+
if (closeStatus != ZE_RESULT_SUCCESS) {
113+
// Cleanup and exit
114+
metricGroup->destroy();
115+
for (auto &metricGroupCreated : metricGroupList) {
116+
MetricGroup::fromHandle(metricGroupCreated)->destroy();
124117
}
118+
metricGroupList.clear();
119+
120+
// Delete the remaining subdevice groups
121+
for (uint32_t subDevGroupIndex = groupIndex + 1; subDevGroupIndex < static_cast<uint32_t>(metricGroupsPerSubDevice[0].size()); subDevGroupIndex++) {
122+
for (uint32_t subDeviceIndex = 0; subDeviceIndex < subDeviceCount; subDeviceIndex++) {
123+
[[maybe_unused]] auto status = zetMetricGroupDestroyExp(metricGroupsPerSubDevice[subDeviceIndex][subDevGroupIndex]);
124+
DEBUG_BREAK_IF(status != ZE_RESULT_SUCCESS);
125+
}
126+
}
127+
*maxMetricGroupCount = 0;
128+
return closeStatus;
125129
}
126-
*maxMetricGroupCount = 0;
127-
return closeStatus;
130+
metricGroupList.push_back(metricGroup);
128131
}
129-
metricGroupList.push_back(metricGroup);
130132
}
131133

132134
*maxMetricGroupCount = static_cast<uint32_t>(metricGroupList.size());

level_zero/tools/test/unit_tests/sources/debug/linux/prelim/test_debug_api_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5909,7 +5909,7 @@ TEST_F(DebugApiLinuxTest, givenEnginesEventHandledThenLrcToContextHandleMapIsFil
59095909
session->handleEvent(&client.base);
59105910

59115911
unsigned char bytes1[sizeof(prelim_drm_i915_debug_event_engines) + 2 * sizeof(prelim_drm_i915_debug_engine_info)];
5912-
prelim_drm_i915_debug_event_engines *engines1 = reinterpret_cast<prelim_drm_i915_debug_event_engines *>(bytes1);
5912+
prelim_drm_i915_debug_event_engines *engines1 = new (bytes1) prelim_drm_i915_debug_event_engines;
59135913
engines1->base.type = PRELIM_DRM_I915_DEBUG_EVENT_ENGINES;
59145914
engines1->base.flags = PRELIM_DRM_I915_DEBUG_EVENT_CREATE;
59155915
engines1->client_handle = clientHandle;
@@ -5919,7 +5919,7 @@ TEST_F(DebugApiLinuxTest, givenEnginesEventHandledThenLrcToContextHandleMapIsFil
59195919
engines1->engines[1].lrc_handle = 2;
59205920

59215921
unsigned char bytes2[sizeof(prelim_drm_i915_debug_event_engines) + 4 * sizeof(prelim_drm_i915_debug_engine_info)];
5922-
prelim_drm_i915_debug_event_engines *engines2 = reinterpret_cast<prelim_drm_i915_debug_event_engines *>(bytes2);
5922+
prelim_drm_i915_debug_event_engines *engines2 = new (bytes2) prelim_drm_i915_debug_event_engines;
59235923
engines2->base.type = PRELIM_DRM_I915_DEBUG_EVENT_ENGINES;
59245924
engines2->base.flags = PRELIM_DRM_I915_DEBUG_EVENT_CREATE;
59255925
engines2->client_handle = clientHandle;

level_zero/tools/test/unit_tests/sources/debug/linux/prelim/tile_debug_session_linux_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ TEST(TileDebugSessionLinuxi915Test, GivenTileDebugSessionWhenReadingContextState
112112
EXPECT_TRUE(session->stateSaveAreaHeader.empty());
113113

114114
const char *header = "cssa";
115-
rootSession->stateSaveAreaHeader.assign(header, header + sizeof(header));
115+
rootSession->stateSaveAreaHeader.assign(header, header + strlen(header) + 1);
116116

117117
session->readStateSaveAreaHeader();
118118
EXPECT_FALSE(session->stateSaveAreaHeader.empty());
@@ -134,7 +134,7 @@ TEST(TileDebugSessionLinuxi915Test, GivenTileDebugSessionWhenReadingContextState
134134
ASSERT_NE(nullptr, session);
135135

136136
const char *header = "cssa";
137-
rootSession->stateSaveAreaHeader.assign(header, header + sizeof(header));
137+
rootSession->stateSaveAreaHeader.assign(header, header + strlen(header) + 1);
138138
rootSession->sipSupportsSlm = false;
139139

140140
session->readStateSaveAreaHeader();

opencl/source/command_queue/enqueue_common.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,15 +1217,17 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueCommandWithoutKernel(
12171217

12181218
if (enqueueProperties.operation == EnqueueProperties::Operation::blit) {
12191219
UNRECOVERABLE_IF(!enqueueProperties.blitPropertiesContainer);
1220-
const auto newTaskCount = bcsCsr->flushBcsTask(*enqueueProperties.blitPropertiesContainer, false, this->isProfilingEnabled(), getDevice());
1221-
if (newTaskCount > CompletionStamp::notReady) {
1222-
CompletionStamp completionStamp{};
1223-
completionStamp.taskCount = newTaskCount;
1220+
if (bcsCsr) {
1221+
const auto newTaskCount = bcsCsr->flushBcsTask(*enqueueProperties.blitPropertiesContainer, false, this->isProfilingEnabled(), getDevice());
1222+
if (newTaskCount > CompletionStamp::notReady) {
1223+
CompletionStamp completionStamp{};
1224+
completionStamp.taskCount = newTaskCount;
12241225

1225-
return completionStamp;
1226-
}
1226+
return completionStamp;
1227+
}
12271228

1228-
this->updateBcsTaskCount(bcsCsr->getOsContext().getEngineType(), newTaskCount);
1229+
this->updateBcsTaskCount(bcsCsr->getOsContext().getEngineType(), newTaskCount);
1230+
}
12291231
}
12301232

12311233
return completionStamp;

opencl/test/unit_test/mocks/mock_kernel.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ class MockKernel : public Kernel {
191191
crossThreadDataSize = 0;
192192
}
193193
if (crossThreadDataPattern && (newCrossThreadDataSize > 0)) {
194-
mockCrossThreadData.clear();
195-
mockCrossThreadData.insert(mockCrossThreadData.begin(), (char *)crossThreadDataPattern, ((char *)crossThreadDataPattern) + newCrossThreadDataSize);
194+
mockCrossThreadData.assign((char *)crossThreadDataPattern, ((char *)crossThreadDataPattern) + newCrossThreadDataSize);
196195
} else {
197196
mockCrossThreadData.resize(newCrossThreadDataSize, 0);
198197
}

shared/source/compiler_interface/linker.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
namespace NEO {
3232

33+
LinkerInput::~LinkerInput() = default;
34+
3335
SegmentType LinkerInput::getSegmentForSection(ConstStringRef name) {
3436
if (name == NEO::Zebin::Elf::SectionNames::dataConst || name == NEO::Zebin::Elf::SectionNames::dataGlobalConst) {
3537
return NEO::SegmentType::globalConstants;

shared/source/compiler_interface/linker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct LinkerInput {
109109
using SymbolMap = std::unordered_map<std::string, SymbolInfo>;
110110
using RelocationsPerInstSegment = std::vector<Relocations>;
111111

112-
virtual ~LinkerInput() = default;
112+
virtual ~LinkerInput();
113113

114114
static SegmentType getSegmentForSection(ConstStringRef name);
115115

0 commit comments

Comments
 (0)