mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Reverse logic of creating Memory Manager - part 3
-Move a Device::getEnabled64kbPages method's logic to the Memory Manager constructor Change-Id: Ide88898000e5817a79f9a6ad5dfc9d680bec0533 Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
cc13045ddd
commit
9ecb3193af
@@ -163,7 +163,7 @@ INSTANTIATE_TEST_CASE_P(Disallow32BitAnd64kbPagesTypes,
|
||||
|
||||
TEST(MemoryManagerTest, givenForced32BitSetWhenGraphicsMemoryFor32BitAllowedTypeIsAllocatedThen32BitAllocationIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
memoryManager.setForce32BitAllocations(true);
|
||||
|
||||
AllocationData allocData;
|
||||
@@ -186,7 +186,7 @@ TEST(MemoryManagerTest, givenForced32BitSetWhenGraphicsMemoryFor32BitAllowedType
|
||||
|
||||
TEST(MemoryManagerTest, givenForced32BitEnabledWhenGraphicsMemoryWihtoutAllow32BitFlagIsAllocatedThenNon32BitAllocationIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(executionEnvironment);
|
||||
memoryManager.setForce32BitAllocations(true);
|
||||
|
||||
AllocationData allocData;
|
||||
@@ -204,7 +204,7 @@ TEST(MemoryManagerTest, givenForced32BitEnabledWhenGraphicsMemoryWihtoutAllow32B
|
||||
|
||||
TEST(MemoryManagerTest, givenForced32BitDisabledWhenGraphicsMemoryWith32BitFlagFor32BitAllowedTypeIsAllocatedThenNon32BitAllocationIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(executionEnvironment);
|
||||
memoryManager.setForce32BitAllocations(false);
|
||||
|
||||
AllocationData allocData;
|
||||
@@ -221,7 +221,7 @@ TEST(MemoryManagerTest, givenForced32BitDisabledWhenGraphicsMemoryWith32BitFlagF
|
||||
|
||||
TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryMustBeHostMemoryAndIsAllocatedWithNullptrForBufferThen64kbAllocationIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(true, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(true, false, executionEnvironment);
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
|
||||
@@ -271,7 +271,7 @@ TEST(MemoryManagerTest, givenDisabled64kbPagesWhenGraphicsMemoryMustBeHostMemory
|
||||
|
||||
TEST(MemoryManagerTest, givenForced32BitAndEnabled64kbPagesWhenGraphicsMemoryMustBeHostMemoryAndIsAllocatedWithNullptrForBufferThen32BitAllocationOver64kbIsChosen) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
memoryManager.setForce32BitAllocations(true);
|
||||
|
||||
AllocationData allocData;
|
||||
@@ -292,7 +292,7 @@ TEST(MemoryManagerTest, givenForced32BitAndEnabled64kbPagesWhenGraphicsMemoryMus
|
||||
|
||||
TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryIsAllocatedWithHostPtrForBufferThenExistingMemoryIsUsedForAllocation) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(true, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(true, false, executionEnvironment);
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(false, 1, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "unit_tests/fixtures/memory_allocator_fixture.h"
|
||||
#include "unit_tests/fixtures/memory_manager_fixture.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/helpers/execution_environment_helper.h"
|
||||
#include "unit_tests/helpers/memory_management.h"
|
||||
#include "unit_tests/helpers/variable_backup.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
@@ -539,20 +540,20 @@ TEST_F(MemoryAllocatorTest, given32BitDeviceWhenPrintfSurfaceIsCreatedThen32BitA
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenItIsCreatedThenForce32BitAllocationsIsFalse) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
EXPECT_FALSE(memoryManager.peekForce32BitAllocations());
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenForce32bitallocationIsCalledWithTrueThenMemoryManagerForces32BitAlloactions) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
memoryManager.setForce32BitAllocations(true);
|
||||
EXPECT_TRUE(memoryManager.peekForce32BitAllocations());
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenAllocateGraphicsMemoryForImageIsCalledThenGraphicsAllocationIsReturned) {
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
MockMemoryManager memoryManager(false, false, *executionEnvironment);
|
||||
MockMemoryManager memoryManager(*executionEnvironment);
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = 512;
|
||||
imgDesc.image_height = 1;
|
||||
@@ -664,7 +665,7 @@ TEST(OsAgnosticMemoryManager, givenHostPointerRequiringCopyWhenAllocateGraphicsM
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerAndUnifiedAuxCapableAllocationWhenMappingThenReturnFalse) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
|
||||
auto gmm = new Gmm(nullptr, 123, false);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
@@ -680,7 +681,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerAndUnifiedAuxCapableAlloc
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocateGraphicsMemoryIsCalledThenMemoryPoolIsSystem4KBPages) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
auto size = 4096u;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{size});
|
||||
@@ -701,10 +702,10 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesEnabledWhenAllocate
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesEnabledWhenAllocateGraphicsMemoryFailsThenNullptrIsReturned) {
|
||||
class MockOsAgnosticManagerWithFailingAllocate : public OsAgnosticMemoryManager {
|
||||
class MockOsAgnosticManagerWithFailingAllocate : public MemoryManagerCreate<OsAgnosticMemoryManager> {
|
||||
public:
|
||||
using OsAgnosticMemoryManager::allocateGraphicsMemory64kb;
|
||||
MockOsAgnosticManagerWithFailingAllocate(bool enable64kbPages, ExecutionEnvironment &executionEnvironment) : OsAgnosticMemoryManager(enable64kbPages, false, executionEnvironment) {}
|
||||
MockOsAgnosticManagerWithFailingAllocate(bool enable64kbPages, ExecutionEnvironment &executionEnvironment) : MemoryManagerCreate(enable64kbPages, false, executionEnvironment) {}
|
||||
|
||||
GraphicsAllocation *allocateGraphicsMemoryWithAlignment(const AllocationData &allocationData) override {
|
||||
return nullptr;
|
||||
@@ -721,7 +722,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesEnabledWhenAllocate
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocateGraphicsMemoryWithPtrIsCalledThenMemoryPoolIsSystem4KBPages) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
void *ptr = reinterpret_cast<void *>(0x1001);
|
||||
auto size = MemoryConstants::pageSize;
|
||||
|
||||
@@ -762,7 +763,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocate32BitGraphicsMemoryW
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesEnabledWhenAllocateGraphicsMemoryThenMemoryPoolIsSystem64KBPages) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(true, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(true, false, executionEnvironment);
|
||||
auto svmAllocation = memoryManager.allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SVM});
|
||||
EXPECT_NE(nullptr, svmAllocation);
|
||||
EXPECT_EQ(MemoryPool::System64KBPages, svmAllocation->getMemoryPool());
|
||||
@@ -771,35 +772,15 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesEnabledWhenAllocate
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesDisabledWhenAllocateGraphicsMemoryThen4KBGraphicsAllocationIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
auto svmAllocation = memoryManager.allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SVM});
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, svmAllocation->getMemoryPool());
|
||||
memoryManager.freeGraphicsMemory(svmAllocation);
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenDeviceWith64kbPagesEnabledWhenCreatingMemoryManagerThenAllowFor64kbAllocations) {
|
||||
VariableBackup<bool> os64kbPagesEnabled(&OSInterface::osEnabled64kbPages, true);
|
||||
|
||||
HardwareInfo localHwInfo = *platformDevices[0];
|
||||
localHwInfo.capabilityTable.ftr64KBpages = true;
|
||||
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<Device>(&localHwInfo));
|
||||
EXPECT_TRUE(device->getEnabled64kbPages());
|
||||
EXPECT_TRUE(device->getMemoryManager()->peek64kbPagesEnabled());
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenDeviceWith64kbPagesDisbledWhenCreatingMemoryManagerThenDisallowFor64kbAllocations) {
|
||||
HardwareInfo localHwInfo = *platformDevices[0];
|
||||
localHwInfo.capabilityTable.ftr64KBpages = false;
|
||||
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<Device>(&localHwInfo));
|
||||
EXPECT_FALSE(device->getEnabled64kbPages());
|
||||
EXPECT_FALSE(device->getMemoryManager()->peek64kbPagesEnabled());
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocationFromSharedObjectIsCalledThenGraphicsAllocationIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
osHandle handle = 1;
|
||||
auto size = 4096u;
|
||||
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, false);
|
||||
@@ -814,14 +795,14 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenCreateAllocationFromNtHandleIsCalledThenReturnNullptr) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
auto graphicsAllocation = memoryManager.createGraphicsAllocationFromNTHandle((void *)1);
|
||||
EXPECT_EQ(nullptr, graphicsAllocation);
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenLockUnlockCalledThenReturnCpuPtr) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
@@ -837,7 +818,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenLockUnlockCalledThenReturnCp
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenGraphicsAllocationContainsOffsetWhenAddressIsObtainedThenOffsetIsAdded) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
@@ -857,7 +838,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenGraphicsAllocationCon
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenGraphicsAllocationIsPaddedThenNewGraphicsAllocationIsCreated) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto sizeWithPadding = 8192;
|
||||
@@ -876,7 +857,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenGraphicsAllocationIsP
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenTwoGraphicsAllocationArePaddedThenOnlyOnePaddingBufferIsUsed) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto sizeWithPadding = 8192;
|
||||
@@ -900,7 +881,7 @@ TEST(OsAgnosticMemoryManager, pleaseDetectLeak) {
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocateMemoryWithNoAlignmentProvidedThenAllocationIsAlignedToPageSize) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
MockAllocationProperties properties(MemoryConstants::pageSize >> 1);
|
||||
properties.alignment = 0;
|
||||
auto ga = memoryManager.allocateGraphicsMemoryWithProperties(properties);
|
||||
@@ -913,7 +894,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocateMemoryWithNoAlignmen
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocateMemoryWithAlignmentNotAlignedToPageSizeThenAlignmentIsAlignedUp) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
MockAllocationProperties properties(MemoryConstants::pageSize >> 1);
|
||||
properties.alignment = MemoryConstants::pageSize - 1;
|
||||
auto ga = memoryManager.allocateGraphicsMemoryWithProperties(properties);
|
||||
@@ -926,7 +907,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocateMemoryWithAlignmentN
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenCommonMemoryManagerWhenIsAskedIfApplicationMemoryBudgetIsExhaustedThenFalseIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
EXPECT_FALSE(memoryManager.isMemoryBudgetExhausted());
|
||||
}
|
||||
|
||||
@@ -990,7 +971,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenIsAsyncDeleterEnabledCalledT
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenItIsCreatedThenAsyncDeleterEnabledIsFalse) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
EXPECT_FALSE(memoryManager.isAsyncDeleterEnabled());
|
||||
EXPECT_EQ(nullptr, memoryManager.getDeferredDeleter());
|
||||
}
|
||||
@@ -999,7 +980,7 @@ TEST(OsAgnosticMemoryManager, givenEnabledAsyncDeleterFlagWhenMemoryManagerIsCre
|
||||
bool defaultEnableDeferredDeleterFlag = DebugManager.flags.EnableDeferredDeleter.get();
|
||||
DebugManager.flags.EnableDeferredDeleter.set(true);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
EXPECT_FALSE(memoryManager.isAsyncDeleterEnabled());
|
||||
EXPECT_EQ(nullptr, memoryManager.getDeferredDeleter());
|
||||
DebugManager.flags.EnableDeferredDeleter.set(defaultEnableDeferredDeleterFlag);
|
||||
@@ -1009,7 +990,7 @@ TEST(OsAgnosticMemoryManager, givenDisabledAsyncDeleterFlagWhenMemoryManagerIsCr
|
||||
bool defaultEnableDeferredDeleterFlag = DebugManager.flags.EnableDeferredDeleter.get();
|
||||
DebugManager.flags.EnableDeferredDeleter.set(false);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
EXPECT_FALSE(memoryManager.isAsyncDeleterEnabled());
|
||||
EXPECT_EQ(nullptr, memoryManager.getDeferredDeleter());
|
||||
DebugManager.flags.EnableDeferredDeleter.set(defaultEnableDeferredDeleterFlag);
|
||||
@@ -1019,7 +1000,7 @@ TEST(OsAgnosticMemoryManager, GivenEnabled64kbPagesWhenHostMemoryAllocationIsCre
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.Enable64kbpages.set(true);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(true, false, executionEnvironment);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(true, false, executionEnvironment);
|
||||
|
||||
GraphicsAllocation *galloc = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY});
|
||||
EXPECT_NE(nullptr, galloc);
|
||||
@@ -1047,7 +1028,7 @@ TEST(OsAgnosticMemoryManager, givenPointerAndSizeWhenCreateInternalAllocationIsC
|
||||
}
|
||||
TEST(OsAgnosticMemoryManager, givenDefaultOsAgnosticMemoryManagerWhenItIsQueriedForInternalHeapBaseThen32BitAllocatorBaseIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
auto heapBase = memoryManager.allocator32Bit->getBase();
|
||||
EXPECT_EQ(heapBase, memoryManager.getInternalHeapBaseAddress());
|
||||
}
|
||||
@@ -1073,7 +1054,7 @@ TEST_P(OsAgnosticMemoryManagerWithParams, givenReducedGpuAddressSpaceWhenAllocat
|
||||
if (executionEnvironment.isFullRangeSvm()) {
|
||||
return;
|
||||
}
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
||||
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
||||
@@ -1092,7 +1073,7 @@ TEST_P(OsAgnosticMemoryManagerWithParams, givenFullGpuAddressSpaceWhenAllocateGr
|
||||
if (!executionEnvironment.isFullRangeSvm()) {
|
||||
return;
|
||||
}
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
||||
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
||||
@@ -1115,7 +1096,7 @@ TEST_P(OsAgnosticMemoryManagerWithParams, givenDisabledHostPtrTrackingWhenAlloca
|
||||
if (!executionEnvironment.isFullRangeSvm()) {
|
||||
return;
|
||||
}
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
||||
|
||||
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
||||
@@ -1146,6 +1127,7 @@ TEST(OsAgnosticMemoryManager, givenLocalMemoryNotSupportedWhenMemoryManagerIsCre
|
||||
TEST(OsAgnosticMemoryManager, givenLocalMemorySupportedAndNotAubUsageWhenMemoryManagerIsCreatedThenAllocator32BitHasCorrectBaseAddress) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
MockMemoryManager memoryManager(false, true, false, executionEnvironment);
|
||||
memoryManager.allocator32Bit.reset(memoryManager.create32BitAllocator(false));
|
||||
uint64_t heap32Base = 0x80000000000ul;
|
||||
|
||||
if (is32bit) {
|
||||
@@ -1168,6 +1150,7 @@ TEST(OsAgnosticMemoryManager, givenLocalMemoryNotSupportedAndAubUsageWhenMemoryM
|
||||
TEST(OsAgnosticMemoryManager, givenLocalMemorySupportedAndAubUsageWhenMemoryManagerIsCreatedThenAllocator32BitHasCorrectBaseAddress) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
MockMemoryManager memoryManager(false, true, true, executionEnvironment);
|
||||
memoryManager.allocator32Bit.reset(memoryManager.create32BitAllocator(true));
|
||||
uint64_t heap32Base = 0x80000000000ul;
|
||||
|
||||
if (is32bit) {
|
||||
|
||||
@@ -65,7 +65,7 @@ HWTEST_TYPED_TEST(SurfaceTest, GivenSurfaceWhenInterfaceIsUsedThenSurfaceBehaves
|
||||
executionEnvironment->commandStreamReceivers.resize(1);
|
||||
MockCsr<FamilyType> *csr = new MockCsr<FamilyType>(execStamp, *executionEnvironment);
|
||||
executionEnvironment->commandStreamReceivers[0].push_back(std::unique_ptr<CommandStreamReceiver>(csr));
|
||||
executionEnvironment->initializeMemoryManager(false, false);
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
auto engine = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0];
|
||||
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(csr, engine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
|
||||
csr->setupContext(*osContext);
|
||||
|
||||
Reference in New Issue
Block a user