mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add dg1 unit tests
Change-Id: I9b66f2da665b21ba0a714cec79ae3b1d72ecdb51 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
1067596196
commit
eb766be160
19
opencl/test/unit_test/gen12lp/dg1/CMakeLists.txt
Normal file
19
opencl/test/unit_test/gen12lp/dg1/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_DG1)
|
||||
set(IGDRCL_SRCS_tests_dg1
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_dg1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_dg1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_dg1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_dg1.cpp
|
||||
)
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_dg1})
|
||||
add_subdirectories()
|
||||
neo_copy_test_files(copy_test_files_dg1 dg1)
|
||||
add_dependencies(unit_tests copy_test_files_dg1)
|
||||
endif()
|
54
opencl/test/unit_test/gen12lp/dg1/hw_helper_tests_dg1.cpp
Normal file
54
opencl/test/unit_test/gen12lp/dg1/hw_helper_tests_dg1.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
|
||||
|
||||
using HwHelperTestDg1 = HwHelperTest;
|
||||
|
||||
DG1TEST_F(HwHelperTestDg1, givenDg1PlatformWhenIsLocalMemoryEnabledIsCalledThenTrueIsReturned) {
|
||||
hardwareInfo.featureTable.ftrLocalMemory = true;
|
||||
|
||||
auto &helper = reinterpret_cast<HwHelperHw<FamilyType> &>(HwHelperHw<FamilyType>::get());
|
||||
EXPECT_TRUE(helper.isLocalMemoryEnabled(hardwareInfo));
|
||||
}
|
||||
|
||||
DG1TEST_F(HwHelperTestDg1, givenDg1PlatformWithoutLocalMemoryFeatureWhenIsLocalMemoryEnabledIsCalledThenFalseIsReturned) {
|
||||
hardwareInfo.featureTable.ftrLocalMemory = false;
|
||||
|
||||
auto &helper = reinterpret_cast<HwHelperHw<FamilyType> &>(HwHelperHw<FamilyType>::get());
|
||||
EXPECT_FALSE(helper.isLocalMemoryEnabled(hardwareInfo));
|
||||
}
|
||||
|
||||
DG1TEST_F(HwHelperTestDg1, givenDg1PlatformWhenSetupHardwareCapabilitiesIsCalledThenThenSpecificImplementationIsUsed) {
|
||||
hardwareInfo.featureTable.ftrLocalMemory = true;
|
||||
|
||||
HardwareCapabilities hwCaps = {0};
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
helper.setupHardwareCapabilities(&hwCaps, hardwareInfo);
|
||||
|
||||
EXPECT_EQ(2048u, hwCaps.image3DMaxHeight);
|
||||
EXPECT_EQ(2048u, hwCaps.image3DMaxWidth);
|
||||
EXPECT_TRUE(hwCaps.isStatelesToStatefullWithOffsetSupported);
|
||||
}
|
||||
|
||||
DG1TEST_F(HwHelperTestDg1, givenDg1A0WhenAdjustDefaultEngineTypeCalledThenRcsIsReturned) {
|
||||
hardwareInfo.featureTable.ftrCCSNode = true;
|
||||
hardwareInfo.platform.usRevId = REVISION_A0;
|
||||
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
helper.adjustDefaultEngineType(&hardwareInfo);
|
||||
EXPECT_EQ(aub_stream::ENGINE_RCS, hardwareInfo.capabilityTable.defaultEngineType);
|
||||
}
|
||||
|
||||
DG1TEST_F(HwHelperTestDg1, givenDg1BWhenAdjustDefaultEngineTypeCalledThenCcsIsReturned) {
|
||||
hardwareInfo.featureTable.ftrCCSNode = true;
|
||||
hardwareInfo.platform.usRevId = REVISION_B;
|
||||
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
helper.adjustDefaultEngineType(&hardwareInfo);
|
||||
EXPECT_EQ(aub_stream::ENGINE_RCS, hardwareInfo.capabilityTable.defaultEngineType);
|
||||
}
|
29
opencl/test/unit_test/gen12lp/dg1/hw_info_tests_dg1.cpp
Normal file
29
opencl/test/unit_test/gen12lp/dg1/hw_info_tests_dg1.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/test/unit_test/helpers/gtest_helpers.h"
|
||||
#include "test.h"
|
||||
using namespace NEO;
|
||||
|
||||
template <typename T>
|
||||
class Dg1HwInfoTests : public ::testing::Test {};
|
||||
typedef ::testing::Types<DG1_CONFIG> dg1TestTypes;
|
||||
TYPED_TEST_CASE(Dg1HwInfoTests, dg1TestTypes);
|
||||
|
||||
TYPED_TEST(Dg1HwInfoTests, WhenSetupHardwareInfoWithSetupFeatureTableFlagTrueOrFalseIsCalledThenFeatureTableHasCorrectValueOfLocalMemoryFeature) {
|
||||
HardwareInfo hwInfo;
|
||||
FeatureTable &featureTable = hwInfo.featureTable;
|
||||
|
||||
EXPECT_FALSE(featureTable.ftrLocalMemory);
|
||||
TypeParam::setupHardwareInfo(&hwInfo, false);
|
||||
EXPECT_FALSE(featureTable.ftrLocalMemory);
|
||||
TypeParam::setupHardwareInfo(&hwInfo, true);
|
||||
EXPECT_TRUE(featureTable.ftrLocalMemory);
|
||||
}
|
13
opencl/test/unit_test/gen12lp/dg1/linux/CMakeLists.txt
Normal file
13
opencl/test/unit_test/gen12lp/dg1/linux/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(IGDRCL_SRCS_tests_gen12_dg1_linux
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
)
|
||||
if(UNIX)
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen12_dg1_linux})
|
||||
add_subdirectory(dll)
|
||||
endif()
|
11
opencl/test/unit_test/gen12lp/dg1/linux/dll/CMakeLists.txt
Normal file
11
opencl/test/unit_test/gen12lp/dg1/linux/dll/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(IGDRCL_SRCS_linux_dll_tests_gen12_dg1
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/device_id_tests_dg1.cpp
|
||||
)
|
||||
target_sources(igdrcl_linux_dll_tests PRIVATE ${IGDRCL_SRCS_linux_dll_tests_gen12_dg1})
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(Dg1DeviceIdTest, supportedDeviceId) {
|
||||
std::array<DeviceDescriptor, 1> expectedDescriptors = {{
|
||||
{DEV_ID_4905, &DG1_CONFIG::hwInfo, &DG1_CONFIG::setupHardwareInfo, GTTYPE_GT2},
|
||||
}};
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
52
opencl/test/unit_test/gen12lp/dg1/test_device_caps_dg1.cpp
Normal file
52
opencl/test/unit_test/gen12lp/dg1/test_device_caps_dg1.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/driver_info.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using Dg1DeviceCaps = Test<ClDeviceFixture>;
|
||||
|
||||
DG1TEST_F(Dg1DeviceCaps, givenDg1WhenCheckSupportCacheFlushAfterWalkerThenFalse) {
|
||||
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportCacheFlushAfterWalker);
|
||||
}
|
||||
|
||||
DG1TEST_F(Dg1DeviceCaps, givenDG1WhenCheckftr64KBpagesThenTrue) {
|
||||
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftr64KBpages);
|
||||
}
|
||||
|
||||
DG1TEST_F(Dg1DeviceCaps, givenDG1WhenRequestedVmeFlagsThenReturnFalse) {
|
||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.supportsVme);
|
||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsVmeAvcTextureSampler);
|
||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsVmeAvcPreemption);
|
||||
}
|
||||
|
||||
DG1TEST_F(Dg1DeviceCaps, givenDg1hpWhenInitializeCapsThenVmeIsNotSupported) {
|
||||
pClDevice->driverInfo.reset();
|
||||
pClDevice->name.clear();
|
||||
pClDevice->initializeCaps();
|
||||
|
||||
cl_uint expectedVmeAvcVersion = CL_AVC_ME_VERSION_0_INTEL;
|
||||
cl_uint expectedVmeVersion = CL_ME_VERSION_LEGACY_INTEL;
|
||||
|
||||
EXPECT_EQ(expectedVmeVersion, pClDevice->getDeviceInfo().vmeVersion);
|
||||
EXPECT_EQ(expectedVmeAvcVersion, pClDevice->getDeviceInfo().vmeAvcVersion);
|
||||
|
||||
EXPECT_FALSE(pClDevice->getDeviceInfo().vmeAvcSupportsTextureSampler);
|
||||
EXPECT_FALSE(pDevice->getDeviceInfo().vmeAvcSupportsPreemption);
|
||||
}
|
||||
|
||||
DG1TEST_F(Dg1DeviceCaps, givenDg1WhenCheckFtrSupportsInteger64BitAtomicsThenReturnTrue) {
|
||||
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsInteger64BitAtomics);
|
||||
}
|
||||
|
||||
DG1TEST_F(Dg1DeviceCaps, givenDg1WhenCheckGpuAdressSpaceThenReturn47bits) {
|
||||
EXPECT_EQ(MemoryConstants::max64BitAppAddress, pDevice->getHardwareInfo().capabilityTable.gpuAddressSpace);
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
|
||||
#include "opencl/source/helpers/hardware_commands_helper.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(Dg1HwInfoConfig, givenHwInfoErrorneousConfigString) {
|
||||
if (IGFX_DG1 != productFamily) {
|
||||
return;
|
||||
}
|
||||
HardwareInfo hwInfo;
|
||||
GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo;
|
||||
|
||||
uint64_t config = 0xdeadbeef;
|
||||
gtSystemInfo = {0};
|
||||
EXPECT_ANY_THROW(hardwareInfoSetup[productFamily](&hwInfo, false, config));
|
||||
EXPECT_EQ(0u, gtSystemInfo.SliceCount);
|
||||
EXPECT_EQ(0u, gtSystemInfo.SubSliceCount);
|
||||
EXPECT_EQ(0u, gtSystemInfo.EUCount);
|
||||
}
|
||||
|
||||
using Dg1HwInfo = ::testing::Test;
|
||||
|
||||
DG1TEST_F(Dg1HwInfo, givenBoolWhenCallDg1HardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) {
|
||||
bool boolValue[]{
|
||||
true, false};
|
||||
HardwareInfo hwInfo;
|
||||
GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo;
|
||||
FeatureTable &featureTable = hwInfo.featureTable;
|
||||
WorkaroundTable &workaroundTable = hwInfo.workaroundTable;
|
||||
|
||||
uint64_t config = 0x100060016;
|
||||
for (auto setParamBool : boolValue) {
|
||||
|
||||
gtSystemInfo = {0};
|
||||
featureTable = {};
|
||||
workaroundTable = {};
|
||||
hardwareInfoSetup[productFamily](&hwInfo, setParamBool, config);
|
||||
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrL3IACoherency);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrPPGTT);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrSVM);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrIA32eGfxPTEs);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrStandardMipTailFormat);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrLocalMemory);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrTranslationTable);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrUserModeTranslationTable);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrTileMappedResource);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrEnableGuC);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrFbc);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrFbc2AddressTranslation);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrFbcBlitterTracking);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrFbcCpuTracking);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrTileY);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrAstcLdr2D);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrAstcHdr2D);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftr3dMidBatchPreempt);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrGpGpuMidBatchPreempt);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrGpGpuThreadGroupLevelPreempt);
|
||||
EXPECT_EQ(setParamBool, featureTable.ftrPerCtxtPreemptionGranularityControl);
|
||||
|
||||
EXPECT_EQ(setParamBool, workaroundTable.wa4kAlignUVOffsetNV12LinearSurface);
|
||||
EXPECT_EQ(setParamBool, workaroundTable.waEnablePreemptionGranularityControlByUMD);
|
||||
}
|
||||
}
|
||||
|
||||
DG1TEST_F(Dg1HwInfo, whenPlatformIsDg1ThenExpectSvmIsSet) {
|
||||
const HardwareInfo &hardwareInfo = DG1::hwInfo;
|
||||
EXPECT_TRUE(hardwareInfo.capabilityTable.ftrSvm);
|
||||
}
|
13
opencl/test/unit_test/gen12lp/dg1/windows/CMakeLists.txt
Normal file
13
opencl/test/unit_test/gen12lp/dg1/windows/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(IGDRCL_SRCS_tests_gen12_dg1_windows
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_dg1.cpp
|
||||
)
|
||||
if(WIN32)
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen12_dg1_windows})
|
||||
endif()
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/windows/os_interface.h"
|
||||
|
||||
#include "opencl/test/unit_test/os_interface/windows/hw_info_config_win_tests.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using HwInfoConfigTestWindowsDg1 = HwInfoConfigTestWindows;
|
||||
|
||||
DG1TEST_F(HwInfoConfigTestWindowsDg1, whenCallAdjustPlatformThenDoNothing) {
|
||||
EXPECT_EQ(IGFX_DG1, productFamily);
|
||||
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
PLATFORM *testPlatform = &outHwInfo.platform;
|
||||
testPlatform->eDisplayCoreFamily = IGFX_GEN11_CORE;
|
||||
testPlatform->eRenderCoreFamily = IGFX_GEN11_CORE;
|
||||
hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo);
|
||||
|
||||
EXPECT_EQ(IGFX_GEN12LP_CORE, testPlatform->eRenderCoreFamily);
|
||||
EXPECT_EQ(IGFX_GEN12LP_CORE, testPlatform->eDisplayCoreFamily);
|
||||
}
|
||||
|
||||
DG1TEST_F(HwInfoConfigTestWindowsDg1, whenCheckIfEvenContextCountIsRequiredThenReturnTrue) {
|
||||
EXPECT_EQ(IGFX_DG1, productFamily);
|
||||
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
EXPECT_TRUE(hwInfoConfig->isEvenContextCountRequired());
|
||||
}
|
Reference in New Issue
Block a user