performance: set 1ms timeout for ulls controller since xe2

Related-To: NEO-13843

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2025-02-19 11:49:52 +00:00
committed by Compute-Runtime-Automation
parent b0e3d8656e
commit 28c008e438
10 changed files with 51 additions and 269 deletions

View File

@@ -5,6 +5,7 @@
*
*/
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/source/os_interface/os_thread.h"
#include "shared/source/os_interface/os_time.h"
@@ -27,15 +28,6 @@ TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerTimeoutWhen
EXPECT_EQ(controller.timeout.count(), 14);
}
TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllertimeoutDivisorWhenCreateObjectThentimeoutDivisorIsEqualWithDebugFlag) {
DebugManagerStateRestore restorer;
debugManager.flags.DirectSubmissionControllerDivisor.set(4);
DirectSubmissionControllerMock controller;
EXPECT_EQ(controller.timeoutDivisor, 4);
}
TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerWhenRegisterDirectSubmissionWorksThenItIsMonitoringItsState) {
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
@@ -166,10 +158,10 @@ TEST(DirectSubmissionControllerTests, givenDebugFlagSetWhenCheckingNewSubmission
controller.unregisterDirectSubmission(&ccsCsr);
}
TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerAndDivisorDisabledWhenIncreaseTimeoutEnabledThenTimeoutIsIncreased) {
TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerWhenIncreaseTimeoutEnabledThenTimeoutIsIncreased) {
DebugManagerStateRestore restorer;
debugManager.flags.DirectSubmissionControllerTimeout.set(5'000);
debugManager.flags.DirectSubmissionControllerMaxTimeout.set(200'000);
debugManager.flags.DirectSubmissionControllerDivisor.set(1);
debugManager.flags.DirectSubmissionControllerAdjustOnThrottleAndAcLineStatus.set(0);
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
@@ -290,7 +282,6 @@ TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerAndAdjustOn
TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerAndAdjustOnThrottleAndAcLineStatusEnabledWhenThrottleOrAcLineStatusChangesThenTimeoutIsChanged) {
DebugManagerStateRestore restorer;
debugManager.flags.DirectSubmissionControllerDivisor.set(1);
debugManager.flags.DirectSubmissionControllerAdjustOnThrottleAndAcLineStatus.set(1);
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
@@ -403,7 +394,7 @@ TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerAndAdjustOn
controller.unregisterDirectSubmission(&csr);
}
TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerWhenRegisterCsrsThenTimeoutIsNotAdjusted) {
TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerWhenRegisterCsrsThenTimeoutIsAdjusted) {
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager();
@@ -415,54 +406,12 @@ TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerWhenRegiste
PreemptionMode::ThreadGroup, deviceBitfield)));
csr.setupContext(*osContext.get());
MockCommandStreamReceiver csr1(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext1(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr1.setupContext(*osContext1.get());
MockCommandStreamReceiver csr2(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext2(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr2.setupContext(*osContext2.get());
MockCommandStreamReceiver csr3(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext3(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr3.setupContext(*osContext3.get());
MockCommandStreamReceiver csr4(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext4(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr4.setupContext(*osContext4.get());
DirectSubmissionControllerMock controller;
EXPECT_EQ(controller.timeout.count(), 5'000);
auto timeout = std::chrono::microseconds{5'000};
EXPECT_EQ(controller.timeout, timeout);
controller.registerDirectSubmission(&csr);
EXPECT_EQ(controller.timeout.count(), 5'000);
controller.registerDirectSubmission(&csr3);
EXPECT_EQ(controller.timeout.count(), 5'000);
controller.registerDirectSubmission(&csr1);
EXPECT_EQ(controller.timeout.count(), 5'000);
controller.registerDirectSubmission(&csr2);
EXPECT_EQ(controller.timeout.count(), 5'000);
controller.registerDirectSubmission(&csr4);
EXPECT_EQ(controller.timeout.count(), 5'000);
controller.unregisterDirectSubmission(&csr);
controller.unregisterDirectSubmission(&csr1);
controller.unregisterDirectSubmission(&csr2);
controller.unregisterDirectSubmission(&csr3);
controller.unregisterDirectSubmission(&csr4);
csr.getGfxCoreHelper().overrideDirectSubmissionTimeouts(timeout, timeout);
EXPECT_EQ(controller.timeout, timeout);
}
TEST(DirectSubmissionControllerTests, givenPowerSavingUintWhenCallingGetThrottleFromPowerSavingUintThenCorrectValueIsReturned) {
@@ -471,187 +420,6 @@ TEST(DirectSubmissionControllerTests, givenPowerSavingUintWhenCallingGetThrottle
EXPECT_EQ(QueueThrottle::LOW, getThrottleFromPowerSavingUint(100u));
}
TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerWhenRegisterCsrsFromDifferentSubdevicesThenTimeoutIsAdjusted) {
DebugManagerStateRestore restorer;
debugManager.flags.DirectSubmissionControllerDivisor.set(4);
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager();
DeviceBitfield deviceBitfield(1);
DeviceBitfield deviceBitfield1(0b10);
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr.setupContext(*osContext.get());
MockCommandStreamReceiver csr1(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext1(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr1.setupContext(*osContext1.get());
MockCommandStreamReceiver csr2(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext2(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr2.setupContext(*osContext2.get());
MockCommandStreamReceiver csr3(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext3(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr3.setupContext(*osContext3.get());
MockCommandStreamReceiver csr4(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext4(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr4.setupContext(*osContext4.get());
MockCommandStreamReceiver csr5(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext5(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield1)));
csr5.setupContext(*osContext5.get());
MockCommandStreamReceiver csr6(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext6(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield1)));
csr6.setupContext(*osContext6.get());
MockCommandStreamReceiver csr7(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext7(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield1)));
csr7.setupContext(*osContext7.get());
MockCommandStreamReceiver csr8(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext8(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield1)));
csr8.setupContext(*osContext8.get());
MockCommandStreamReceiver csr9(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext9(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield1)));
csr9.setupContext(*osContext9.get());
MockCommandStreamReceiver csr10(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext10(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield1)));
csr10.setupContext(*osContext10.get());
DirectSubmissionControllerMock controller;
EXPECT_EQ(controller.timeout.count(), 5'000);
controller.registerDirectSubmission(&csr);
EXPECT_EQ(controller.timeout.count(), 5'000);
controller.registerDirectSubmission(&csr5);
EXPECT_EQ(controller.timeout.count(), 5'000);
controller.registerDirectSubmission(&csr1);
EXPECT_EQ(controller.timeout.count(), 1'250);
controller.registerDirectSubmission(&csr2);
EXPECT_EQ(controller.timeout.count(), 312);
controller.registerDirectSubmission(&csr4);
EXPECT_EQ(controller.timeout.count(), 312);
controller.registerDirectSubmission(&csr6);
EXPECT_EQ(controller.timeout.count(), 312);
controller.registerDirectSubmission(&csr7);
EXPECT_EQ(controller.timeout.count(), 312);
controller.registerDirectSubmission(&csr9);
EXPECT_EQ(controller.timeout.count(), 312);
controller.registerDirectSubmission(&csr8);
EXPECT_EQ(controller.timeout.count(), 78);
controller.registerDirectSubmission(&csr10);
EXPECT_EQ(controller.timeout.count(), 78);
controller.unregisterDirectSubmission(&csr);
controller.unregisterDirectSubmission(&csr1);
controller.unregisterDirectSubmission(&csr2);
controller.unregisterDirectSubmission(&csr3);
controller.unregisterDirectSubmission(&csr4);
}
TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerDirectSubmissionControllerDivisorSetWhenRegisterCsrsThenTimeoutIsAdjusted) {
DebugManagerStateRestore restorer;
debugManager.flags.DirectSubmissionControllerDivisor.set(5);
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager();
DeviceBitfield deviceBitfield(1);
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr.setupContext(*osContext.get());
MockCommandStreamReceiver csr1(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext1(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr1.setupContext(*osContext1.get());
MockCommandStreamReceiver csr2(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext2(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr2.setupContext(*osContext2.get());
MockCommandStreamReceiver csr3(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext3(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr3.setupContext(*osContext3.get());
MockCommandStreamReceiver csr4(executionEnvironment, 0, deviceBitfield);
std::unique_ptr<OsContext> osContext4(OsContext::create(nullptr, 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::regular},
PreemptionMode::ThreadGroup, deviceBitfield)));
csr4.setupContext(*osContext4.get());
DirectSubmissionControllerMock controller;
EXPECT_EQ(controller.timeout.count(), 5'000);
controller.registerDirectSubmission(&csr);
EXPECT_EQ(controller.timeout.count(), 5'000);
controller.registerDirectSubmission(&csr3);
EXPECT_EQ(controller.timeout.count(), 5'000);
controller.registerDirectSubmission(&csr1);
EXPECT_EQ(controller.timeout.count(), 1'000);
controller.registerDirectSubmission(&csr2);
EXPECT_EQ(controller.timeout.count(), 200);
controller.registerDirectSubmission(&csr4);
EXPECT_EQ(controller.timeout.count(), 200);
controller.unregisterDirectSubmission(&csr);
controller.unregisterDirectSubmission(&csr1);
controller.unregisterDirectSubmission(&csr2);
controller.unregisterDirectSubmission(&csr3);
controller.unregisterDirectSubmission(&csr4);
}
TEST(DirectSubmissionControllerTests, givenDirectSubmissionControllerWhenEnqueueWaitForPagingFenceThenWaitInQueue) {
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -106,3 +106,21 @@ HWTEST2_F(GfxCoreHelperXe2AndLaterTests, givenAtLeastXe2HpgWhenEncodeAdditionalT
EXPECT_EQ(storeRegMem->getRegisterAddress(), RegisterOffsets::globalTimestampUn);
EXPECT_EQ(storeRegMem->getMemoryAddress(), sndAddress + sizeof(uint32_t));
}
HWTEST2_F(GfxCoreHelperXe2AndLaterTests, givenOverrideDirectSubmissionTimeoutsCalledThenTimeoutsAreOverridden, IsAtLeastXe2HpgCore) {
MockExecutionEnvironment mockExecutionEnvironment{};
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>();
auto timeout = std::chrono::microseconds{5'000};
auto maxTimeout = timeout;
gfxCoreHelper.overrideDirectSubmissionTimeouts(timeout, maxTimeout);
EXPECT_EQ(timeout.count(), 1'000);
EXPECT_EQ(maxTimeout.count(), 1'000);
DebugManagerStateRestore restorer{};
debugManager.flags.DirectSubmissionControllerTimeout.set(2'000);
debugManager.flags.DirectSubmissionControllerMaxTimeout.set(3'000);
gfxCoreHelper.overrideDirectSubmissionTimeouts(timeout, maxTimeout);
EXPECT_EQ(timeout.count(), 2'000);
EXPECT_EQ(maxTimeout.count(), 3'000);
}