refactor: remove not used code

Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:
Artur Harasimiuk
2023-06-28 09:43:39 +02:00
committed by Compute-Runtime-Automation
parent 0d7aefe66b
commit cf73ab0df3
36 changed files with 1 additions and 2516 deletions

View File

@@ -1,31 +0,0 @@
#
# Copyright (C) 2021-2023 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(TESTS_XE_HP_SDV)
set(IGDRCL_SRCS_tests_xe_hp_core_xehp
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/cache_flush_tests_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/get_device_info_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/gfx_core_helper_tests_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_tests_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/sampler_tests_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/source_level_debugger_csr_tests_xehp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_buffer_xe_hp_sdv.inl
${CMAKE_CURRENT_SOURCE_DIR}/test_command_stream_receiver_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/test_product_helper_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/test_image_xe_hp_sdv.inl
${CMAKE_CURRENT_SOURCE_DIR}/test_local_work_size_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/test_sub_devices_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_xehp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_platform_caps_xehp.inl
${CMAKE_CURRENT_SOURCE_DIR}/test_wrapper_xehp.cpp
)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_xe_hp_core_xehp})
add_subdirectories()
endif()

View File

@@ -1,83 +0,0 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/mocks/mock_allocation_properties.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/common/utilities/base_object_utils.h"
#include "opencl/test/unit_test/kernel/cache_flush_xehp_and_later_tests.inl"
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
using namespace NEO;
using GivenCacheFlushAfterWalkerEnabledWhenSvmAllocationsSetAsCacheFlushRequiringThenExpectCacheFlushCommandXEHP = GivenCacheFlushAfterWalkerEnabledWhenSvmAllocationsSetAsCacheFlushRequiringThenExpectCacheFlushCommand<XeHpFamily>;
XEHPTEST_F(GivenCacheFlushAfterWalkerEnabledWhenSvmAllocationsSetAsCacheFlushRequiringThenExpectCacheFlushCommandXEHP, I) {
testBodyImpl();
}
using GivenCacheFlushAfterWalkerEnabledWhenKernelArgIsSetAsCacheFlushRequiredThenExpectCacheFlushCommandXEHP = GivenCacheFlushAfterWalkerEnabledWhenKernelArgIsSetAsCacheFlushRequiredThenExpectCacheFlushCommand<XeHpFamily>;
XEHPTEST_F(GivenCacheFlushAfterWalkerEnabledWhenKernelArgIsSetAsCacheFlushRequiredThenExpectCacheFlushCommandXEHP, I) {
testBodyImpl();
}
using GivenCacheFlushAfterWalkerEnabledWhenProgramGlobalSurfacePresentThenExpectCacheFlushCommandXEHP = GivenCacheFlushAfterWalkerEnabledWhenProgramGlobalSurfacePresentThenExpectCacheFlushCommand<XeHpFamily>;
XEHPTEST_F(GivenCacheFlushAfterWalkerEnabledWhenProgramGlobalSurfacePresentThenExpectCacheFlushCommandXEHP, I) {
testBodyImpl();
}
using GivenCacheFlushAfterWalkerEnabledWhenProgramGlobalSurfacePresentAndPostSyncRequiredThenExpectProperCacheFlushCommandXEHP = GivenCacheFlushAfterWalkerEnabledWhenProgramGlobalSurfacePresentAndPostSyncRequiredThenExpectProperCacheFlushCommand<XeHpFamily>;
XEHPTEST_F(GivenCacheFlushAfterWalkerEnabledWhenProgramGlobalSurfacePresentAndPostSyncRequiredThenExpectProperCacheFlushCommandXEHP, I) {
testBodyImpl();
}
using GivenCacheFlushAfterWalkerEnabledWhenAllocationRequiresCacheFlushThenFlushCommandPresentAfterWalkerXEHP = GivenCacheFlushAfterWalkerEnabledWhenAllocationRequiresCacheFlushThenFlushCommandPresentAfterWalker<XeHpFamily>;
XEHPTEST_F(GivenCacheFlushAfterWalkerEnabledWhenAllocationRequiresCacheFlushThenFlushCommandPresentAfterWalkerXEHP, I) {
testBodyImpl();
}
using GivenCacheFlushAfterWalkerDisabledWhenAllocationRequiresCacheFlushThenFlushCommandNotPresentAfterWalkerXEHP = GivenCacheFlushAfterWalkerDisabledWhenAllocationRequiresCacheFlushThenFlushCommandNotPresentAfterWalker<XeHpFamily>;
XEHPTEST_F(GivenCacheFlushAfterWalkerDisabledWhenAllocationRequiresCacheFlushThenFlushCommandNotPresentAfterWalkerXEHP, I) {
testBodyImpl();
}
using GivenCacheFlushAfterWalkerAndTimestampPacketsEnabledWhenAllocationRequiresCacheFlushThenFlushCommandPresentAfterWalkerXEHP = GivenCacheFlushAfterWalkerAndTimestampPacketsEnabledWhenAllocationRequiresCacheFlushThenFlushCommandPresentAfterWalker<XeHpFamily>;
XEHPTEST_F(GivenCacheFlushAfterWalkerAndTimestampPacketsEnabledWhenAllocationRequiresCacheFlushThenFlushCommandPresentAfterWalkerXEHP, I) {
testBodyImpl();
}
using GivenCacheFlushAfterWalkerEnabledWhenSvmAllocationsSetAsCacheFlushRequiringThenExpectCorrectCommandSizeXEHP = GivenCacheFlushAfterWalkerEnabledWhenSvmAllocationsSetAsCacheFlushRequiringThenExpectCorrectCommandSize<XeHpFamily>;
XEHPTEST_F(GivenCacheFlushAfterWalkerEnabledWhenSvmAllocationsSetAsCacheFlushRequiringThenExpectCorrectCommandSizeXEHP, I) {
testBodyImpl();
}
using GivenCacheFlushAfterWalkerEnabledWhenMoreThan126AllocationRangesRequiresCacheFlushThenAtLeatsTwoFlushCommandPresentAfterWalkerXEHP = GivenCacheFlushAfterWalkerEnabledWhenMoreThan126AllocationRangesRequiresCacheFlushThenAtLeatsTwoFlushCommandPresentAfterWalker<XeHpFamily>;
XEHPTEST_F(GivenCacheFlushAfterWalkerEnabledWhenMoreThan126AllocationRangesRequiresCacheFlushThenAtLeatsTwoFlushCommandPresentAfterWalkerXEHP, I) {
testBodyImpl();
}
using GivenCacheFlushAfterWalkerEnabledWhen126AllocationRangesRequiresCacheFlushThenExpectOneFlushXEHP = GivenCacheFlushAfterWalkerEnabledWhen126AllocationRangesRequiresCacheFlushThenExpectOneFlush<XeHpFamily>;
XEHPTEST_F(GivenCacheFlushAfterWalkerEnabledWhen126AllocationRangesRequiresCacheFlushThenExpectOneFlushXEHP, I) {
testBodyImpl();
}
using GivenCacheFlushAfterWalkerAndTimestampPacketsEnabledWhenMoreThan126AllocationRangesRequiresCacheFlushThenExpectFlushWithOutPostSyncAndThenWithPostSyncXEHP = GivenCacheFlushAfterWalkerAndTimestampPacketsEnabledWhenMoreThan126AllocationRangesRequiresCacheFlushThenExpectFlushWithOutPostSyncAndThenWithPostSync<XeHpFamily>;
XEHPTEST_F(GivenCacheFlushAfterWalkerAndTimestampPacketsEnabledWhenMoreThan126AllocationRangesRequiresCacheFlushThenExpectFlushWithOutPostSyncAndThenWithPostSyncXEHP, I) {
testBodyImpl();
}
using CommandQueueHwCacheFlushTest = ::testing::Test;
XEHPTEST_F(CommandQueueHwCacheFlushTest, givenHwCommandQueueForSpecificTileThenCacheFlushAfterWalkerIsNeeded) {
UltClDeviceFactory clDeviceFactory{1, 2};
cl_device_id devices[] = {clDeviceFactory.subDevices[0], clDeviceFactory.subDevices[1]};
MockContext context{ClDeviceVector{devices, 2}};
{
MockCommandQueueHw<FamilyType> commandQueue{&context, clDeviceFactory.rootDevices[0], nullptr};
EXPECT_FALSE(commandQueue.getRequiresCacheFlushAfterWalker());
}
{
MockCommandQueueHw<FamilyType> commandQueue{&context, clDeviceFactory.subDevices[0], nullptr};
EXPECT_TRUE(commandQueue.getRequiresCacheFlushAfterWalker());
}
}

View File

