Opensource ADLS.

Resolves: NEO-5092

Change-Id: I544247a057a667ce6423f2e59ba4ca769e866479
Signed-off-by: Piotr Zdunowski <piotr.zdunowski@intel.com>
This commit is contained in:
Piotr Zdunowski
2020-10-08 15:40:40 +02:00
committed by sys_ocldev
parent 9bb8700b62
commit 4c2d92890f
32 changed files with 790 additions and 7 deletions

View File

@ -0,0 +1,18 @@
#
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(TESTS_ADLS)
set(IGDRCL_SRCS_tests_gen12lp_adls
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_adls.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_adls.cpp
${CMAKE_CURRENT_SOURCE_DIR}/excludes_adls.cpp
)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen12lp_adls})
add_subdirectories()
neo_copy_test_files_with_revision(copy_test_files_adls_0 adls 0)
add_dependencies(copy_test_files_per_product copy_test_files_adls_0)
endif()

View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "test.h"
namespace NEO {
HWCMDTEST_EXCLUDE_FAMILY(ProfilingTests, GivenCommandQueueBlockedWithProfilingWhenWalkerIsDispatchedThenMiStoreRegisterMemIsPresentInCS, IGFX_ALDERLAKE_S);
HWCMDTEST_EXCLUDE_FAMILY(ProfilingTests, GivenCommandQueueWithProflingWhenWalkerIsDispatchedThenMiStoreRegisterMemIsPresentInCS, IGFX_ALDERLAKE_S);
HWCMDTEST_EXCLUDE_FAMILY(EventProfilingTest, givenEventWhenCompleteIsZeroThenCalcProfilingDataSetsEndTimestampInCompleteTimestampAndDoesntCallOsTimeMethods, IGFX_ALDERLAKE_S);
HWCMDTEST_EXCLUDE_FAMILY(EventProfilingTests, givenRawTimestampsDebugModeWhenDataIsQueriedThenRawDataIsReturned, IGFX_ALDERLAKE_S);
HWCMDTEST_EXCLUDE_FAMILY(EventProfilingTest, givenRawTimestampsDebugModeWhenStartTimeStampLTQueueTimeStampThenIncreaseStartTimeStamp, IGFX_ALDERLAKE_S);
HWCMDTEST_EXCLUDE_FAMILY(ProfilingWithPerfCountersTests, GivenCommandQueueWithProfilingPerfCountersWhenWalkerIsDispatchedThenRegisterStoresArePresentInCS, IGFX_ALDERLAKE_S);
HWCMDTEST_EXCLUDE_FAMILY(TimestampEventCreate, givenEventTimestampsWhenQueryKernelTimestampThenCorrectDataAreSet, IGFX_ALDERLAKE_S);
} // namespace NEO
HWCMDTEST_EXCLUDE_FAMILY(ProfilingCommandsTest, givenKernelWhenProfilingCommandStartIsTakenThenTimeStampAddressIsProgrammedCorrectly, IGFX_ALDERLAKE_S);
HWCMDTEST_EXCLUDE_FAMILY(ProfilingCommandsTest, givenKernelWhenProfilingCommandStartIsNotTakenThenTimeStampAddressIsProgrammedCorrectly, IGFX_ALDERLAKE_S);

View File

@ -0,0 +1,14 @@
#
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set(IGDRCL_SRCS_tests_gen12_adls_linux
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_adls.cpp
)
if(UNIX)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen12_adls_linux})
add_subdirectory(dll)
endif()

View File

@ -0,0 +1,11 @@
#
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set(IGDRCL_SRCS_linux_dll_tests_gen12_adls
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/device_id_tests_adls.cpp
)
target_sources(igdrcl_linux_dll_tests PRIVATE ${IGDRCL_SRCS_linux_dll_tests_gen12_adls})

