From 0e2dad1ffb9d699b71636e21b68b5030fabe9366 Mon Sep 17 00:00:00 2001 From: Maciej Plewka Date: Wed, 5 Feb 2020 11:49:26 +0100 Subject: [PATCH] Move device factory to core Change-Id: Ic98a75ed80fb9556465c9a6c93b1b1a9ba628200 Signed-off-by: Maciej Plewka --- core/os_interface/CMakeLists.txt | 2 ++ .../os_interface/device_factory.cpp | 0 .../os_interface/device_factory.h | 2 +- core/os_interface/linux/CMakeLists.txt | 1 + .../linux/device_factory_linux.cpp | 6 +--- core/os_interface/windows/CMakeLists.txt | 1 + .../windows/device_factory_win.cpp | 19 +---------- .../aub_memory_operations_handler_tests.h | 2 +- .../create_command_stream_impl.cpp | 2 +- runtime/dll/get_devices.cpp | 4 +-- .../execution_environment.h | 2 +- runtime/os_interface/CMakeLists.txt | 2 -- runtime/os_interface/linux/CMakeLists.txt | 2 +- .../linux/device_caps_init_linux.cpp | 14 ++++++++ runtime/os_interface/windows/CMakeLists.txt | 2 +- .../windows/device_caps_init_win.cpp | 33 +++++++++++++++++++ runtime/platform/platform.cpp | 2 +- .../command_stream/get_devices_tests.cpp | 2 +- .../tgllp/test_hw_info_config_tgllp.cpp | 2 +- .../helpers/execution_environment_helper.cpp | 2 +- unit_tests/mocks/mock_device_factory.h | 4 +-- .../os_interface/device_factory_tests.cpp | 2 +- .../os_interface/linux/device_factory_tests.h | 2 +- unit_tests/os_interface/linux/drm_tests.cpp | 2 +- .../windows/os_interface_win_tests.h | 2 +- unit_tests/windows/get_devices_tests.cpp | 2 +- 26 files changed, 72 insertions(+), 44 deletions(-) rename {runtime => core}/os_interface/device_factory.cpp (100%) rename {runtime => core}/os_interface/device_factory.h (92%) rename {runtime => core}/os_interface/linux/device_factory_linux.cpp (94%) rename {runtime => core}/os_interface/windows/device_factory_win.cpp (71%) create mode 100644 runtime/os_interface/linux/device_caps_init_linux.cpp create mode 100644 runtime/os_interface/windows/device_caps_init_win.cpp diff --git a/core/os_interface/CMakeLists.txt b/core/os_interface/CMakeLists.txt index 1fa1a1e816..370f024bbe 100644 --- a/core/os_interface/CMakeLists.txt +++ b/core/os_interface/CMakeLists.txt @@ -8,6 +8,8 @@ set(NEO_CORE_OS_INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/aub_memory_operations_handler.cpp ${CMAKE_CURRENT_SOURCE_DIR}/aub_memory_operations_handler.h + ${CMAKE_CURRENT_SOURCE_DIR}/device_factory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/device_factory.h ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.h ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.inl ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_bdw_plus.inl diff --git a/runtime/os_interface/device_factory.cpp b/core/os_interface/device_factory.cpp similarity index 100% rename from runtime/os_interface/device_factory.cpp rename to core/os_interface/device_factory.cpp diff --git a/runtime/os_interface/device_factory.h b/core/os_interface/device_factory.h similarity index 92% rename from runtime/os_interface/device_factory.h rename to core/os_interface/device_factory.h index d51c3303b0..5ffabc057d 100644 --- a/runtime/os_interface/device_factory.h +++ b/core/os_interface/device_factory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * diff --git a/core/os_interface/linux/CMakeLists.txt b/core/os_interface/linux/CMakeLists.txt index b53a213d8e..c6c2a95299 100644 --- a/core/os_interface/linux/CMakeLists.txt +++ b/core/os_interface/linux/CMakeLists.txt @@ -9,6 +9,7 @@ set(NEO_CORE_OS_INTERFACE_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/allocator_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/debug_env_reader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/debug_env_reader.h + ${CMAKE_CURRENT_SOURCE_DIR}/device_factory_linux.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drm_allocation.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drm_allocation.h ${CMAKE_CURRENT_SOURCE_DIR}/drm_buffer_object.cpp diff --git a/runtime/os_interface/linux/device_factory_linux.cpp b/core/os_interface/linux/device_factory_linux.cpp similarity index 94% rename from runtime/os_interface/linux/device_factory_linux.cpp rename to core/os_interface/linux/device_factory_linux.cpp index 9d588fded2..d5e391baa0 100644 --- a/runtime/os_interface/linux/device_factory_linux.cpp +++ b/core/os_interface/linux/device_factory_linux.cpp @@ -8,13 +8,12 @@ #include "core/debug_settings/debug_settings_manager.h" #include "core/execution_environment/root_device_environment.h" #include "core/helpers/hw_info.h" +#include "core/os_interface/device_factory.h" #include "core/os_interface/hw_info_config.h" #include "core/os_interface/linux/drm_memory_operations_handler.h" #include "core/os_interface/linux/drm_neo.h" #include "core/os_interface/linux/os_interface.h" -#include "runtime/device/cl_device.h" #include "runtime/execution_environment/execution_environment.h" -#include "runtime/os_interface/device_factory.h" #include "drm/i915_drm.h" @@ -63,7 +62,4 @@ void DeviceFactory::releaseDevices() { } DeviceFactory::numDevices = 0; } - -void ClDevice::initializeCaps() { -} } // namespace NEO diff --git a/core/os_interface/windows/CMakeLists.txt b/core/os_interface/windows/CMakeLists.txt index 3c30137ccf..75234d5237 100644 --- a/core/os_interface/windows/CMakeLists.txt +++ b/core/os_interface/windows/CMakeLists.txt @@ -16,6 +16,7 @@ set(NEO_CORE_OS_INTERFACE_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/debug_registry_reader.h ${CMAKE_CURRENT_SOURCE_DIR}/deferrable_deletion_win.cpp ${CMAKE_CURRENT_SOURCE_DIR}/deferrable_deletion_win.h + ${CMAKE_CURRENT_SOURCE_DIR}/device_factory_win.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface.h ${CMAKE_CURRENT_SOURCE_DIR}/kmdaf_listener${KMDAF_FILE_SUFFIX}.cpp diff --git a/runtime/os_interface/windows/device_factory_win.cpp b/core/os_interface/windows/device_factory_win.cpp similarity index 71% rename from runtime/os_interface/windows/device_factory_win.cpp rename to core/os_interface/windows/device_factory_win.cpp index ac023ab152..f40e907315 100644 --- a/runtime/os_interface/windows/device_factory_win.cpp +++ b/core/os_interface/windows/device_factory_win.cpp @@ -9,12 +9,11 @@ #include "core/debug_settings/debug_settings_manager.h" #include "core/execution_environment/root_device_environment.h" +#include "core/os_interface/device_factory.h" #include "core/os_interface/windows/os_interface.h" #include "core/os_interface/windows/wddm/wddm.h" #include "core/os_interface/windows/wddm_memory_operations_handler.h" -#include "runtime/device/cl_device.h" #include "runtime/device/device.h" -#include "runtime/os_interface/device_factory.h" namespace NEO { @@ -54,22 +53,6 @@ void DeviceFactory::releaseDevices() { DeviceFactory::numDevices = 0; } -void ClDevice::initializeCaps() { - device.appendOSExtensions("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}; -} - } // namespace NEO #endif diff --git a/core/unit_tests/os_interface/aub_memory_operations_handler_tests.h b/core/unit_tests/os_interface/aub_memory_operations_handler_tests.h index 9d8540d4ee..4c0670fd1f 100644 --- a/core/unit_tests/os_interface/aub_memory_operations_handler_tests.h +++ b/core/unit_tests/os_interface/aub_memory_operations_handler_tests.h @@ -9,8 +9,8 @@ #include "core/helpers/hw_info.h" #include "core/os_interface/aub_memory_operations_handler.h" +#include "core/os_interface/device_factory.h" #include "core/unit_tests/helpers/debug_manager_state_restore.h" -#include "runtime/os_interface/device_factory.h" #include "unit_tests/mocks/mock_graphics_allocation.h" #include "gtest/gtest.h" diff --git a/runtime/command_stream/create_command_stream_impl.cpp b/runtime/command_stream/create_command_stream_impl.cpp index 43436479ee..0453e32fb4 100644 --- a/runtime/command_stream/create_command_stream_impl.cpp +++ b/runtime/command_stream/create_command_stream_impl.cpp @@ -5,11 +5,11 @@ * */ +#include "core/os_interface/device_factory.h" #include "runtime/command_stream/aub_command_stream_receiver.h" #include "runtime/command_stream/command_stream_receiver_with_aub_dump.h" #include "runtime/command_stream/tbx_command_stream_receiver.h" #include "runtime/execution_environment/execution_environment.h" -#include "runtime/os_interface/device_factory.h" namespace NEO { diff --git a/runtime/dll/get_devices.cpp b/runtime/dll/get_devices.cpp index c7679e04f6..215550fff7 100644 --- a/runtime/dll/get_devices.cpp +++ b/runtime/dll/get_devices.cpp @@ -1,13 +1,13 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ +#include "core/os_interface/device_factory.h" #include "runtime/command_stream/create_command_stream_impl.h" #include "runtime/execution_environment/execution_environment.h" -#include "runtime/os_interface/device_factory.h" namespace NEO { diff --git a/runtime/execution_environment/execution_environment.h b/runtime/execution_environment/execution_environment.h index 9591cca811..1c9be7d05a 100644 --- a/runtime/execution_environment/execution_environment.h +++ b/runtime/execution_environment/execution_environment.h @@ -6,8 +6,8 @@ */ #pragma once +#include "core/os_interface/device_factory.h" #include "core/utilities/reference_tracked_object.h" -#include "runtime/os_interface/device_factory.h" #include #include diff --git a/runtime/os_interface/CMakeLists.txt b/runtime/os_interface/CMakeLists.txt index 371ada0e28..2281d4df74 100644 --- a/runtime/os_interface/CMakeLists.txt +++ b/runtime/os_interface/CMakeLists.txt @@ -6,8 +6,6 @@ set(RUNTIME_SRCS_OS_INTERFACE_BASE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - ${CMAKE_CURRENT_SOURCE_DIR}/device_factory.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/device_factory.h ${CMAKE_CURRENT_SOURCE_DIR}/metrics_library.cpp ${CMAKE_CURRENT_SOURCE_DIR}/metrics_library.h ${CMAKE_CURRENT_SOURCE_DIR}/ocl_reg_path.h diff --git a/runtime/os_interface/linux/CMakeLists.txt b/runtime/os_interface/linux/CMakeLists.txt index 7b9cf10f50..3abce8257a 100644 --- a/runtime/os_interface/linux/CMakeLists.txt +++ b/runtime/os_interface/linux/CMakeLists.txt @@ -9,7 +9,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/api_linux.cpp ${CMAKE_CURRENT_SOURCE_DIR}/d3d_sharing_functions.h ${CMAKE_CURRENT_SOURCE_DIR}/device_command_stream.inl - ${CMAKE_CURRENT_SOURCE_DIR}/device_factory_linux.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/device_caps_init_linux.cpp ${CMAKE_CURRENT_SOURCE_DIR}/driver_info.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drm_command_stream.h ${CMAKE_CURRENT_SOURCE_DIR}/drm_command_stream.inl diff --git a/runtime/os_interface/linux/device_caps_init_linux.cpp b/runtime/os_interface/linux/device_caps_init_linux.cpp new file mode 100644 index 0000000000..c0352402c0 --- /dev/null +++ b/runtime/os_interface/linux/device_caps_init_linux.cpp @@ -0,0 +1,14 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "runtime/device/cl_device.h" + +namespace NEO { + +void ClDevice::initializeCaps() { +} +} // namespace NEO diff --git a/runtime/os_interface/windows/CMakeLists.txt b/runtime/os_interface/windows/CMakeLists.txt index 18fc66de0c..0f1ab7ec3f 100644 --- a/runtime/os_interface/windows/CMakeLists.txt +++ b/runtime/os_interface/windows/CMakeLists.txt @@ -11,7 +11,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/d3d9_sharing_functions.cpp ${CMAKE_CURRENT_SOURCE_DIR}/d3d_sharing_functions.h ${CMAKE_CURRENT_SOURCE_DIR}/device_command_stream.inl - ${CMAKE_CURRENT_SOURCE_DIR}/device_factory_win.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/device_caps_init_win.cpp ${CMAKE_CURRENT_SOURCE_DIR}/driver_info.cpp ${CMAKE_CURRENT_SOURCE_DIR}/driver_info.h ${CMAKE_CURRENT_SOURCE_DIR}/environment_variables.h diff --git a/runtime/os_interface/windows/device_caps_init_win.cpp b/runtime/os_interface/windows/device_caps_init_win.cpp new file mode 100644 index 0000000000..21894fdcd8 --- /dev/null +++ b/runtime/os_interface/windows/device_caps_init_win.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#ifdef _WIN32 + +#include "runtime/device/cl_device.h" +#include "runtime/device/device.h" + +namespace NEO { + +void ClDevice::initializeCaps() { + device.appendOSExtensions("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}; +} + +} // namespace NEO + +#endif diff --git a/runtime/platform/platform.cpp b/runtime/platform/platform.cpp index 91a3252c99..045631ed46 100644 --- a/runtime/platform/platform.cpp +++ b/runtime/platform/platform.cpp @@ -15,6 +15,7 @@ #include "core/helpers/get_info.h" #include "core/helpers/hw_helper.h" #include "core/helpers/string.h" +#include "core/os_interface/device_factory.h" #include "core/os_interface/os_interface.h" #include "runtime/api/api.h" #include "runtime/command_stream/command_stream_receiver.h" @@ -24,7 +25,6 @@ #include "runtime/execution_environment/execution_environment.h" #include "runtime/gtpin/gtpin_notify.h" #include "runtime/helpers/built_ins_helper.h" -#include "runtime/os_interface/device_factory.h" #include "runtime/platform/extensions.h" #include "runtime/sharings/sharing_factory.h" #include "runtime/source_level_debugger/source_level_debugger.h" diff --git a/unit_tests/command_stream/get_devices_tests.cpp b/unit_tests/command_stream/get_devices_tests.cpp index 5fbee4e5bb..6fc9598adc 100644 --- a/unit_tests/command_stream/get_devices_tests.cpp +++ b/unit_tests/command_stream/get_devices_tests.cpp @@ -5,13 +5,13 @@ * */ +#include "core/os_interface/device_factory.h" #include "core/os_interface/hw_info_config.h" #include "core/unit_tests/helpers/debug_manager_state_restore.h" #include "core/unit_tests/helpers/ult_hw_config.h" #include "runtime/command_stream/command_stream_receiver.h" #include "runtime/execution_environment/execution_environment.h" #include "runtime/memory_manager/os_agnostic_memory_manager.h" -#include "runtime/os_interface/device_factory.h" #include "runtime/platform/platform.h" #include "test.h" #include "unit_tests/helpers/variable_backup.h" diff --git a/unit_tests/gen12lp/tgllp/test_hw_info_config_tgllp.cpp b/unit_tests/gen12lp/tgllp/test_hw_info_config_tgllp.cpp index 46653a28fe..fbb65f02ba 100644 --- a/unit_tests/gen12lp/tgllp/test_hw_info_config_tgllp.cpp +++ b/unit_tests/gen12lp/tgllp/test_hw_info_config_tgllp.cpp @@ -5,8 +5,8 @@ * */ +#include "core/os_interface/device_factory.h" #include "core/unit_tests/helpers/debug_manager_state_restore.h" -#include "runtime/os_interface/device_factory.h" #include "test.h" #include "unit_tests/mocks/mock_execution_environment.h" diff --git a/unit_tests/helpers/execution_environment_helper.cpp b/unit_tests/helpers/execution_environment_helper.cpp index 8562f45055..5e6d568c5a 100644 --- a/unit_tests/helpers/execution_environment_helper.cpp +++ b/unit_tests/helpers/execution_environment_helper.cpp @@ -7,8 +7,8 @@ #include "unit_tests/helpers/execution_environment_helper.h" +#include "core/os_interface/device_factory.h" #include "core/unit_tests/helpers/debug_manager_state_restore.h" -#include "runtime/os_interface/device_factory.h" #include "runtime/platform/platform.h" namespace NEO { diff --git a/unit_tests/mocks/mock_device_factory.h b/unit_tests/mocks/mock_device_factory.h index 62bb4703f2..876603ea51 100644 --- a/unit_tests/mocks/mock_device_factory.h +++ b/unit_tests/mocks/mock_device_factory.h @@ -1,12 +1,12 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once -#include "runtime/os_interface/device_factory.h" +#include "core/os_interface/device_factory.h" namespace NEO { class MockDeviceFactory : public DeviceFactory { diff --git a/unit_tests/os_interface/device_factory_tests.cpp b/unit_tests/os_interface/device_factory_tests.cpp index f2b337ddd9..6121e0722b 100644 --- a/unit_tests/os_interface/device_factory_tests.cpp +++ b/unit_tests/os_interface/device_factory_tests.cpp @@ -7,11 +7,11 @@ #include "core/helpers/hw_info.h" #include "core/memory_manager/memory_constants.h" +#include "core/os_interface/device_factory.h" #include "core/os_interface/os_interface.h" #include "core/os_interface/os_library.h" #include "core/unit_tests/helpers/debug_manager_state_restore.h" #include "runtime/execution_environment/execution_environment.h" -#include "runtime/os_interface/device_factory.h" #include "runtime/platform/platform.h" #include "unit_tests/mocks/mock_execution_environment.h" diff --git a/unit_tests/os_interface/linux/device_factory_tests.h b/unit_tests/os_interface/linux/device_factory_tests.h index b9b7d708a5..3456f86e86 100644 --- a/unit_tests/os_interface/linux/device_factory_tests.h +++ b/unit_tests/os_interface/linux/device_factory_tests.h @@ -7,8 +7,8 @@ #pragma once +#include "core/os_interface/device_factory.h" #include "runtime/device/device.h" -#include "runtime/os_interface/device_factory.h" #include "test.h" #include "unit_tests/mocks/mock_device_factory.h" #include "unit_tests/mocks/mock_execution_environment.h" diff --git a/unit_tests/os_interface/linux/drm_tests.cpp b/unit_tests/os_interface/linux/drm_tests.cpp index 272127e8fa..0c3d4b4174 100644 --- a/unit_tests/os_interface/linux/drm_tests.cpp +++ b/unit_tests/os_interface/linux/drm_tests.cpp @@ -6,9 +6,9 @@ */ #include "core/helpers/file_io.h" +#include "core/os_interface/device_factory.h" #include "core/os_interface/linux/os_context_linux.h" #include "core/os_interface/linux/os_interface.h" -#include "runtime/os_interface/device_factory.h" #include "unit_tests/fixtures/memory_management_fixture.h" #include "unit_tests/os_interface/linux/drm_mock.h" diff --git a/unit_tests/os_interface/windows/os_interface_win_tests.h b/unit_tests/os_interface/windows/os_interface_win_tests.h index 721d9d1cc4..6e4e8a8885 100644 --- a/unit_tests/os_interface/windows/os_interface_win_tests.h +++ b/unit_tests/os_interface/windows/os_interface_win_tests.h @@ -8,9 +8,9 @@ #pragma once #include "core/helpers/hw_info.h" +#include "core/os_interface/device_factory.h" #include "core/os_interface/windows/os_interface.h" #include "core/os_interface/windows/wddm/wddm.h" -#include "runtime/os_interface/device_factory.h" #include "gtest/gtest.h" diff --git a/unit_tests/windows/get_devices_tests.cpp b/unit_tests/windows/get_devices_tests.cpp index e0b92b2e80..f5791fbae8 100644 --- a/unit_tests/windows/get_devices_tests.cpp +++ b/unit_tests/windows/get_devices_tests.cpp @@ -6,8 +6,8 @@ */ #include "core/helpers/hw_info.h" +#include "core/os_interface/device_factory.h" #include "runtime/execution_environment/execution_environment.h" -#include "runtime/os_interface/device_factory.h" #include "runtime/platform/platform.h" #include "test.h"