mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Move AllocationType enum out of GraphicsAllocation class
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
fd27098194
commit
4b0d986876
@ -465,7 +465,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafDisabledWhenFlushIsCalledWithAll
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::LINEAR_STREAM, device->getDeviceBitfield()});
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::LINEAR_STREAM, device->getDeviceBitfield()});
|
||||
ASSERT_NE(nullptr, linearStreamAllocation);
|
||||
ResidencyContainer allocationsForResidency = {linearStreamAllocation};
|
||||
|
||||
@ -500,7 +500,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithResi
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
auto linearStreamAllocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::LINEAR_STREAM, device->getDeviceBitfield()}));
|
||||
auto linearStreamAllocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::LINEAR_STREAM, device->getDeviceBitfield()}));
|
||||
ASSERT_NE(nullptr, linearStreamAllocation);
|
||||
|
||||
csr->makeResident(*linearStreamAllocation);
|
||||
@ -524,7 +524,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
auto linearStreamAllocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::LINEAR_STREAM, device->getDeviceBitfield()}));
|
||||
auto linearStreamAllocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::LINEAR_STREAM, device->getDeviceBitfield()}));
|
||||
ASSERT_NE(nullptr, linearStreamAllocation);
|
||||
ResidencyContainer allocationsForResidency = {linearStreamAllocation};
|
||||
|
||||
@ -545,7 +545,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
auto fillPatternAllocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::FILL_PATTERN, device->getDeviceBitfield()}));
|
||||
auto fillPatternAllocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::FILL_PATTERN, device->getDeviceBitfield()}));
|
||||
ASSERT_NE(nullptr, fillPatternAllocation);
|
||||
ResidencyContainer allocationsForResidency = {fillPatternAllocation};
|
||||
|
||||
@ -566,7 +566,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
auto commandBufferAllocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::COMMAND_BUFFER, device->getDeviceBitfield()}));
|
||||
auto commandBufferAllocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::COMMAND_BUFFER, device->getDeviceBitfield()}));
|
||||
ASSERT_NE(nullptr, commandBufferAllocation);
|
||||
ResidencyContainer allocationsForResidency = {commandBufferAllocation};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -30,7 +30,7 @@ TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagThenLogsCorrectInfo) {
|
||||
|
||||
MockWddmAllocation allocation(getGmmClientContext());
|
||||
allocation.handle = 4;
|
||||
allocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
allocation.setAllocationType(AllocationType::BUFFER);
|
||||
allocation.memoryPool = MemoryPool::System64KBPages;
|
||||
allocation.getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly = 0;
|
||||
allocation.setGpuAddress(0x12345);
|
||||
@ -76,7 +76,7 @@ TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagSetFalseThenAllocationIs
|
||||
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
|
||||
MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext());
|
||||
allocation.handle = 4;
|
||||
allocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
allocation.setAllocationType(AllocationType::BUFFER);
|
||||
allocation.memoryPool = MemoryPool::System64KBPages;
|
||||
allocation.getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly = 0;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -15,7 +15,7 @@ namespace NEO {
|
||||
class MockWddmAllocation : public WddmAllocation {
|
||||
public:
|
||||
MockWddmAllocation(GmmClientContext *gmmClientContext) : MockWddmAllocation(gmmClientContext, EngineLimits::maxHandleCount) {}
|
||||
MockWddmAllocation(GmmClientContext *gmmClientContext, uint32_t numGmms) : WddmAllocation(0, numGmms, GraphicsAllocation::AllocationType::UNKNOWN,
|
||||
MockWddmAllocation(GmmClientContext *gmmClientContext, uint32_t numGmms) : WddmAllocation(0, numGmms, AllocationType::UNKNOWN,
|
||||
nullptr, 0, nullptr, MemoryPool::MemoryNull, 0u, 3u),
|
||||
gpuPtr(gpuAddress), handle(handles[0]) {
|
||||
for (uint32_t i = 0; i < numGmms; i++) {
|
||||
|
@ -92,7 +92,7 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerAndCompressedResourceWhenMappingGpu
|
||||
mockGmmRes->setUnifiedAuxTranslationCapable();
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x100);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, fakePtr, 0x2100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, fakePtr, 0x2100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
allocation.getHandleToModify(0u) = ALLOCATION_HANDLE;
|
||||
|
||||
@ -245,7 +245,7 @@ TEST_F(Wddm20Tests, whenInitPrivateDataThenDefaultValuesAreSet) {
|
||||
|
||||
TEST_F(Wddm20Tests, WhenCreatingAllocationAndDestroyingAllocationThenCorrectResultReturned) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
@ -269,7 +269,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz
|
||||
size_t underlyingPages = underlyingSize / MemoryConstants::pageSize;
|
||||
size_t alignedPages = alignedSize / MemoryConstants::pageSize;
|
||||
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, ptr, 0x2100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, ptr, 0x2100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmClientContext());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
@ -311,7 +311,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenReserveCallWhenItIsCalledWithProperParamt
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) {
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmClientContext()));
|
||||
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
@ -378,7 +378,7 @@ TEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocati
|
||||
|
||||
TEST_F(Wddm20Tests, WhenMappingAndFreeingGpuVaThenReturnIsCorrect) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
@ -404,7 +404,7 @@ TEST_F(Wddm20Tests, WhenMappingAndFreeingGpuVaThenReturnIsCorrect) {
|
||||
TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext()));
|
||||
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
@ -422,7 +422,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenCreateResourceFlagIsEnabled) {
|
||||
init();
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true, 1u);
|
||||
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmClientContext()));
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
auto status = wddm->createAllocation(&allocation);
|
||||
@ -439,7 +439,7 @@ TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenSharedHandl
|
||||
using WddmMemoryManager::WddmMemoryManager;
|
||||
};
|
||||
MemoryManagerCreate<MockWddmMemoryManager> memoryManager(false, false, *executionEnvironment);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true, 1u);
|
||||
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmClientContext()));
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
auto status = memoryManager.createGpuAllocationsWithRetry(&allocation);
|
||||
@ -448,7 +448,7 @@ TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenSharedHandl
|
||||
}
|
||||
|
||||
TEST(WddmAllocationTest, whenAllocationIsShareableThenSharedHandleToModifyIsSharedHandleOfAllocation) {
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true, 1u);
|
||||
auto sharedHandleToModify = allocation.getSharedHandleToModify();
|
||||
EXPECT_NE(nullptr, sharedHandleToModify);
|
||||
*sharedHandleToModify = 1234u;
|
||||
@ -456,14 +456,14 @@ TEST(WddmAllocationTest, whenAllocationIsShareableThenSharedHandleToModifyIsShar
|
||||
}
|
||||
|
||||
TEST(WddmAllocationTest, whenAllocationIsNotShareableThenItDoesntReturnSharedHandleToModify) {
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, false, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, false, 1u);
|
||||
auto sharedHandleToModify = allocation.getSharedHandleToModify();
|
||||
EXPECT_EQ(nullptr, sharedHandleToModify);
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, WhenMakingResidentAndEvictingThenReturnIsCorrect) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
@ -502,7 +502,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
MemoryManagerCreate<WddmMemoryManager> mm(false, false, *executionEnvironment);
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
|
||||
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, {});
|
||||
|
||||
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false, false);
|
||||
auto wddmAllocation = (WddmAllocation *)graphicsAllocation;
|
||||
@ -539,7 +539,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
MemoryManagerCreate<WddmMemoryManager> mm(false, false, *executionEnvironment);
|
||||
AllocationProperties properties(0, false, 4096, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
|
||||
AllocationProperties properties(0, false, 4096, AllocationType::SHARED_BUFFER, false, {});
|
||||
|
||||
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false, false);
|
||||
auto wddmAllocation = (WddmAllocation *)graphicsAllocation;
|
||||
@ -831,7 +831,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) {
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), fakePtr, 100, 0, false);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
|
||||
EXPECT_FALSE(wddm->createAllocation64k(&allocation));
|
||||
|
@ -60,7 +60,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenShareableAllocationWhenAllocateInDevice
|
||||
MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Error;
|
||||
AllocationData allocData;
|
||||
allocData.allFlags = 0;
|
||||
allocData.type = GraphicsAllocation::AllocationType::SVM_GPU;
|
||||
allocData.type = AllocationType::SVM_GPU;
|
||||
allocData.storageInfo.localOnlyRequired = true;
|
||||
allocData.size = MemoryConstants::pageSize;
|
||||
allocData.flags.allocateMemory = true;
|
||||
@ -87,7 +87,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenShareableAllocationWhenAllocateGraphics
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
|
||||
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(false, localMemoryEnabled, *executionEnvironment);
|
||||
AllocationProperties properties{mockRootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SVM_GPU, mockDeviceBitfield};
|
||||
AllocationProperties properties{mockRootDeviceIndex, MemoryConstants::pageSize, AllocationType::SVM_GPU, mockDeviceBitfield};
|
||||
properties.allFlags = 0;
|
||||
properties.size = MemoryConstants::pageSize;
|
||||
properties.flags.allocateMemory = true;
|
||||
@ -222,7 +222,7 @@ TEST_F(WddmMemoryManagerDevicePoolAlignmentTests, givenAtLeast2MbAllocationWhenA
|
||||
HWTEST_F(WddmMemoryManagerSimpleTest, givenLinearStreamWhenItIsAllocatedThenItIsInLocalMemoryHasCpuPointerAndHasStandardHeap64kbAsGpuAddress) {
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(false, true, *executionEnvironment);
|
||||
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties({mockRootDeviceIndex, 4096u, GraphicsAllocation::AllocationType::LINEAR_STREAM, mockDeviceBitfield});
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties({mockRootDeviceIndex, 4096u, AllocationType::LINEAR_STREAM, mockDeviceBitfield});
|
||||
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, graphicsAllocation->getMemoryPool());
|
||||
@ -250,7 +250,7 @@ HWTEST_F(WddmMemoryManagerSimpleTest, givenLinearStreamWhenItIsAllocatedThenItIs
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_EQ(graphicsAllocation->getAllocationType(), GraphicsAllocation::AllocationType::LINEAR_STREAM);
|
||||
EXPECT_EQ(graphicsAllocation->getAllocationType(), AllocationType::LINEAR_STREAM);
|
||||
|
||||
memoryManager->freeGraphicsMemory(graphicsAllocation);
|
||||
}
|
||||
@ -362,7 +362,7 @@ TEST_F(WddmMemoryManagerTest, givenLocalMemoryAllocationWhenCpuPointerNotMeetRes
|
||||
void *cpuPtr = reinterpret_cast<void *>(memoryManager->getAlignedMallocRestrictions()->minAddress - 0x1000);
|
||||
size_t size = 0x1000;
|
||||
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({mockRootDeviceIndex, size, GraphicsAllocation::AllocationType::BUFFER, mockDeviceBitfield}, cpuPtr));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({mockRootDeviceIndex, size, AllocationType::BUFFER, mockDeviceBitfield}, cpuPtr));
|
||||
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_FALSE(MemoryPool::isSystemMemoryPool(allocation->getMemoryPool()));
|
||||
@ -401,12 +401,12 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocationWithHighPriorityWhenMemoryIsA
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(false, localMemoryEnabled, *executionEnvironment);
|
||||
|
||||
GraphicsAllocation::AllocationType highPriorityTypes[] = {
|
||||
GraphicsAllocation::AllocationType::KERNEL_ISA,
|
||||
GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL,
|
||||
GraphicsAllocation::AllocationType::COMMAND_BUFFER,
|
||||
GraphicsAllocation::AllocationType::INTERNAL_HEAP,
|
||||
GraphicsAllocation::AllocationType::LINEAR_STREAM
|
||||
AllocationType highPriorityTypes[] = {
|
||||
AllocationType::KERNEL_ISA,
|
||||
AllocationType::KERNEL_ISA_INTERNAL,
|
||||
AllocationType::COMMAND_BUFFER,
|
||||
AllocationType::INTERNAL_HEAP,
|
||||
AllocationType::LINEAR_STREAM
|
||||
|
||||
};
|
||||
for (auto &allocationType : highPriorityTypes) {
|
||||
@ -439,7 +439,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocationWithoutHighPriorityWhenMemory
|
||||
allocData.allFlags = 0;
|
||||
allocData.size = MemoryConstants::pageSize;
|
||||
allocData.flags.allocateMemory = true;
|
||||
allocData.type = GraphicsAllocation::AllocationType::BUFFER;
|
||||
allocData.type = AllocationType::BUFFER;
|
||||
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryInDevicePool(allocData, status));
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
@ -501,8 +501,8 @@ TEST_F(WddmMemoryManagerSimpleTestWithLocalMemory, givenLocalMemoryAndImageOrSha
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
GraphicsAllocation::AllocationType types[] = {GraphicsAllocation::AllocationType::IMAGE,
|
||||
GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY};
|
||||
AllocationType types[] = {AllocationType::IMAGE,
|
||||
AllocationType::SHARED_RESOURCE_COPY};
|
||||
|
||||
AllocationData allocData;
|
||||
allocData.allFlags = 0;
|
||||
@ -526,7 +526,7 @@ using WddmMemoryManagerMultiHandleAllocationTest = WddmMemoryManagerSimpleTest;
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenSvmGpuAllocationWhenHostPtrProvidedThenUseHostPtrAsGpuVa) {
|
||||
size_t size = 2 * MemoryConstants::megaByte;
|
||||
AllocationProperties properties{mockRootDeviceIndex, false, size, GraphicsAllocation::AllocationType::SVM_GPU, false, mockDeviceBitfield};
|
||||
AllocationProperties properties{mockRootDeviceIndex, false, size, AllocationType::SVM_GPU, false, mockDeviceBitfield};
|
||||
properties.alignment = size;
|
||||
void *svmPtr = reinterpret_cast<void *>(2 * size);
|
||||
memoryManager->localMemorySupported[properties.rootDeviceIndex] = true;
|
||||
@ -601,10 +601,10 @@ TEST_F(WddmMemoryManagerSimpleTest, given32BitAllocationOfBufferWhenItIsAllocate
|
||||
GTEST_SKIP();
|
||||
}
|
||||
REQUIRE_SVM_OR_SKIP(defaultHwInfo);
|
||||
GraphicsAllocation::AllocationType allocationTypes[] = {GraphicsAllocation::AllocationType::BUFFER,
|
||||
GraphicsAllocation::AllocationType::SHARED_BUFFER,
|
||||
GraphicsAllocation::AllocationType::SCRATCH_SURFACE,
|
||||
GraphicsAllocation::AllocationType::PRIVATE_SURFACE};
|
||||
AllocationType allocationTypes[] = {AllocationType::BUFFER,
|
||||
AllocationType::SHARED_BUFFER,
|
||||
AllocationType::SCRATCH_SURFACE,
|
||||
AllocationType::PRIVATE_SURFACE};
|
||||
|
||||
for (auto &allocationType : allocationTypes) {
|
||||
size_t size = 2 * MemoryConstants::kiloByte;
|
||||
|
@ -121,15 +121,15 @@ TEST(WddmAllocationTest, givenRequestedContextIdTooLargeWhenGettingTrimCandidate
|
||||
}
|
||||
|
||||
TEST(WddmAllocationTest, givenAllocationTypeWhenPassedToWddmAllocationConstructorThenAllocationTypeIsStored) {
|
||||
WddmAllocation allocation{0, GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, 0, nullptr, MemoryPool::MemoryNull, 0u, 1u};
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::COMMAND_BUFFER, allocation.getAllocationType());
|
||||
WddmAllocation allocation{0, AllocationType::COMMAND_BUFFER, nullptr, 0, nullptr, MemoryPool::MemoryNull, 0u, 1u};
|
||||
EXPECT_EQ(AllocationType::COMMAND_BUFFER, allocation.getAllocationType());
|
||||
}
|
||||
|
||||
TEST(WddmAllocationTest, givenMemoryPoolWhenPassedToWddmAllocationConstructorThenMemoryPoolIsStored) {
|
||||
WddmAllocation allocation{0, GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, 0, nullptr, MemoryPool::System64KBPages, 0u, 1u};
|
||||
WddmAllocation allocation{0, AllocationType::COMMAND_BUFFER, nullptr, 0, nullptr, MemoryPool::System64KBPages, 0u, 1u};
|
||||
EXPECT_EQ(MemoryPool::System64KBPages, allocation.getMemoryPool());
|
||||
|
||||
WddmAllocation allocation2{0, GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, 0, 0u, MemoryPool::SystemCpuInaccessible, 0u, 1u};
|
||||
WddmAllocation allocation2{0, AllocationType::COMMAND_BUFFER, nullptr, 0, 0u, MemoryPool::SystemCpuInaccessible, 0u, 1u};
|
||||
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation2.getMemoryPool());
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocate32BitGraphicsM
|
||||
void *ptr = reinterpret_cast<void *>(0x1001);
|
||||
auto size = MemoryConstants::pageSize;
|
||||
|
||||
auto allocation = memoryManager->allocate32BitGraphicsMemory(csr->getRootDeviceIndex(), size, ptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
auto allocation = memoryManager->allocate32BitGraphicsMemory(csr->getRootDeviceIndex(), size, ptr, AllocationType::BUFFER);
|
||||
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPagesWith32BitGpuAddressing, allocation->getMemoryPool());
|
||||
@ -272,7 +272,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWith64KBPagesDisabledWhenA
|
||||
}
|
||||
auto size = MemoryConstants::pageSize;
|
||||
|
||||
auto svmAllocation = memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY, mockDeviceBitfield});
|
||||
auto svmAllocation = memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), size, AllocationType::SVM_ZERO_COPY, mockDeviceBitfield});
|
||||
EXPECT_NE(nullptr, svmAllocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, svmAllocation->getMemoryPool());
|
||||
EXPECT_TRUE(svmAllocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
@ -286,7 +286,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWith64KBPagesEnabledWhenAl
|
||||
}
|
||||
auto size = MemoryConstants::pageSize;
|
||||
|
||||
auto svmAllocation = memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY, mockDeviceBitfield});
|
||||
auto svmAllocation = memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), size, AllocationType::SVM_ZERO_COPY, mockDeviceBitfield});
|
||||
EXPECT_NE(nullptr, svmAllocation);
|
||||
EXPECT_EQ(MemoryPool::System64KBPages, svmAllocation->getMemoryPool());
|
||||
memoryManager->freeGraphicsMemory(svmAllocation);
|
||||
@ -305,7 +305,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenCreateAllocationFromHa
|
||||
|
||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||
|
||||
AllocationProperties properties(0, false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
AllocationProperties properties(0, false, 0, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation->getMemoryPool());
|
||||
@ -325,8 +325,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocationPropertiesWhenCreateAllocatio
|
||||
|
||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||
|
||||
AllocationProperties propertiesBuffer(0, false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
AllocationProperties propertiesImage(0, false, 0, GraphicsAllocation::AllocationType::SHARED_IMAGE, false, false, 0);
|
||||
AllocationProperties propertiesBuffer(0, false, 0, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
AllocationProperties propertiesImage(0, false, 0, AllocationType::SHARED_IMAGE, false, false, 0);
|
||||
|
||||
AllocationProperties *propertiesArray[2] = {&propertiesBuffer, &propertiesImage};
|
||||
|
||||
@ -354,7 +354,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenCreateAllocationFromHandleAndMapCallFail
|
||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||
EXPECT_EQ(0u, memoryManager->freeGraphicsMemoryImplCalled);
|
||||
|
||||
AllocationProperties properties(0, false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
AllocationProperties properties(0, false, 0, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
|
||||
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
|
||||
EXPECT_EQ(nullptr, allocation);
|
||||
@ -417,7 +417,7 @@ TEST_F(WddmMemoryManagerSimpleTest, GivenShareableEnabledAndHugeSizeWhenAskedToC
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenZeroFenceValueOnSingleEngineRegisteredWhenHandleFenceCompletionIsCalledThenDoNotWaitOnCpu) {
|
||||
ASSERT_EQ(1u, memoryManager->getRegisteredEnginesCount());
|
||||
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER, mockDeviceBitfield}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, AllocationType::BUFFER, mockDeviceBitfield}));
|
||||
allocation->getResidencyData().updateCompletionData(0u, 0u);
|
||||
|
||||
memoryManager->handleFenceCompletion(allocation);
|
||||
@ -429,7 +429,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenZeroFenceValueOnSingleEngineRegisteredW
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSingleEngineRegisteredWhenHandleFenceCompletionIsCalledThenWaitOnCpuOnce) {
|
||||
ASSERT_EQ(1u, memoryManager->getRegisteredEnginesCount());
|
||||
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER, mockDeviceBitfield}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, AllocationType::BUFFER, mockDeviceBitfield}));
|
||||
auto fence = &static_cast<OsContextWin *>(memoryManager->getRegisteredEngines()[0].osContext)->getResidencyController().getMonitoredFence();
|
||||
allocation->getResidencyData().updateCompletionData(129u, 0u);
|
||||
|
||||
@ -461,7 +461,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegi
|
||||
osContext->ensureContextInitialized();
|
||||
ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount());
|
||||
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0u, 32, GraphicsAllocation::AllocationType::BUFFER, mockDeviceBitfield}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0u, 32, AllocationType::BUFFER, mockDeviceBitfield}));
|
||||
auto lastEngineFence = &static_cast<OsContextWin *>(osContext)->getResidencyController().getMonitoredFence();
|
||||
allocation->getResidencyData().updateCompletionData(129u, 0u);
|
||||
allocation->getResidencyData().updateCompletionData(152u, 1u);
|
||||
@ -494,7 +494,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSomeOfMultipleEngine
|
||||
PreemptionHelper::getDefaultPreemptionMode(*hwInfo), deviceBitfield));
|
||||
ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount());
|
||||
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0u, 32, GraphicsAllocation::AllocationType::BUFFER, mockDeviceBitfield}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0u, 32, AllocationType::BUFFER, mockDeviceBitfield}));
|
||||
auto lastEngineFence = &static_cast<OsContextWin *>(memoryManager->getRegisteredEngines()[0].osContext)->getResidencyController().getMonitoredFence();
|
||||
allocation->getResidencyData().updateCompletionData(129u, 0u);
|
||||
allocation->getResidencyData().updateCompletionData(0, 1u);
|
||||
@ -604,7 +604,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, mockDeviceBitfield);
|
||||
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, mockDeviceBitfield);
|
||||
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(gpuAllocation);
|
||||
@ -626,7 +626,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestr
|
||||
|
||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||
|
||||
AllocationProperties properties(0, false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
AllocationProperties properties(0, false, 0, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
|
||||
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(1, properties, false, false);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
@ -647,12 +647,12 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCall
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast<void *>(1), 0, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast<void *>(1), 0, AllocationType::SHARED_IMAGE);
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(gpuAllocation);
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
EXPECT_EQ(NT_RESOURCE_HANDLE, wddmAlloc->resourceHandle);
|
||||
EXPECT_EQ(NT_ALLOCATION_HANDLE, wddmAlloc->getDefaultHandle());
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::SHARED_IMAGE, wddmAlloc->getAllocationType());
|
||||
EXPECT_EQ(AllocationType::SHARED_IMAGE, wddmAlloc->getAllocationType());
|
||||
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
@ -681,7 +681,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndRequireSpecificBitness
|
||||
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, true, false);
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
@ -704,7 +704,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndNotRequiredSpecificBit
|
||||
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
|
||||
@ -724,7 +724,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandl
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
auto gpuAllocation = (WddmAllocation *)memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
|
||||
EXPECT_NE(nullptr, gpuAllocation);
|
||||
auto expectedDestroyHandle = gpuAllocation->resourceHandle;
|
||||
@ -746,7 +746,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShared
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
AllocationProperties properties(0, false, size, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
EXPECT_EQ(size, gpuAllocation->getUnderlyingBufferSize());
|
||||
@ -767,7 +767,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenAllocateGraphicsMemory
|
||||
rootDeviceEnvironment->executionEnvironment.initializeMemoryManager();
|
||||
memoryManager->allocateGraphicsMemoryInNonDevicePool = true;
|
||||
|
||||
MockAllocationProperties properties = {mockRootDeviceIndex, true, size, GraphicsAllocation::AllocationType::BUFFER, mockDeviceBitfield};
|
||||
MockAllocationProperties properties = {mockRootDeviceIndex, true, size, AllocationType::BUFFER, mockDeviceBitfield};
|
||||
properties.flags.preferCompressed = true;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, ptr);
|
||||
@ -797,7 +797,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenAllocateGraphicsMemory
|
||||
|
||||
auto memoryManager = std::make_unique<MockWddmMemoryManager>(false, false, *executionEnvironment);
|
||||
memoryManager->allocateGraphicsMemoryInNonDevicePool = true;
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{mockRootDeviceIndex, true, size, GraphicsAllocation::AllocationType::BUFFER, mockDeviceBitfield}, ptr);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{mockRootDeviceIndex, true, size, AllocationType::BUFFER, mockDeviceBitfield}, ptr);
|
||||
|
||||
auto gfxPartition = memoryManager->getGfxPartition(mockRootDeviceIndex);
|
||||
D3DGPU_VIRTUAL_ADDRESS svmRangeMinimumAddress = gfxPartition->getHeapMinimalAddress(HeapIndex::HEAP_SVM);
|
||||
@ -824,7 +824,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFa
|
||||
|
||||
wddm->failOpenSharedHandle = true;
|
||||
|
||||
AllocationProperties properties(0, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
AllocationProperties properties(0, false, size, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
|
||||
EXPECT_EQ(nullptr, gpuAllocation);
|
||||
}
|
||||
@ -1043,7 +1043,7 @@ TEST_F(WddmMemoryManagerTest, GivenAlignedPointerWhenAllocate32BitMemoryThenGmmC
|
||||
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
|
||||
uint32_t size = 4096;
|
||||
void *ptr = reinterpret_cast<void *>(4096);
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, size, ptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, size, ptr, AllocationType::BUFFER);
|
||||
EXPECT_EQ(ptr, reinterpret_cast<void *>(gpuAllocation->getDefaultGmm()->resourceParams.pExistingSysMem));
|
||||
EXPECT_EQ(size, gpuAllocation->getDefaultGmm()->resourceParams.ExistingSysMemSize);
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
@ -1053,7 +1053,7 @@ TEST_F(WddmMemoryManagerTest, GivenUnAlignedPointerAndSizeWhenAllocate32BitMemor
|
||||
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
|
||||
uint32_t size = 0x1001;
|
||||
void *ptr = reinterpret_cast<void *>(0x1001);
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, size, ptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, size, ptr, AllocationType::BUFFER);
|
||||
EXPECT_EQ(reinterpret_cast<void *>(0x1000), reinterpret_cast<void *>(gpuAllocation->getDefaultGmm()->resourceParams.pExistingSysMem));
|
||||
EXPECT_EQ(0x2000, gpuAllocation->getDefaultGmm()->resourceParams.ExistingSysMemSize);
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
@ -1081,7 +1081,7 @@ TEST_F(WddmMemoryManagerTest, GivenBitnessWhenGettingMaxAddressThenCorrectAddres
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, GivenNullptrWhenAllocating32BitMemoryThenAddressIsCorrect) {
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, 3 * MemoryConstants::pageSize, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, 3 * MemoryConstants::pageSize, nullptr, AllocationType::BUFFER);
|
||||
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
EXPECT_LT(GmmHelper::canonize(memoryManager->getGfxPartition(0)->getHeapBase(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress());
|
||||
@ -1092,7 +1092,7 @@ TEST_F(WddmMemoryManagerTest, GivenNullptrWhenAllocating32BitMemoryThenAddressIs
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, given32BitAllocationWhenItIsCreatedThenItHasNonZeroGpuAddressToPatch) {
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, 3 * MemoryConstants::pageSize, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, 3 * MemoryConstants::pageSize, nullptr, AllocationType::BUFFER);
|
||||
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
EXPECT_NE(0llu, gpuAllocation->getGpuAddressToPatch());
|
||||
@ -1105,7 +1105,7 @@ TEST_F(WddmMemoryManagerTest, GivenMisalignedHostPtrWhenAllocating32BitMemoryThe
|
||||
size_t misalignedSize = 0x2500;
|
||||
void *misalignedPtr = reinterpret_cast<void *>(0x12500);
|
||||
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, misalignedSize, misalignedPtr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, misalignedSize, misalignedPtr, AllocationType::BUFFER);
|
||||
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
|
||||
@ -1124,7 +1124,7 @@ TEST_F(WddmMemoryManagerTest, GivenMisalignedHostPtrWhenAllocating32BitMemoryThe
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, WhenAllocating32BitMemoryThenGpuBaseAddressIsCannonized) {
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, 3 * MemoryConstants::pageSize, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, 3 * MemoryConstants::pageSize, nullptr, AllocationType::BUFFER);
|
||||
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
|
||||
@ -1212,7 +1212,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV
|
||||
memoryManager->setDeferredDeleter(nullptr);
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER, ptr, size, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::BUFFER, ptr, size, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, allocation.getAlignedCpuPtr());
|
||||
EXPECT_FALSE(ret);
|
||||
@ -1228,7 +1228,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap
|
||||
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER, ptr, size, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::BUFFER, ptr, size, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, allocation.getAlignedCpuPtr());
|
||||
EXPECT_TRUE(ret);
|
||||
@ -1244,14 +1244,14 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAnd
|
||||
|
||||
setMapGpuVaFailConfigFcn(0, 2);
|
||||
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER, ptr, size, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation(0, AllocationType::BUFFER, ptr, size, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, allocation.getAlignedCpuPtr());
|
||||
EXPECT_FALSE(ret);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenNullPtrAndSizePassedToCreateInternalAllocationWhenCallIsMadeThenAllocationIsCreatedIn32BitHeapInternal) {
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, MemoryConstants::pageSize, nullptr, GraphicsAllocation::AllocationType::INTERNAL_HEAP));
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, MemoryConstants::pageSize, nullptr, AllocationType::INTERNAL_HEAP));
|
||||
ASSERT_NE(nullptr, wddmAllocation);
|
||||
EXPECT_EQ(wddmAllocation->getGpuBaseAddress(), GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(wddmAllocation->getRootDeviceIndex(), wddmAllocation->isAllocatedInLocalMemoryPool())));
|
||||
EXPECT_NE(nullptr, wddmAllocation->getUnderlyingBuffer());
|
||||
@ -1270,7 +1270,7 @@ TEST_F(WddmMemoryManagerTest, givenNullPtrAndSizePassedToCreateInternalAllocatio
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenPtrAndSizePassedToCreateInternalAllocationWhenCallIsMadeThenAllocationIsCreatedIn32BitHeapInternal) {
|
||||
auto ptr = reinterpret_cast<void *>(0x1000000);
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, MemoryConstants::pageSize, ptr, GraphicsAllocation::AllocationType::INTERNAL_HEAP));
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, MemoryConstants::pageSize, ptr, AllocationType::INTERNAL_HEAP));
|
||||
ASSERT_NE(nullptr, wddmAllocation);
|
||||
EXPECT_EQ(wddmAllocation->getGpuBaseAddress(), GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(rootDeviceIndex, wddmAllocation->isAllocatedInLocalMemoryPool())));
|
||||
EXPECT_EQ(ptr, wddmAllocation->getUnderlyingBuffer());
|
||||
@ -1637,7 +1637,7 @@ TEST_F(MockWddmMemoryManagerTest, givenEnabled64kbpagesWhenCreatingGraphicsMemor
|
||||
}
|
||||
EXPECT_EQ(0U, wddm->createAllocationResult.called);
|
||||
|
||||
GraphicsAllocation *galloc = memoryManager64k.allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, mockDeviceBitfield});
|
||||
GraphicsAllocation *galloc = memoryManager64k.allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize64k, AllocationType::BUFFER_HOST_MEMORY, mockDeviceBitfield});
|
||||
EXPECT_NE(0U, wddm->createAllocationResult.called);
|
||||
EXPECT_NE(nullptr, galloc);
|
||||
EXPECT_EQ(true, galloc->isLocked());
|
||||
@ -1704,7 +1704,7 @@ TEST_F(MockWddmMemoryManagerTest, givenAllocateGraphicsMemoryForBufferAndRequest
|
||||
|
||||
memoryManager.hugeGfxMemoryChunkSize = MemoryConstants::pageSize64k - MemoryConstants::pageSize;
|
||||
|
||||
WddmAllocation *wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize64k * 3, GraphicsAllocation::AllocationType::BUFFER, mockDeviceBitfield}));
|
||||
WddmAllocation *wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize64k * 3, AllocationType::BUFFER, mockDeviceBitfield}));
|
||||
EXPECT_NE(nullptr, wddmAlloc);
|
||||
EXPECT_EQ(4, wddmAlloc->getNumGmms());
|
||||
EXPECT_EQ(4, wddm->createAllocationResult.called);
|
||||
@ -1737,7 +1737,7 @@ TEST_F(MockWddmMemoryManagerTest, givenAllocateGraphicsMemoryForHostBufferAndReq
|
||||
memoryManager.hugeGfxMemoryChunkSize = MemoryConstants::pageSize64k - MemoryConstants::pageSize;
|
||||
|
||||
std::vector<uint8_t> hostPtr(MemoryConstants::pageSize64k * 3);
|
||||
AllocationProperties allocProps{rootDeviceIndex, MemoryConstants::pageSize64k * 3, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, mockDeviceBitfield};
|
||||
AllocationProperties allocProps{rootDeviceIndex, MemoryConstants::pageSize64k * 3, AllocationType::BUFFER_HOST_MEMORY, mockDeviceBitfield};
|
||||
allocProps.flags.allocateMemory = false;
|
||||
WddmAllocation *wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(allocProps, hostPtr.data()));
|
||||
|
||||
@ -1855,7 +1855,7 @@ TEST_F(MockWddmMemoryManagerTest, givenPageTableManagerWhenMapAuxGpuVaCalledThen
|
||||
engine.commandStreamReceiver->pageTableManager.reset(mockMngr);
|
||||
}
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(AllocationProperties(1, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, mockDeviceBitfield));
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(AllocationProperties(1, MemoryConstants::pageSize, AllocationType::INTERNAL_HOST_MEMORY, mockDeviceBitfield));
|
||||
|
||||
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
|
||||
expectedDdiUpdateAuxTable.BaseGpuVA = allocation->getGpuAddress();
|
||||
@ -1966,7 +1966,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedAllocationAndPageTableSupported
|
||||
engine.commandStreamReceiver->pageTableManager.reset(mockMngr);
|
||||
}
|
||||
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(AllocationProperties(1, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, mockDeviceBitfield)));
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(AllocationProperties(1, MemoryConstants::pageSize, AllocationType::INTERNAL_HOST_MEMORY, mockDeviceBitfield)));
|
||||
wddmAlloc->setGpuAddress(gpuVa);
|
||||
wddmAlloc->getDefaultGmm()->isCompressionEnabled = true;
|
||||
|
||||
@ -2223,7 +2223,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenDestroyingAllocationWithReservedGpuVirtu
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenAllocationWithReservedGpuVirtualAddressWhenMapCallFailsDuringCreateWddmAllocationThenReleasePreferredAddress) {
|
||||
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext(), 1);
|
||||
allocation.setAllocationType(GraphicsAllocation::AllocationType::KERNEL_ISA);
|
||||
allocation.setAllocationType(AllocationType::KERNEL_ISA);
|
||||
uint64_t gpuAddress = 0x123;
|
||||
uint64_t sizeForFree = 0x1234;
|
||||
allocation.reservedGpuVirtualAddress = gpuAddress;
|
||||
@ -2245,7 +2245,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMultiHandleAllocationAndPreferredGpuVaI
|
||||
|
||||
uint32_t numGmms = 10;
|
||||
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext(), numGmms);
|
||||
allocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
allocation.setAllocationType(AllocationType::BUFFER);
|
||||
allocation.storageInfo.multiStorage = true;
|
||||
|
||||
wddm->callBaseMapGpuVa = true;
|
||||
@ -2269,7 +2269,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenSvmCpuAllocationWhenSizeAndAlignmentPro
|
||||
}
|
||||
|
||||
size_t size = 2 * MemoryConstants::megaByte;
|
||||
MockAllocationProperties properties{csr->getRootDeviceIndex(), true, size, GraphicsAllocation::AllocationType::SVM_CPU, mockDeviceBitfield};
|
||||
MockAllocationProperties properties{csr->getRootDeviceIndex(), true, size, AllocationType::SVM_CPU, mockDeviceBitfield};
|
||||
properties.alignment = size;
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(properties));
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
@ -2291,7 +2291,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenWriteCombinedAllocationThenCpuAddressIs
|
||||
}
|
||||
memoryManager.reset(new MockWddmMemoryManager(true, true, *executionEnvironment));
|
||||
size_t size = 2 * MemoryConstants::megaByte;
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, size, GraphicsAllocation::AllocationType::WRITE_COMBINED, mockDeviceBitfield}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, size, AllocationType::WRITE_COMBINED, mockDeviceBitfield}));
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(size, allocation->getUnderlyingBufferSize());
|
||||
EXPECT_NE(nullptr, allocation->getUnderlyingBuffer());
|
||||
@ -2328,7 +2328,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenBufferHostMemoryAllocationAndLimitedRan
|
||||
|
||||
memoryManager.reset(new MockWddmMemoryManager(true, true, *executionEnvironment));
|
||||
size_t size = 2 * MemoryConstants::megaByte;
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, size, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, mockDeviceBitfield}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, size, AllocationType::BUFFER_HOST_MEMORY, mockDeviceBitfield}));
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(size, allocation->getUnderlyingBufferSize());
|
||||
EXPECT_NE(nullptr, allocation->getUnderlyingBuffer());
|
||||
@ -2346,7 +2346,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenDebugModuleAreaTypeWhenCreatingAllocati
|
||||
const auto size = MemoryConstants::pageSize64k;
|
||||
|
||||
NEO::AllocationProperties properties{0, true, size,
|
||||
NEO::GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA,
|
||||
NEO::AllocationType::DEBUG_MODULE_AREA,
|
||||
false,
|
||||
mockDeviceBitfield};
|
||||
|
||||
@ -2583,7 +2583,7 @@ class WddmMemoryManagerMock : public MockWddmMemoryManagerFixture, public ::test
|
||||
|
||||
TEST_F(WddmMemoryManagerMock, givenAllocationWithReservedGpuVirtualAddressWhenMapCallFailsDuringCreateWddmAllocationThenReleasePreferredAddress) {
|
||||
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext(), 4);
|
||||
allocation.setAllocationType(GraphicsAllocation::AllocationType::KERNEL_ISA);
|
||||
allocation.setAllocationType(AllocationType::KERNEL_ISA);
|
||||
uint64_t gpuAddress = 0x123;
|
||||
uint64_t sizeForFree = 0x1234;
|
||||
allocation.reservedGpuVirtualAddress = gpuAddress;
|
||||
@ -2639,7 +2639,7 @@ TEST_F(PlatformWithFourDevicesTest, whenCreateColoredAllocationAndWddmReturnsCan
|
||||
platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getMutableHardwareInfo()->featureTable.flags.ftrMultiTileArch = true;
|
||||
|
||||
GraphicsAllocation *allocation = nullptr;
|
||||
EXPECT_NO_THROW(allocation = memoryManager.allocateGraphicsMemoryWithProperties({mockRootDeviceIndex, true, 4 * MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::BUFFER, true, mockDeviceBitfield}));
|
||||
EXPECT_NO_THROW(allocation = memoryManager.allocateGraphicsMemoryWithProperties({mockRootDeviceIndex, true, 4 * MemoryConstants::pageSize64k, AllocationType::BUFFER, true, mockDeviceBitfield}));
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
|
||||
memoryManager.freeGraphicsMemory(allocation);
|
||||
@ -2660,7 +2660,7 @@ TEST_F(PlatformWithFourDevicesTest, givenDifferentAllocationSizesWhenColourAlloc
|
||||
|
||||
// We are allocating memory from 4 to 12 pages and want to check if remainders (1, 2 or 3 pages in case of 4 devices) are spread equally.
|
||||
for (int additionalSize = 0; additionalSize <= 8; additionalSize++) {
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties({mockRootDeviceIndex, true, (4 + additionalSize) * MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::BUFFER, true, 0b1111}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties({mockRootDeviceIndex, true, (4 + additionalSize) * MemoryConstants::pageSize64k, AllocationType::BUFFER, true, 0b1111}));
|
||||
auto handles = allocation->getNumGmms();
|
||||
|
||||
EXPECT_EQ(4u, handles);
|
||||
@ -2699,7 +2699,7 @@ TEST_F(PlatformWithFourDevicesTest, givenDifferentAllocationSizesWhenColourAlloc
|
||||
TEST_F(PlatformWithFourDevicesTest, whenCreateScratchSpaceInSingleTileQueueThenTheAllocationHasOneHandle) {
|
||||
MemoryManagerCreate<WddmMemoryManager> memoryManager(true, true, *platform()->peekExecutionEnvironment());
|
||||
|
||||
AllocationProperties properties{mockRootDeviceIndex, true, 1u, GraphicsAllocation::AllocationType::SCRATCH_SURFACE, false, false, mockDeviceBitfield};
|
||||
AllocationProperties properties{mockRootDeviceIndex, true, 1u, AllocationType::SCRATCH_SURFACE, false, false, mockDeviceBitfield};
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(properties));
|
||||
EXPECT_EQ(1u, allocation->getNumGmms());
|
||||
memoryManager.freeGraphicsMemory(allocation);
|
||||
|
@ -714,9 +714,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, GivenNumBytesToTrimIsNotZeroWhenTrimm
|
||||
}
|
||||
|
||||
TEST_F(WddmResidencyControllerWithGdiTest, GivenNumBytesToTrimIsZeroWhenTrimmingToBudgetThenEvictingStops) {
|
||||
WddmAllocation allocation1(0, GraphicsAllocation::AllocationType::UNKNOWN, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation2(0, GraphicsAllocation::AllocationType::UNKNOWN, reinterpret_cast<void *>(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation3(0, GraphicsAllocation::AllocationType::UNKNOWN, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation1(0, AllocationType::UNKNOWN, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation2(0, AllocationType::UNKNOWN, reinterpret_cast<void *>(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation3(0, AllocationType::UNKNOWN, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
|
||||
allocation1.getResidencyData().resident[osContextId] = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContextId);
|
||||
@ -814,8 +814,8 @@ TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, WhenTrimmingToBudgetT
|
||||
}
|
||||
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||
void *ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1000);
|
||||
WddmAllocation allocation1(0, GraphicsAllocation::AllocationType::UNKNOWN, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation2(0, GraphicsAllocation::AllocationType::UNKNOWN, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation1(0, AllocationType::UNKNOWN, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation2(0, AllocationType::UNKNOWN, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
|
||||
allocation1.getResidencyData().resident[osContextId] = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContextId);
|
||||
@ -873,9 +873,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, givenThreeAllocationsAlignedSizeBigge
|
||||
void *ptr2 = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x3000);
|
||||
void *ptr3 = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x5000);
|
||||
|
||||
WddmAllocation allocation1(0, GraphicsAllocation::AllocationType::UNKNOWN, ptr1, underlyingSize, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation2(0, GraphicsAllocation::AllocationType::UNKNOWN, ptr2, underlyingSize, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation3(0, GraphicsAllocation::AllocationType::UNKNOWN, ptr3, underlyingSize, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation1(0, AllocationType::UNKNOWN, ptr1, underlyingSize, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation2(0, AllocationType::UNKNOWN, ptr2, underlyingSize, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocation3(0, AllocationType::UNKNOWN, ptr3, underlyingSize, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
|
||||
allocation1.getResidencyData().resident[osContextId] = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContextId);
|
||||
@ -1086,7 +1086,7 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsAndTrimToB
|
||||
MockWddmAllocation allocation1(gmmClientContext);
|
||||
void *cpuPtr = reinterpret_cast<void *>(wddm->getWddmMinAddress() + 0x1000);
|
||||
size_t allocationSize = 0x1000;
|
||||
WddmAllocation allocationToTrim(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
WddmAllocation allocationToTrim(0, AllocationType::UNKNOWN, cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
|
||||
allocationToTrim.getResidencyData().updateCompletionData(residencyController->getMonitoredFence().lastSubmittedFence, osContext->getContextId());
|
||||
|
||||
|
Reference in New Issue
Block a user