mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Enable hw path in the memory manager multi device test
Resolves: NEO-4136 Change-Id: I95b1de2804b61516bda9d6eb76d30ea9752d0771 Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com> Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
c959f00212
commit
1d44699adb
15
opencl/test/unit_test/fixtures/linux/CMakeLists.txt
Normal file
15
opencl/test/unit_test/fixtures/linux/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(IGDRCL_SRCS_tests_fixtures_linux
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_allocator_multi_device_fixture_linux.cpp
|
||||
)
|
||||
if(UNIX)
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_fixtures_linux})
|
||||
endif()
|
||||
set_property(GLOBAL PROPERTY IGDRCL_SRCS_tests_fixtures_linux ${IGDRCL_SRCS_tests_fixtures_linux})
|
||||
add_subdirectories()
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/memory_allocator_multi_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/linux/mock_drm_memory_manager.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
void MemoryAllocatorMultiDeviceSystemSpecificFixture::SetUp(ExecutionEnvironment &executionEnvironment) {
|
||||
auto memoryManager = static_cast<TestedDrmMemoryManager *>(executionEnvironment.memoryManager.get());
|
||||
auto bufferObject = memoryManager->createSharedBufferObject(0u, 10, true, 0u);
|
||||
memoryManager->pushSharedBufferObject(bufferObject);
|
||||
}
|
||||
|
||||
void MemoryAllocatorMultiDeviceSystemSpecificFixture::TearDown(ExecutionEnvironment &executionEnvironment) {
|
||||
auto memoryManager = static_cast<TestedDrmMemoryManager *>(executionEnvironment.memoryManager.get());
|
||||
auto bufferObject = memoryManager->sharingBufferObjects.back();
|
||||
memoryManager->eraseSharedBufferObject(bufferObject);
|
||||
delete bufferObject;
|
||||
}
|
@ -7,20 +7,26 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/unit_test/helpers/ult_hw_config.h"
|
||||
|
||||
#include "opencl/source/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "opencl/test/unit_test/fixtures/memory_management_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/variable_backup.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
class MemoryAllocatorMultiDeviceSystemSpecificFixture {
|
||||
public:
|
||||
void SetUp(ExecutionEnvironment &executionEnvironment);
|
||||
void TearDown(ExecutionEnvironment &executionEnvironment);
|
||||
|
||||
std::unique_ptr<Gmm> gmm;
|
||||
};
|
||||
|
||||
template <uint32_t numRootDevices>
|
||||
class MemoryAllocatorMultiDeviceFixture : public MemoryManagementFixture, public ::testing::TestWithParam<bool> {
|
||||
class MemoryAllocatorMultiDeviceFixture : public MemoryManagementFixture, public MemoryAllocatorMultiDeviceSystemSpecificFixture, public ::testing::TestWithParam<bool> {
|
||||
public:
|
||||
void SetUp() override {
|
||||
MemoryManagementFixture::SetUp();
|
||||
@ -34,6 +40,16 @@ class MemoryAllocatorMultiDeviceFixture : public MemoryManagementFixture, public
|
||||
initPlatform();
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
memoryManager = executionEnvironment->memoryManager.get();
|
||||
|
||||
if (!isOsAgnosticMemoryManager) {
|
||||
MemoryAllocatorMultiDeviceSystemSpecificFixture::SetUp(*executionEnvironment);
|
||||
}
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
if (!isOsAgnosticMemoryManager) {
|
||||
MemoryAllocatorMultiDeviceSystemSpecificFixture::TearDown(*executionEnvironment);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t getNumRootDevices() { return numRootDevices; }
|
||||
|
15
opencl/test/unit_test/fixtures/windows/CMakeLists.txt
Normal file
15
opencl/test/unit_test/fixtures/windows/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(IGDRCL_SRCS_tests_fixtures_windows
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_allocator_multi_device_fixture_windows.cpp
|
||||
)
|
||||
if(WIN32)
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_fixtures_windows})
|
||||
endif()
|
||||
set_property(GLOBAL PROPERTY IGDRCL_SRCS_tests_fixtures_windows ${IGDRCL_SRCS_tests_fixtures_windows})
|
||||
add_subdirectories()
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/gmm_helper/resource_info.h"
|
||||
#include "shared/source/os_interface/windows/os_interface.h"
|
||||
#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/memory_allocator_multi_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mock_gdi/mock_gdi.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
void MemoryAllocatorMultiDeviceSystemSpecificFixture::SetUp(ExecutionEnvironment &executionEnvironment) {
|
||||
static D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
for (auto i = 0u; i < executionEnvironment.rootDeviceEnvironments.size(); i++) {
|
||||
gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[i]->getGmmClientContext(), nullptr, 0, false);
|
||||
auto wddm = static_cast<WddmMock *>(executionEnvironment.rootDeviceEnvironments[i]->osInterface->get()->getWddm());
|
||||
wddm->callBaseMapGpuVa = false;
|
||||
auto gdi = new MockGdi();
|
||||
wddm->resetGdi(gdi);
|
||||
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
|
||||
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
allocationInfo.hAllocation = ALLOCATION_HANDLE;
|
||||
allocationInfo.PrivateDriverDataSize = sizeof(GMM_RESOURCE_INFO);
|
||||
|
||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryAllocatorMultiDeviceSystemSpecificFixture::TearDown(ExecutionEnvironment &executionEnvironment) {}
|
Reference in New Issue
Block a user