2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2020-02-03 13:19:12 +01:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 15:20:22 +01:00
|
|
|
#include "opencl/test/unit_test/libult/create_command_stream.h"
|
2020-02-03 13:19:12 +01:00
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
|
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2020-02-24 01:01:38 +01:00
|
|
|
#include "shared/test/unit_test/helpers/default_hw_info.h"
|
|
|
|
|
#include "shared/test/unit_test/helpers/ult_hw_config.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2020-02-22 22:50:57 +01:00
|
|
|
#include "opencl/source/command_stream/aub_command_stream_receiver.h"
|
|
|
|
|
#include "opencl/source/command_stream/create_command_stream_impl.h"
|
|
|
|
|
#include "opencl/source/command_stream/tbx_command_stream_receiver.h"
|
2020-02-23 15:20:22 +01:00
|
|
|
#include "opencl/test/unit_test/libult/ult_command_stream_receiver.h"
|
2020-02-22 09:28:27 +01:00
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
#include <cassert>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
2018-02-14 13:48:31 +01:00
|
|
|
|
2019-10-29 08:01:53 +01:00
|
|
|
CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex) {
|
2020-02-18 13:29:30 +01:00
|
|
|
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
|
2019-08-06 18:01:26 +02:00
|
|
|
|
2020-02-03 13:19:12 +01:00
|
|
|
if (ultHwConfig.useHwCsr) {
|
2019-10-29 08:01:53 +01:00
|
|
|
return createCommandStreamImpl(executionEnvironment, rootDeviceIndex);
|
2019-08-06 18:01:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto funcCreate = commandStreamReceiverFactory[IGFX_MAX_CORE + hwInfo->platform.eRenderCoreFamily];
|
|
|
|
|
if (funcCreate) {
|
2019-10-29 08:01:53 +01:00
|
|
|
return funcCreate(false, executionEnvironment, rootDeviceIndex);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
2019-08-06 18:01:26 +02:00
|
|
|
return nullptr;
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
2019-05-06 12:33:44 +02:00
|
|
|
bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) {
|
2020-03-04 08:51:02 +01:00
|
|
|
if (executionEnvironment.rootDeviceEnvironments.size() == 0) {
|
|
|
|
|
executionEnvironment.prepareRootDeviceEnvironments(1u);
|
|
|
|
|
}
|
|
|
|
|
auto currentHwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
|
2020-01-30 09:36:05 +01:00
|
|
|
if (currentHwInfo->platform.eProductFamily == IGFX_UNKNOWN && currentHwInfo->platform.eRenderCoreFamily == IGFX_UNKNOWN_CORE) {
|
2020-03-04 08:51:02 +01:00
|
|
|
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(platformDevices[0]);
|
2020-01-30 09:36:05 +01:00
|
|
|
}
|
2020-02-03 13:19:12 +01:00
|
|
|
if (ultHwConfig.useMockedGetDevicesFunc) {
|
2020-02-18 14:39:59 +01:00
|
|
|
numDevicesReturned = DebugManager.flags.CreateMultipleRootDevices.get() != 0 ? DebugManager.flags.CreateMultipleRootDevices.get() : 1u;
|
2019-11-15 09:59:48 +01:00
|
|
|
executionEnvironment.prepareRootDeviceEnvironments(static_cast<uint32_t>(numDevicesReturned));
|
2020-03-04 08:51:02 +01:00
|
|
|
for (auto i = 0u; i < numDevicesReturned; i++) {
|
|
|
|
|
if (executionEnvironment.rootDeviceEnvironments[i]->getHardwareInfo() == nullptr ||
|
|
|
|
|
(executionEnvironment.rootDeviceEnvironments[i]->getHardwareInfo()->platform.eProductFamily == IGFX_UNKNOWN &&
|
|
|
|
|
executionEnvironment.rootDeviceEnvironments[i]->getHardwareInfo()->platform.eRenderCoreFamily == IGFX_UNKNOWN_CORE)) {
|
|
|
|
|
executionEnvironment.rootDeviceEnvironments[i]->setHwInfo(platformDevices[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-24 09:59:49 +01:00
|
|
|
executionEnvironment.calculateMaxOsContextCount();
|
2020-02-14 16:37:48 +01:00
|
|
|
executionEnvironment.initializeMemoryManager();
|
2020-02-03 13:19:12 +01:00
|
|
|
return ultHwConfig.mockedGetDevicesFuncResult;
|
2018-02-14 13:48:31 +01:00
|
|
|
}
|
2018-06-20 18:25:40 +02:00
|
|
|
|
2019-05-06 12:33:44 +02:00
|
|
|
return getDevicesImpl(numDevicesReturned, executionEnvironment);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|