2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-02-07 22:09:27 +08:00
|
|
|
* Copyright (C) 2017-2019 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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
2018-02-28 23:52:08 +08:00
|
|
|
#include "runtime/device/device.h"
|
2019-03-19 22:09:33 +08:00
|
|
|
#include "runtime/helpers/device_helpers.h"
|
2018-06-20 17:19:55 +08:00
|
|
|
#include "runtime/os_interface/debug_settings_manager.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "runtime/os_interface/device_factory.h"
|
2018-03-23 17:49:30 +08:00
|
|
|
#include "runtime/os_interface/hw_info_config.h"
|
|
|
|
#include "runtime/os_interface/windows/os_interface.h"
|
2018-05-10 17:42:41 +08:00
|
|
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
2018-01-09 21:08:34 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT];
|
|
|
|
|
|
|
|
size_t DeviceFactory::numDevices = 0;
|
|
|
|
|
2019-05-06 18:33:44 +08:00
|
|
|
bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executionEnvironment) {
|
2018-06-20 17:19:55 +08:00
|
|
|
numDevices = 0;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-05-06 18:33:44 +08:00
|
|
|
auto hardwareInfo = executionEnvironment.getMutableHardwareInfo();
|
2019-04-10 17:51:45 +08:00
|
|
|
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
2019-07-08 19:30:31 +08:00
|
|
|
if (!wddm->init(*hardwareInfo)) {
|
2019-03-19 22:09:33 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-05-06 18:33:44 +08:00
|
|
|
auto totalDeviceCount = DeviceHelper::getDevicesCount(hardwareInfo);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-19 22:09:33 +08:00
|
|
|
executionEnvironment.osInterface.reset(new OSInterface());
|
|
|
|
executionEnvironment.osInterface->get()->setWddm(wddm.release());
|
2018-08-10 17:07:17 +08:00
|
|
|
|
2019-03-19 22:09:33 +08:00
|
|
|
numDevices = totalDeviceCount;
|
2018-06-20 17:19:55 +08:00
|
|
|
DeviceFactory::numDevices = numDevices;
|
2018-11-14 23:10:25 +08:00
|
|
|
|
2018-06-20 17:19:55 +08:00
|
|
|
return true;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void DeviceFactory::releaseDevices() {
|
|
|
|
DeviceFactory::numDevices = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Device::appendOSExtensions(std::string &deviceExtensions) {
|
|
|
|
deviceExtensions += "cl_intel_simultaneous_sharing ";
|
|
|
|
|
|
|
|
simultaneousInterops = {CL_GL_CONTEXT_KHR,
|
|
|
|
CL_WGL_HDC_KHR,
|
|
|
|
CL_CONTEXT_ADAPTER_D3D9_KHR,
|
|
|
|
CL_CONTEXT_D3D9_DEVICE_INTEL,
|
|
|
|
CL_CONTEXT_ADAPTER_D3D9EX_KHR,
|
|
|
|
CL_CONTEXT_D3D9EX_DEVICE_INTEL,
|
|
|
|
CL_CONTEXT_ADAPTER_DXVA_KHR,
|
|
|
|
CL_CONTEXT_DXVA_DEVICE_INTEL,
|
|
|
|
CL_CONTEXT_D3D10_DEVICE_KHR,
|
|
|
|
CL_CONTEXT_D3D11_DEVICE_KHR,
|
|
|
|
0};
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-01-09 21:08:34 +08:00
|
|
|
#endif
|