mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 14:33:04 +08:00
Special address pool at External heap begining
Change-Id: I7da6e67010ff7a819aec25abea9213b6e43e348e Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
79498dee93
commit
e34c319ed7
@@ -7,6 +7,7 @@
|
||||
set(NEO_CORE_OS_INTERFACE_TESTS_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/drm_query_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_special_heap_test.cpp
|
||||
)
|
||||
|
||||
set_property(GLOBAL PROPERTY NEO_CORE_OS_INTERFACE_TESTS_LINUX ${NEO_CORE_OS_INTERFACE_TESTS_LINUX})
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/source/os_interface/linux/os_interface.h"
|
||||
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/unit_test/mocks/linux/mock_drm_memory_manager.h"
|
||||
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock.h"
|
||||
#include "test.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class DrmMemManagerFixture {
|
||||
public:
|
||||
struct FrontWindowMemManagerMock : public TestedDrmMemoryManager {
|
||||
using MemoryManager::allocate32BitGraphicsMemoryImpl;
|
||||
FrontWindowMemManagerMock(NEO::ExecutionEnvironment &executionEnvironment) : TestedDrmMemoryManager(executionEnvironment) {}
|
||||
void forceLimitedRangeAllocator(uint32_t rootDeviceIndex, uint64_t range) { getGfxPartition(rootDeviceIndex)->init(range, 0, 0, gfxPartitions.size(), true); }
|
||||
};
|
||||
|
||||
void SetUp() {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.UseExternalAllocatorForSshAndDsh.set(true);
|
||||
executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->get()->setDrm(new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]));
|
||||
memManager = std::unique_ptr<FrontWindowMemManagerMock>(new FrontWindowMemManagerMock(*executionEnvironment));
|
||||
}
|
||||
void TearDown() {
|
||||
}
|
||||
std::unique_ptr<FrontWindowMemManagerMock> memManager;
|
||||
std::unique_ptr<ExecutionEnvironment> executionEnvironment;
|
||||
};
|
||||
|
||||
using DrmFrontWindowPoolAllocatorTests = Test<DrmMemManagerFixture>;
|
||||
|
||||
TEST_F(DrmFrontWindowPoolAllocatorTests, givenAllocateInSpecialPoolFlagWhenDrmAllocate32BitGraphicsMemoryThenAllocateAtHeapBegining) {
|
||||
AllocationData allocData = {};
|
||||
allocData.flags.use32BitExtraPool = true;
|
||||
allocData.size = MemoryConstants::kiloByte;
|
||||
auto allocation = memManager->allocate32BitGraphicsMemoryImpl(allocData, false);
|
||||
EXPECT_EQ(allocation->getGpuBaseAddress(), allocation->getGpuAddress());
|
||||
memManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
} // namespace NEO
|
||||
@@ -11,6 +11,7 @@ set(NEO_CORE_OS_INTERFACE_TESTS_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gdi_interface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gdi_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_preemption_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_special_heap_test.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_tests.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/source/os_interface/windows/os_interface.h"
|
||||
#include "shared/test/unit_test/fixtures/device_fixture.h"
|
||||
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_memory_manager.h"
|
||||
#include "test.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class WddmMemManagerFixture {
|
||||
public:
|
||||
struct FrontWindowMemManagerMock : public MockWddmMemoryManager {
|
||||
using MemoryManager::allocate32BitGraphicsMemoryImpl;
|
||||
FrontWindowMemManagerMock(NEO::ExecutionEnvironment &executionEnvironment) : MockWddmMemoryManager(executionEnvironment) {}
|
||||
};
|
||||
|
||||
void SetUp() {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.UseExternalAllocatorForSshAndDsh.set(true);
|
||||
executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
auto wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->get()->getWddm());
|
||||
wddm->callBaseMapGpuVa = false;
|
||||
memManager = std::unique_ptr<FrontWindowMemManagerMock>(new FrontWindowMemManagerMock(*executionEnvironment));
|
||||
}
|
||||
void TearDown() {
|
||||
}
|
||||
std::unique_ptr<FrontWindowMemManagerMock> memManager;
|
||||
std::unique_ptr<ExecutionEnvironment> executionEnvironment;
|
||||
};
|
||||
|
||||
using WddmFrontWindowPoolAllocatorTests = Test<WddmMemManagerFixture>;
|
||||
|
||||
TEST_F(WddmFrontWindowPoolAllocatorTests, givenAllocateInFrontWindowPoolFlagWhenWddmAllocate32BitGraphicsMemoryThenAllocateAtHeapBegining) {
|
||||
AllocationData allocData = {};
|
||||
allocData.flags.use32BitExtraPool = true;
|
||||
allocData.size = MemoryConstants::kiloByte;
|
||||
auto allocation = memManager->allocate32BitGraphicsMemoryImpl(allocData, false);
|
||||
EXPECT_EQ(allocation->getGpuBaseAddress(), GmmHelper::canonize(allocation->getGpuAddress()));
|
||||
memManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user