From bdee42ca162d5ac91434a64df53e7252bbffa2a3 Mon Sep 17 00:00:00 2001 From: "Dunajski, Bartosz" Date: Mon, 5 Feb 2018 08:54:46 +0100 Subject: [PATCH] devices.m separation for Linux Change-Id: Ia8e430db4dfcefc1b19e23e9cd7113bf87f0a7af --- runtime/CMakeLists.txt | 1 + runtime/dll/linux/devices/devices.m | 23 ++++++ .../{devices.m => devices/devices_base.m} | 16 +++- runtime/dll/linux/drm_neo_create.cpp | 9 +-- runtime/os_interface/linux/drm_neo.h | 12 +++ unit_tests/CMakeLists.txt | 3 + unit_tests/gen8/CMakeLists.txt | 9 +++ unit_tests/gen8/linux/dll/device_id_tests.cpp | 60 ++++++++++++++ unit_tests/gen9/CMakeLists.txt | 21 +++++ .../gen9/bxt/linux/dll/device_id_tests.cpp | 53 ++++++++++++ .../gen9/cfl/linux/dll/device_id_tests.cpp | 63 +++++++++++++++ .../gen9/kbl/linux/dll/device_id_tests.cpp | 76 +++++++++++++++++ .../gen9/skl/linux/dll/device_id_tests.cpp | 81 +++++++++++++++++++ 13 files changed, 419 insertions(+), 8 deletions(-) create mode 100644 runtime/dll/linux/devices/devices.m rename runtime/dll/linux/{devices.m => devices/devices_base.m} (86%) create mode 100644 unit_tests/gen8/linux/dll/device_id_tests.cpp create mode 100644 unit_tests/gen9/bxt/linux/dll/device_id_tests.cpp create mode 100644 unit_tests/gen9/cfl/linux/dll/device_id_tests.cpp create mode 100644 unit_tests/gen9/kbl/linux/dll/device_id_tests.cpp create mode 100644 unit_tests/gen9/skl/linux/dll/device_id_tests.cpp diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 5f0399a02a..738fd57b6d 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -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) diff --git a/runtime/dll/linux/devices/devices.m b/runtime/dll/linux/devices/devices.m new file mode 100644 index 0000000000..eb0bf9e5dc --- /dev/null +++ b/runtime/dll/linux/devices/devices.m @@ -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" diff --git a/runtime/dll/linux/devices.m b/runtime/dll/linux/devices/devices_base.m similarity index 86% rename from runtime/dll/linux/devices.m rename to runtime/dll/linux/devices/devices_base.m index 6ba63126dd..1bad63acfd 100644 --- a/runtime/dll/linux/devices.m +++ b/runtime/dll/linux/devices/devices_base.m @@ -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 diff --git a/runtime/dll/linux/drm_neo_create.cpp b/runtime/dll/linux/drm_neo_create.cpp index 8f80e8fbdb..028b98acea 100644 --- a/runtime/dll/linux/drm_neo_create.cpp +++ b/runtime/dll/linux/drm_neo_create.cpp @@ -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, >::hwInfo, >::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; diff --git a/runtime/os_interface/linux/drm_neo.h b/runtime/os_interface/linux/drm_neo.h index 1168ebb0a5..7ae692d17c 100644 --- a/runtime/os_interface/linux/drm_neo.h +++ b/runtime/os_interface/linux/drm_neo.h @@ -30,6 +30,8 @@ #include #include +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; diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index e771db181f..f0a1908042 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -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) diff --git a/unit_tests/gen8/CMakeLists.txt b/unit_tests/gen8/CMakeLists.txt index 0020de91ac..d4268d5f33 100644 --- a/unit_tests/gen8/CMakeLists.txt +++ b/unit_tests/gen8/CMakeLists.txt @@ -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) diff --git a/unit_tests/gen8/linux/dll/device_id_tests.cpp b/unit_tests/gen8/linux/dll/device_id_tests.cpp new file mode 100644 index 0000000000..2763169403 --- /dev/null +++ b/unit_tests/gen8/linux/dll/device_id_tests.cpp @@ -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 + +using namespace OCLRT; + +TEST(BdwDeviceIdTest, supportedDeviceId) { + std::array 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++; + } +} diff --git a/unit_tests/gen9/CMakeLists.txt b/unit_tests/gen9/CMakeLists.txt index 20c236f7bb..5d6118eafb 100644 --- a/unit_tests/gen9/CMakeLists.txt +++ b/unit_tests/gen9/CMakeLists.txt @@ -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) diff --git a/unit_tests/gen9/bxt/linux/dll/device_id_tests.cpp b/unit_tests/gen9/bxt/linux/dll/device_id_tests.cpp new file mode 100644 index 0000000000..473b43cd65 --- /dev/null +++ b/unit_tests/gen9/bxt/linux/dll/device_id_tests.cpp @@ -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 + +using namespace OCLRT; + +TEST(BxtDeviceIdTest, supportedDeviceId) { + std::array 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++; + } +} diff --git a/unit_tests/gen9/cfl/linux/dll/device_id_tests.cpp b/unit_tests/gen9/cfl/linux/dll/device_id_tests.cpp new file mode 100644 index 0000000000..c44efd04a3 --- /dev/null +++ b/unit_tests/gen9/cfl/linux/dll/device_id_tests.cpp @@ -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 + +using namespace OCLRT; + +TEST(CflDeviceIdTest, supportedDeviceId) { + std::array 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++; + } +} diff --git a/unit_tests/gen9/kbl/linux/dll/device_id_tests.cpp b/unit_tests/gen9/kbl/linux/dll/device_id_tests.cpp new file mode 100644 index 0000000000..3f4ffb60e5 --- /dev/null +++ b/unit_tests/gen9/kbl/linux/dll/device_id_tests.cpp @@ -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 + +using namespace OCLRT; + +TEST(KblDeviceIdTest, supportedDeviceId) { + std::array 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++; + } +} diff --git a/unit_tests/gen9/skl/linux/dll/device_id_tests.cpp b/unit_tests/gen9/skl/linux/dll/device_id_tests.cpp new file mode 100644 index 0000000000..706ddd72f7 --- /dev/null +++ b/unit_tests/gen9/skl/linux/dll/device_id_tests.cpp @@ -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 + +using namespace OCLRT; + +TEST(SklDeviceIdTest, supportedDeviceId) { + std::array 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++; + } +}