devices.m separation for Linux

Change-Id: Ia8e430db4dfcefc1b19e23e9cd7113bf87f0a7af
This commit is contained in:
Dunajski, Bartosz
2018-02-05 08:54:46 +01:00
committed by sys_ocldev
parent 6ef0581a02
commit bdee42ca16
13 changed files with 419 additions and 8 deletions

View File

@ -542,6 +542,7 @@ if(${GENERATE_EXECUTABLE})
${GMM_INCLUDE_PATHS}
${UMKM_SHAREDDATA_INCLUDE_PATHS}
${INSTRUMENTATION_INCLUDE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/dll/linux/devices${BRANCH_DIR_SUFFIX}
)
endif (WIN32)

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/dll/linux/devices/devices_base.m"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -81,6 +81,20 @@ DEVICE( IKBL_GT3_SERV_DEVICE_F0_ID, KBL_2x3x8, GTTYPE_GT3 )
DEVICE( IKBL_GT4_SERV_DEVICE_F0_ID, KBL_3x3x8, GTTYPE_GT4 )
DEVICE( IKBL_GT4_WRK_DEVICE_F0_ID, KBL_3x3x8, GTTYPE_GT4 )
#endif
#ifdef SUPPORT_CFL
DEVICE( ICFL_GT1_DT_DEVICE_F0_ID, CFL_1x2x6, GTTYPE_GT1 )
DEVICE( ICFL_GT1_S61_DT_DEVICE_F0_ID, CFL_1x2x6, GTTYPE_GT1 )
DEVICE( ICFL_GT1_S41_DT_DEVICE_F0_ID, CFL_1x2x6, GTTYPE_GT1 )
DEVICE( ICFL_GT2_DT_DEVICE_F0_ID, CFL_1x3x6, GTTYPE_GT2 )
DEVICE( ICFL_GT2_S62_DT_DEVICE_F0_ID, CFL_1x3x6, GTTYPE_GT2 )
DEVICE( ICFL_GT2_HALO_DEVICE_F0_ID, CFL_1x3x6, GTTYPE_GT2 )
DEVICE( ICFL_GT2_SERV_DEVICE_F0_ID, CFL_1x3x6, GTTYPE_GT2 )
DEVICE( ICFL_GT2_HALO_WS_DEVICE_F0_ID, CFL_1x3x6, GTTYPE_GT2 )
DEVICE( ICFL_GT2_S42_DT_DEVICE_F0_ID, CFL_1x3x6, GTTYPE_GT2 )
DEVICE( ICFL_GT3_ULT_15W_DEVICE_F0_ID, CFL_2x3x8, GTTYPE_GT3 )
DEVICE( ICFL_GT3_ULT_15W_42EU_DEVICE_F0_ID, CFL_2x3x8, GTTYPE_GT3 )
DEVICE( ICFL_GT3_ULT_DEVICE_F0_ID, CFL_2x3x8, GTTYPE_GT3 )
#endif
#ifdef SUPPORT_BXT
DEVICE(IBXT_P_3x6_DEVICE_ID, BXT_1x3x6, GTTYPE_GTA) //18EU APL
DEVICE(IBXT_P_12EU_3x6_DEVICE_ID, BXT_1x2x6, GTTYPE_GTA) //12EU APL

View File

