From 16636b82ffb22aa8fd7ebbc8cd9170e93aa05d30 Mon Sep 17 00:00:00 2001 From: Rafal Maziejuk Date: Fri, 2 Dec 2022 09:45:39 +0000 Subject: [PATCH] Move device caps gen tests to shared Signed-off-by: Rafal Maziejuk --- .../test/unit_test/xe_hpc_core/CMakeLists.txt | 8 +- .../test_cl_device_caps_xe_hpc_core.cpp | 42 ++++++++ .../test_device_caps_xe_hpc_core.cpp | 75 ------------- .../test/unit_test/xe_hpg_core/CMakeLists.txt | 4 +- .../xe_hpg_core/excludes_ocl_xe_hpg_core.cpp | 2 + .../test_cl_device_caps_xe_hpg_core.cpp | 60 +++++++++++ .../test_device_caps_xe_hpg_core.cpp | 101 ------------------ .../test/unit_test/xe_hpc_core/CMakeLists.txt | 1 + .../test_device_caps_xe_hpc_core.cpp | 46 ++++++++ .../test/unit_test/xe_hpg_core/CMakeLists.txt | 1 + .../test_device_caps_xe_hpg_core.cpp | 50 +++++++++ 11 files changed, 208 insertions(+), 182 deletions(-) create mode 100644 opencl/test/unit_test/xe_hpc_core/test_cl_device_caps_xe_hpc_core.cpp delete mode 100644 opencl/test/unit_test/xe_hpc_core/test_device_caps_xe_hpc_core.cpp create mode 100644 opencl/test/unit_test/xe_hpg_core/test_cl_device_caps_xe_hpg_core.cpp delete mode 100644 opencl/test/unit_test/xe_hpg_core/test_device_caps_xe_hpg_core.cpp create mode 100644 shared/test/unit_test/xe_hpc_core/test_device_caps_xe_hpc_core.cpp create mode 100644 shared/test/unit_test/xe_hpg_core/test_device_caps_xe_hpg_core.cpp diff --git a/opencl/test/unit_test/xe_hpc_core/CMakeLists.txt b/opencl/test/unit_test/xe_hpc_core/CMakeLists.txt index fb9ec9b2e4..44cb164c8c 100644 --- a/opencl/test/unit_test/xe_hpc_core/CMakeLists.txt +++ b/opencl/test/unit_test/xe_hpc_core/CMakeLists.txt @@ -13,15 +13,15 @@ if(TESTS_XE_HPC_CORE) set(IGDRCL_SRCS_tests_xe_hpc_core ${IGDRCL_SRCS_tests_xe_hpc_core_excludes} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/api_tests_xe_hpc_core.cpp ${CMAKE_CURRENT_SOURCE_DIR}/built_in_xe_hpc_core_tests_ocl.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/test_cmds_programming_xe_hpc_core.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/copy_engine_tests_xe_hpc_core.cpp ${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests_xe_hpc_core.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/copy_engine_tests_xe_hpc_core.cpp ${CMAKE_CURRENT_SOURCE_DIR}/enqueue_tests_xe_hpc_core.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_xe_hpc_core.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_xe_hpc_core.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_cl_device_caps_xe_hpc_core.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_cmds_programming_xe_hpc_core.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_platform_caps_xe_hpc_core.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/api_tests_xe_hpc_core.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xe_hpc_core_test_ocl_fixtures.h ${CMAKE_CURRENT_SOURCE_DIR}/xe_hpc_core_test_ocl_fixtures.cpp ) diff --git a/opencl/test/unit_test/xe_hpc_core/test_cl_device_caps_xe_hpc_core.cpp b/opencl/test/unit_test/xe_hpc_core/test_cl_device_caps_xe_hpc_core.cpp new file mode 100644 index 0000000000..df8ab453c2 --- /dev/null +++ b/opencl/test/unit_test/xe_hpc_core/test_cl_device_caps_xe_hpc_core.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/xe_hpc_core/hw_cmds.h" +#include "shared/test/common/helpers/gtest_helpers.h" +#include "shared/test/common/test_macros/header/per_product_test_definitions.h" + +#include "opencl/test/unit_test/fixtures/cl_device_fixture.h" +#include "opencl/test/unit_test/fixtures/device_info_fixture.h" + +using namespace NEO; + +using XeHpcCoreClDeviceCaps = Test; + +XE_HPC_CORETEST_F(XeHpcCoreClDeviceCaps, givenXeHpcCoreWhenCheckExtensionsThenDeviceDoesNotReportClKhrSubgroupsExtension) { + const auto &caps = pClDevice->getDeviceInfo(); + + EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_subgroups"))); + EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate"))); + EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_split_matrix_multiply_accumulate"))); + EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_bfloat16_conversions"))); +} + +XE_HPC_CORETEST_F(XeHpcCoreClDeviceCaps, givenXeHpcCoreWhenCheckingCapsThenDeviceDoesNotSupportIndependentForwardProgress) { + const auto &caps = pClDevice->getDeviceInfo(); + + EXPECT_TRUE(caps.independentForwardProgress); +} + +using QueueFamilyNameTestXeHpcCore = QueueFamilyNameTest; + +XE_HPC_CORETEST_F(QueueFamilyNameTestXeHpcCore, givenCccsWhenGettingQueueFamilyNameThenReturnProperValue) { + verify(EngineGroupType::RenderCompute, "cccs"); +} + +XE_HPC_CORETEST_F(QueueFamilyNameTestXeHpcCore, givenLinkedBcsWhenGettingQueueFamilyNameThenReturnProperValue) { + verify(EngineGroupType::LinkedCopy, "linked bcs"); +} diff --git a/opencl/test/unit_test/xe_hpc_core/test_device_caps_xe_hpc_core.cpp b/opencl/test/unit_test/xe_hpc_core/test_device_caps_xe_hpc_core.cpp deleted file mode 100644 index 1e055ee42f..0000000000 --- a/opencl/test/unit_test/xe_hpc_core/test_device_caps_xe_hpc_core.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2021-2022 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/helpers/hw_helper.h" -#include "shared/test/common/helpers/gtest_helpers.h" -#include "shared/test/common/test_macros/header/per_product_test_definitions.h" -#include "shared/test/common/test_macros/test.h" - -#include "opencl/test/unit_test/fixtures/cl_device_fixture.h" -#include "opencl/test/unit_test/fixtures/device_info_fixture.h" - -#include "hw_cmds_xe_hpc_core_base.h" - -using namespace NEO; - -typedef Test XeHpcCoreDeviceCaps; - -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, givenXeHpcCoreWhenCheckExtensionsThenDeviceDoesNotReportClKhrSubgroupsExtension) { - const auto &caps = pClDevice->getDeviceInfo(); - - EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_subgroups"))); - EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate"))); - EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_split_matrix_multiply_accumulate"))); - EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_bfloat16_conversions"))); -} - -XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenXeHpcCoreWhenCheckingCapsThenDeviceDoesNotSupportIndependentForwardProgress) { - const auto &caps = pClDevice->getDeviceInfo(); - - EXPECT_TRUE(caps.independentForwardProgress); -} - -XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenDeviceWhenAskingForSubGroupSizesThenReturnCorrectValues) { - auto &hwHelper = HwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily); - - auto deviceSubgroups = hwHelper.getDeviceSubGroupSizes(); - - EXPECT_EQ(2u, deviceSubgroups.size()); - EXPECT_EQ(16u, deviceSubgroups[0]); - EXPECT_EQ(32u, deviceSubgroups[1]); -} - -using QueueFamilyNameTestXeHpcCore = QueueFamilyNameTest; - -XE_HPC_CORETEST_F(QueueFamilyNameTestXeHpcCore, givenCccsWhenGettingQueueFamilyNameThenReturnProperValue) { - verify(EngineGroupType::RenderCompute, "cccs"); -} - -XE_HPC_CORETEST_F(QueueFamilyNameTestXeHpcCore, givenLinkedBcsWhenGettingQueueFamilyNameThenReturnProperValue) { - verify(EngineGroupType::LinkedCopy, "linked bcs"); -} diff --git a/opencl/test/unit_test/xe_hpg_core/CMakeLists.txt b/opencl/test/unit_test/xe_hpg_core/CMakeLists.txt index 54e52123b5..3672ba374c 100644 --- a/opencl/test/unit_test/xe_hpg_core/CMakeLists.txt +++ b/opencl/test/unit_test/xe_hpg_core/CMakeLists.txt @@ -15,10 +15,10 @@ if(TESTS_XE_HPG_CORE) ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_helper_tests_xe_hpg_core.cpp ${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests_xe_hpg_core.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/test_cmds_programming_xe_hpg_core.cpp ${CMAKE_CURRENT_SOURCE_DIR}/copy_engine_tests_xe_hpg_core.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_xe_hpg_core.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image_tests_xe_hpg_core.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_cl_device_caps_xe_hpg_core.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_cmds_programming_xe_hpg_core.cpp ) get_property(NEO_CORE_TESTS_XE_HPG_CORE GLOBAL PROPERTY NEO_CORE_TESTS_XE_HPG_CORE) diff --git a/opencl/test/unit_test/xe_hpg_core/excludes_ocl_xe_hpg_core.cpp b/opencl/test/unit_test/xe_hpg_core/excludes_ocl_xe_hpg_core.cpp index 27f2e1f414..9f4d546d0e 100644 --- a/opencl/test/unit_test/xe_hpg_core/excludes_ocl_xe_hpg_core.cpp +++ b/opencl/test/unit_test/xe_hpg_core/excludes_ocl_xe_hpg_core.cpp @@ -11,3 +11,5 @@ HWTEST_EXCLUDE_PRODUCT(BufferSetSurfaceTests, givenAlignedCacheableReadOnlyBuffe HWTEST_EXCLUDE_PRODUCT(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemoryIsUnalignedToCachelineButReadOnlyThenL3CacheShouldBeStillOn, IGFX_XE_HPG_CORE); HWTEST_EXCLUDE_PRODUCT(XeHPAndLaterImageTests, givenCompressionWhenAppendingImageFromBufferThenTwoIsSetAsCompressionFormat, IGFX_XE_HPG_CORE); HWTEST_EXCLUDE_PRODUCT(XeHPAndLaterImageTests, givenImageFromBufferWhenSettingSurfaceStateThenPickCompressionFormatFromDebugVariable, IGFX_XE_HPG_CORE); +HWTEST_EXCLUDE_PRODUCT(DeviceGetCapsTest, givenEnabledFtrPooledEuWhenCalculatingMaxEuPerSSThenDontIgnoreEuCountPerPoolMin, IGFX_XE_HPG_CORE); +HWTEST_EXCLUDE_PRODUCT(DeviceGetCapsTest, givenDeviceThatHasHighNumberOfExecutionUnitsWhenMaxWorkgroupSizeIsComputedItIsLimitedTo1024, IGFX_XE_HPG_CORE); diff --git a/opencl/test/unit_test/xe_hpg_core/test_cl_device_caps_xe_hpg_core.cpp b/opencl/test/unit_test/xe_hpg_core/test_cl_device_caps_xe_hpg_core.cpp new file mode 100644 index 0000000000..c8c919a6b7 --- /dev/null +++ b/opencl/test/unit_test/xe_hpg_core/test_cl_device_caps_xe_hpg_core.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/xe_hpg_core/hw_cmds.h" +#include "shared/test/common/helpers/gtest_helpers.h" +#include "shared/test/common/test_macros/header/per_product_test_definitions.h" + +#include "opencl/test/unit_test/fixtures/cl_device_fixture.h" + +using namespace NEO; + +using XeHpgCoreClDeviceCaps = Test; + +XE_HPG_CORETEST_F(XeHpgCoreClDeviceCaps, givenXeHpgCoreWhenCheckExtensionsThenDeviceDoesNotReportClKhrSubgroupsExtension) { + const auto &caps = pClDevice->getDeviceInfo(); + + EXPECT_FALSE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_subgroups"))); +} + +XE_HPG_CORETEST_F(XeHpgCoreClDeviceCaps, giveDeviceExtensionsWhenDeviceCapsInitializedThenAddProperExtensions) { + const auto &productHelper = getHelper(); + const auto &caps = pClDevice->getDeviceInfo(); + + EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_create_buffer_with_properties"))); + EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_dot_accumulate"))); + EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_local_block_io"))); + + bool expectMatrixMultiplyAccumulateExtensions = productHelper.isMatrixMultiplyAccumulateSupported(pClDevice->getHardwareInfo()); + EXPECT_EQ(expectMatrixMultiplyAccumulateExtensions, hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate"))); + EXPECT_EQ(expectMatrixMultiplyAccumulateExtensions, hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_split_matrix_multiply_accumulate"))); + + bool expectBFloat16ConversionsExtension = productHelper.isBFloat16ConversionSupported(pClDevice->getHardwareInfo()); + EXPECT_EQ(expectBFloat16ConversionsExtension, hasSubstr(caps.deviceExtensions, std::string("cl_intel_bfloat16_conversions"))); +} + +XE_HPG_CORETEST_F(XeHpgCoreClDeviceCaps, givenXeHpgCoreWhenCheckingCapsThenDeviceDoesNotSupportIndependentForwardProgress) { + const auto &caps = pClDevice->getDeviceInfo(); + + EXPECT_FALSE(caps.independentForwardProgress); +} + +XE_HPG_CORETEST_F(XeHpgCoreClDeviceCaps, givenDeviceThatHasHighNumberOfExecutionUnitsAndNotA0SteppingWhenMaxWorkgroupSizeIsComputedThenItIsLimitedTo1024) { + HardwareInfo myHwInfo = *defaultHwInfo; + GT_SYSTEM_INFO &mySysInfo = myHwInfo.gtSystemInfo; + PLATFORM &myPlatform = myHwInfo.platform; + + mySysInfo.EUCount = 32; + mySysInfo.SubSliceCount = 2; + mySysInfo.DualSubSliceCount = 2; + mySysInfo.ThreadCount = 32 * 8; // 128 threads per subslice, in simd 8 gives 1024 + myPlatform.usRevId = 0x4; + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&myHwInfo)); + + EXPECT_EQ(1024u, device->sharedDeviceInfo.maxWorkGroupSize); + EXPECT_EQ(device->sharedDeviceInfo.maxWorkGroupSize / 8, device->getDeviceInfo().maxNumOfSubGroups); +} diff --git a/opencl/test/unit_test/xe_hpg_core/test_device_caps_xe_hpg_core.cpp b/opencl/test/unit_test/xe_hpg_core/test_device_caps_xe_hpg_core.cpp deleted file mode 100644 index f7eeb28bd0..0000000000 --- a/opencl/test/unit_test/xe_hpg_core/test_device_caps_xe_hpg_core.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2021-2022 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/helpers/hw_helper.h" -#include "shared/test/common/helpers/gtest_helpers.h" -#include "shared/test/common/test_macros/header/per_product_test_definitions.h" -#include "shared/test/common/test_macros/test.h" - -#include "opencl/test/unit_test/fixtures/cl_device_fixture.h" - -#include "hw_cmds_xe_hpg_core_base.h" - -using namespace NEO; - -typedef Test XeHpgCoreDeviceCaps; - -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, givenXeHpgCoreWhenCheckExtensionsThenDeviceDoesNotReportClKhrSubgroupsExtension) { - const auto &caps = pClDevice->getDeviceInfo(); - - EXPECT_FALSE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_subgroups"))); -} - -XE_HPG_CORETEST_F(XeHpgCoreDeviceCaps, giveDeviceExtensionsWhenDeviceCapsInitializedThenAddProperExtensions) { - auto &hwInfoConfig = *HwInfoConfig::get(pClDevice->getHardwareInfo().platform.eProductFamily); - const auto &caps = pClDevice->getDeviceInfo(); - - EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_create_buffer_with_properties"))); - EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_dot_accumulate"))); - EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_local_block_io"))); - - bool expectMatrixMultiplyAccumulateExtensions = hwInfoConfig.isMatrixMultiplyAccumulateSupported(pClDevice->getHardwareInfo()); - EXPECT_EQ(expectMatrixMultiplyAccumulateExtensions, hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate"))); - EXPECT_EQ(expectMatrixMultiplyAccumulateExtensions, hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_split_matrix_multiply_accumulate"))); - - bool expectBFloat16ConversionsExtension = hwInfoConfig.isBFloat16ConversionSupported(pClDevice->getHardwareInfo()); - EXPECT_EQ(expectBFloat16ConversionsExtension, hasSubstr(caps.deviceExtensions, std::string("cl_intel_bfloat16_conversions"))); -} - -XE_HPG_CORETEST_F(XeHpgCoreDeviceCaps, givenXeHpgCoreWhenCheckingCapsThenDeviceDoesNotSupportIndependentForwardProgress) { - const auto &caps = pClDevice->getDeviceInfo(); - - EXPECT_FALSE(caps.independentForwardProgress); -} - -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(MockDevice::createWithNewExecutionEnvironment(&myHwInfo)); - - auto expectedMaxWGS = mySysInfo.EuCountPerPoolMin * (mySysInfo.ThreadCount / mySysInfo.EUCount) * 8; - expectedMaxWGS = std::min(Math::prevPowerOfTwo(expectedMaxWGS), 1024u); - - EXPECT_EQ(expectedMaxWGS, device->getDeviceInfo().maxWorkGroupSize); -} - -XE_HPG_CORETEST_F(XeHpgCoreDeviceCaps, givenDeviceThatHasHighNumberOfExecutionUnitsAndNotA0SteppingWhenMaxWorkgroupSizeIsComputedThenItIsLimitedTo1024) { - HardwareInfo myHwInfo = *defaultHwInfo; - GT_SYSTEM_INFO &mySysInfo = myHwInfo.gtSystemInfo; - PLATFORM &myPlatform = myHwInfo.platform; - - mySysInfo.EUCount = 32; - mySysInfo.SubSliceCount = 2; - mySysInfo.DualSubSliceCount = 2; - mySysInfo.ThreadCount = 32 * 8; // 128 threads per subslice, in simd 8 gives 1024 - myPlatform.usRevId = 0x4; - auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&myHwInfo)); - - EXPECT_EQ(1024u, device->sharedDeviceInfo.maxWorkGroupSize); - EXPECT_EQ(device->sharedDeviceInfo.maxWorkGroupSize / 8, device->getDeviceInfo().maxNumOfSubGroups); -} - -HWTEST_EXCLUDE_PRODUCT(DeviceGetCapsTest, givenEnabledFtrPooledEuWhenCalculatingMaxEuPerSSThenDontIgnoreEuCountPerPoolMin, IGFX_XE_HPG_CORE); -HWTEST_EXCLUDE_PRODUCT(DeviceGetCapsTest, givenDeviceThatHasHighNumberOfExecutionUnitsWhenMaxWorkgroupSizeIsComputedItIsLimitedTo1024, IGFX_XE_HPG_CORE); diff --git a/shared/test/unit_test/xe_hpc_core/CMakeLists.txt b/shared/test/unit_test/xe_hpc_core/CMakeLists.txt index fbc4117fac..528457da62 100644 --- a/shared/test/unit_test/xe_hpc_core/CMakeLists.txt +++ b/shared/test/unit_test/xe_hpc_core/CMakeLists.txt @@ -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 diff --git a/shared/test/unit_test/xe_hpc_core/test_device_caps_xe_hpc_core.cpp b/shared/test/unit_test/xe_hpc_core/test_device_caps_xe_hpc_core.cpp new file mode 100644 index 0000000000..57a89f75ff --- /dev/null +++ b/shared/test/unit_test/xe_hpc_core/test_device_caps_xe_hpc_core.cpp @@ -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; + +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(); + + const auto deviceSubgroups = coreHelper.getDeviceSubGroupSizes(); + + EXPECT_EQ(2u, deviceSubgroups.size()); + EXPECT_EQ(16u, deviceSubgroups[0]); + EXPECT_EQ(32u, deviceSubgroups[1]); +} diff --git a/shared/test/unit_test/xe_hpg_core/CMakeLists.txt b/shared/test/unit_test/xe_hpg_core/CMakeLists.txt index 38d4bf8f48..29dffd390b 100644 --- a/shared/test/unit_test/xe_hpg_core/CMakeLists.txt +++ b/shared/test/unit_test/xe_hpg_core/CMakeLists.txt @@ -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 diff --git a/shared/test/unit_test/xe_hpg_core/test_device_caps_xe_hpg_core.cpp b/shared/test/unit_test/xe_hpg_core/test_device_caps_xe_hpg_core.cpp new file mode 100644 index 0000000000..b5e62776d3 --- /dev/null +++ b/shared/test/unit_test/xe_hpg_core/test_device_caps_xe_hpg_core.cpp @@ -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; + +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(MockDevice::createWithNewExecutionEnvironment(&myHwInfo)); + + auto expectedMaxWGS = mySysInfo.EuCountPerPoolMin * (mySysInfo.ThreadCount / mySysInfo.EUCount) * 8; + expectedMaxWGS = std::min(Math::prevPowerOfTwo(expectedMaxWGS), 1024u); + + EXPECT_EQ(expectedMaxWGS, device->getDeviceInfo().maxWorkGroupSize); +}