mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add UltDeviceFactory
Change-Id: Ib35bb6132f69e887fad3db282d7c0206d35515b7 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
bb5df7afb9
commit
91b2758f05
@ -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}
|
||||
)
|
||||
|
33
opencl/test/unit_test/mocks/ult_cl_device_factory.cpp
Normal file
33
opencl/test/unit_test/mocks/ult_cl_device_factory.cpp
Normal 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();
|
||||
}
|
||||
}
|
27
opencl/test/unit_test/mocks/ult_cl_device_factory.h
Normal file
27
opencl/test/unit_test/mocks/ult_cl_device_factory.h
Normal 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
|
Reference in New Issue
Block a user