@ -34,12 +34,7 @@
namespace OCLRT {
static struct DeviceDescriptor {
unsigned short deviceId;
const HardwareInfo *pHwInfo;
void (*setupGtSystemInfo)(GT_SYSTEM_INFO *);
GTTYPE eGtType;
} const DeviceDescriptorTable[] = {
const DeviceDescriptor deviceDescriptorTable[] = {
#define DEVICE(devId, gt, gtType) {devId, &gt::hwInfo, &gt::setupGtSystemInfo, gtType},
#include "devices.m"
#undef DEVICE
@ -177,7 +172,7 @@ Drm *Drm::create(int32_t deviceOrdinal) {
const DeviceDescriptor *device = nullptr;
GTTYPE eGtType = GTTYPE_UNDEFINED;
for (auto &d : DeviceDescriptorTable) {
for (auto &d : deviceDescriptorTable) {
if (drmObject->deviceId == d.deviceId) {
device = &d;
eGtType = d.eGtType;

View File

@ -30,6 +30,8 @@
#include <cerrno>
#include <string>
struct GT_SYSTEM_INFO;
namespace OCLRT {
#define I915_PRIVATE_PARAM_HAS_EXEC_FORCE_NON_COHERENT (-1)
@ -38,6 +40,16 @@ namespace OCLRT {
#define I915_CONTEXT_PRIVATE_PARAM_BOOST 0x80000000
class DeviceFactory;
struct HardwareInfo;
struct DeviceDescriptor {
unsigned short deviceId;
const HardwareInfo *pHwInfo;
void (*setupGtSystemInfo)(GT_SYSTEM_INFO *);
GTTYPE eGtType;
};
extern const DeviceDescriptor deviceDescriptorTable[];
class Drm {
friend DeviceFactory;

View File

@ -170,6 +170,7 @@ foreach(GEN_NUM RANGE 0 ${MAX_GEN} 1)
if(NOT MSVC)
list (APPEND IGDRCL_SRCS_tests ${IGDRCL_SRCS_tests_gen${GEN_NUM}_linux})
source_group("gen${GEN_NUM}\\linux" FILES ${IGDRCL_SRCS_tests_gen${GEN_NUM}_linux})
list (APPEND IGDRCL_SRCS_linux_dll_tests ${IGDRCL_SRCS_linux_dll_tests_gen${GEN_NUM}})
else(NOT MSVC)
list (APPEND IGDRCL_SRCS_tests ${IGDRCL_SRCS_tests_gen${GEN_NUM}_windows})
source_group("gen${GEN_NUM}\\windows" FILES ${IGDRCL_SRCS_tests_gen${GEN_NUM}_windows})
@ -266,6 +267,7 @@ else()
${KHRONOS_HEADERS_DIR}
${IGDRCL__IGC_INCLUDE_DIR}
${THIRD_PARTY_DIR}
${IGDRCL_SOURCE_DIR}/runtime/dll/linux/devices${BRANCH_DIR_SUFFIX}
)
target_include_directories(igdrcl_linux_dll_tests PRIVATE
${GTEST_INCLUDE_DIR}
@ -276,6 +278,7 @@ else()
${KHRONOS_HEADERS_DIR}
${IGDRCL__IGC_INCLUDE_DIR}
${THIRD_PARTY_DIR}
${IGDRCL_SOURCE_DIR}/runtime/dll/linux/devices${BRANCH_DIR_SUFFIX}
)
endif(MSVC)

View File

@ -44,6 +44,10 @@ if(NOT MSVC)
"${CMAKE_CURRENT_SOURCE_DIR}/linux/drm_mapper_tests.cpp"
PARENT_SCOPE
)
list(APPEND IGDRCL_SRCS_linux_dll_tests_gen8
${CMAKE_CURRENT_SOURCE_DIR}/linux/dll/device_id_tests.cpp
)
endif(NOT MSVC)
if(MSVC)
@ -51,4 +55,9 @@ if(MSVC)
"${CMAKE_CURRENT_SOURCE_DIR}/windows/wddm_mapper_tests.cpp"
PARENT_SCOPE
)
else()
set(IGDRCL_SRCS_linux_dll_tests_gen8
${IGDRCL_SRCS_linux_dll_tests_gen8}
PARENT_SCOPE
)
endif(MSVC)

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "hw_cmds.h"
#include "runtime/os_interface/linux/drm_neo.h"
#include "test.h"
#include <array>
using namespace OCLRT;
TEST(BdwDeviceIdTest, supportedDeviceId) {
std::array<DeviceDescriptor, 9> expectedDescriptors = {{
{IBDW_GT1_HALO_MOBL_DEVICE_F0_ID, &BDW_1x2x6::hwInfo, &BDW_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{IBDW_GT1_ULT_MOBL_DEVICE_F0_ID, &BDW_1x2x6::hwInfo, &BDW_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{IBDW_GT2_HALO_MOBL_DEVICE_F0_ID, &BDW_1x3x8::hwInfo, &BDW_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{IBDW_GT2_ULT_MOBL_DEVICE_F0_ID, &BDW_1x3x8::hwInfo, &BDW_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{IBDW_GT2_ULX_DEVICE_F0_ID, &BDW_1x3x8::hwInfo, &BDW_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{IBDW_GT3_HALO_MOBL_DEVICE_F0_ID, &BDW_2x3x8::hwInfo, &BDW_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{IBDW_GT3_ULT_MOBL_DEVICE_F0_ID, &BDW_2x3x8::hwInfo, &BDW_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{IBDW_GT3_SERV_DEVICE_F0_ID, &BDW_2x3x8::hwInfo, &BDW_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{IBDW_GT3_ULT25W_MOBL_DEVICE_F0_ID, &BDW_2x3x8::hwInfo, &BDW_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
}};
auto compareStructs = [](const DeviceDescriptor *first, const DeviceDescriptor *second) {
return first->deviceId == second->deviceId && first->pHwInfo == second->pHwInfo &&
first->setupGtSystemInfo == second->setupGtSystemInfo && first->eGtType == second->eGtType;
};
size_t startIndex = 0;
while (!compareStructs(&expectedDescriptors[0], &deviceDescriptorTable[startIndex]) &&
deviceDescriptorTable[startIndex].deviceId != 0) {
startIndex++;
};
EXPECT_NE(0u, deviceDescriptorTable[startIndex].deviceId);
for (auto &expected : expectedDescriptors) {
EXPECT_TRUE(compareStructs(&expected, &deviceDescriptorTable[startIndex]));
startIndex++;
}
}

View File

@ -57,6 +57,10 @@ if(TESTS_SKL)
${CMAKE_CURRENT_SOURCE_DIR}/skl/linux/hw_info_config_tests.cpp
PARENT_SCOPE
)
list(APPEND IGDRCL_SRCS_linux_dll_tests_gen9
${CMAKE_CURRENT_SOURCE_DIR}/skl/linux/dll/device_id_tests.cpp
)
endif(NOT MSVC)
endif()
@ -83,6 +87,10 @@ if(TESTS_CFL)
${CMAKE_CURRENT_SOURCE_DIR}/cfl/linux/hw_info_config_tests.cpp
PARENT_SCOPE
)
list(APPEND IGDRCL_SRCS_linux_dll_tests_gen9
${CMAKE_CURRENT_SOURCE_DIR}/cfl/linux/dll/device_id_tests.cpp
)
endif(NOT MSVC)
endif()
@ -97,6 +105,10 @@ if(TESTS_BXT)
${CMAKE_CURRENT_SOURCE_DIR}/bxt/linux/hw_info_config_tests.cpp
PARENT_SCOPE
)
list(APPEND IGDRCL_SRCS_linux_dll_tests_gen9
${CMAKE_CURRENT_SOURCE_DIR}/bxt/linux/dll/device_id_tests.cpp
)
endif(NOT MSVC)
endif()
@ -111,6 +123,10 @@ if(TESTS_KBL)
${CMAKE_CURRENT_SOURCE_DIR}/kbl/linux/hw_info_config_tests.cpp
PARENT_SCOPE
)
list(APPEND IGDRCL_SRCS_linux_dll_tests_gen9
${CMAKE_CURRENT_SOURCE_DIR}/kbl/linux/dll/device_id_tests.cpp
)
endif(NOT MSVC)
endif()
@ -120,4 +136,9 @@ if(MSVC)
"${CMAKE_CURRENT_SOURCE_DIR}/windows/os_interface_tests.cpp"
PARENT_SCOPE
)
else()
set(IGDRCL_SRCS_linux_dll_tests_gen9
${IGDRCL_SRCS_linux_dll_tests_gen9}
PARENT_SCOPE
)
endif(MSVC)

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "hw_cmds.h"
#include "runtime/os_interface/linux/drm_neo.h"
#include "test.h"
#include <array>
using namespace OCLRT;
TEST(BxtDeviceIdTest, supportedDeviceId) {
std::array<DeviceDescriptor, 2> expectedDescriptors = {{
{IBXT_P_3x6_DEVICE_ID, &BXT_1x3x6::hwInfo, &BXT_1x3x6::setupGtSystemInfo, GTTYPE_GTA},
{IBXT_P_12EU_3x6_DEVICE_ID, &BXT_1x2x6::hwInfo, &BXT_1x2x6::setupGtSystemInfo, GTTYPE_GTA},
}};
auto compareStructs = [](const DeviceDescriptor *first, const DeviceDescriptor *second) {
return first->deviceId == second->deviceId && first->pHwInfo == second->pHwInfo &&
first->setupGtSystemInfo == second->setupGtSystemInfo && first->eGtType == second->eGtType;
};
size_t startIndex = 0;
while (!compareStructs(&expectedDescriptors[0], &deviceDescriptorTable[startIndex]) &&
deviceDescriptorTable[startIndex].deviceId != 0) {
startIndex++;
};
EXPECT_NE(0u, deviceDescriptorTable[startIndex].deviceId);
for (auto &expected : expectedDescriptors) {
EXPECT_TRUE(compareStructs(&expected, &deviceDescriptorTable[startIndex]));
startIndex++;
}
}

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "hw_cmds.h"
#include "runtime/os_interface/linux/drm_neo.h"
#include "test.h"
#include <array>
using namespace OCLRT;
TEST(CflDeviceIdTest, supportedDeviceId) {
std::array<DeviceDescriptor, 12> expectedDescriptors = {{
{ICFL_GT1_DT_DEVICE_F0_ID, &CFL_1x2x6::hwInfo, &CFL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{ICFL_GT1_S61_DT_DEVICE_F0_ID, &CFL_1x2x6::hwInfo, &CFL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{ICFL_GT1_S41_DT_DEVICE_F0_ID, &CFL_1x2x6::hwInfo, &CFL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{ICFL_GT2_DT_DEVICE_F0_ID, &CFL_1x3x6::hwInfo, &CFL_1x3x6::setupGtSystemInfo, GTTYPE_GT2},
{ICFL_GT2_S62_DT_DEVICE_F0_ID, &CFL_1x3x6::hwInfo, &CFL_1x3x6::setupGtSystemInfo, GTTYPE_GT2},
{ICFL_GT2_HALO_DEVICE_F0_ID, &CFL_1x3x6::hwInfo, &CFL_1x3x6::setupGtSystemInfo, GTTYPE_GT2},
{ICFL_GT2_SERV_DEVICE_F0_ID, &CFL_1x3x6::hwInfo, &CFL_1x3x6::setupGtSystemInfo, GTTYPE_GT2},
{ICFL_GT2_HALO_WS_DEVICE_F0_ID, &CFL_1x3x6::hwInfo, &CFL_1x3x6::setupGtSystemInfo, GTTYPE_GT2},
{ICFL_GT2_S42_DT_DEVICE_F0_ID, &CFL_1x3x6::hwInfo, &CFL_1x3x6::setupGtSystemInfo, GTTYPE_GT2},
{ICFL_GT3_ULT_15W_DEVICE_F0_ID, &CFL_2x3x8::hwInfo, &CFL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{ICFL_GT3_ULT_15W_42EU_DEVICE_F0_ID, &CFL_2x3x8::hwInfo, &CFL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{ICFL_GT3_ULT_DEVICE_F0_ID, &CFL_2x3x8::hwInfo, &CFL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
}};
auto compareStructs = [](const DeviceDescriptor *first, const DeviceDescriptor *second) {
return first->deviceId == second->deviceId && first->pHwInfo == second->pHwInfo &&
first->setupGtSystemInfo == second->setupGtSystemInfo && first->eGtType == second->eGtType;
};
size_t startIndex = 0;
while (!compareStructs(&expectedDescriptors[0], &deviceDescriptorTable[startIndex]) &&
deviceDescriptorTable[startIndex].deviceId != 0) {
startIndex++;
};
EXPECT_NE(0u, deviceDescriptorTable[startIndex].deviceId);
for (auto &expected : expectedDescriptors) {
EXPECT_TRUE(compareStructs(&expected, &deviceDescriptorTable[startIndex]));
startIndex++;
}
}

View File

@ -0,0 +1,76 @@
/*
* Copyright (c) 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "hw_cmds.h"
#include "runtime/os_interface/linux/drm_neo.h"
#include "test.h"
#include <array>
using namespace OCLRT;
TEST(KblDeviceIdTest, supportedDeviceId) {
std::array<DeviceDescriptor, 25> expectedDescriptors = {{
{IKBL_GT1_ULT_DEVICE_F0_ID, &KBL_1x2x6::hwInfo, &KBL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{IKBL_GT1_5_ULT_DEVICE_F0_ID, &KBL_1x3x6::hwInfo, &KBL_1x3x6::setupGtSystemInfo, GTTYPE_GT1_5},
{IKBL_GT2_ULT_DEVICE_F0_ID, &KBL_1x3x8::hwInfo, &KBL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{IKBL_GT2F_ULT_DEVICE_F0_ID, &KBL_1x3x8::hwInfo, &KBL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{IKBL_GT3_15W_ULT_DEVICE_F0_ID, &KBL_2x3x8::hwInfo, &KBL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{IKBL_GT1_ULX_DEVICE_F0_ID, &KBL_1x3x6::hwInfo, &KBL_1x3x6::setupGtSystemInfo, GTTYPE_GT1},
{IKBL_GT1_5_ULX_DEVICE_F0_ID, &KBL_1x2x6::hwInfo, &KBL_1x2x6::setupGtSystemInfo, GTTYPE_GT1_5},
{IKBL_GT2_ULX_DEVICE_F0_ID, &KBL_1x3x8::hwInfo, &KBL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{IKBL_GT1_DT_DEVICE_F0_ID, &KBL_1x2x6::hwInfo, &KBL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{IKBL_GT2_R_ULT_DEVICE_F0_ID, &KBL_1x3x8::hwInfo, &KBL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{IKBL_GT2_DT_DEVICE_F0_ID, &KBL_1x3x8::hwInfo, &KBL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{IKBL_GT1_HALO_DEVICE_F0_ID, &KBL_1x2x6::hwInfo, &KBL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{IKBL_GT1F_HALO_DEVICE_F0_ID, &KBL_1x2x6::hwInfo, &KBL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{IKBL_GT2_HALO_DEVICE_F0_ID, &KBL_1x3x8::hwInfo, &KBL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{IKBL_GT4_HALO_DEVICE_F0_ID, &KBL_3x3x8::hwInfo, &KBL_3x3x8::setupGtSystemInfo, GTTYPE_GT4},
{IKBL_GT1_SERV_DEVICE_F0_ID, &KBL_1x2x6::hwInfo, &KBL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{IKBL_GT2_SERV_DEVICE_F0_ID, &KBL_1x3x8::hwInfo, &KBL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{IKBL_GT2_WRK_DEVICE_F0_ID, &KBL_1x3x8::hwInfo, &KBL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{IKBL_GT3_ULT_DEVICE_F0_ID, &KBL_2x3x8::hwInfo, &KBL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{IKBL_GT3_28W_ULT_DEVICE_F0_ID, &KBL_2x3x8::hwInfo, &KBL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{IKBL_GT4_DT_DEVICE_F0_ID, &KBL_3x3x8::hwInfo, &KBL_3x3x8::setupGtSystemInfo, GTTYPE_GT4},
{IKBL_GT3_HALO_DEVICE_F0_ID, &KBL_2x3x8::hwInfo, &KBL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{IKBL_GT3_SERV_DEVICE_F0_ID, &KBL_2x3x8::hwInfo, &KBL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{IKBL_GT4_SERV_DEVICE_F0_ID, &KBL_3x3x8::hwInfo, &KBL_3x3x8::setupGtSystemInfo, GTTYPE_GT4},
{IKBL_GT4_WRK_DEVICE_F0_ID, &KBL_3x3x8::hwInfo, &KBL_3x3x8::setupGtSystemInfo, GTTYPE_GT4},
}};
auto compareStructs = [](const DeviceDescriptor *first, const DeviceDescriptor *second) {
return first->deviceId == second->deviceId && first->pHwInfo == second->pHwInfo &&
first->setupGtSystemInfo == second->setupGtSystemInfo && first->eGtType == second->eGtType;
};
size_t startIndex = 0;
while (!compareStructs(&expectedDescriptors[0], &deviceDescriptorTable[startIndex]) &&
deviceDescriptorTable[startIndex].deviceId != 0) {
startIndex++;
};
EXPECT_NE(0u, deviceDescriptorTable[startIndex].deviceId);
for (auto &expected : expectedDescriptors) {
EXPECT_TRUE(compareStructs(&expected, &deviceDescriptorTable[startIndex]));
startIndex++;
}
}

View File

@ -0,0 +1,81 @@
/*
* Copyright (c) 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "hw_cmds.h"
#include "runtime/os_interface/linux/drm_neo.h"
#include "test.h"
#include <array>
using namespace OCLRT;
TEST(SklDeviceIdTest, supportedDeviceId) {
std::array<DeviceDescriptor, 30> expectedDescriptors = {{
{ISKL_GT1_DESK_DEVICE_F0_ID, &SKL_1x2x6::hwInfo, &SKL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{ISKL_GT1_DT_DEVICE_F0_ID, &SKL_1x2x6::hwInfo, &SKL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{ISKL_GT1_SERV_DEVICE_F0_ID, &SKL_1x2x6::hwInfo, &SKL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{ISKL_GT1_5_DT_DEVICE_F0_ID, &SKL_1x3x6::hwInfo, &SKL_1x3x6::setupGtSystemInfo, GTTYPE_GT1_5},
{ISKL_GT2_DESK_DEVICE_F0_ID, &SKL_1x3x8::hwInfo, &SKL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{ISKL_GT2_DT_DEVICE_F0_ID, &SKL_1x3x8::hwInfo, &SKL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{ISKL_GT2_WRK_DEVICE_F0_ID, &SKL_1x3x8::hwInfo, &SKL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{ISKL_GT2_SERV_DEVICE_F0_ID, &SKL_1x3x8::hwInfo, &SKL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{ISKL_GT3_DESK_DEVICE_F0_ID, &SKL_2x3x8::hwInfo, &SKL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{ISKL_GT3_SERV_DEVICE_F0_ID, &SKL_2x3x8::hwInfo, &SKL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{ISKL_GT3_MEDIA_SERV_DEVICE_F0_ID, &SKL_2x3x8::hwInfo, &SKL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{ISKL_GT4_DESK_DEVICE_F0_ID, &SKL_3x3x8::hwInfo, &SKL_3x3x8::setupGtSystemInfo, GTTYPE_GT4},
{ISKL_GT4_DT_DEVICE_F0_ID, &SKL_3x3x8::hwInfo, &SKL_3x3x8::setupGtSystemInfo, GTTYPE_GT4},
{ISKL_GT4_WRK_DEVICE_F0_ID, &SKL_3x3x8::hwInfo, &SKL_3x3x8::setupGtSystemInfo, GTTYPE_GT4},
{ISKL_GT4_SERV_DEVICE_F0_ID, &SKL_3x3x8::hwInfo, &SKL_3x3x8::setupGtSystemInfo, GTTYPE_GT4},
{ISKL_GT2_ULT_DEVICE_F0_ID, &SKL_1x3x8::hwInfo, &SKL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{ISKL_GT2F_ULT_DEVICE_F0_ID, &SKL_1x3x8::hwInfo, &SKL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{ISKL_GT2_ULX_DEVICE_F0_ID, &SKL_1x3x8::hwInfo, &SKL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{ISKL_GT1_ULT_DEVICE_F0_ID, &SKL_1x2x6::hwInfo, &SKL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{ISKL_GT1_ULX_DEVICE_F0_ID, &SKL_1x2x6::hwInfo, &SKL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{ISKL_GT1_5_ULT_DEVICE_F0_ID, &SKL_1x3x6::hwInfo, &SKL_1x3x6::setupGtSystemInfo, GTTYPE_GT1_5},
{ISKL_GT1_5_ULX_DEVICE_F0_ID, &SKL_1x3x6::hwInfo, &SKL_1x3x6::setupGtSystemInfo, GTTYPE_GT1_5},
{ISKL_GT3_ULT_DEVICE_F0_ID, &SKL_2x3x8::hwInfo, &SKL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{ISKL_GT3e_ULT_DEVICE_F0_ID_540, &SKL_2x3x8::hwInfo, &SKL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{ISKL_GT3e_ULT_DEVICE_F0_ID_550, &SKL_2x3x8::hwInfo, &SKL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{ISKL_GT1_HALO_MOBL_DEVICE_F0_ID, &SKL_1x2x6::hwInfo, &SKL_1x2x6::setupGtSystemInfo, GTTYPE_GT1},
{ISKL_GT2_HALO_MOBL_DEVICE_F0_ID, &SKL_1x3x8::hwInfo, &SKL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
{ISKL_GT3_HALO_MOBL_DEVICE_F0_ID, &SKL_2x3x8::hwInfo, &SKL_2x3x8::setupGtSystemInfo, GTTYPE_GT3},
{ISKL_GT4_HALO_MOBL_DEVICE_F0_ID, &SKL_3x3x8::hwInfo, &SKL_3x3x8::setupGtSystemInfo, GTTYPE_GT4},
{ISKL_LP_DEVICE_F0_ID, &SKL_1x3x8::hwInfo, &SKL_1x3x8::setupGtSystemInfo, GTTYPE_GT2},
}};
auto compareStructs = [](const DeviceDescriptor *first, const DeviceDescriptor *second) {
return first->deviceId == second->deviceId && first->pHwInfo == second->pHwInfo &&
first->setupGtSystemInfo == second->setupGtSystemInfo && first->eGtType == second->eGtType;
};
size_t startIndex = 0;
while (!compareStructs(&expectedDescriptors[0], &deviceDescriptorTable[startIndex]) &&
deviceDescriptorTable[startIndex].deviceId != 0) {
startIndex++;
};
EXPECT_NE(0u, deviceDescriptorTable[startIndex].deviceId);
for (auto &expected : expectedDescriptors) {
EXPECT_TRUE(compareStructs(&expected, &deviceDescriptorTable[startIndex]));
startIndex++;
}
}