ULT: Move Xe product specific tests shared

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-10-31 12:11:16 +00:00
committed by Compute-Runtime-Automation
parent 0f8489b5f8
commit 5d3b665ea0
15 changed files with 219 additions and 232 deletions

View File

@@ -6,9 +6,9 @@
set(IGDRCL_SRCS_tests_memory_manager
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/cl_memory_manager_allocate_in_preferred_pool_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cpu_page_fault_manager_memory_sync_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_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}/unified_memory_manager_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mem_obj_surface_tests.cpp

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/test/common/mocks/mock_gmm.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
#include "opencl/source/mem_obj/mem_obj_helper.h"
using namespace NEO;
TEST(MemoryManagerTest, givenEnabledLocalMemoryWhenAllocatingSharedResourceCopyThenLocalMemoryAllocationIsReturnedAndGpuAddresIsInStandard64kHeap) {
UltDeviceFactory deviceFactory{1, 0};
HardwareInfo localPlatformDevice = {};
localPlatformDevice = *defaultHwInfo;
localPlatformDevice.featureTable.flags.ftrLocalMemory = true;
auto executionEnvironment = std::unique_ptr<ExecutionEnvironment>(MockDevice::prepareExecutionEnvironment(&localPlatformDevice, 0u));
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
MockMemoryManager memoryManager(false, true, *executionEnvironment);
ImageDescriptor imgDesc = {};
imgDesc.imageWidth = 512;
imgDesc.imageHeight = 1;
imgDesc.imageType = ImageType::Image2D;
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, deviceFactory.rootDevices[0]);
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(mockRootDeviceIndex, imgInfo, true, memoryProperties, localPlatformDevice, mockDeviceBitfield, true);
allocProperties.allocationType = AllocationType::SHARED_RESOURCE_COPY;
auto allocation = memoryManager.allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
ASSERT_NE(nullptr, allocation);
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
auto gmmHelper = memoryManager.getGmmHelper(allocation->getRootDeviceIndex());
EXPECT_LT(gmmHelper->canonize(memoryManager.getGfxPartition(allocation->getRootDeviceIndex())->getHeapBase(HeapIndex::HEAP_STANDARD64KB)), allocation->getGpuAddress());
EXPECT_GT(gmmHelper->canonize(memoryManager.getGfxPartition(allocation->getRootDeviceIndex())->getHeapLimit(HeapIndex::HEAP_STANDARD64KB)), allocation->getGpuAddress());
EXPECT_EQ(0llu, allocation->getGpuBaseAddress());
memoryManager.freeGraphicsMemory(allocation);
}