2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-05-28 20:05:12 +08:00
|
|
|
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "test.h"
|
2020-02-23 05:50:57 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
using namespace NEO;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-05-28 20:05:12 +08:00
|
|
|
typedef Test<ClDeviceFixture> Gen9DeviceCaps;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-10-26 21:57:52 +08:00
|
|
|
GEN9TEST_F(Gen9DeviceCaps, WhenCheckingExtensionStringThenFp64CorrectlyReported) {
|
2020-03-06 01:13:32 +08:00
|
|
|
const auto &caps = pClDevice->getDeviceInfo();
|
2017-12-21 07:45:38 +08:00
|
|
|
std::string extensionString = caps.deviceExtensions;
|
|
|
|
if (pDevice->getHardwareInfo().capabilityTable.ftrSupportsFP64) {
|
|
|
|
EXPECT_NE(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
|
|
|
|
EXPECT_NE(0u, caps.doubleFpConfig);
|
|
|
|
} else {
|
|
|
|
EXPECT_EQ(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
|
|
|
|
EXPECT_EQ(0u, caps.doubleFpConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-25 20:06:45 +08:00
|
|
|
GEN9TEST_F(Gen9DeviceCaps, givenGen9WhenCheckExtensionsThenDeviceProperlyReportsClKhrSubgroupsExtension) {
|
|
|
|
const auto &caps = pClDevice->getDeviceInfo();
|
2020-05-05 22:40:31 +08:00
|
|
|
if (pClDevice->areOcl21FeaturesEnabled()) {
|
2020-03-25 20:06:45 +08:00
|
|
|
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_subgroups")));
|
|
|
|
} else {
|
|
|
|
EXPECT_THAT(caps.deviceExtensions, ::testing::Not(testing::HasSubstr(std::string("cl_khr_subgroups"))));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GEN9TEST_F(Gen9DeviceCaps, givenGen9WhenCheckingCapsThenDeviceDoesProperlyReportsIndependentForwardProgress) {
|
|
|
|
const auto &caps = pClDevice->getDeviceInfo();
|
|
|
|
|
2020-05-05 22:40:31 +08:00
|
|
|
if (pClDevice->areOcl21FeaturesEnabled()) {
|
2020-03-25 20:06:45 +08:00
|
|
|
EXPECT_TRUE(caps.independentForwardProgress != 0);
|
|
|
|
} else {
|
|
|
|
EXPECT_FALSE(caps.independentForwardProgress != 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-26 21:57:52 +08:00
|
|
|
GEN9TEST_F(Gen9DeviceCaps, WhenGettingDeviceInfoThenCorrectlyRoundedDivideSqrtIsEnabled) {
|
2020-03-06 01:13:32 +08:00
|
|
|
const auto &caps = pClDevice->getDeviceInfo();
|
2017-12-21 07:45:38 +08:00
|
|
|
EXPECT_NE(0u, caps.singleFpConfig & CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
|
|
|
|
}
|
|
|
|
|
2020-10-26 21:57:52 +08:00
|
|
|
GEN9TEST_F(Gen9DeviceCaps, GivenDefaultWhenCheckingPreemptionModeThenMidThreadIsSupported) {
|
2018-01-12 21:18:53 +08:00
|
|
|
EXPECT_EQ(PreemptionMode::MidThread, pDevice->getHardwareInfo().capabilityTable.defaultPreemptionMode);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2020-10-26 21:57:52 +08:00
|
|
|
GEN9TEST_F(Gen9DeviceCaps, WhenCheckingCompressionThenItIsDisabled) {
|
2018-07-18 20:11:05 +08:00
|
|
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedBuffers);
|
|
|
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedImages);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2018-06-06 14:45:45 +08:00
|
|
|
|
|
|
|
GEN9TEST_F(Gen9DeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue) {
|
|
|
|
const auto &hwInfo = pDevice->getHardwareInfo();
|
2019-05-08 22:00:24 +08:00
|
|
|
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
2018-06-06 14:45:45 +08:00
|
|
|
|
2019-05-08 22:00:24 +08:00
|
|
|
uint32_t expectedValue = hwInfo.gtSystemInfo.MaxSubSlicesSupported * hwInfo.gtSystemInfo.MaxEuPerSubSlice *
|
|
|
|
hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount;
|
2018-06-06 14:45:45 +08:00
|
|
|
|
|
|
|
EXPECT_EQ(expectedValue, hwHelper.getComputeUnitsUsedForScratch(&hwInfo));
|
|
|
|
EXPECT_EQ(expectedValue, pDevice->getDeviceInfo().computeUnitsUsedForScratch);
|
|
|
|
}
|
2018-12-05 23:09:27 +08:00
|
|
|
|
2019-05-29 21:37:54 +08:00
|
|
|
GEN9TEST_F(Gen9DeviceCaps, givenHwInfoWhenRequestedMaxFrontEndThreadsThenReturnValidValue) {
|
|
|
|
const auto &hwInfo = pDevice->getHardwareInfo();
|
|
|
|
|
|
|
|
EXPECT_EQ(HwHelper::getMaxThreadsForVfe(hwInfo), pDevice->getDeviceInfo().maxFrontEndThreads);
|
|
|
|
}
|
|
|
|
|
2018-12-05 23:09:27 +08:00
|
|
|
GEN9TEST_F(Gen9DeviceCaps, givenHwInfoWhenSlmSizeIsRequiredThenReturnCorrectValue) {
|
|
|
|
EXPECT_EQ(64u, pDevice->getHardwareInfo().capabilityTable.slmSize);
|
|
|
|
}
|
2018-12-06 22:33:02 +08:00
|
|
|
|
|
|
|
GEN9TEST_F(Gen9DeviceCaps, givenGen9WhenCheckSupportCacheFlushAfterWalkerThenFalse) {
|
|
|
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.supportCacheFlushAfterWalker);
|
|
|
|
}
|
2019-04-16 15:06:37 +08:00
|
|
|
|
|
|
|
GEN9TEST_F(Gen9DeviceCaps, givenGen9WhenCheckBlitterOperationsSupportThenReturnFalse) {
|
|
|
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.blitterOperationsSupported);
|
2019-09-30 23:32:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GEN9TEST_F(Gen9DeviceCaps, givenGen9WhenCheckingImageSupportThenReturnTrue) {
|
|
|
|
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsImages);
|
|
|
|
}
|
2021-05-13 22:58:26 +08:00
|
|
|
|
|
|
|
GEN9TEST_F(Gen9DeviceCaps, givenGen9WhenCheckingMediaBlockSupportThenReturnTrue) {
|
|
|
|
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsMediaBlock);
|
|
|
|
}
|