performance: Switch waitpkg use to tpause for ULLS light

Related-To: NEO-13922, NEO-14336

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2025-03-21 15:08:53 +00:00
committed by Compute-Runtime-Automation
parent bb10290828
commit 54cb0e24f8
7 changed files with 81 additions and 36 deletions

View File

@@ -253,3 +253,25 @@ class DrmCommandStreamEnhancedWithFailingExecTemplate : public ::testing::Test {
};
using DrmCommandStreamEnhancedWithFailingExec = DrmCommandStreamEnhancedWithFailingExecTemplate<DrmMockCustom>;
struct DrmCommandStreamDirectSubmissionTest : public DrmCommandStreamEnhancedTest {
template <typename GfxFamily>
void setUpT() {
debugManager.flags.EnableDirectSubmission.set(1u);
debugManager.flags.DirectSubmissionDisableMonitorFence.set(0);
debugManager.flags.DirectSubmissionFlatRingBuffer.set(0);
DrmCommandStreamEnhancedTest::setUpT<GfxFamily>();
auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo();
auto engineType = device->getDefaultEngine().osContext->getEngineType();
hwInfo->capabilityTable.directSubmissionEngines.data[engineType].engineSupported = true;
csr->initDirectSubmission();
}
template <typename GfxFamily>
void tearDownT() {
this->dbgState.reset();
DrmCommandStreamEnhancedTest::tearDownT<GfxFamily>();
}
DebugManagerStateRestore restorer;
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,18 @@
#pragma once
#include "shared/source/utilities/cpu_info.h"
using namespace NEO;
struct MockCpuInfo : public NEO::CpuInfo {
using CpuInfo::features;
};
inline MockCpuInfo *getMockCpuInfo(const NEO::CpuInfo &cpuInfo) {
return static_cast<MockCpuInfo *>(const_cast<NEO::CpuInfo *>(&CpuInfo::getInstance()));
}
void mockCpuidEnableAll(int *cpuInfo, int functionId);
void mockCpuidFunctionAvailableDisableAll(int *cpuInfo, int functionId);

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2020-2024 Intel Corporation
# Copyright (C) 2020-2025 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -44,6 +44,12 @@ set(NEO_CORE_OS_INTERFACE_TESTS_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/self_lib_lin.cpp
)
if(${NEO_TARGET_PROCESSOR} STREQUAL "x86_64")
list(APPEND NEO_CORE_OS_INTERFACE_TESTS_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/drm_command_stream_tests_x86_64.cpp
)
endif()
if(NEO_ENABLE_I915_PRELIM_DETECTION)
list(APPEND NEO_CORE_OS_INTERFACE_TESTS_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/drm_buffer_object_tests_prelim.cpp

View File

@@ -24,7 +24,6 @@
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/os_interface/sys_calls_common.h"
#include "shared/test/common/helpers/batch_buffer_helper.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/dispatch_flags_helper.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/helpers/gtest_helpers.h"
@@ -744,28 +743,6 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFailingExecWhenFlushingThe
mm->freeGraphicsMemory(commandBuffer);
}
struct DrmCommandStreamDirectSubmissionTest : public DrmCommandStreamEnhancedTest {
template <typename GfxFamily>
void setUpT() {
debugManager.flags.EnableDirectSubmission.set(1u);
debugManager.flags.DirectSubmissionDisableMonitorFence.set(0);
debugManager.flags.DirectSubmissionFlatRingBuffer.set(0);
DrmCommandStreamEnhancedTest::setUpT<GfxFamily>();
auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo();
auto engineType = device->getDefaultEngine().osContext->getEngineType();
hwInfo->capabilityTable.directSubmissionEngines.data[engineType].engineSupported = true;
csr->initDirectSubmission();
}
template <typename GfxFamily>
void tearDownT() {
this->dbgState.reset();
DrmCommandStreamEnhancedTest::tearDownT<GfxFamily>();
}
DebugManagerStateRestore restorer;
};
struct DrmCommandStreamBlitterDirectSubmissionTest : public DrmCommandStreamDirectSubmissionTest {
template <typename GfxFamily>
void setUpT() {

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/utilities/wait_util.h"
#include "shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h"
#include "shared/test/common/os_interface/linux/drm_command_stream_fixture.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "shared/test/unit_test/mocks/mock_cpuid_functions.h"
#include "gtest/gtest.h"
using namespace NEO;
HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenDirectSubmissionLightWhenInitThenUseTpauseWaitpkg) {
using CpuIdFuncT = void (*)(int *, int);
auto mockCpuInfo = getMockCpuInfo(CpuInfo::getInstance());
VariableBackup<MockCpuInfo> cpuInfoBackup(mockCpuInfo);
mockCpuInfo->features = CpuInfo::featureNone;
CpuIdFuncT savedCpuIdFunc = CpuInfo::cpuidFunc;
CpuInfo::cpuidFunc = mockCpuidEnableAll;
VariableBackup<bool> backupWaitpkgSupport(&WaitUtils::waitpkgSupport, true);
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
testedCsr->directSubmission.reset();
csr->initDirectSubmission();
EXPECT_EQ(WaitUtils::waitpkgUse, WaitUtils::WaitpkgUse::tpause);
CpuInfo::cpuidFunc = savedCpuIdFunc;
}

View File

@@ -5,7 +5,6 @@
*
*/
#include "shared/source/utilities/cpu_info.h"
#include "shared/source/utilities/wait_util.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/variable_backup.h"
@@ -20,10 +19,6 @@ using namespace NEO;
struct WaitPkgFixture {
using CpuIdFuncT = void (*)(int *, int);
struct MockCpuInfo : public NEO::CpuInfo {
using CpuInfo::features;
};
#ifdef SUPPORTS_WAITPKG
constexpr static bool expectedWaitpkgSupport = SUPPORTS_WAITPKG;
#else
@@ -48,13 +43,8 @@ struct WaitPkgFixture {
CpuInfo::cpuidFunc = savedCpuIdFunc;
}
MockCpuInfo *getMockCpuInfo(const NEO::CpuInfo &cpuInfo) {
return static_cast<MockCpuInfo *>(const_cast<NEO::CpuInfo *>(&CpuInfo::getInstance()));
}
DebugManagerStateRestore restore;
std::unique_ptr<VariableBackup<MockCpuInfo>> backupCpuInfo;
std::unique_ptr<VariableBackup<CpuIdFuncT>> backupCpuIdFunc;
std::unique_ptr<VariableBackup<bool>> backupWaitpkgSupport;
std::unique_ptr<VariableBackup<WaitUtils::WaitpkgUse>> backupWaitpkgUse;
std::unique_ptr<VariableBackup<uint64_t>> backupWaitpkgCounter;