Skip to content

Commit

Permalink
Add device ids
Browse files Browse the repository at this point in the history
Signed-off-by: Bartosz Dunajski <[email protected]>
  • Loading branch information
BartoszDunajski authored and Compute-Runtime-Automation committed Nov 26, 2021
1 parent b93fa8b commit 0e75f43
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 0 deletions.
13 changes: 13 additions & 0 deletions opencl/test/unit_test/xe_hp_core/xehp/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

set(IGDRCL_SRCS_tests_xe_hp_core_xehp_linux
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
)
if(UNIX)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_xe_hp_core_xehp_linux})
add_subdirectory(dll)
endif()
11 changes: 11 additions & 0 deletions opencl/test/unit_test/xe_hp_core/xehp/linux/dll/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

set(IGDRCL_SRCS_linux_dll_tests_xe_hp_core_xehp
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/device_id_tests_xehp.cpp
)
target_sources(igdrcl_linux_dll_tests PRIVATE ${IGDRCL_SRCS_linux_dll_tests_xe_hp_core_xehp})
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#include "shared/source/os_interface/linux/drm_neo.h"

#include "test.h"

using namespace NEO;

TEST(XeHPDeviceIdTest, GivenSupportedDeviceIdThenConfigIsCorrect) {
DeviceDescriptor expectedDescriptor = {0x0201, &XE_HP_SDV_CONFIG::hwInfo, &XE_HP_SDV_CONFIG::setupHardwareInfo, GTTYPE_GT4};

auto compareStructs = [](const DeviceDescriptor *first, const DeviceDescriptor *second) {
return first->deviceId == second->deviceId && first->pHwInfo == second->pHwInfo &&
first->setupHardwareInfo == second->setupHardwareInfo && first->eGtType == second->eGtType;
};

bool found = false;

for (size_t i = 0; deviceDescriptorTable[i].deviceId != 0; i++) {
if (compareStructs(&expectedDescriptor, &deviceDescriptorTable[i])) {
found = true;
break;
}
};

EXPECT_TRUE(found);
}
11 changes: 11 additions & 0 deletions opencl/test/unit_test/xe_hpg_core/dg2/linux/dll/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

set(IGDRCL_SRCS_linux_dll_tests_xe_hpg_core_dg2
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}/device_id_tests_dg2.cpp
)
target_sources(igdrcl_linux_dll_tests PRIVATE ${IGDRCL_SRCS_linux_dll_tests_xe_hpg_core_dg2})
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#include "shared/source/os_interface/linux/drm_neo.h"

#include "test.h"

#include <array>

using namespace NEO;

TEST(Dg2AdditionalDeviceIdTest, GivenSupportedDeviceIdThenDeviceDescriptorTableExists) {
std::array<DeviceDescriptor, 2> expectedDescriptors = {{
{0x4F80, &DG2_CONFIG::hwInfo, &DG2_CONFIG::setupHardwareInfo, GTTYPE_GT4},
{0x4F87, &DG2_CONFIG::hwInfo, &DG2_CONFIG::setupHardwareInfo, GTTYPE_GT4},
}};

auto compareStructs = [](const DeviceDescriptor *first, const DeviceDescriptor *second) {
return first->deviceId == second->deviceId && first->pHwInfo == second->pHwInfo &&
first->setupHardwareInfo == second->setupHardwareInfo && 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++;
}
}
7 changes: 7 additions & 0 deletions shared/source/dll/devices/devices_additional.inl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
*
*/

#ifdef SUPPORT_XE_HPG_CORE
#ifdef SUPPORT_DG2
DEVICE(0x4F80, DG2_CONFIG, GTTYPE_GT4)
DEVICE(0x4F87, DG2_CONFIG, GTTYPE_GT4)
#endif
#endif

#ifdef SUPPORT_GEN12LP
#ifdef SUPPORT_ADLP
DEVICE(0x46A0, ADLP_CONFIG, GTTYPE_GT2)
Expand Down
7 changes: 7 additions & 0 deletions shared/source/dll/devices/devices_base.inl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
*/

// clang-format off
#ifdef SUPPORT_XE_HP_CORE
#ifdef SUPPORT_XE_HP_SDV
DEVICE(0x0201, XE_HP_SDV_CONFIG, GTTYPE_GT4)
#endif
#endif


#ifdef SUPPORT_GEN12LP
#ifdef SUPPORT_TGLLP
DEVICE( 0xFF20, TGLLP_1x6x16, GTTYPE_GT2 )
Expand Down

0 comments on commit 0e75f43

Please sign in to comment.