Add UltDeviceFactory

Change-Id: Ib35bb6132f69e887fad3db282d7c0206d35515b7
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2020-04-02 10:37:59 +02:00
committed by sys_ocldev
parent bb5df7afb9
commit 91b2758f05
6 changed files with 137 additions and 0 deletions

View File

@ -91,6 +91,8 @@ set(IGDRCL_SRCS_tests_mocks
${CMAKE_CURRENT_SOURCE_DIR}/mock_tbx_csr.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_tbx_stream.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_timestamp_container.h
${CMAKE_CURRENT_SOURCE_DIR}/ult_cl_device_factory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ult_cl_device_factory.h
${NEO_SHARED_DIRECTORY}/gmm_helper/page_table_mngr_impl.cpp
${IGDRCL_SRCS_tests_compiler_mocks}
)

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/test/unit_test/mocks/ult_cl_device_factory.h"
#include "shared/test/unit_test/mocks/ult_device_factory.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
using namespace NEO;
UltClDeviceFactory::UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevicesCount) {
auto executionEnvironment = new ClExecutionEnvironment();
pUltDeviceFactory = std::make_unique<UltDeviceFactory>(rootDevicesCount, subDevicesCount, *executionEnvironment);
for (auto &pRootDevice : pUltDeviceFactory->rootDevices) {
auto pRootClDevice = new MockClDevice{pRootDevice};
for (auto &pClSubDevice : pRootClDevice->subDevices) {
subDevices.push_back(pClSubDevice.get());
}
rootDevices.push_back(pRootClDevice);
}
}
UltClDeviceFactory::~UltClDeviceFactory() {
for (auto &pClDevice : rootDevices) {
pClDevice->decRefInternal();
}
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <cstdint>
#include <memory>
#include <vector>
namespace NEO {
class ClDevice;
class MockClDevice;
struct UltDeviceFactory;
struct UltClDeviceFactory {
UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevicesCount);
~UltClDeviceFactory();
std::unique_ptr<UltDeviceFactory> pUltDeviceFactory;
std::vector<MockClDevice *> rootDevices;
std::vector<ClDevice *> subDevices;
};
} // namespace NEO