@@ -1,86 +0,0 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/product_helper.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/fixtures/device_info_fixture.h"
using namespace NEO;
HWTEST_EXCLUDE_PRODUCT(GetDeviceInfoMemCapabilitiesTest, GivenValidParametersWhenGetDeviceInfoIsCalledForXE_HP_COREThenClSuccessIsReturned, IGFX_XE_HP_SDV);
XEHPTEST_F(GetDeviceInfoMemCapabilitiesTest, GivenValidParametersWhenGetDeviceInfoIsCalledForXEHPThenClSuccessIsReturned) {
std::vector<TestParams> params = {
{CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL,
(CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL)},
{CL_DEVICE_SINGLE_DEVICE_SHARED_MEM_CAPABILITIES_INTEL,
(CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL)},
{CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL,
(CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL)},
{CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL, 0}};
check(params);
}
XEHPTEST_F(GetDeviceInfoMemCapabilitiesTest, GivenA0ThenUsmHostMemSupportIsEnabledByDefault) {
std::vector<TestParams> params = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL}};
check(params);
}
XEHPTEST_F(GetDeviceInfoMemCapabilitiesTest, GivenDebugVariableIsEnabledThenUsmHostMemSupportIsEnabled) {
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.EnableHostUsmSupport.set(1);
std::vector<TestParams> params = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL}};
check(params);
}
XEHPTEST_F(GetDeviceInfoMemCapabilitiesTest, GivenA0AndDebugVariableIsDisabledThenUsmHostMemSupportIsDisabled) {
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
const auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily);
defaultHwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, *defaultHwInfo);
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.EnableHostUsmSupport.set(0);
std::vector<TestParams> params = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, 0}};
std::vector<TestParams> enabledParams = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL}};
check(params);
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
check(params);
DebugManager.flags.EnableHostUsmSupport.set(1);
check(enabledParams);
DebugManager.flags.EnableHostUsmSupport.set(-1);
check(params);
}
XEHPTEST_F(GetDeviceInfoMemCapabilitiesTest, GivenB0ThenUsmHostMemSupportIsSetCorrectly) {
const auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily);
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
defaultHwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, *defaultHwInfo);
std::vector<TestParams> params = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL}};
std::vector<TestParams> disabledParameters = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, 0u}};
check(params);
{
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.EnableHostUsmSupport.set(0);
check(disabledParameters);
}
{
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.EnableHostUsmSupport.set(1);
check(params);
}
}

View File

@@ -1,109 +0,0 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/gfx_core_helper_tests.h"
using GfxCoreHelperTestsXeHP = GfxCoreHelperTest;
XEHPTEST_F(GfxCoreHelperTestsXeHP, givenXEHPWhenIsBankOverrideRequiredIsCalledThenCorrectValueIsReturned) {
DebugManagerStateRestore restore;
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
auto &productHelper = getHelper<ProductHelper>();
auto hwInfo = *defaultHwInfo;
hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
{
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 4;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
EXPECT_TRUE(gfxCoreHelper.isBankOverrideRequired(hwInfo, productHelper));
}
{
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 4;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo);
EXPECT_FALSE(gfxCoreHelper.isBankOverrideRequired(hwInfo, productHelper));
}
{
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 2;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
EXPECT_FALSE(gfxCoreHelper.isBankOverrideRequired(hwInfo, productHelper));
}
{
DebugManager.flags.ForceMemoryBankIndexOverride.set(1);
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 1;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
EXPECT_TRUE(gfxCoreHelper.isBankOverrideRequired(hwInfo, productHelper));
}
{
DebugManager.flags.ForceMemoryBankIndexOverride.set(0);
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 4;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
EXPECT_FALSE(gfxCoreHelper.isBankOverrideRequired(hwInfo, productHelper));
}
}
XEHPTEST_F(GfxCoreHelperTestsXeHP, givenRcsDisabledWhenGetGpgpuEnginesCalledThenDontSetRcs) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.featureTable.flags.ftrCCSNode = true;
hwInfo.featureTable.ftrBcsInfo = 1;
hwInfo.featureTable.flags.ftrRcsNode = false;
hwInfo.capabilityTable.blitterOperationsSupported = true;
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
EXPECT_EQ(8u, device->allEngines.size());
auto &engines = GfxCoreHelperHw<FamilyType>::get().getGpgpuEngineInstances(hwInfo);
EXPECT_EQ(8u, engines.size());
EXPECT_EQ(aub_stream::ENGINE_CCS, engines[0].first);
EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[1].first);
EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[2].first);
EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[3].first);
EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[4].first); // low priority
EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[5].first); // internal
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[6].first);
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[7].first);
}
XEHPTEST_F(GfxCoreHelperTestsXeHP, givenRcsDisabledButDebugVariableSetWhenGetGpgpuEnginesCalledThenSetRcs) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.featureTable.flags.ftrCCSNode = true;
hwInfo.featureTable.ftrBcsInfo = 1;
hwInfo.featureTable.flags.ftrRcsNode = false;
hwInfo.capabilityTable.blitterOperationsSupported = true;
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
DebugManagerStateRestore restore;
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_RCS));
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
EXPECT_EQ(9u, device->allEngines.size());
auto &engines = GfxCoreHelperHw<FamilyType>::get().getGpgpuEngineInstances(hwInfo);
EXPECT_EQ(9u, engines.size());
EXPECT_EQ(aub_stream::ENGINE_CCS, engines[0].first);
EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[1].first);
EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[2].first);
EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[3].first);
EXPECT_EQ(aub_stream::ENGINE_RCS, engines[4].first);
EXPECT_EQ(aub_stream::ENGINE_RCS, engines[5].first); // low priority
EXPECT_EQ(aub_stream::ENGINE_RCS, engines[6].first); // internal
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[7].first);
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[8].first);
}
XEHPTEST_F(GfxCoreHelperTestsXeHP, GivenVariousValuesWhenComputeSlmSizeIsCalledThenCorrectValueIsReturned) {
auto &hwInfo = pDevice->getHardwareInfo();
for (auto &testInput : computeSlmValuesXeHPAndLaterTestsInput) {
EXPECT_EQ(testInput.expected, GfxCoreHelperHw<FamilyType>::get().computeSlmValues(hwInfo, testInput.slmSize));
}
}

View File

@@ -1,91 +0,0 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/hw_info.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/gtest_helpers.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
using XeHPHwInfoTest = ::testing::Test;
XEHPTEST_F(XeHPHwInfoTest, whenSetupHardwareInfoWithSetupFeatureTableFlagTrueOrFalseIsCalledThenFeatureTableHasCorrectValues) {
HardwareInfo hwInfo = *defaultHwInfo;
FeatureTable &featureTable = hwInfo.featureTable;
GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
EXPECT_FALSE(featureTable.flags.ftrLocalMemory);
EXPECT_FALSE(featureTable.flags.ftrFlatPhysCCS);
EXPECT_FALSE(featureTable.flags.ftrLinearCCS);
EXPECT_FALSE(featureTable.flags.ftrE2ECompression);
EXPECT_FALSE(featureTable.flags.ftrCCSNode);
EXPECT_FALSE(featureTable.flags.ftrCCSRing);
EXPECT_FALSE(featureTable.flags.ftrMultiTileArch);
EXPECT_FALSE(featureTable.flags.ftrLinearCCS);
EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled);
EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated);
EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb);
XehpSdvHwConfig::setupHardwareInfo(&hwInfo, false);
EXPECT_FALSE(featureTable.flags.ftrLocalMemory);
EXPECT_FALSE(featureTable.flags.ftrFlatPhysCCS);
EXPECT_FALSE(featureTable.flags.ftrLinearCCS);
EXPECT_FALSE(featureTable.flags.ftrE2ECompression);
EXPECT_FALSE(featureTable.flags.ftrCCSNode);
EXPECT_FALSE(featureTable.flags.ftrCCSRing);
EXPECT_FALSE(featureTable.flags.ftrMultiTileArch);
EXPECT_FALSE(featureTable.flags.ftrLinearCCS);
EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled);
EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated);
EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb);
XehpSdvHwConfig::setupHardwareInfo(&hwInfo, true);
EXPECT_TRUE(featureTable.flags.ftrLocalMemory);
EXPECT_TRUE(featureTable.flags.ftrFlatPhysCCS);
EXPECT_TRUE(featureTable.flags.ftrLinearCCS);
EXPECT_TRUE(featureTable.flags.ftrE2ECompression);
EXPECT_TRUE(featureTable.flags.ftrCCSNode);
EXPECT_TRUE(featureTable.flags.ftrCCSRing);
EXPECT_TRUE(featureTable.flags.ftrMultiTileArch);
EXPECT_TRUE(featureTable.flags.ftrLinearCCS);
EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled);
EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated);
EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb);
}
XEHPTEST_F(XeHPHwInfoTest, givenAlreadyInitializedHwInfoWhenSetupCalledThenDontOverride) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.gtSystemInfo.SliceCount = 0;
XehpSdvHwConfig::setupHardwareInfo(&hwInfo, false);
EXPECT_NE(0u, hwInfo.gtSystemInfo.SliceCount);
auto expectedValue = ++hwInfo.gtSystemInfo.SliceCount;
XehpSdvHwConfig::setupHardwareInfo(&hwInfo, false);
EXPECT_EQ(expectedValue, hwInfo.gtSystemInfo.SliceCount);
}
XEHPTEST_F(XeHPHwInfoTest, givenXeHpConfigWhenSetupHardwareInfoBaseThenGtSystemInfoIsCorrect) {
HardwareInfo hwInfo = *defaultHwInfo;
GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
XE_HP_SDV::setupHardwareInfoBase(&hwInfo, false);
EXPECT_EQ(336u, gtSystemInfo.TotalVsThreads);
EXPECT_EQ(336u, gtSystemInfo.TotalHsThreads);
EXPECT_EQ(336u, gtSystemInfo.TotalDsThreads);
EXPECT_EQ(336u, gtSystemInfo.TotalGsThreads);
EXPECT_EQ(64u, gtSystemInfo.TotalPsThreadsWindowerRange);
EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb);
EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled);
EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated);
}

