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