diff --git a/opencl/test/unit_test/memory_manager/CMakeLists.txt b/opencl/test/unit_test/memory_manager/CMakeLists.txt index a943dd00fc..afdbbc0085 100644 --- a/opencl/test/unit_test/memory_manager/CMakeLists.txt +++ b/opencl/test/unit_test/memory_manager/CMakeLists.txt @@ -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 ) diff --git a/opencl/test/unit_test/xe_hp_core/xehp/memory_manager_tests_xehp.inl b/opencl/test/unit_test/xe_hp_core/xehp/memory_manager_tests_xehp.inl index 0f5e073622..b846cde330 100644 --- a/opencl/test/unit_test/xe_hp_core/xehp/memory_manager_tests_xehp.inl +++ b/opencl/test/unit_test/xe_hp_core/xehp/memory_manager_tests_xehp.inl @@ -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()); diff --git a/opencl/test/unit_test/xe_hpg_core/dg2/memory_manager_tests_dg2.cpp b/opencl/test/unit_test/xe_hpg_core/dg2/memory_manager_tests_dg2.cpp index 027a16cd80..d45758a4b5 100644 --- a/opencl/test/unit_test/xe_hpg_core/dg2/memory_manager_tests_dg2.cpp +++ b/opencl/test/unit_test/xe_hpg_core/dg2/memory_manager_tests_dg2.cpp @@ -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); diff --git a/shared/test/common/xe_hpg_core/dg2/excludes_dg2.cpp b/shared/test/common/xe_hpg_core/dg2/excludes_dg2.cpp index aa2ed2eeba..9f548c837d 100644 --- a/shared/test/common/xe_hpg_core/dg2/excludes_dg2.cpp +++ b/shared/test/common/xe_hpg_core/dg2/excludes_dg2.cpp @@ -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); diff --git a/shared/test/unit_test/memory_manager/CMakeLists.txt b/shared/test/unit_test/memory_manager/CMakeLists.txt index ae7a8ebb26..d140a1436c 100644 --- a/shared/test/unit_test/memory_manager/CMakeLists.txt +++ b/shared/test/unit_test/memory_manager/CMakeLists.txt @@ -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() diff --git a/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.cpp b/shared/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.cpp similarity index 94% rename from opencl/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.cpp rename to shared/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.cpp index 2d516baae2..cc1c3279a1 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.cpp +++ b/shared/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.cpp @@ -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(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(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); } diff --git a/opencl/test/unit_test/memory_manager/storage_info_tests.cpp b/shared/test/unit_test/memory_manager/storage_info_tests.cpp similarity index 99% rename from opencl/test/unit_test/memory_manager/storage_info_tests.cpp rename to shared/test/unit_test/memory_manager/storage_info_tests.cpp index 5db71bda67..7b99945dfb 100644 --- a/opencl/test/unit_test/memory_manager/storage_info_tests.cpp +++ b/shared/test/unit_test/memory_manager/storage_info_tests.cpp @@ -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 {