View File

@@ -1,9 +0,0 @@
#
# Copyright (C) 2021-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(UNIX)
add_subdirectories()
endif()

View File

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

View File

@@ -1,31 +0,0 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/fixtures/linux/device_id_fixture.h"
using namespace NEO;
TEST_F(DeviceIdTests, GivenXeHpSdvSupportedDeviceIdThenConfigIsCorrect) {
std::array<DeviceDescriptor, 16> expectedDescriptors = {{{0x0201, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x0202, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x0203, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x0204, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x0205, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x0206, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x0207, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x0208, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x0209, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x020A, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x020B, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x020C, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x020D, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x020E, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x020F, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo},
{0x0210, &XehpSdvHwConfig::hwInfo, &XehpSdvHwConfig::setupHardwareInfo}}};
testImpl(expectedDescriptors);
}

View File

@@ -1,25 +0,0 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
using MemoryManagerTestsXeHP = ::testing::Test;
XEHPTEST_F(MemoryManagerTestsXeHP, givenEnabledLocalMemoryWhenLinearStreamIsAllocatedInPreferredPoolThenLocalMemoryPoolIsUsed) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
MockMemoryManager memoryManager(false, true, executionEnvironment);
auto allocation = memoryManager.allocateGraphicsMemoryInPreferredPool({mockRootDeviceIndex, MemoryConstants::pageSize, AllocationType::LINEAR_STREAM, mockDeviceBitfield}, nullptr);
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
EXPECT_TRUE(memoryManager.allocationInDevicePoolCreated);
memoryManager.freeGraphicsMemory(allocation);
}

View File

@@ -1,46 +0,0 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include <memory>
using namespace NEO;
using XeHPSamplerTest = Test<ClDeviceFixture>;
XEHPTEST_F(XeHPSamplerTest, givenXeHPSamplerWhenUsingDefaultFilteringAndAppendSamplerStateParamsThenDisableLowQualityFilter) {
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
auto state = FamilyType::cmdInitSamplerState;
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
auto &helper = getHelper<ProductHelper>();
helper.adjustSamplerState(&state, *defaultHwInfo);
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
}
XEHPTEST_F(XeHPSamplerTest, givenXeHPSamplerWhenForcingLowQualityFilteringAndAppendSamplerStateParamsThenEnableLowQualityFilter) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
auto state = FamilyType::cmdInitSamplerState;
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
auto &helper = getHelper<ProductHelper>();
helper.adjustSamplerState(&state, *defaultHwInfo);
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter());
}

View File

@@ -1,130 +0,0 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/source_level_debugger/source_level_debugger.h"
#include "shared/source/xe_hp_core/hw_cmds.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/helpers/dispatch_flags_helper.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/command_queue/command_queue_hw.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
#include "opencl/test/unit_test/source_level_debugger/source_level_debugger_csr_tests.h"
#include <memory>
using CommandStreamReceiverWithActiveDebuggerXehpTest = CommandStreamReceiverWithActiveDebuggerTest;
XEHPTEST_F(CommandStreamReceiverWithActiveDebuggerXehpTest, GivenASteppingAndActiveDebuggerAndWhenFlushTaskIsCalledThenAlwaysProgramStateBaseAddressAndGlobalSip) {
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
using MI_NOOP = typename FamilyType::MI_NOOP;
hwInfo = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getMutableHardwareInfo();
const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily);
hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVID::REVISION_A0, *hwInfo);
auto mockCsr = createCSR<FamilyType>();
mockCsr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
CommandQueueHw<FamilyType> commandQueue(nullptr, device.get(), 0, false);
auto &commandStream = commandQueue.getCS(4096u);
auto &csrStream = mockCsr->getCS(0);
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
void *buffer = alignedMalloc(MemoryConstants::pageSize, MemoryConstants::pageSize64k);
std::unique_ptr<MockGraphicsAllocation> allocation(new MockGraphicsAllocation(buffer, MemoryConstants::pageSize));
std::unique_ptr<IndirectHeap> heap(new IndirectHeap(allocation.get()));
auto &neoDevice = device->getDevice();
mockCsr->flushTask(commandStream,
0,
heap.get(),
heap.get(),
heap.get(),
0,
dispatchFlags,
neoDevice);
mockCsr->flushBatchedSubmissions();
auto noops = reinterpret_cast<MI_NOOP *>(commandStream.getSpace(8 * sizeof(MI_NOOP)));
for (int i = 0; i < 8; i++) {
noops[i] = FamilyType::cmdInitNoop;
}
mockCsr->flushTask(commandStream,
0,
heap.get(),
heap.get(),
heap.get(),
0,
dispatchFlags,
neoDevice);
auto sipAllocation = SipKernel::getSipKernel(neoDevice).getSipAllocation();
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(csrStream);
hwParser.parseCommands<FamilyType>(commandStream);
auto itorStateBaseAddr = find<STATE_BASE_ADDRESS *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
auto itorBbEnd = find<MI_BATCH_BUFFER_END *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
auto itorStateBaseAddr2 = find<STATE_BASE_ADDRESS *>(std::next(itorStateBaseAddr), hwParser.cmdList.end());
ASSERT_NE(hwParser.cmdList.end(), itorStateBaseAddr);
ASSERT_NE(hwParser.cmdList.end(), itorStateBaseAddr2);
auto itorGlobalSip1 = findMmio<FamilyType>(itorStateBaseAddr, itorBbEnd, GlobalSipRegister<FamilyType>::registerOffset);
auto itorGlobalSip2 = findMmio<FamilyType>(std::next(itorGlobalSip1), itorBbEnd, GlobalSipRegister<FamilyType>::registerOffset);
auto itorGlobalSip3 = findMmio<FamilyType>(itorBbEnd, hwParser.cmdList.end(), GlobalSipRegister<FamilyType>::registerOffset);
auto itorGlobalSip4 = findMmio<FamilyType>(std::next(itorGlobalSip3), hwParser.cmdList.end(), GlobalSipRegister<FamilyType>::registerOffset);
ASSERT_NE(hwParser.cmdList.end(), itorGlobalSip1);
ASSERT_NE(hwParser.cmdList.end(), itorGlobalSip2);
ASSERT_NE(hwParser.cmdList.end(), itorGlobalSip3);
ASSERT_NE(hwParser.cmdList.end(), itorGlobalSip4);
EXPECT_NE(itorGlobalSip1, itorGlobalSip2);
auto expectedSipPosition = --itorBbEnd;
EXPECT_EQ(expectedSipPosition, itorGlobalSip2);
auto itorBbEnd2 = find<MI_BATCH_BUFFER_END *>(itorGlobalSip3, hwParser.cmdList.end());
expectedSipPosition = --itorBbEnd2;
EXPECT_EQ(expectedSipPosition, itorGlobalSip4);
MI_LOAD_REGISTER_IMM *globalSip = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorGlobalSip1);
auto sipAddress = globalSip->getDataDword();
EXPECT_EQ(sipAllocation->getGpuAddressToPatch(), sipAddress & 0xfffffff8);
globalSip = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorGlobalSip2);
auto sipAddress2 = globalSip->getDataDword();
EXPECT_EQ(0u, sipAddress2);
globalSip = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorGlobalSip3);
sipAddress = globalSip->getDataDword();
EXPECT_EQ(sipAllocation->getGpuAddressToPatch(), sipAddress & 0xfffffff8);
globalSip = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorGlobalSip4);
sipAddress2 = globalSip->getDataDword();
EXPECT_EQ(0u, sipAddress2);
alignedFree(buffer);
}

View File

