fix: allowing neo ULT build with optimization enabled 5/n

- fix mismatched-new-delete warnings
- fix initialization warnings
- fix attempt to free a non-heap object warnings

Related-To: NEO-8116

Signed-off-by: Oskar Hubert Weber <oskar.hubert.weber@intel.com>
This commit is contained in:
Oskar Hubert Weber
2024-12-18 14:51:08 +00:00
committed by Compute-Runtime-Automation
parent dec695f405
commit 1c1b2db9a9
8 changed files with 39 additions and 21 deletions

View File

@@ -67,7 +67,9 @@ bool checkDefaultCacheDirSettings(std::string &cacheDir, NEO::EnvironmentVariabl
}
time_t getFileModificationTime(const std::string &path) {
struct stat st;
struct stat st {
0, 0
};
if (NEO::SysCalls::stat(path, &st) == 0) {
return st.st_mtime;
}
@@ -75,7 +77,9 @@ time_t getFileModificationTime(const std::string &path) {
}
size_t getFileSize(const std::string &path) {
struct stat st;
struct stat st {
0, 0
};
if (NEO::SysCalls::stat(path, &st) == 0) {
return static_cast<size_t>(st.st_size);
}

View File

@@ -29,7 +29,9 @@ OSTimeLinux::OSTimeLinux(OSInterface &osInterface, std::unique_ptr<DeviceTime> d
}
bool OSTimeLinux::getCpuTime(uint64_t *timestamp) {
struct timespec ts;
struct timespec ts {
0, 0
};
if (getTimeFunc(CLOCK_MONOTONIC_RAW, &ts)) {
return false;
@@ -41,7 +43,9 @@ bool OSTimeLinux::getCpuTime(uint64_t *timestamp) {
}
bool OSTime::getCpuTimeHost(uint64_t *timestamp) {
struct timespec ts;
struct timespec ts {
0, 0
};
auto ret = clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
@@ -51,7 +55,9 @@ bool OSTime::getCpuTimeHost(uint64_t *timestamp) {
}
double OSTimeLinux::getHostTimerResolution() const {
struct timespec ts;
struct timespec ts {
0, 0
};
if (resolutionFunc(CLOCK_MONOTONIC_RAW, &ts)) {
return 0;
}

View File

@@ -634,7 +634,7 @@ TEST_F(BindlessHeapsHelperTests, givenLocalMemorySupportWhenReservingMemoryForSp
size_t reservationSize = MemoryConstants::pageSize64k;
size_t alignment = MemoryConstants::pageSize64k;
memManager->localMemorySupported = {localMemSupported};
memManager->localMemorySupported = std::vector<bool>{localMemSupported};
auto specialSshReservationSuccessful = bindlessHeapHelper->tryReservingMemoryForSpecialSsh(reservationSize, alignment);
EXPECT_TRUE(specialSshReservationSuccessful);

View File

@@ -5243,8 +5243,17 @@ TEST_F(DrmMemoryManagerTest, whenDebugFlagToNotFreeResourcesIsSpecifiedThenFreeI
TestedDrmMemoryManager memoryManager(false, false, false, *executionEnvironment);
size_t sizeIn = 1024llu;
uint64_t gpuAddress = 0x1337llu;
DrmAllocation stackDrmAllocation(0u, 1u /*num gmms*/, AllocationType::buffer, nullptr, nullptr, gpuAddress, sizeIn, MemoryPool::system64KBPages);
memoryManager.freeGraphicsMemoryImpl(&stackDrmAllocation);
auto drmAllocation = std::make_unique<DrmAllocation>(0u, 1u /*num gmms*/, AllocationType::buffer, nullptr, nullptr, gpuAddress, sizeIn, MemoryPool::system64KBPages);
memoryManager.freeGraphicsMemoryImpl(drmAllocation.get());
EXPECT_EQ(drmAllocation->getNumGmms(), 1u);
EXPECT_EQ(drmAllocation->getRootDeviceIndex(), 0u);
EXPECT_EQ(drmAllocation->getBOs().size(), EngineLimits::maxHandleCount);
EXPECT_EQ(drmAllocation->getAllocationType(), AllocationType::buffer);
EXPECT_EQ(drmAllocation->getGpuAddress(), gpuAddress);
EXPECT_EQ(drmAllocation->getUnderlyingBufferSize(), sizeIn);
EXPECT_EQ(drmAllocation->getMemoryPool(), MemoryPool::system64KBPages);
EXPECT_EQ(drmAllocation->getUnderlyingBuffer(), nullptr);
}
TEST_F(DrmMemoryManagerTest, given2MbPagesDisabledWhenWddmMemoryManagerIsCreatedThenAlignmentSelectorHasExpectedAlignments) {