Move tests to shared

memory manager allocate in device pool
storage info

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2022-03-16 17:02:01 +00:00 committed by Compute-Runtime-Automation
parent b03119b964
commit 14acaf677d
7 changed files with 31 additions and 42 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2018-2021 Intel Corporation
# Copyright (C) 2018-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@ -11,11 +11,9 @@ set(IGDRCL_SRCS_tests_memory_manager
${CMAKE_CURRENT_SOURCE_DIR}/internal_allocation_storage_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_multi_device_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_allocate_in_device_pool_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_allocate_in_preferred_pool_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/migraton_controller_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/surface_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/storage_info_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/unified_memory_manager_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/unified_memory_token_tests.cpp
)

View File

@ -12,11 +12,6 @@
using namespace NEO;
HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateInternalAllocationInDevicePoolThen32BitAllocationIsCreated, IGFX_XE_HP_SDV);
HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateKernelIsaInDevicePoolThenLocalMemoryPoolIsUsed, IGFX_XE_HP_SDV);
HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateInternalHeapInDevicePoolThenLocalMemoryPoolIsUsed, IGFX_XE_HP_SDV);
HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenLinearStreamIsAllocatedInDevicePoolThenLocalMemoryPoolIsUsed, IGFX_XE_HP_SDV);
using MemoryManagerTestsXeHP = ::testing::Test;
XEHPTEST_F(MemoryManagerTestsXeHP, givenEnabledLocalMemoryWhenLinearStreamIsAllocatedInPreferredPoolThenLocalMemoryPoolIsUsed) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());

View File

