fix: fix compilation issues with gcc14

- don't populate buffer objects by direct access - use push_back method
- remove template-id from constructor definitions
- correct allocating minimum memory size for mock objects

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2024-08-22 16:11:12 +02:00 committed by Compute-Runtime-Automation
parent f87673e761
commit 70bb654c15
5 changed files with 17 additions and 15 deletions

View File

@ -2936,7 +2936,7 @@ TEST(OfflineCompilerTest, givenInvalidGenBinarySizeAndNotNullPointerWhenGenerati
MockOfflineCompiler mockOfflineCompiler;
// Destructor of OfflineCompiler will deallocate the memory.
mockOfflineCompiler.genBinary = new char[0];
mockOfflineCompiler.genBinary = new char[1];
mockOfflineCompiler.genBinarySize = 0;
EXPECT_FALSE(mockOfflineCompiler.generateElfBinary());

View File

@ -37,14 +37,16 @@ class DrmAllocation : public GraphicsAllocation {
};
DrmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool pool, uint64_t canonizedGpuAddress)
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, sizeIn, sharedHandle, pool, MemoryManager::maxOsContextCount, canonizedGpuAddress), bufferObjects(EngineLimits::maxHandleCount) {
bufferObjects[0] = bo;
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, sizeIn, sharedHandle, pool, MemoryManager::maxOsContextCount, canonizedGpuAddress) {
bufferObjects.push_back(bo);
resizeBufferObjects(EngineLimits::maxHandleCount);
handles.resize(EngineLimits::maxHandleCount, std::numeric_limits<uint64_t>::max());
}
DrmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, BufferObject *bo, void *ptrIn, uint64_t canonizedGpuAddress, size_t sizeIn, MemoryPool pool)
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, canonizedGpuAddress, 0, sizeIn, pool, MemoryManager::maxOsContextCount), bufferObjects(EngineLimits::maxHandleCount) {
bufferObjects[0] = bo;
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, canonizedGpuAddress, 0, sizeIn, pool, MemoryManager::maxOsContextCount) {
bufferObjects.push_back(bo);
resizeBufferObjects(EngineLimits::maxHandleCount);
handles.resize(EngineLimits::maxHandleCount, std::numeric_limits<uint64_t>::max());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -11,11 +11,11 @@
namespace NEO {
GMM_RESOURCE_INFO *MockGmmClientContextBase::createResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams) {
return reinterpret_cast<GMM_RESOURCE_INFO *>(new char[1]);
return reinterpret_cast<GMM_RESOURCE_INFO *>(new char[sizeof(GMM_RESOURCE_INFO)]);
}
GMM_RESOURCE_INFO *MockGmmClientContextBase::copyResInfoObject(GMM_RESOURCE_INFO *pSrcRes) {
return reinterpret_cast<GMM_RESOURCE_INFO *>(new char[1]);
return reinterpret_cast<GMM_RESOURCE_INFO *>(new char[sizeof(GMM_RESOURCE_INFO)]);
}
void MockGmmClientContextBase::destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo) {

View File

@ -126,9 +126,9 @@ struct MyMockCsr : UltCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> {
template <typename BaseCSR>
struct MyMockCsrWithAubDump : CommandStreamReceiverWithAUBDump<BaseCSR> {
MyMockCsrWithAubDump<BaseCSR>(bool createAubCSR,
ExecutionEnvironment &executionEnvironment,
const DeviceBitfield deviceBitfield)
MyMockCsrWithAubDump(bool createAubCSR,
ExecutionEnvironment &executionEnvironment,
const DeviceBitfield deviceBitfield)
: CommandStreamReceiverWithAUBDump<BaseCSR>("aubfile", executionEnvironment, 0, deviceBitfield) {
this->aubCSR.reset(createAubCSR ? new MyMockCsr(executionEnvironment, 0, deviceBitfield) : nullptr);
}

View File

@ -798,7 +798,7 @@ struct DrmDirectSubmissionFunctionsCalled {
template <typename GfxFamily>
struct MockDrmDirectSubmissionToTestDtor : public DrmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>> {
MockDrmDirectSubmissionToTestDtor<GfxFamily>(const CommandStreamReceiver &commandStreamReceiver, DrmDirectSubmissionFunctionsCalled &functionsCalled)
MockDrmDirectSubmissionToTestDtor(const CommandStreamReceiver &commandStreamReceiver, DrmDirectSubmissionFunctionsCalled &functionsCalled)
: DrmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>(commandStreamReceiver), functionsCalled(functionsCalled) {
}
~MockDrmDirectSubmissionToTestDtor() override {
@ -842,7 +842,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenEnabledDirectSubmi
template <typename GfxFamily>
struct MockDrmDirectSubmissionToTestRingStop : public DrmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>> {
MockDrmDirectSubmissionToTestRingStop<GfxFamily>(const CommandStreamReceiver &commandStreamReceiver)
MockDrmDirectSubmissionToTestRingStop(const CommandStreamReceiver &commandStreamReceiver)
: DrmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>(commandStreamReceiver) {
}
using DrmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>::ringStart;
@ -858,7 +858,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenEnabledDirectSubmi
template <typename GfxFamily>
struct MockDrmDirectSubmissionDispatchCommandBuffer : public DrmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>> {
MockDrmDirectSubmissionDispatchCommandBuffer<GfxFamily>(const CommandStreamReceiver &commandStreamReceiver)
MockDrmDirectSubmissionDispatchCommandBuffer(const CommandStreamReceiver &commandStreamReceiver)
: DrmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>(commandStreamReceiver) {
}
@ -872,7 +872,7 @@ struct MockDrmDirectSubmissionDispatchCommandBuffer : public DrmDirectSubmission
template <typename GfxFamily>
struct MockDrmBlitterDirectSubmissionDispatchCommandBuffer : public DrmDirectSubmission<GfxFamily, BlitterDispatcher<GfxFamily>> {
MockDrmBlitterDirectSubmissionDispatchCommandBuffer<GfxFamily>(const CommandStreamReceiver &commandStreamReceiver)
MockDrmBlitterDirectSubmissionDispatchCommandBuffer(const CommandStreamReceiver &commandStreamReceiver)
: DrmDirectSubmission<GfxFamily, BlitterDispatcher<GfxFamily>>(commandStreamReceiver) {
}