Skip to content

Commit f907c7d

Browse files
Revert "performance: set 1ms timeout for ulls controller since xe2"
This reverts commit 28c008e. Signed-off-by: Compute-Runtime-Validation <[email protected]>
1 parent 74c2a92 commit f907c7d

File tree

10 files changed

+267
-49
lines changed

10 files changed

+267
-49
lines changed

shared/source/debug_settings/debug_variables_base.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, EnableDirectSubmissionController, -1, "Enable di
447447
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionControllerTimeout, -1, "Set direct submission controller timeout, -1: default 5000 us, >=0: timeout in us")
448448
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionControllerBcsTimeoutDivisor, -1, "If >=1, divide controller timeout to stop BCS only engines faster than others")
449449
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionControllerMaxTimeout, -1, "Set direct submission controller max timeout - timeout will increase up to given value, -1: default 5000 us, >=0: max timeout in us")
450+
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionControllerDivisor, -1, "Set direct submission controller timeout divider, -1: default 1, >0: divider value")
450451
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionControllerAdjustOnThrottleAndAcLineStatus, -1, "Adjust controller timeout settings based on queue throttle and ac line status, -1: default, 0: disabled, 1: enabled")
451452
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionForceLocalMemoryStorageMode, -1, "Force local memory storage for command/ring/semaphore buffer, -1: default - for all engines, 0: disabled, 1: for multiOsContextCapable engine, 2: for all engines")
452453
DECLARE_DEBUG_VARIABLE(int32_t, EnableRingSwitchTagUpdateWa, -1, "-1: default, 0 - disable, 1 - enable. If enabled, completionFences wont be updated if ring is not running.")

