Move device caps gen tests to shared

Signed-off-by: Rafal Maziejuk <rafal.maziejuk@intel.com>
This commit is contained in:
Rafal Maziejuk
2022-12-02 09:45:39 +00:00
committed by Compute-Runtime-Automation
parent a2aad265bf
commit 16636b82ff
11 changed files with 208 additions and 182 deletions

View File

@@ -19,6 +19,7 @@ if(TESTS_XE_HPC_CORE)
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_xe_hpc_core_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state_tests_xe_hpc_core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_xe_hpc_core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_xe_hpc_core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_xe_hpc_core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_xe_hpc_core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_xe_hpc_core.cpp

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/xe_hpc_core/hw_cmds.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/hw_helper_tests.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
using namespace NEO;
using XeHpcCoreDeviceCaps = Test<DeviceFixture>;
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenXeHpcCoreWhenCheckFtrSupportsInteger64BitAtomicsThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsInteger64BitAtomics);
}
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenXeHpcCoreWhenCheckingImageSupportThenReturnFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.supportsImages);
}
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenXeHpcCoreWhenCheckingMediaBlockSupportThenReturnFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.supportsMediaBlock);
}
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenXeHpcCoreWhenCheckingCoherencySupportThenReturnFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsCoherency);
}
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenHwInfoWhenSlmSizeIsRequiredThenReturnCorrectValue) {
EXPECT_EQ(128u, pDevice->getHardwareInfo().capabilityTable.slmSize);
}
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenDeviceWhenAskingForSubGroupSizesThenReturnCorrectValues) {
const auto &coreHelper = getHelper<CoreHelper>();
const auto deviceSubgroups = coreHelper.getDeviceSubGroupSizes();
EXPECT_EQ(2u, deviceSubgroups.size());
EXPECT_EQ(16u, deviceSubgroups[0]);
EXPECT_EQ(32u, deviceSubgroups[1]);
}

View File

@@ -17,6 +17,7 @@ if(TESTS_XE_HPG_CORE)
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_xe_hpg_core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state_tests_xe_hpg_core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_xe_hpg_core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_xe_hpg_core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_dispatch_kernel_xe_hpg_core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_xe_hpg_core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_xe_hpg_core.cpp

View File

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/xe_hpg_core/hw_cmds.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/hw_helper_tests.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
using namespace NEO;
using XeHpgCoreDeviceCaps = Test<DeviceFixture>;
XE_HPG_CORETEST_F(XeHpgCoreDeviceCaps, givenXeHpgCoreWhenCheckFtrSupportsInteger64BitAtomicsThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsInteger64BitAtomics);
}
XE_HPG_CORETEST_F(XeHpgCoreDeviceCaps, givenXeHpgCoreWhenCheckingImageSupportThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsImages);
}
XE_HPG_CORETEST_F(XeHpgCoreDeviceCaps, givenXeHpgCoreWhenCheckingMediaBlockSupportThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsMediaBlock);
}
XE_HPG_CORETEST_F(XeHpgCoreDeviceCaps, givenXeHpgCoreWhenCheckingCoherencySupportThenReturnFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsCoherency);
}
XE_HPG_CORETEST_F(XeHpgCoreDeviceCaps, givenEnabledFtrPooledEuAndNotA0SteppingWhenCalculatingMaxEuPerSSThenDontIgnoreEuCountPerPoolMin) {
HardwareInfo myHwInfo = *defaultHwInfo;
GT_SYSTEM_INFO &mySysInfo = myHwInfo.gtSystemInfo;
FeatureTable &mySkuTable = myHwInfo.featureTable;
PLATFORM &myPlatform = myHwInfo.platform;
mySysInfo.EUCount = 20;
mySysInfo.EuCountPerPoolMin = 99999;
mySkuTable.flags.ftrPooledEuEnabled = 1;
myPlatform.usRevId = 0x4;
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&myHwInfo));
auto expectedMaxWGS = mySysInfo.EuCountPerPoolMin * (mySysInfo.ThreadCount / mySysInfo.EUCount) * 8;
expectedMaxWGS = std::min(Math::prevPowerOfTwo(expectedMaxWGS), 1024u);
EXPECT_EQ(expectedMaxWGS, device->getDeviceInfo().maxWorkGroupSize);
}