@ -12,10 +12,6 @@
using namespace NEO;
HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateInternalAllocationInDevicePoolThen32BitAllocationIsCreated, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateKernelIsaInDevicePoolThenLocalMemoryPoolIsUsed, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateInternalHeapInDevicePoolThenLocalMemoryPoolIsUsed, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenLinearStreamIsAllocatedInDevicePoolThenLocalMemoryPoolIsUsed, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(GetAllocationDataTestHw, givenLinearStreamTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(GetAllocationDataTestHw, givenLinearStreamWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(GetAllocationDataTestHw, givenKernelIsaTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested, IGFX_DG2);

View File

@ -8,3 +8,6 @@
#include "shared/test/common/test_macros/test.h"
HWTEST_EXCLUDE_PRODUCT(CommandEncodeStatesTest, givenSlmTotalSizeEqualZeroWhenDispatchingKernelThenSharedMemorySizeIsSetCorrectly, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateInternalAllocationInDevicePoolThen32BitAllocationIsCreated, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenLinearStreamIsAllocatedInDevicePoolThenLocalMemoryPoolIsUsed, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateKernelIsaInDevicePoolThenLocalMemoryPoolIsUsed, IGFX_DG2);

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2020-2021 Intel Corporation
# Copyright (C) 2020-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@ -13,12 +13,14 @@ target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/gfx_partition_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/graphics_allocation_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_usage_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_allocate_in_device_pool_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_pool_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/multi_graphics_allocation_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/page_table_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/physical_address_allocator_hw_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/physical_address_allocator_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/special_heap_pool_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/storage_info_tests.cpp
)
add_subdirectories()

View File

@ -8,6 +8,7 @@
#include "shared/source/aub/aub_helper.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/memory_properties_helpers.h"
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_device.h"
@ -17,12 +18,6 @@
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
#include "opencl/source/mem_obj/mem_obj_helper.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/ult_cl_device_factory.h"
using namespace NEO;
TEST(MemoryManagerTest, givenSetUseSytemMemoryWhenGraphicsAllocationInDevicePoolIsAllocatedThenNullptrIsReturned) {
@ -59,7 +54,8 @@ TEST(AllocationFlagsTest, givenAllocateMemoryFlagWhenGetAllocationFlagsIsCalledT
HardwareInfo hwInfo(*defaultHwInfo);
UltDeviceFactory deviceFactory{1, 0};
auto pDevice = deviceFactory.rootDevices[0];
MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, pDevice);
MemoryProperties memoryProperties{};
memoryProperties.pDevice = pDevice;
auto allocationProperties = MemoryPropertiesHelper::getAllocationProperties(0, memoryProperties, true, 0, AllocationType::BUFFER, false, hwInfo, {}, true);
EXPECT_TRUE(allocationProperties.flags.allocateMemory);
@ -68,26 +64,29 @@ TEST(AllocationFlagsTest, givenAllocateMemoryFlagWhenGetAllocationFlagsIsCalledT
}
TEST(UncacheableFlagsTest, givenUncachedResourceFlagWhenGetAllocationFlagsIsCalledThenUncacheableFlagIsCorrectlySet) {
cl_mem_flags_intel flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
UltDeviceFactory deviceFactory{1, 0};
auto pDevice = deviceFactory.rootDevices[0];
MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, flagsIntel, 0, pDevice);
MemoryProperties memoryProperties{};
memoryProperties.pDevice = pDevice;
memoryProperties.flags.locallyUncachedResource = true;
auto allocationFlags = MemoryPropertiesHelper::getAllocationProperties(
0, memoryProperties, false, 0, AllocationType::BUFFER, false, pDevice->getHardwareInfo(), {}, true);
EXPECT_TRUE(allocationFlags.flags.uncacheable);
flagsIntel = 0;
memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, flagsIntel, 0, pDevice);
memoryProperties.flags.locallyUncachedResource = false;
auto allocationFlags2 = MemoryPropertiesHelper::getAllocationProperties(
0, memoryProperties, false, 0, AllocationType::BUFFER, false, pDevice->getHardwareInfo(), {}, true);
EXPECT_FALSE(allocationFlags2.flags.uncacheable);
}
TEST(AllocationFlagsTest, givenReadOnlyResourceFlagWhenGetAllocationFlagsIsCalledThenFlushL3FlagsAreCorrectlySet) {
cl_mem_flags flags = CL_MEM_READ_ONLY;
UltDeviceFactory deviceFactory{1, 2};
auto pDevice = deviceFactory.rootDevices[0];
MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, pDevice);
MemoryProperties memoryProperties{};
memoryProperties.pDevice = pDevice;
memoryProperties.flags.readOnly = true;
auto allocationFlags =
MemoryPropertiesHelper::getAllocationProperties(
@ -95,7 +94,7 @@ TEST(AllocationFlagsTest, givenReadOnlyResourceFlagWhenGetAllocationFlagsIsCalle
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForRead);
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForWrite);
memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, pDevice);
memoryProperties.flags.readOnly = false;
auto allocationFlags2 = MemoryPropertiesHelper::getAllocationProperties(
0, memoryProperties, true, 0, AllocationType::BUFFER, false, pDevice->getHardwareInfo(), {}, false);
EXPECT_TRUE(allocationFlags2.flags.flushL3RequiredForRead);
@ -415,26 +414,24 @@ TEST(BaseMemoryManagerTest, givenSvmGpuAllocationTypeWhenAllocationSucceedThenRe
}
TEST(MemoryAllocationTest, givenMultiTileVisiblityWhenAskedForFlagsThenL3NeedsToBeFlushed) {
HardwareInfo hwInfo(*defaultHwInfo);
UltClDeviceFactory deviceFactory{1, 2};
auto pClDevice = deviceFactory.rootDevices[0];
auto context = std::make_unique<MockContext>(pClDevice);
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, &pClDevice->getDevice());
auto allocationFlags = MemoryPropertiesHelper::getAllocationProperties(0, memoryProperties, true, 0, AllocationType::BUFFER, false, hwInfo, {}, context->isSingleDeviceContext());
UltDeviceFactory deviceFactory{1, 2};
auto pDevice = deviceFactory.rootDevices[0];
MemoryProperties memoryProperties{};
memoryProperties.pDevice = pDevice;
auto allocationFlags = MemoryPropertiesHelper::getAllocationProperties(0, memoryProperties, true, 0, AllocationType::BUFFER, false, pDevice->getHardwareInfo(), {}, false);
EXPECT_TRUE(allocationFlags.flags.flushL3RequiredForRead);
EXPECT_TRUE(allocationFlags.flags.flushL3RequiredForWrite);
}
TEST(MemoryAllocationTest, givenMultiTileVisiblityAndUncachedWhenAskedForFlagsThenL3DoesNotNeedToBeFlushed) {
UltClDeviceFactory deviceFactory{1, 2};
auto pClDevice = deviceFactory.rootDevices[0];
auto context = std::make_unique<MockContext>(pClDevice);
cl_mem_flags_intel flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, flagsIntel, 0, &pClDevice->getDevice());
HardwareInfo hwInfo(*defaultHwInfo);
UltDeviceFactory deviceFactory{1, 2};
auto pDevice = deviceFactory.rootDevices[0];
MemoryProperties memoryProperties{};
memoryProperties.pDevice = pDevice;
memoryProperties.flags.locallyUncachedResource = true;
auto allocationFlags = MemoryPropertiesHelper::getAllocationProperties(
0, memoryProperties, true, 0, AllocationType::BUFFER, false, hwInfo, {}, context->isSingleDeviceContext());
0, memoryProperties, true, 0, AllocationType::BUFFER, false, pDevice->getHardwareInfo(), {}, false);
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForRead);
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForWrite);
}

View File

@ -19,8 +19,6 @@
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/cl_device/cl_device.h"
using namespace NEO;
struct MultiDeviceStorageInfoTest : public ::testing::Test {