View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/gen12lp/hw_cmds_adls.h"
#include "shared/source/os_interface/linux/drm_neo.h"
#include "opencl/source/dll/linux/devices/device_ids.h"
#include "test.h"
#include <array>
using namespace NEO;
TEST(AdlsDeviceIdTest, supportedDeviceId) {
std::array<DeviceDescriptor, 3> expectedDescriptors = {{
{DEVICE_ID_4680, &ADLS_HW_CONFIG::hwInfo, &ADLS_HW_CONFIG::setupHardwareInfo, GTTYPE_GT1},
{DEVICE_ID_46FF, &ADLS_HW_CONFIG::hwInfo, &ADLS_HW_CONFIG::setupHardwareInfo, GTTYPE_GT1},
{DEVICE_ID_4600, &ADLS_HW_CONFIG::hwInfo, &ADLS_HW_CONFIG::setupHardwareInfo, GTTYPE_GT1},
}};
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++;
}
}

View File

@ -0,0 +1,104 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/linux/os_interface.h"
#include "opencl/test/unit_test/helpers/gtest_helpers.h"
#include "opencl/test/unit_test/os_interface/linux/drm_mock.h"
#include "opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
using namespace NEO;
struct HwInfoConfigTestLinuxAdls : HwInfoConfigTestLinux {
void SetUp() override {
HwInfoConfigTestLinux::SetUp();
drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
osInterface->get()->setDrm(drm);
drm->StoredDeviceID = IGFX_ALDERLAKE_S;
drm->setGtType(GTTYPE_GT1);
}
};
ADLSTEST_F(HwInfoConfigTestLinuxAdls, configureHwInfoAdls) {
auto hwInfoConfig = HwInfoConfig::get(productFamily);
int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(static_cast<unsigned short>(drm->StoredDeviceID), outHwInfo.platform.usDeviceID);
EXPECT_EQ(static_cast<unsigned short>(drm->StoredDeviceRevID), outHwInfo.platform.usRevId);
EXPECT_EQ(static_cast<uint32_t>(drm->StoredEUVal), outHwInfo.gtSystemInfo.EUCount);
EXPECT_EQ(static_cast<uint32_t>(drm->StoredSSVal), outHwInfo.gtSystemInfo.SubSliceCount);
EXPECT_EQ(1u, outHwInfo.gtSystemInfo.SliceCount);
EXPECT_EQ(GTTYPE_GT1, outHwInfo.platform.eGTType);
EXPECT_TRUE(outHwInfo.featureTable.ftrGT1);
EXPECT_FALSE(outHwInfo.featureTable.ftrGT1_5);
EXPECT_FALSE(outHwInfo.featureTable.ftrGT2);
EXPECT_FALSE(outHwInfo.featureTable.ftrGT3);
EXPECT_FALSE(outHwInfo.featureTable.ftrGT4);
EXPECT_FALSE(outHwInfo.featureTable.ftrGTA);
EXPECT_FALSE(outHwInfo.featureTable.ftrGTC);
EXPECT_FALSE(outHwInfo.featureTable.ftrGTX);
EXPECT_FALSE(outHwInfo.featureTable.ftrTileY);
}
ADLSTEST_F(HwInfoConfigTestLinuxAdls, whenCallAdjustPlatformThenDoNothing) {
auto hwInfoConfig = HwInfoConfig::get(productFamily);
outHwInfo = pInHwInfo;
hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo);
int ret = memcmp(&outHwInfo.platform, &pInHwInfo.platform, sizeof(PLATFORM));
EXPECT_EQ(0, ret);
}
ADLSTEST_F(HwInfoConfigTestLinuxAdls, negative) {
auto hwInfoConfig = HwInfoConfig::get(productFamily);
drm->StoredRetValForDeviceID = -1;
int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
drm->StoredRetValForDeviceID = 0;
drm->StoredRetValForDeviceRevID = -1;
ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
drm->StoredRetValForDeviceRevID = 0;
drm->failRetTopology = true;
drm->StoredRetValForEUVal = -1;
ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
drm->StoredRetValForEUVal = 0;
drm->StoredRetValForSSVal = -1;
ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
}
TEST(AdlsHwInfoTests, gtSetupIsCorrect) {
HardwareInfo hwInfo;
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
DrmMock drm(*executionEnvironment->rootDeviceEnvironments[0]);
GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
DeviceDescriptor device = {0, &hwInfo, &ADLS_HW_CONFIG::setupHardwareInfo, GTTYPE_GT1};
int ret = drm.setupHardwareInfo(&device, false);
EXPECT_EQ(ret, 0);
EXPECT_GT(gtSystemInfo.EUCount, 0u);
EXPECT_GT(gtSystemInfo.ThreadCount, 0u);
EXPECT_GT(gtSystemInfo.SliceCount, 0u);
EXPECT_GT(gtSystemInfo.SubSliceCount, 0u);
EXPECT_GT_VAL(gtSystemInfo.L3CacheSizeInKb, 0u);
EXPECT_EQ(gtSystemInfo.CsrSizeInMb, 8u);
EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated);
EXPECT_GT(gtSystemInfo.DualSubSliceCount, 0u);
EXPECT_GT(gtSystemInfo.MaxDualSubSlicesSupported, 0u);
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/source/dll/linux/devices/device_ids.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "test.h"
using namespace NEO;
using AdlsUsDeviceIdTest = Test<ClDeviceFixture>;
ADLSTEST_F(AdlsUsDeviceIdTest, isSimulationCap) {
unsigned short adlsSimulationIds[2] = {
DEVICE_ID_4680,
0, // default, non-simulation
};
NEO::MockDevice *mockDevice = nullptr;
for (auto id : adlsSimulationIds) {
mockDevice = createWithUsDeviceId(id);
ASSERT_NE(mockDevice, nullptr);
if (id == 0)
EXPECT_FALSE(mockDevice->isSimulation());
else
EXPECT_TRUE(mockDevice->isSimulation());
delete mockDevice;
}
}
ADLSTEST_F(AdlsUsDeviceIdTest, givenADLSWhenCheckFtrSupportsInteger64BitAtomicsThenReturnFalse) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsInteger64BitAtomics);
}
ADLSTEST_F(AdlsUsDeviceIdTest, givenAdlsWhenRequestedVmeFlagsThenReturnFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.supportsVme);
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsVmeAvcTextureSampler);
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsVmeAvcPreemption);
}