@@ -1,323 +0,0 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_container/implicit_scaling.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/cl_device/cl_device.h"
#include "opencl/source/mem_obj/buffer.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
using XeHpSdvBufferTests = ::testing::Test;
XEHPTEST_F(XeHpSdvBufferTests, givenContextTypeDefaultWhenBufferIsWritableAndOnlyOneTileIsAvailableThenRemainFlagsToTrue) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(1);
initPlatform();
EXPECT_EQ(0u, platform()->getClDevice(0)->getNumGenericSubDevices());
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context(platform()->getClDevice(0));
context.contextType = ContextType::CONTEXT_TYPE_DEFAULT;
size_t size = 0x1000;
auto retVal = CL_SUCCESS;
auto buffer = std::unique_ptr<Buffer>(
Buffer::create(
&context,
CL_MEM_READ_WRITE,
size,
nullptr,
retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
surfaceState.setDisableSupportForMultiGpuAtomics(false);
surfaceState.setDisableSupportForMultiGpuPartialWrites(false);
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false, false);
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
XEHPTEST_F(XeHpSdvBufferTests, givenContextTypeDefaultWhenBufferIsWritableThenFlipPartialFlagsToFalse) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(4);
initPlatform();
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context(platform()->getClDevice(0));
context.contextType = ContextType::CONTEXT_TYPE_DEFAULT;
size_t size = 0x1000;
auto retVal = CL_SUCCESS;
auto buffer = std::unique_ptr<Buffer>(
Buffer::create(
&context,
CL_MEM_READ_WRITE,
size,
nullptr,
retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), true, true);
EXPECT_FALSE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_FALSE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
XEHPTEST_F(XeHpSdvBufferTests, givenContextTypeUnrestrictiveWhenBufferIsWritableThenFlipPartialFlagsToFalse) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(4);
initPlatform();
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context(platform()->getClDevice(0));
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
size_t size = 0x1000;
auto retVal = CL_SUCCESS;
auto buffer = std::unique_ptr<Buffer>(
Buffer::create(
&context,
CL_MEM_READ_WRITE,
size,
nullptr,
retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), true, true);
EXPECT_FALSE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_FALSE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
XEHPTEST_F(XeHpSdvBufferTests, givenContextTypeDefaultWhenBufferIsNotWritableThenRemainPartialFlagsToTrue) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_DEFAULT;
size_t size = 0x1000;
auto retVal = CL_SUCCESS;
auto buffer = std::unique_ptr<Buffer>(Buffer::create(
&context,
CL_MEM_READ_ONLY,
size,
nullptr,
retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
surfaceState.setDisableSupportForMultiGpuAtomics(false);
surfaceState.setDisableSupportForMultiGpuPartialWrites(false);
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), true, false);
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
XEHPTEST_F(XeHpSdvBufferTests, givenContextTypeSpecializedWhenBufferIsWritableThenRemainPartialFlagsToTrue) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_SPECIALIZED;
size_t size = 0x1000;
auto retVal = CL_SUCCESS;
auto buffer = std::unique_ptr<Buffer>(Buffer::create(
&context,
CL_MEM_READ_WRITE,
size,
nullptr,
retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
surfaceState.setDisableSupportForMultiGpuAtomics(false);
surfaceState.setDisableSupportForMultiGpuPartialWrites(false);
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false, false);
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
XEHPTEST_F(XeHpSdvBufferTests, givenDebugFlagForMultiTileSupportWhenSurfaceStateIsSetThenValuesMatch) {
DebugManagerStateRestore restore;
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_SPECIALIZED;
size_t size = 0x1000;
auto retVal = CL_SUCCESS;
auto buffer = std::unique_ptr<Buffer>(Buffer::create(
&context,
CL_MEM_READ_WRITE,
size,
nullptr,
retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
DebugManager.flags.ForceMultiGpuAtomics.set(0);
DebugManager.flags.ForceMultiGpuPartialWrites.set(0);
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false, false);
EXPECT_EQ(0u, surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_EQ(0u, surfaceState.getDisableSupportForMultiGpuPartialWrites());
DebugManager.flags.ForceMultiGpuAtomics.set(1);
DebugManager.flags.ForceMultiGpuPartialWrites.set(1);
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false, false);
EXPECT_EQ(1u, surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_EQ(1u, surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
XEHPTEST_F(XeHpSdvBufferTests, givenNullContextWhenBufferAllocationIsNullThenRemainPartialFlagsToTrue) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
auto size = MemoryConstants::pageSize;
auto ptr = alignedMalloc(size, MemoryConstants::pageSize);
surfaceState.setDisableSupportForMultiGpuAtomics(false);
surfaceState.setDisableSupportForMultiGpuPartialWrites(false);
Buffer::setSurfaceState(device.get(), &surfaceState, false, false, size, ptr, 0, nullptr, 0, 0, false, false);
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
alignedFree(ptr);
}
struct MultiGpuGlobalAtomicsBufferTest : public XeHpSdvBufferTests,
public ::testing::WithParamInterface<std::tuple<unsigned int, unsigned int, bool, bool, bool>> {
};
XEHPTEST_P(MultiGpuGlobalAtomicsBufferTest, givenSetArgStatefulCalledThenDisableSupportForMultiGpuAtomicsIsSetCorrectly) {
unsigned int numAvailableDevices, bufferFlags;
bool useGlobalAtomics, areMultipleSubDevicesInContext, enableMultiGpuAtomicsOptimization;
std::tie(numAvailableDevices, bufferFlags, useGlobalAtomics, areMultipleSubDevicesInContext, enableMultiGpuAtomicsOptimization) = GetParam();
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(numAvailableDevices);
DebugManager.flags.EnableMultiGpuAtomicsOptimization.set(enableMultiGpuAtomicsOptimization);
initPlatform();
if (numAvailableDevices == 1) {
EXPECT_EQ(0u, platform()->getClDevice(0)->getNumGenericSubDevices());
} else {
EXPECT_EQ(numAvailableDevices, platform()->getClDevice(0)->getNumGenericSubDevices());
}
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context(platform()->getClDevice(0));
context.contextType = ContextType::CONTEXT_TYPE_DEFAULT;
size_t size = 0x1000;
auto retVal = CL_SUCCESS;
auto buffer = std::unique_ptr<Buffer>(
Buffer::create(
&context,
bufferFlags,
size,
nullptr,
retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
surfaceState.setDisableSupportForMultiGpuAtomics(false);
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), useGlobalAtomics, areMultipleSubDevicesInContext);
DeviceBitfield deviceBitfield{static_cast<uint32_t>(maxNBitValue(numAvailableDevices))};
bool implicitScaling = ImplicitScalingHelper::isImplicitScalingEnabled(deviceBitfield, true);
bool enabled = implicitScaling;
if (enableMultiGpuAtomicsOptimization) {
enabled = useGlobalAtomics && (enabled || areMultipleSubDevicesInContext);
}
EXPECT_EQ(!enabled, surfaceState.getDisableSupportForMultiGpuAtomics());
}
XEHPTEST_P(MultiGpuGlobalAtomicsBufferTest, givenSetSurfaceStateCalledThenDisableSupportForMultiGpuAtomicsIsSetCorrectly) {
unsigned int numAvailableDevices, bufferFlags;
bool useGlobalAtomics, areMultipleSubDevicesInContext, enableMultiGpuAtomicsOptimization;
std::tie(numAvailableDevices, bufferFlags, useGlobalAtomics, areMultipleSubDevicesInContext, enableMultiGpuAtomicsOptimization) = GetParam();
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(numAvailableDevices);
DebugManager.flags.EnableMultiGpuAtomicsOptimization.set(enableMultiGpuAtomicsOptimization);
initPlatform();
if (numAvailableDevices == 1) {
EXPECT_EQ(0u, platform()->getClDevice(0)->getNumGenericSubDevices());
} else {
EXPECT_EQ(numAvailableDevices, platform()->getClDevice(0)->getNumGenericSubDevices());
}
auto size = MemoryConstants::pageSize;
auto ptr = alignedMalloc(size, MemoryConstants::pageSize);
MockGraphicsAllocation gfxAllocation(ptr, size);
gfxAllocation.setMemObjectsAllocationWithWritableFlags(bufferFlags == CL_MEM_READ_WRITE);
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
surfaceState.setDisableSupportForMultiGpuAtomics(false);
Buffer::setSurfaceState(&platform()->getClDevice(0)->getDevice(), &surfaceState, false, false, 0, nullptr, 0, &gfxAllocation, bufferFlags, 0, useGlobalAtomics, areMultipleSubDevicesInContext);
DeviceBitfield deviceBitfield{static_cast<uint32_t>(maxNBitValue(numAvailableDevices))};
bool implicitScaling = ImplicitScalingHelper::isImplicitScalingEnabled(deviceBitfield, true);
bool enabled = implicitScaling;
if (enableMultiGpuAtomicsOptimization) {
enabled = useGlobalAtomics && (enabled || areMultipleSubDevicesInContext);
}
EXPECT_EQ(!enabled, surfaceState.getDisableSupportForMultiGpuAtomics());
alignedFree(ptr);
}
static unsigned int numAvailableDevices[] = {1, 2};
static unsigned int bufferFlags[] = {CL_MEM_READ_ONLY, CL_MEM_READ_WRITE};
INSTANTIATE_TEST_CASE_P(MultiGpuGlobalAtomicsBufferTest,
MultiGpuGlobalAtomicsBufferTest,
::testing::Combine(
::testing::ValuesIn(numAvailableDevices),
::testing::ValuesIn(bufferFlags),
::testing::Bool(),
::testing::Bool(),
::testing::Bool()));

View File

@@ -1,142 +0,0 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/mocks/mock_csr.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "gtest/gtest.h"
using namespace NEO;
class CommandStreamReceiverHwTestWithLocalMemory : public ClDeviceFixture,
public HardwareParse,
public ::testing::Test {
public:
void SetUp() override {
dbgRestore = std::make_unique<DebugManagerStateRestore>();
DebugManager.flags.EnableLocalMemory.set(1);
ClDeviceFixture::setUp();
HardwareParse::setUp();
}
void TearDown() override {
HardwareParse::tearDown();
ClDeviceFixture::tearDown();
}
private:
std::unique_ptr<DebugManagerStateRestore> dbgRestore;
};
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenUseClearColorAllocationForBlitterIsNotSetWhenCallingGetClearColorAllocationThenClearAllocationIsNotCreated) {
DebugManagerStateRestore restore;
DebugManager.flags.UseClearColorAllocationForBlitter.set(false);
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
commandStreamReceiver.setupContext(pDevice->getGpgpuCommandStreamReceiver().getOsContext());
auto gfxAllocation = commandStreamReceiver.getClearColorAllocation();
EXPECT_EQ(nullptr, gfxAllocation);
}
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenUseClearColorAllocationForBlitterIsSetWhenCallingGetClearColorAllocationThenClearAllocationIsCreated) {
DebugManagerStateRestore restore;
DebugManager.flags.UseClearColorAllocationForBlitter.set(true);
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
commandStreamReceiver.setupContext(pDevice->getGpgpuCommandStreamReceiver().getOsContext());
auto gfxAllocation = commandStreamReceiver.getClearColorAllocation();
ASSERT_NE(nullptr, gfxAllocation);
EXPECT_TRUE(gfxAllocation->storageInfo.readOnlyMultiStorage);
}
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenUseClearColorAllocationForBlitterIsSetWhenClearColorAllocationIsAlreadyCreatedThenCallingGetClearColorAllocationReturnsAlreadyCreatedAllocation) {
DebugManagerStateRestore restore;
DebugManager.flags.UseClearColorAllocationForBlitter.set(true);
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
commandStreamReceiver.setupContext(pDevice->getGpgpuCommandStreamReceiver().getOsContext());
auto mockAllocation = std::make_unique<MockGraphicsAllocation>();
auto expectedResult = mockAllocation.get();
commandStreamReceiver.clearColorAllocation = mockAllocation.release();
auto gfxAllocation = commandStreamReceiver.getClearColorAllocation();
EXPECT_EQ(expectedResult, gfxAllocation);
}
template <typename GfxFamily>
struct MockCsrHwWithRace : public MockCsrHw<GfxFamily> {
MockCsrHwWithRace() = delete;
MockCsrHwWithRace(ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield) : MockCsrHw<GfxFamily>(executionEnvironment, rootDeviceIndex, deviceBitfield) {
mockGraphicsAllocation.reset(new MockGraphicsAllocation());
}
std::unique_lock<CommandStreamReceiver::MutexType> obtainUniqueOwnership() override {
if (raceLost) {
this->clearColorAllocation = mockGraphicsAllocation.release();
}
return MockCsrHw<GfxFamily>::obtainUniqueOwnership();
}
bool raceLost = false;
std::unique_ptr<MockGraphicsAllocation> mockGraphicsAllocation;
};
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenUseClearColorAllocationForBlitterIsSetWhenCallingGetClearColorAllocationAndRaceIsWonThenClearAllocationIsCreatedInCurrentThread) {
DebugManagerStateRestore restore;
DebugManager.flags.UseClearColorAllocationForBlitter.set(true);
MockCsrHwWithRace<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
commandStreamReceiver.setupContext(pDevice->getGpgpuCommandStreamReceiver().getOsContext());
auto gfxAllocation = commandStreamReceiver.getClearColorAllocation();
EXPECT_EQ(commandStreamReceiver.clearColorAllocation, gfxAllocation);
EXPECT_NE(commandStreamReceiver.mockGraphicsAllocation.get(), gfxAllocation);
}
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenUseClearColorAllocationForBlitterIsSetWhenCallingGetClearColorAllocationAndRaceIsLostThenClearAllocationIsNotCreatedInCurrentThread) {
DebugManagerStateRestore restore;
DebugManager.flags.UseClearColorAllocationForBlitter.set(true);
MockCsrHwWithRace<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
commandStreamReceiver.setupContext(pDevice->getGpgpuCommandStreamReceiver().getOsContext());
commandStreamReceiver.raceLost = true;
auto expectedClearColorAllocation = commandStreamReceiver.mockGraphicsAllocation.get();
auto gfxAllocation = commandStreamReceiver.getClearColorAllocation();
EXPECT_EQ(commandStreamReceiver.clearColorAllocation, gfxAllocation);
EXPECT_EQ(expectedClearColorAllocation, gfxAllocation);
}
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenEnableStatelessCompressionWhenCallingGetMemoryCompressionStateThenReturnCorrectValue) {
DebugManagerStateRestore restore;
CommandStreamReceiverHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
DebugManager.flags.EnableStatelessCompression.set(0);
for (bool auxTranslationRequired : {false, true}) {
auto memoryCompressionState = commandStreamReceiver.getMemoryCompressionState(auxTranslationRequired, pDevice->getHardwareInfo());
EXPECT_EQ(MemoryCompressionState::NotApplicable, memoryCompressionState);
}
DebugManager.flags.EnableStatelessCompression.set(1);
for (bool auxTranslationRequired : {false, true}) {
auto memoryCompressionState = commandStreamReceiver.getMemoryCompressionState(auxTranslationRequired, pDevice->getHardwareInfo());
if (auxTranslationRequired) {
EXPECT_EQ(MemoryCompressionState::Disabled, memoryCompressionState);
} else {
EXPECT_EQ(MemoryCompressionState::Enabled, memoryCompressionState);
}
}
}

