mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Add allocation type for Write Combined memory
Related-To: NEO-3392 Change-Id: I8c61b2ca2a25325d47095568703888688a2eb069 Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
931bd04a99
commit
09e87879db
@@ -86,6 +86,16 @@ TEST(MemoryManagerGetAlloctionDataTest, givenBufferCompressedTypeWhenAllocationD
|
||||
EXPECT_TRUE(allocData.flags.forcePin);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenWriteCombinedTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::WRITE_COMBINED, false);
|
||||
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
|
||||
EXPECT_TRUE(allocData.flags.forcePin);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenDefaultAllocationFlagsWhenAllocationDataIsQueriedThenAllocateMemoryIsFalse) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(false, 0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, false);
|
||||
@@ -151,7 +161,8 @@ static const GraphicsAllocation::AllocationType allocationTypesWith32BitAnd64KbP
|
||||
GraphicsAllocation::AllocationType::PRIVATE_SURFACE,
|
||||
GraphicsAllocation::AllocationType::PRINTF_SURFACE,
|
||||
GraphicsAllocation::AllocationType::CONSTANT_SURFACE,
|
||||
GraphicsAllocation::AllocationType::GLOBAL_SURFACE};
|
||||
GraphicsAllocation::AllocationType::GLOBAL_SURFACE,
|
||||
GraphicsAllocation::AllocationType::WRITE_COMBINED};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Allow32BitAnd64kbPagesTypes,
|
||||
MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest,
|
||||
@@ -417,6 +428,14 @@ TEST(MemoryManagerTest, givenGlobalSurfaceTypeWhenGetAllocationDataIsCalledThenS
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenWriteCombinedTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::WRITE_COMBINED};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenDeviceQueueBufferTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
|
||||
@@ -1681,7 +1681,7 @@ TEST(MemoryManagerTest, givenAllocationTypesThatMayNeedL3FlushWhenCallingGetAllo
|
||||
GraphicsAllocation::AllocationType::PIPE, GraphicsAllocation::AllocationType::SHARED_IMAGE,
|
||||
GraphicsAllocation::AllocationType::SHARED_BUFFER, GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY,
|
||||
GraphicsAllocation::AllocationType::SVM_ZERO_COPY, GraphicsAllocation::AllocationType::SVM_GPU,
|
||||
GraphicsAllocation::AllocationType::SVM_CPU};
|
||||
GraphicsAllocation::AllocationType::SVM_CPU, GraphicsAllocation::AllocationType::WRITE_COMBINED};
|
||||
|
||||
MockMemoryManager mockMemoryManager;
|
||||
for (auto allocationType : allocationTypesThatMayNeedL3Flush) {
|
||||
|
||||
@@ -933,7 +933,8 @@ AllocationTypeTestCase allocationTypeValues[] = {
|
||||
{GraphicsAllocation::AllocationType::SVM_ZERO_COPY, "SVM_ZERO_COPY"},
|
||||
{GraphicsAllocation::AllocationType::TAG_BUFFER, "TAG_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, "TIMESTAMP_PACKET_TAG_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::UNKNOWN, "UNKNOWN"}};
|
||||
{GraphicsAllocation::AllocationType::UNKNOWN, "UNKNOWN"},
|
||||
{GraphicsAllocation::AllocationType::WRITE_COMBINED, "WRITE_COMBINED"}};
|
||||
|
||||
class AllocationTypeLogging : public ::testing::TestWithParam<AllocationTypeTestCase> {};
|
||||
|
||||
|
||||
@@ -1692,6 +1692,25 @@ TEST_F(WddmMemoryManagerSimpleTest, givenSvmCpuAllocationWhenSizeAndAlignmentPro
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenWriteCombinedAllocationThenCpuAddressIsEqualToGpuAddress) {
|
||||
if (is32bit) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
memoryManager.reset(new MockWddmMemoryManager(true, true, *executionEnvironment));
|
||||
size_t size = 2 * MemoryConstants::megaByte;
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({size, GraphicsAllocation::AllocationType::WRITE_COMBINED}));
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(size, allocation->getUnderlyingBufferSize());
|
||||
EXPECT_NE(nullptr, allocation->getUnderlyingBuffer());
|
||||
EXPECT_NE(nullptr, reinterpret_cast<void *>(allocation->getGpuAddress()));
|
||||
|
||||
if (executionEnvironment->isFullRangeSvm()) {
|
||||
EXPECT_EQ(allocation->getUnderlyingBuffer(), reinterpret_cast<void *>(allocation->getGpuAddress()));
|
||||
}
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, whenCreatingWddmMemoryManagerThenSupportsMultiStorageResourcesFlagIsSetToFalse) {
|
||||
EXPECT_TRUE(memoryManager->supportsMultiStorageResources);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user