Skip to content

Commit

Permalink
Move getDevices to a separate file
Browse files Browse the repository at this point in the history
Change-Id: Ia5ea548ce233d332a040fd3a50592da294d3d612
Signed-off-by: Filip Hazubski <[email protected]>
  • Loading branch information
fhazubski-Intel authored and Compute-Runtime-Automation committed Mar 6, 2019
1 parent a2c05a2 commit 880e891
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 9 deletions.
1 change: 1 addition & 0 deletions runtime/dll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ set(RUNTIME_SRCS_DLL_BASE
${CMAKE_CURRENT_SOURCE_DIR}/create_tbx_sockets.cpp
${CMAKE_CURRENT_SOURCE_DIR}/options.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source_level_debugger.cpp
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/get_devices.cpp

${IGDRCL_SOURCE_DIR}/runtime/api/api.cpp
${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/resource_info.cpp
Expand Down
7 changes: 0 additions & 7 deletions runtime/dll/create_command_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,12 @@
#include "runtime/command_stream/create_command_stream_impl.h"
#include "runtime/command_stream/device_command_stream.h"
#include "runtime/command_stream/tbx_command_stream_receiver.h"
#include "runtime/helpers/debug_helpers.h"
#include "runtime/helpers/hw_info.h"
#include "runtime/helpers/options.h"
#include "runtime/os_interface/device_factory.h"

namespace OCLRT {

CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo, ExecutionEnvironment &executionEnvironment) {
return createCommandStreamImpl(pHwInfo, executionEnvironment);
}

bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnviornment) {
return getDevicesImpl(hwInfo, numDevicesReturned, executionEnviornment);
}

} // namespace OCLRT
19 changes: 19 additions & 0 deletions runtime/dll/get_devices.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#include "runtime/command_stream/create_command_stream_impl.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/helpers/hw_info.h"
#include "runtime/os_interface/device_factory.h"

namespace OCLRT {

bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnviornment) {
return getDevicesImpl(hwInfo, numDevicesReturned, executionEnviornment);
}

} // namespace OCLRT
1 change: 1 addition & 0 deletions unit_tests/tbx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ add_executable(igdrcl_tbx_tests
${CMAKE_CURRENT_SOURCE_DIR}/tbx_tests_configuration.cpp
${IGDRCL_SOURCE_DIR}/runtime/aub/aub_stream_interface.cpp
${IGDRCL_SOURCE_DIR}/runtime/dll/create_command_stream.cpp
${IGDRCL_SOURCE_DIR}/runtime/dll${BRANCH_DIR_SUFFIX}/get_devices.cpp
${IGDRCL_SOURCE_DIR}/unit_tests/libult/os_interface.cpp
${IGDRCL_SOURCE_DIR}/unit_tests/options.cpp
$<TARGET_OBJECTS:igdrcl_libult>
Expand Down
6 changes: 4 additions & 2 deletions unit_tests/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ project(igdrcl_windows_dll_tests)

set(NEO_IGDRCL_WINDOWS_DLL_TESTS_TARGET_OBJECTS
$<TARGET_OBJECTS:igdrcl_libult>
$<TARGET_OBJECTS:igdrcl_libult_cs>
$<TARGET_OBJECTS:igdrcl_libult_env>
)

add_executable(igdrcl_windows_dll_tests
${NEO_IGDRCL_WINDOWS_DLL_TESTS_TARGET_OBJECTS}
${IGDRCL_SOURCE_DIR}/runtime/aub/aub_stream_interface.cpp
${IGDRCL_SOURCE_DIR}/runtime/dll/create_command_stream.cpp
${IGDRCL_SOURCE_DIR}/runtime/dll${BRANCH_DIR_SUFFIX}/get_devices.cpp
${IGDRCL_SOURCE_DIR}/runtime/dll/windows/os_interface.cpp
${IGDRCL_SOURCE_DIR}/runtime/os_interface/windows/wddm/wddm_create.cpp
${IGDRCL_SOURCE_DIR}/unit_tests/ult_configuration.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_create_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/get_devices_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/os_interface_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_create_tests.cpp
)

target_link_libraries(igdrcl_windows_dll_tests ${NEO_MOCKABLE_LIB_NAME} igdrcl_mocks gmock-gtest ${IGDRCL_EXTRA_LIBS})
Expand Down
25 changes: 25 additions & 0 deletions unit_tests/windows/get_devices_tests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#include "runtime/execution_environment/execution_environment.h"
#include "runtime/helpers/hw_info.h"
#include "test.h"

namespace OCLRT {
bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment);
} // namespace OCLRT

using GetDevicesTests = ::testing::Test;

HWTEST_F(GetDevicesTests, WhenGetDevicesIsCalledThenSuccessIsReturned) {
OCLRT::HardwareInfo *hwInfo;
size_t numDevicesReturned = 0;
OCLRT::ExecutionEnvironment executionEnviornment;

auto returnValue = OCLRT::getDevices(&hwInfo, numDevicesReturned, executionEnviornment);
EXPECT_EQ(true, returnValue);
}

0 comments on commit 880e891

Please sign in to comment.