performance: Enable internal heap preallocation on xe and later

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk 2024-02-28 16:49:03 +00:00 committed by Compute-Runtime-Automation
parent 0fcc67fba9
commit 676644bc50
9 changed files with 58 additions and 17 deletions

View File

@ -812,14 +812,6 @@ uint32_t ProductHelperHw<gfxProduct>::getCommandBuffersPreallocatedPerCommandQue
return 0u;
}
template <PRODUCT_FAMILY gfxProduct>
uint32_t ProductHelperHw<gfxProduct>::getInternalHeapsPreallocated() const {
if (debugManager.flags.SetAmountOfInternalHeapsToPreallocate.get() != -1) {
return debugManager.flags.SetAmountOfInternalHeapsToPreallocate.get();
}
return 0u;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::disableL3CacheForDebug(const HardwareInfo &) const {
return false;

View File

@ -65,6 +65,14 @@ bool ProductHelperHw<gfxProduct>::isTimestampWaitSupportedForEvents() const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
uint32_t ProductHelperHw<gfxProduct>::getInternalHeapsPreallocated() const {
if (debugManager.flags.SetAmountOfInternalHeapsToPreallocate.get() != -1) {
return debugManager.flags.SetAmountOfInternalHeapsToPreallocate.get();
}
return 0u;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const {
return true;

View File

@ -69,6 +69,14 @@ bool ProductHelperHw<gfxProduct>::isTimestampWaitSupportedForEvents() const {
return true;
}
template <PRODUCT_FAMILY gfxProduct>
uint32_t ProductHelperHw<gfxProduct>::getInternalHeapsPreallocated() const {
if (debugManager.flags.SetAmountOfInternalHeapsToPreallocate.get() != -1) {
return debugManager.flags.SetAmountOfInternalHeapsToPreallocate.get();
}
return 1u;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const {
return false;

View File

@ -88,14 +88,6 @@ uint32_t ProductHelperHw<gfxProduct>::getCommandBuffersPreallocatedPerCommandQue
return 2u;
}
template <>
uint32_t ProductHelperHw<gfxProduct>::getInternalHeapsPreallocated() const {
if (debugManager.flags.SetAmountOfInternalHeapsToPreallocate.get() != -1) {
return debugManager.flags.SetAmountOfInternalHeapsToPreallocate.get();
}
return 1u;
}
template <>
std::optional<GfxMemoryAllocationMethod> ProductHelperHw<gfxProduct>::getPreferredAllocationMethod(AllocationType allocationType) const {
switch (allocationType) {

View File

@ -345,6 +345,11 @@ bool ProductHelperHw<IGFX_UNKNOWN>::isTimestampWaitSupportedForEvents() const {
return false;
}
template <>
uint32_t ProductHelperHw<IGFX_UNKNOWN>::getInternalHeapsPreallocated() const {
return 0u;
}
template <>
uint64_t ProductHelperHw<IGFX_UNKNOWN>::getHostMemCapabilitiesValue() const {
return 0;

View File

@ -454,6 +454,14 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenAskedIfIsTimestampWaitSupport
EXPECT_FALSE(productHelper->isTimestampWaitSupportedForEvents());
}
HWTEST2_F(ProductHelperTest, givenProductHelperWhenCallGetInternalHeapsPreallocatedThenReturnCorrectValue, IsBeforeXeHpCore) {
EXPECT_EQ(productHelper->getInternalHeapsPreallocated(), 0u);
DebugManagerStateRestore restorer;
debugManager.flags.SetAmountOfInternalHeapsToPreallocate.set(3);
EXPECT_EQ(productHelper->getInternalHeapsPreallocated(), 3u);
}
HWTEST2_F(ProductHelperTest, givenProductHelperWhenAskedIfIsTlbFlushRequiredThenTrueIsReturned, IsNotXeHpgOrXeHpcCore) {
EXPECT_TRUE(productHelper->isTlbFlushRequired());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -9,6 +9,7 @@
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/xe_hpc_core/hw_cmds_xe_hpc_core_base.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/gfx_core_helper_tests.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
@ -74,6 +75,15 @@ XE_HPC_CORETEST_F(ProductHelperTestXeHpcCore, givenProductHelperWhenCheckTimesta
EXPECT_TRUE(helper.isTimestampWaitSupportedForEvents());
}
XE_HPC_CORETEST_F(ProductHelperTestXeHpcCore, givenProductHelperWhenCallGetInternalHeapsPreallocatedThenReturnCorrectValue) {
const auto &productHelper = getHelper<ProductHelper>();
EXPECT_EQ(productHelper.getInternalHeapsPreallocated(), 1u);
DebugManagerStateRestore restorer;
debugManager.flags.SetAmountOfInternalHeapsToPreallocate.set(3);
EXPECT_EQ(productHelper.getInternalHeapsPreallocated(), 3u);
}
XE_HPC_CORETEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCallCopyThroughLockedPtrEnabledThenReturnTrue) {
const auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
const auto &productHelper = getHelper<ProductHelper>();

View File

@ -717,6 +717,14 @@ DG2TEST_F(ProductHelperTestDg2, givenDG2WhenCheckingIsTimestampWaitSupportedForE
EXPECT_TRUE(productHelper->isTimestampWaitSupportedForEvents());
}
DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenCallGetInternalHeapsPreallocatedThenReturnCorrectValue) {
EXPECT_EQ(productHelper->getInternalHeapsPreallocated(), 1u);
DebugManagerStateRestore restorer;
debugManager.flags.SetAmountOfInternalHeapsToPreallocate.set(3);
EXPECT_EQ(productHelper->getInternalHeapsPreallocated(), 3u);
}
DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) {
for (const auto &deviceId : dg2G10DeviceIds) {
hwInfo.platform.usDeviceID = deviceId;

View File

@ -12,6 +12,7 @@
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/test/common/fixtures/device_fixture.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/mocks/mock_device.h"
@ -200,6 +201,15 @@ HWTEST2_F(XeLpgProductHelperTests, givenProductHelperWhenCheckBlitEnqueueAllowed
EXPECT_FALSE(productHelper->blitEnqueueAllowed());
}
HWTEST2_F(XeLpgProductHelperTests, givenProductHelperWhenCallGetInternalHeapsPreallocatedThenReturnCorrectValue, IsXeLpg) {
const auto &productHelper = getHelper<ProductHelper>();
EXPECT_EQ(productHelper.getInternalHeapsPreallocated(), 1u);
DebugManagerStateRestore restorer;
debugManager.flags.SetAmountOfInternalHeapsToPreallocate.set(3);
EXPECT_EQ(productHelper.getInternalHeapsPreallocated(), 3u);
}
HWTEST2_F(XeLpgProductHelperTests, givenProductHelperWhenGetCommandsStreamPropertiesSupportThenExpectCorrectValues, IsXeLpg) {
EXPECT_FALSE(productHelper->getScmPropertyThreadArbitrationPolicySupport());