View File

@@ -1,39 +0,0 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "gtest/gtest.h"
using namespace NEO;
typedef Test<ClDeviceFixture> XeHPUsDeviceIdTest;
XEHPTEST_F(XeHPUsDeviceIdTest, givenXeHPThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
XEHPTEST_F(XeHPUsDeviceIdTest, WhenGettingHardwareInfoThenProductFamilyIsXeHpSdv) {
EXPECT_EQ(IGFX_XE_HP_SDV, pDevice->getHardwareInfo().platform.eProductFamily);
}
XEHPTEST_F(XeHPUsDeviceIdTest, givenXeHPWhenCheckftr64KBpagesThenTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftr64KBpages);
}
XEHPTEST_F(XeHPUsDeviceIdTest, givenXeHPSkusThenItSupportCorrectlyRoundedDivSqrtBit) {
EXPECT_TRUE(pClDevice->getHardwareInfo().capabilityTable.ftrSupports64BitMath);
cl_device_fp_config actual = pClDevice->getDeviceInfo().singleFpConfig & CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT;
EXPECT_NE(0ull, actual);
}
XEHPTEST_F(XeHPUsDeviceIdTest, givenXeHPWhenCheckSupportCacheFlushAfterWalkerThenTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportCacheFlushAfterWalker);
}

View File