View File

@ -0,0 +1,63 @@
/*
* 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;
using AdlsHwInfo = ::testing::Test;
ADLSTEST_F(AdlsHwInfo, givenBoolWhenCallAdlsHardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) {
static bool boolValue[]{
true, false};
HardwareInfo hwInfo;
GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
FeatureTable &featureTable = hwInfo.featureTable;
WorkaroundTable &workaroundTable = hwInfo.workaroundTable;
uint64_t config = 0x100020016;
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.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.ftrAstcHdr2D);
EXPECT_EQ(setParamBool, featureTable.ftrAstcLdr2D);
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);
EXPECT_EQ(setParamBool, workaroundTable.waUntypedBufferCompression);
}
}
ADLSTEST_F(AdlsHwInfo, whenPlatformIsAdlsThenExpectSvmIsSet) {
const HardwareInfo &hardwareInfo = ADLS::hwInfo;
EXPECT_TRUE(hardwareInfo.capabilityTable.ftrSvm);
}

View File

@ -0,0 +1,13 @@
#
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set(IGDRCL_SRCS_tests_gen12_adls_windows
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_adls.cpp
)
if(WIN32)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen12_adls_windows})
endif()

View File

@ -0,0 +1,27 @@
/*
* 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 HwInfoConfigTestWindowsAdls = HwInfoConfigTestWindows;
ADLSTEST_F(HwInfoConfigTestWindowsAdls, whenCallAdjustPlatformThenDoNothing) {
EXPECT_EQ(IGFX_ALDERLAKE_S, 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);
}