performance: Limit tlb flush WA scope on DG2 Linux

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2023-12-21 09:58:49 +00:00
committed by Compute-Runtime-Automation
parent f7eb961435
commit fa181937a4
16 changed files with 81 additions and 15 deletions

View File

@@ -140,6 +140,15 @@ TEST_F(DrmBufferObjectTest, whenExecFailsThenValidateHostPtrFails) {
EXPECT_EQ(EINVAL, ret);
}
TEST_F(DrmBufferObjectTest, whenSetImageAllocTypeForBOThenReturnProperValue) {
TestedBufferObject bo(0u, this->mock.get());
EXPECT_FALSE(bo.isImage());
bo.setIsImage(AllocationType::kernelIsa);
EXPECT_FALSE(bo.isImage());
bo.setIsImage(AllocationType::image);
EXPECT_TRUE(bo.isImage());
}
TEST_F(DrmBufferObjectTest, givenResidentBOWhenPrintExecutionBufferIsSetToTrueThenDebugInformationAboutBOIsPrinted) {
mock->ioctlExpected.total = 1;
DebugManagerStateRestore restore;

View File

@@ -131,7 +131,7 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest, whenSetNewResourceBoun
for (const auto &engine : device->getAllEngines()) {
auto osContexLinux = static_cast<MockOsContextLinux *>(engine.osContext);
if (osContexLinux->getDeviceBitfield().test(1u) && executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]->getProductHelper().isTlbFlushRequired()) {
if (osContexLinux->getDeviceBitfield().test(1u) && executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]->getProductHelper().isTlbFlushRequired(*executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]->getHardwareInfo(), true, false)) {
EXPECT_TRUE(osContexLinux->isTlbFlushRequired());
} else {
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());
@@ -150,7 +150,7 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest, whenSetNewResourceBoun
for (const auto &engine : devices[1]->getAllEngines()) {
auto osContexLinux = static_cast<MockOsContextLinux *>(engine.osContext);
if (osContexLinux->getDeviceBitfield().test(0u) && executionEnvironment->rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired()) {
if (osContexLinux->getDeviceBitfield().test(0u) && executionEnvironment->rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired(*executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]->getHardwareInfo(), true, false)) {
EXPECT_TRUE(osContexLinux->isTlbFlushRequired());
} else {
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());
@@ -168,7 +168,7 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest, whenSetNewResourceBoun
for (const auto &engine : device->getAllEngines()) {
auto osContexLinux = static_cast<MockOsContextLinux *>(engine.osContext);
if (osContexLinux->getDeviceBitfield().test(1u) && executionEnvironment->rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired()) {
if (osContexLinux->getDeviceBitfield().test(1u) && executionEnvironment->rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired(*executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]->getHardwareInfo(), true, false)) {
EXPECT_TRUE(osContexLinux->isTlbFlushRequired());
} else {
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());

View File

@@ -455,13 +455,19 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenAskedIfIsTimestampWaitSupport
}
HWTEST2_F(ProductHelperTest, givenProductHelperWhenAskedIfIsTlbFlushRequiredThenTrueIsReturned, IsNotXeHpgOrXeHpcCore) {
EXPECT_TRUE(productHelper->isTlbFlushRequired());
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, false, true));
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, true, true));
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, false, false));
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, true, false));
}
HWTEST2_F(ProductHelperTest, givenProductHelperAndForceTlbFlushNotSetWhenAskedIfIsTlbFlushRequiredThenFalseIsReturned, IsNotPVC) {
DebugManagerStateRestore restore{};
debugManager.flags.ForceTlbFlush.set(0);
EXPECT_FALSE(productHelper->isTlbFlushRequired());
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, true, false));
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, false, false));
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, false, true));
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, true, true));
}
HWTEST_F(ProductHelperTest, givenLockableAllocationWhenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) {

View File

@@ -169,7 +169,7 @@ TEST(WddmNewRsourceTest, whenSetNewResourcesBoundToPageTableThenSetInContextFrom
}
engines = executionEnvironment.memoryManager->getRegisteredEngines(1);
for (const auto &engine : engines) {
EXPECT_EQ(engine.osContext->peekTlbFlushCounter(), executionEnvironment.rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired());
EXPECT_EQ(engine.osContext->peekTlbFlushCounter(), executionEnvironment.rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired(*defaultHwInfo, true, true));
}
executionEnvironment.memoryManager->unregisterEngineForCsr(csr1.get());

View File

@@ -30,13 +30,19 @@ PVCTEST_F(PvcProductHelper, whenGettingAubstreamProductFamilyThenProperEnumValue
}
PVCTEST_F(PvcProductHelper, whenCheckIsTlbFlushRequiredThenReturnProperValue) {
EXPECT_FALSE(productHelper->isTlbFlushRequired());
EXPECT_FALSE(productHelper->isTlbFlushRequired(*defaultHwInfo, true, true));
EXPECT_FALSE(productHelper->isTlbFlushRequired(*defaultHwInfo, false, true));
EXPECT_FALSE(productHelper->isTlbFlushRequired(*defaultHwInfo, true, false));
EXPECT_FALSE(productHelper->isTlbFlushRequired(*defaultHwInfo, false, false));
}
PVCTEST_F(PvcProductHelper, whenForceTlbFlushSetAndCheckIsTlbFlushRequiredThenReturnProperValue) {
DebugManagerStateRestore restore;
debugManager.flags.ForceTlbFlush.set(1);
EXPECT_TRUE(productHelper->isTlbFlushRequired());
EXPECT_TRUE(productHelper->isTlbFlushRequired(*defaultHwInfo, false, true));
EXPECT_TRUE(productHelper->isTlbFlushRequired(*defaultHwInfo, true, true));
EXPECT_TRUE(productHelper->isTlbFlushRequired(*defaultHwInfo, true, false));
EXPECT_TRUE(productHelper->isTlbFlushRequired(*defaultHwInfo, false, false));
}
PVCTEST_F(PvcProductHelper, givenPVCRevId3AndAboveWhenGettingThreadEuRatioForScratchThen16IsReturned) {

View File

@@ -6,7 +6,9 @@
*/
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/xe_hpg_core/hw_cmds_dg2.h"
#include "shared/source/xe_hpg_core/hw_info_xe_hpg_core.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/libult/linux/drm_mock.h"
@@ -43,3 +45,24 @@ DG2TEST_F(Dg2ProductHelperLinux, GivenDg2WhenConfigureHardwareCustomThenKmdNotif
EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForDirectSubmission);
EXPECT_EQ(20ll, pInHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForDirectSubmissionMicroseconds);
}
DG2TEST_F(Dg2ProductHelperLinux, whenCheckIsTlbFlushRequiredThenReturnProperValue) {
EXPECT_EQ(productHelper->isTlbFlushRequired(pInHwInfo, true, false), !DG2::isG10(pInHwInfo));
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, false, false));
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, false, true));
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, true, true));
}
DG2TEST_F(Dg2ProductHelperLinux, whenForceTlbFlushSetAndCheckIsTlbFlushRequiredThenReturnProperValue) {
DebugManagerStateRestore restore;
debugManager.flags.ForceTlbFlush.set(1);
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, false, true));
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, true, true));
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, false, false));
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, true, false));
debugManager.flags.ForceTlbFlush.set(0);
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, false, true));
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, true, true));
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, true, false));
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, true, false));
}

View File

@@ -14,7 +14,7 @@ using namespace NEO;
using MtlProductHelperWindows = ProductHelperTestWindows;
MTLTEST_F(MtlProductHelperWindows, whenCheckIsTlbFlushRequiredThenReturnProperValue) {
EXPECT_TRUE(productHelper->isTlbFlushRequired());
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, false, false));
}
MTLTEST_F(MtlProductHelperWindows, whenCheckingIsTimestampWaitSupportedForEventsThenReturnTrue) {