shared/source/direct_submission/direct_submission_controller.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "shared/source/command_stream/command_stream_receiver.h"
1111
#include "shared/source/debug_settings/debug_settings_manager.h"
1212
#include "shared/source/execution_environment/root_device_environment.h"
13-
#include "shared/source/helpers/gfx_core_helper.h"
1413
#include "shared/source/helpers/sleep.h"
1514
#include "shared/source/os_interface/os_context.h"
1615
#include "shared/source/os_interface/os_thread.h"
@@ -26,6 +25,9 @@ DirectSubmissionController::DirectSubmissionController() {
2625
if (debugManager.flags.DirectSubmissionControllerTimeout.get() != -1) {
2726
timeout = std::chrono::microseconds{debugManager.flags.DirectSubmissionControllerTimeout.get()};
2827
}
28+
if (debugManager.flags.DirectSubmissionControllerDivisor.get() != -1) {
29+
timeoutDivisor = debugManager.flags.DirectSubmissionControllerDivisor.get();
30+
}
2931
if (debugManager.flags.DirectSubmissionControllerBcsTimeoutDivisor.get() != -1) {
3032
bcsTimeoutDivisor = debugManager.flags.DirectSubmissionControllerBcsTimeoutDivisor.get();
3133
}
@@ -46,7 +48,7 @@ DirectSubmissionController::~DirectSubmissionController() {
4648
void DirectSubmissionController::registerDirectSubmission(CommandStreamReceiver *csr) {
4749
std::lock_guard<std::mutex> lock(directSubmissionsMutex);
4850
directSubmissions.insert(std::make_pair(csr, DirectSubmissionState()));
49-
csr->getGfxCoreHelper().overrideDirectSubmissionTimeouts(this->timeout, this->maxTimeout);
51+
this->adjustTimeout(csr);
5052
}
5153

5254
void DirectSubmissionController::setTimeoutParamsForPlatform(const ProductHelper &helper) {
@@ -215,6 +217,21 @@ SteadyClock::time_point DirectSubmissionController::getCpuTimestamp() {
215217
return SteadyClock::now();
216218
}
217219

220+
void DirectSubmissionController::adjustTimeout(CommandStreamReceiver *csr) {
221+
if (EngineHelpers::isCcs(csr->getOsContext().getEngineType())) {
222+
for (size_t subDeviceIndex = 0u; subDeviceIndex < csr->getOsContext().getDeviceBitfield().size(); ++subDeviceIndex) {
223+
if (csr->getOsContext().getDeviceBitfield().test(subDeviceIndex)) {
224+
++this->ccsCount[subDeviceIndex];
225+
}
226+
}
227+
auto curentMaxCcsCount = std::max_element(this->ccsCount.begin(), this->ccsCount.end());
228+
if (*curentMaxCcsCount > this->maxCcsCount) {
229+
this->maxCcsCount = *curentMaxCcsCount;
230+
this->timeout /= this->timeoutDivisor;
231+
}
232+
}
233+
}
234+
218235
void DirectSubmissionController::recalculateTimeout() {
219236
const auto now = this->getCpuTimestamp();
220237
const auto timeSinceLastTerminate = std::chrono::duration_cast<std::chrono::microseconds>(now - this->lastTerminateCpuTimestamp);

shared/source/direct_submission/direct_submission_controller.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class DirectSubmissionController {
9898
MOCKABLE_VIRTUAL bool sleep(std::unique_lock<std::mutex> &lock);
9999
MOCKABLE_VIRTUAL SteadyClock::time_point getCpuTimestamp();
100100

101+
void adjustTimeout(CommandStreamReceiver *csr);
101102
void recalculateTimeout();
102103
void applyTimeoutForAcLineStatusAndThrottle(bool acLineConnected);
103104
void updateLastSubmittedThrottle(QueueThrottle throttle);

shared/source/helpers/gfx_core_helper.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "aubstream/aubstream.h"
1717
#include "igfxfmid.h"
1818

19-
#include <chrono>
2019
#include <cstdint>
2120
#include <memory>
2221
#include <string>
@@ -200,8 +199,6 @@ class GfxCoreHelper {
200199
virtual uint32_t getDeviceTimestampWidth() const = 0;
201200
virtual void alignThreadGroupCountToDssSize(uint32_t &threadCount, uint32_t dssCount, uint32_t threadsPerDss, uint32_t threadGroupSize) const = 0;
202201

203-
virtual void overrideDirectSubmissionTimeouts(std::chrono::microseconds &timeout, std::chrono::microseconds &maxTimeout) const = 0;
204-
205202
virtual ~GfxCoreHelper() = default;
206203

207204
protected:
@@ -440,8 +437,6 @@ class GfxCoreHelperHw : public GfxCoreHelper {
440437

441438
uint32_t getDeviceTimestampWidth() const override;
442439

443-
void overrideDirectSubmissionTimeouts(std::chrono::microseconds &timeout, std::chrono::microseconds &maxTimeout) const override;
444-
445440
~GfxCoreHelperHw() override = default;
446441

447442
protected:

shared/source/helpers/gfx_core_helper_base.inl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,4 @@ uint32_t GfxCoreHelperHw<Family>::getInternalCopyEngineIndex(const HardwareInfo
833833
return std::min(defaultInternalCopyEngineIndex, highestAvailableIndex);
834834
}
835835

836-
template <typename Family>
837-
void GfxCoreHelperHw<Family>::overrideDirectSubmissionTimeouts(std::chrono::microseconds &timeout, std::chrono::microseconds &maxTimeout) const {
838-
}
839-
840836
} // namespace NEO

shared/source/helpers/gfx_core_helper_xe2_and_later.inl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,4 @@ void MemorySynchronizationCommands<Family>::encodeAdditionalTimestampOffsets(Lin
8282
EncodeStoreMMIO<Family>::encode(commandStream, RegisterOffsets::globalTimestampUn, globalAddress + sizeof(uint32_t), false, nullptr, isBcs);
8383
}
8484

85-
template <>
86-
void GfxCoreHelperHw<Family>::overrideDirectSubmissionTimeouts(std::chrono::microseconds &timeout, std::chrono::microseconds &maxTimeout) const {
87-
timeout = std::chrono::microseconds{1'000};
88-
maxTimeout = std::chrono::microseconds{1'000};
89-
if (debugManager.flags.DirectSubmissionControllerTimeout.get() != -1) {
90-
timeout = std::chrono::microseconds{debugManager.flags.DirectSubmissionControllerTimeout.get()};
91-
}
92-
if (debugManager.flags.DirectSubmissionControllerMaxTimeout.get() != -1) {
93-
maxTimeout = std::chrono::microseconds{debugManager.flags.DirectSubmissionControllerMaxTimeout.get()};
94-
}
95-
}
96-
9785
} // namespace NEO

shared/source/xe2_hpg_core/lnl/os_agnostic_product_helper_lnl.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ bool ProductHelperHw<gfxProduct>::isCachingOnCpuAvailable() const {
4545
return false;
4646
}
4747

48+
template <>
49+
bool ProductHelperHw<gfxProduct>::isAdjustDirectSubmissionTimeoutOnThrottleAndAcLineStatusEnabled() const {
50+
return true;
51+
}
52+
4853
template <>
4954
TimeoutParams ProductHelperHw<gfxProduct>::getDirectSubmissionControllerTimeoutParams(bool acLineConnected, QueueThrottle queueThrottle) const {
5055
TimeoutParams params{};

shared/test/common/test_files/igdrcl.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ DirectSubmissionMaxRingBuffers = -1
125125
USMEvictAfterMigration = 0
126126
EnableDirectSubmissionController = -1
127127
DirectSubmissionControllerTimeout = -1
128+
DirectSubmissionControllerDivisor = -1
128129
DirectSubmissionMonitorFenceInputPolicy = -1
129130
UseVmBind = -1
130131
EnableNullHardware = 0

0 commit comments

Comments
 (0)