@@ -1,339 +0,0 @@
/*
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/cl_device/cl_device.h"
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
#include "opencl/source/mem_obj/image.h"
#include "opencl/test/unit_test/mem_obj/image_compression_fixture.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
using XeHpSdvImageTests = ::testing::Test;
XEHPTEST_F(XeHpSdvImageTests, givenContextTypeDefaultWhenImageIsWritableAndOnlyOneTileIsAvailableThenRemainFlagsToTrue) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(1);
initPlatform();
EXPECT_EQ(0u, platform()->getClDevice(0)->getNumGenericSubDevices());
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context(platform()->getClDevice(0));
context.contextType = ContextType::CONTEXT_TYPE_DEFAULT;
cl_int retVal = CL_SUCCESS;
cl_image_format imageFormat = {};
cl_image_desc imageDesc = {};
imageFormat.image_channel_data_type = CL_UNORM_INT8;
imageFormat.image_channel_order = CL_RGBA;
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
imageDesc.image_height = 128;
imageDesc.image_width = 256;
auto surfaceFormat = Image::getSurfaceFormatFromTable(
CL_MEM_READ_WRITE, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = std::unique_ptr<Image>(Image::create(
&context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice()),
CL_MEM_READ_WRITE, 0, surfaceFormat, &imageDesc, NULL, retVal));
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
surfaceState.setDisableSupportForMultiGpuAtomics(false);
surfaceState.setDisableSupportForMultiGpuPartialWrites(false);
imageHw->appendSurfaceStateParams(&surfaceState, context.getDevice(0)->getRootDeviceIndex(), true);
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
XEHPTEST_F(XeHpSdvImageTests, givenContextTypeDefaultWhenImageIsWritableThenFlipPartialFlagsToFalse) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(4);
initPlatform();
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context(platform()->getClDevice(0));
context.contextType = ContextType::CONTEXT_TYPE_DEFAULT;
cl_int retVal = CL_SUCCESS;
cl_image_format imageFormat = {};
cl_image_desc imageDesc = {};
imageFormat.image_channel_data_type = CL_UNORM_INT8;
imageFormat.image_channel_order = CL_RGBA;
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
imageDesc.image_height = 128;
imageDesc.image_width = 256;
auto surfaceFormat = Image::getSurfaceFormatFromTable(
CL_MEM_READ_WRITE, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = std::unique_ptr<Image>(Image::create(
&context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice()),
CL_MEM_READ_WRITE, 0, surfaceFormat, &imageDesc, NULL, retVal));
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
imageHw->appendSurfaceStateParams(&surfaceState, context.getDevice(0)->getRootDeviceIndex(), true);
EXPECT_FALSE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_FALSE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
XEHPTEST_F(XeHpSdvImageTests, givenDebugFlagForMultiTileSupportWhenSurfaceStateIsProgrammedThenItHasDesiredValues) {
DebugManagerStateRestore restorer;
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_DEFAULT;
cl_int retVal = CL_SUCCESS;
cl_image_format imageFormat = {};
cl_image_desc imageDesc = {};
imageFormat.image_channel_data_type = CL_UNORM_INT8;
imageFormat.image_channel_order = CL_RGBA;
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
imageDesc.image_height = 128;
imageDesc.image_width = 256;
auto surfaceFormat = Image::getSurfaceFormatFromTable(
CL_MEM_READ_ONLY, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = std::unique_ptr<Image>(Image::create(
&context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice()),
CL_MEM_READ_WRITE, 0, surfaceFormat, &imageDesc, NULL, retVal));
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
DebugManager.flags.ForceMultiGpuAtomics.set(0);
DebugManager.flags.ForceMultiGpuPartialWrites.set(0);
imageHw->appendSurfaceStateParams(&surfaceState, context.getDevice(0)->getRootDeviceIndex(), true);
EXPECT_EQ(0u, surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_EQ(0u, surfaceState.getDisableSupportForMultiGpuPartialWrites());
DebugManager.flags.ForceMultiGpuAtomics.set(1);
DebugManager.flags.ForceMultiGpuPartialWrites.set(1);
imageHw->appendSurfaceStateParams(&surfaceState, context.getDevice(0)->getRootDeviceIndex(), true);
EXPECT_EQ(1u, surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_EQ(1u, surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
XEHPTEST_F(XeHpSdvImageTests, givenContextTypeUnrestrictiveWhenImageIsWritableThenFlipPartialFlagsToFalse) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(4);
initPlatform();
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context(platform()->getClDevice(0));
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
cl_int retVal = CL_SUCCESS;
cl_image_format imageFormat = {};
cl_image_desc imageDesc = {};
imageFormat.image_channel_data_type = CL_UNORM_INT8;
imageFormat.image_channel_order = CL_RGBA;
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
imageDesc.image_height = 128;
imageDesc.image_width = 256;
auto surfaceFormat = Image::getSurfaceFormatFromTable(
CL_MEM_READ_WRITE, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = std::unique_ptr<Image>(Image::create(
&context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice()),
CL_MEM_READ_WRITE, 0, surfaceFormat, &imageDesc, NULL, retVal));
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
imageHw->appendSurfaceStateParams(&surfaceState, context.getDevice(0)->getRootDeviceIndex(), true);
EXPECT_FALSE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_FALSE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
XEHPTEST_F(XeHpSdvImageTests, givenContextTypeDefaultWhenImageIsNotWritableThenRemainPartialFlagsToTrue) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_DEFAULT;
cl_int retVal = CL_SUCCESS;
cl_image_format imageFormat = {};
cl_image_desc imageDesc = {};
imageFormat.image_channel_data_type = CL_UNORM_INT8;
imageFormat.image_channel_order = CL_RGBA;
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
imageDesc.image_height = 128;
imageDesc.image_width = 256;
auto surfaceFormat = Image::getSurfaceFormatFromTable(
CL_MEM_READ_ONLY, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = std::unique_ptr<Image>(Image::create(
&context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice()),
CL_MEM_READ_WRITE, 0, surfaceFormat, &imageDesc, NULL, retVal));
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
surfaceState.setDisableSupportForMultiGpuAtomics(false);
surfaceState.setDisableSupportForMultiGpuPartialWrites(false);
imageHw->appendSurfaceStateParams(&surfaceState, context.getDevice(0)->getRootDeviceIndex(), true);
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
XEHPTEST_F(XeHpSdvImageTests, givenContextTypeSpecializedWhenImageIsWritableThenRemainPartialFlagsToTrue) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_SPECIALIZED;
cl_int retVal = CL_SUCCESS;
cl_image_format imageFormat = {};
cl_image_desc imageDesc = {};
imageFormat.image_channel_data_type = CL_UNORM_INT8;
imageFormat.image_channel_order = CL_RGBA;
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
imageDesc.image_height = 128;
imageDesc.image_width = 256;
auto surfaceFormat = Image::getSurfaceFormatFromTable(
CL_MEM_READ_WRITE, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = std::unique_ptr<Image>(Image::create(
&context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice()),
CL_MEM_READ_WRITE, 0, surfaceFormat, &imageDesc, NULL, retVal));
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
surfaceState.setDisableSupportForMultiGpuAtomics(false);
surfaceState.setDisableSupportForMultiGpuPartialWrites(false);
imageHw->appendSurfaceStateParams(&surfaceState, context.getDevice(0)->getRootDeviceIndex(), true);
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuPartialWrites());
}
struct MultiGpuGlobalAtomicsImageTest : public XeHpSdvImageTests,
public ::testing::WithParamInterface<std::tuple<unsigned int, unsigned int, bool, bool>> {
};
XEHPTEST_P(MultiGpuGlobalAtomicsImageTest, givenAppendSurfaceStateParamCalledThenDisableSupportForMultiGpuAtomicsIsSetCorrectly) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
unsigned int numAvailableSubDevices, memFlags;
bool useGlobalAtomics, enableMultiGpuAtomicsOptimization;
std::tie(numAvailableSubDevices, memFlags, useGlobalAtomics, enableMultiGpuAtomicsOptimization) = GetParam();
DebugManagerStateRestore restorer;
DebugManager.flags.EnableMultiGpuAtomicsOptimization.set(enableMultiGpuAtomicsOptimization);
UltClDeviceFactory deviceFactory{1, 2};
ClDeviceVector deviceVector;
for (auto i = 0u; i < numAvailableSubDevices; i++) {
deviceVector.push_back(deviceFactory.subDevices[i]);
}
if (deviceVector.empty()) {
deviceVector.push_back(deviceFactory.rootDevices[0]);
}
MockContext context(deviceVector);
cl_int retVal = CL_SUCCESS;
cl_image_format imageFormat = {};
cl_image_desc imageDesc = {};
imageFormat.image_channel_data_type = CL_UNORM_INT8;
imageFormat.image_channel_order = CL_RGBA;
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
imageDesc.image_height = 128;
imageDesc.image_width = 256;
auto surfaceFormat = Image::getSurfaceFormatFromTable(
memFlags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = std::unique_ptr<Image>(Image::create(
&context, ClMemoryPropertiesHelper::createMemoryProperties(memFlags, 0, 0, &context.getDevice(0)->getDevice()),
memFlags, 0, surfaceFormat, &imageDesc, NULL, retVal));
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_TRUE(surfaceState.getDisableSupportForMultiGpuAtomics());
surfaceState.setDisableSupportForMultiGpuAtomics(false);
surfaceState.setDisableSupportForMultiGpuPartialWrites(false);
imageHw->appendSurfaceStateParams(&surfaceState, context.getDevice(0)->getRootDeviceIndex(), useGlobalAtomics);
bool enableGlobalAtomics = numAvailableSubDevices != 1u;
if (enableMultiGpuAtomicsOptimization) {
enableGlobalAtomics &= useGlobalAtomics;
}
EXPECT_EQ(!enableGlobalAtomics, surfaceState.getDisableSupportForMultiGpuAtomics());
}
static unsigned int numAvailableSubDevicesForMultiGpuGlobalAtomicsImageTest[] = {0, 1, 2};
static unsigned int memFlags[] = {CL_MEM_READ_ONLY, CL_MEM_READ_WRITE};
INSTANTIATE_TEST_CASE_P(MultiGpuGlobalAtomicsImageTest,
MultiGpuGlobalAtomicsImageTest,
::testing::Combine(
::testing::ValuesIn(numAvailableSubDevicesForMultiGpuGlobalAtomicsImageTest),
::testing::ValuesIn(memFlags),
::testing::Bool(),
::testing::Bool()));
XEHPTEST_F(ImageCompressionTests, givenXeHpCoreAndRedescribableFormatWhenCreatingAllocationThenDoNotPreferCompression) {
MockContext context{};
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
imageDesc.image_width = 5;
imageDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(
flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = std::unique_ptr<Image>(Image::create(
mockContext.get(), ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context.getDevice(0)->getDevice()),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image);
EXPECT_EQ(defaultHwInfo->capabilityTable.supportsImages, myMemoryManager->capturedPreferCompressed);
imageFormat.image_channel_order = CL_RG;
surfaceFormat = Image::getSurfaceFormatFromTable(
flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
image = std::unique_ptr<Image>(Image::create(
mockContext.get(), ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context.getDevice(0)->getDevice()),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image);
EXPECT_TRUE(myMemoryManager->capturedPreferCompressed);
}

View File

@@ -1,94 +0,0 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/command_queue/gpgpu_walker.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/mocks/mock_buffer.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
using namespace NEO;
using XeHPComputeWorkgroupSizeTest = Test<ClDeviceFixture>;
XEHPTEST_F(XeHPComputeWorkgroupSizeTest, giveXeHpA0WhenKernelIsaIsBelowThresholdAndThereAreNoImageBarriersAndSlmThenSmallWorkgorupSizeIsSelected) {
auto program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
MockKernelWithInternals mockKernel(*pClDevice);
auto &kernel = *mockKernel.mockKernel;
kernel.initialize();
Vec3<size_t> elws{0, 0, 0};
Vec3<size_t> gws{1024, 1, 1};
Vec3<size_t> offset{0, 0, 0};
DispatchInfo dispatchInfo{pClDevice, &kernel, 1, gws, elws, offset};
auto maxWgSize = pClDevice->getSharedDeviceInfo().maxWorkGroupSize;
auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
{
auto expectedLws = computeWorkgroupSize(dispatchInfo);
EXPECT_EQ(64u, expectedLws.x * expectedLws.y * expectedLws.z);
EXPECT_EQ(64u, expectedLws.x);
}
mockKernel.mockKernel->slmTotalSize = 1000u;
{
auto expectedLws = computeWorkgroupSize(dispatchInfo);
EXPECT_EQ(maxWgSize, expectedLws.x * expectedLws.y * expectedLws.z);
EXPECT_EQ(maxWgSize, expectedLws.x);
}
mockKernel.mockKernel->slmTotalSize = 0u;
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.barrierCount = 1u;
{
auto expectedLws = computeWorkgroupSize(dispatchInfo);
EXPECT_EQ(maxWgSize, expectedLws.x * expectedLws.y * expectedLws.z);
EXPECT_EQ(maxWgSize, expectedLws.x);
}
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.barrierCount = 0u;
// on B0 algorithm is disabled
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo);
{
auto expectedLws = computeWorkgroupSize(dispatchInfo);
EXPECT_EQ(maxWgSize, expectedLws.x * expectedLws.y * expectedLws.z);
EXPECT_EQ(maxWgSize, expectedLws.x);
}
}
XEHPTEST_F(XeHPComputeWorkgroupSizeTest, givenSmallKernelAndGwsThatIsNotDivisableBySmallerLimitWhenLwsIsComputedThenBigWorgkroupIsSelected) {
auto program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
MockKernelWithInternals mockKernel(*pClDevice);
auto &kernel = *mockKernel.mockKernel;
kernel.initialize();
Vec3<size_t> elws{0, 0, 0};
Vec3<size_t> gws{636056, 1, 1};
Vec3<size_t> offset{0, 0, 0};
DispatchInfo dispatchInfo{pClDevice, &kernel, 1, gws, elws, offset};
auto maxWgSize = pClDevice->getSharedDeviceInfo().maxWorkGroupSize;
{
auto calculatedLws = computeWorkgroupSize(dispatchInfo);
auto expectedLws = (maxWgSize < 344) ? 8u : 344u;
EXPECT_EQ(expectedLws, calculatedLws.x * calculatedLws.y * calculatedLws.z);
EXPECT_EQ(expectedLws, calculatedLws.x);
}
}

View File

@@ -1,28 +0,0 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
using namespace NEO;
struct XE_HP_COREPlatformCaps : public PlatformFixture, public ::testing::Test {
void SetUp() override {
PlatformFixture::setUp();
}
void TearDown() override {
PlatformFixture::tearDown();
}
};
XEHPTEST_F(XE_HP_COREPlatformCaps, givenXeHPSkusThenItSupportFP64) {
const auto &caps = pPlatform->getPlatformInfo();
EXPECT_NE(std::string::npos, caps.extensions.find(std::string("cl_khr_fp64")));
}

View File

@@ -1,119 +0,0 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/test/common/fixtures/preamble_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/helpers/hardware_commands_helper.h"
using namespace NEO;
using PreambleCfeState = PreambleFixture;
HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEWeightedDispatchModeDisableSetFalseWhenCallingProgramVFEStateThenFieldWeightedDispatchModeDisableAreNotSet, IsXEHP) {
using CFE_STATE = typename FamilyType::CFE_STATE;
DebugManagerStateRestore dbgRestore;
DebugManager.flags.CFEWeightedDispatchModeDisable.set(false);
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties streamProperties{};
streamProperties.frontEndState.setProperties(false, false, false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, streamProperties, nullptr);
parseCommands<FamilyType>(linearStream);
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), cfeStateIt);
auto cfeState = reinterpret_cast<CFE_STATE *>(*cfeStateIt);
EXPECT_FALSE(cfeState->getWeightedDispatchModeDisable());
}
HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEWeightedDispatchModeDisableSetTrueWhenCallingProgramVFEStateThenFieldWeightedDispatchModeDisableAreSet, IsXEHP) {
using CFE_STATE = typename FamilyType::CFE_STATE;
DebugManagerStateRestore dbgRestore;
DebugManager.flags.CFEWeightedDispatchModeDisable.set(true);
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties streamProperties{};
streamProperties.frontEndState.setProperties(false, false, false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, streamProperties, nullptr);
parseCommands<FamilyType>(linearStream);
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), cfeStateIt);
auto cfeState = reinterpret_cast<CFE_STATE *>(*cfeStateIt);
EXPECT_TRUE(cfeState->getWeightedDispatchModeDisable());
}
HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEComputeOverdispatchDisableSetFalseWhenCallingProgramVFEStateThenFieldComputeOverdispatchDisableAreNotSet, IsXEHP) {
using CFE_STATE = typename FamilyType::CFE_STATE;
DebugManagerStateRestore dbgRestore;
DebugManager.flags.CFEComputeOverdispatchDisable.set(false);
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties streamProperties{};
streamProperties.frontEndState.setProperties(false, false, false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, streamProperties, nullptr);
parseCommands<FamilyType>(linearStream);
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), cfeStateIt);
auto cfeState = reinterpret_cast<CFE_STATE *>(*cfeStateIt);
EXPECT_FALSE(cfeState->getComputeOverdispatchDisable());
}
HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEComputeOverdispatchDisableSetTrueWhenCallingProgramVFEStateThenFieldComputeOverdispatchDisableAreSet, IsXEHP) {
using CFE_STATE = typename FamilyType::CFE_STATE;
DebugManagerStateRestore dbgRestore;
DebugManager.flags.CFEComputeOverdispatchDisable.set(true);
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties streamProperties{};
streamProperties.frontEndState.setProperties(false, false, false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, streamProperties, nullptr);
parseCommands<FamilyType>(linearStream);
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), cfeStateIt);
auto cfeState = reinterpret_cast<CFE_STATE *>(*cfeStateIt);
EXPECT_TRUE(cfeState->getComputeOverdispatchDisable());
}
HWTEST2_F(PreambleCfeState, givenXehpAndDisabledFusedEuWhenCfeStateProgrammedThenFusedEuDispatchSetToTrue, IsXEHP) {
using CFE_STATE = typename FamilyType::CFE_STATE;
auto hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.fusedEuEnabled = false;
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, hwInfo, EngineGroupType::RenderCompute);
StreamProperties streamProperties{};
streamProperties.frontEndState.setProperties(false, false, false, false, hwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, hwInfo, 0u, 0, 0, streamProperties, nullptr);
parseCommands<FamilyType>(linearStream);
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), cfeStateIt);
auto cfeState = reinterpret_cast<CFE_STATE *>(*cfeStateIt);
EXPECT_TRUE(cfeState->getFusedEuDispatch());
}
HWTEST2_F(PreambleCfeState, givenXehpAndEnabledFusedEuWhenCfeStateProgrammedThenFusedEuDispatchSetToFalse, IsXEHP) {
using CFE_STATE = typename FamilyType::CFE_STATE;
auto hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.fusedEuEnabled = true;
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, hwInfo, EngineGroupType::RenderCompute);
StreamProperties streamProperties{};
streamProperties.frontEndState.setProperties(false, false, false, false, hwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, hwInfo, 0u, 0, 0, streamProperties, nullptr);
parseCommands<FamilyType>(linearStream);
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), cfeStateIt);
auto cfeState = reinterpret_cast<CFE_STATE *>(*cfeStateIt);
EXPECT_FALSE(cfeState->getFusedEuDispatch());
}

View File

@@ -1,153 +0,0 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/gfx_core_helper_tests.h"
#include "shared/test/common/helpers/gtest_helpers.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/command_queue/command_queue_hw.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "gtest/gtest.h"
using namespace NEO;
using XeHPProductHelper = Test<DeviceFixture>;
XEHPTEST_F(XeHPProductHelper, givenXeHPMultiConfigWhenConfigureHardwareCustomIsCalledThenCapabilityTableIsSetProperly) {
auto &productHelper = getHelper<ProductHelper>();
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.featureTable.flags.ftrE2ECompression = true;
hwInfo.gtSystemInfo.EUCount = 256u;
productHelper.configureHardwareCustom(&hwInfo, nullptr);
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedImages);
hwInfo.gtSystemInfo.EUCount = 512u;
productHelper.configureHardwareCustom(&hwInfo, nullptr);
EXPECT_TRUE(hwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_TRUE(hwInfo.capabilityTable.ftrRenderCompressedImages);
}
XEHPTEST_F(XeHPProductHelper, givenXeHPWhenConfiguringThenDisableRcs) {
auto &productHelper = getHelper<ProductHelper>();
HardwareInfo hwInfo = *defaultHwInfo;
productHelper.configureHardwareCustom(&hwInfo, nullptr);
EXPECT_FALSE(hwInfo.featureTable.flags.ftrRcsNode);
}
XEHPTEST_F(XeHPProductHelper, givenDebugVariableSetWhenConfiguringThenEnableRcs) {
DebugManagerStateRestore restore;
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_RCS));
auto &productHelper = getHelper<ProductHelper>();
HardwareInfo hwInfo = *defaultHwInfo;
productHelper.configureHardwareCustom(&hwInfo, nullptr);
EXPECT_TRUE(hwInfo.featureTable.flags.ftrRcsNode);
}
XEHPTEST_F(XeHPProductHelper, givenXeHpWhenCallingGetDeviceMemoryNameThenHbmIsReturned) {
auto productHelper = ProductHelper::get(productFamily);
auto deviceMemoryName = productHelper->getDeviceMemoryName();
EXPECT_TRUE(hasSubstr(deviceMemoryName, std::string("HBM")));
}
XEHPTEST_F(XeHPProductHelper, givenA0OrA1SteppingWhenAskingIfExtraParametersAreInvalidThenReturnTrue) {
auto &productHelper = getHelper<ProductHelper>();
std::array<std::pair<uint32_t, bool>, 4> revisions = {
{{REVISION_A0, true},
{REVISION_A1, true},
{REVISION_B, false},
{REVISION_C, false}}};
for (const auto &[revision, paramBool] : revisions) {
auto hwInfo = *defaultHwInfo;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo);
productHelper.configureHardwareCustom(&hwInfo, nullptr);
EXPECT_EQ(paramBool, productHelper.extraParametersInvalid(hwInfo));
}
}
using XeHPGfxCoreHelperTest = GfxCoreHelperTest;
XEHPTEST_F(XeHPGfxCoreHelperTest, givenXeHPMultiConfigWhenAllowCompressionIsCalledThenCorrectValueIsReturned) {
auto productHelper = ProductHelper::get(productFamily);
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.gtSystemInfo.EUCount = 512u;
EXPECT_TRUE(productHelper->allowCompression(hwInfo));
hwInfo.gtSystemInfo.EUCount = 256u;
EXPECT_FALSE(productHelper->allowCompression(hwInfo));
}
XEHPTEST_F(XeHPProductHelper, givenProductHelperWhenAdditionalKernelExecInfoSupportCheckedThenCorrectValueIsReturned) {
auto &productHelper = *ProductHelper::get(productFamily);
auto hwInfo = *defaultHwInfo;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
EXPECT_FALSE(productHelper.isDisableOverdispatchAvailable(hwInfo));
FrontEndPropertiesSupport fePropertiesSupport{};
productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, hwInfo);
EXPECT_FALSE(fePropertiesSupport.disableOverdispatch);
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo);
EXPECT_TRUE(productHelper.isDisableOverdispatchAvailable(hwInfo));
productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, hwInfo);
EXPECT_TRUE(fePropertiesSupport.disableOverdispatch);
}
XEHPTEST_F(XeHPProductHelper, givenProductHelperWithMultipleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledThenTrueIsReturned) {
const auto &productHelper = *ProductHelper::get(productFamily);
auto hwInfo = *defaultHwInfo;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2;
auto isRcs = false;
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs);
EXPECT_TRUE(isExtendedWARequired);
EXPECT_TRUE(isBasicWARequired);
}
XEHPTEST_F(XeHPProductHelper, givenProgramExtendedPipeControlPriorToNonPipelinedStateCommandEnabledWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledThenTrueIsReturned) {
DebugManagerStateRestore restorer;
DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(true);
const auto &productHelper = *ProductHelper::get(productFamily);
auto hwInfo = *defaultHwInfo;
auto isRcs = false;
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs);
EXPECT_TRUE(isExtendedWARequired);
EXPECT_TRUE(isBasicWARequired);
}
XEHPTEST_F(XeHPProductHelper, givenProgramExtendedPipeControlPriorToNonPipelinedStateCommandDisabledWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledThenFalseIsReturned) {
DebugManagerStateRestore restorer;
DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(0);
const auto &productHelper = *ProductHelper::get(productFamily);
auto hwInfo = *defaultHwInfo;
auto isRcs = false;
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs);
EXPECT_FALSE(isExtendedWARequired);
EXPECT_TRUE(isBasicWARequired);
}

View File

@@ -1,62 +0,0 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/product_helper.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
using namespace NEO;
using XeHPUsDeviceIdTest = Test<ClDeviceFixture>;
HWTEST_EXCLUDE_PRODUCT(SubDeviceTests, givenCCSEngineWhenCallingGetDefaultEngineWithWaThenTheSameEngineIsReturned, IGFX_XE_HP_SDV);
XEHPTEST_F(XeHPUsDeviceIdTest, givenRevisionAWhenCreatingEngineWithSubdevicesThenEngineTypeIsSetToCCS) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(2);
auto executionEnvironment = new MockExecutionEnvironment;
MockDevice device(executionEnvironment, 0);
EXPECT_EQ(0u, device.allEngines.size());
device.createSubDevices();
device.createEngines();
EXPECT_EQ(2u, device.getNumGenericSubDevices());
auto hwInfo = device.getRootDeviceEnvironment().getMutableHardwareInfo();
const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily);
hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, *hwInfo);
device.createEngines();
auto engines = device.getAllEngines();
for (auto engine : engines) {
EXPECT_EQ(aub_stream::ENGINE_CCS, engine.osContext->getEngineType());
}
}
XEHPTEST_F(XeHPUsDeviceIdTest, givenRevisionBWhenCreatingEngineWithSubdevicesThenEngineTypeIsSetToCCS) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(2);
auto executionEnvironment = new MockExecutionEnvironment;
MockDevice device(executionEnvironment, 0);
EXPECT_EQ(0u, device.allEngines.size());
device.createSubDevices();
device.createEngines();
EXPECT_EQ(2u, device.getNumGenericSubDevices());
auto hwInfo = device.getRootDeviceEnvironment().getMutableHardwareInfo();
const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily);
hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo);
device.createEngines();
auto engines = device.getAllEngines();
for (auto engine : engines) {
EXPECT_EQ(aub_stream::ENGINE_CCS, engine.osContext->getEngineType());
}
}

View File

@@ -1,21 +0,0 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "cache_flush_tests_xehp.inl"
#include "get_device_info_xehp.inl"
#include "gfx_core_helper_tests_xehp.inl"
#include "hw_info_tests_xehp.inl"
#include "memory_manager_tests_xehp.inl"
#include "sampler_tests_xehp.inl"
#include "test_buffer_xe_hp_sdv.inl"
#include "test_command_stream_receiver_xehp.inl"
#include "test_device_caps_xehp.inl"
#include "test_image_xe_hp_sdv.inl"
#include "test_local_work_size_xehp.inl"
#include "test_platform_caps_xehp.inl"
#include "test_product_helper_xehp.inl"
#include "test_sub_devices_xehp.inl"