diff --git a/opencl/test/unit_test/helpers/kmd_notify_tests.cpp b/opencl/test/unit_test/helpers/kmd_notify_tests.cpp index a9a4dfa8c8..b6f1875098 100644 --- a/opencl/test/unit_test/helpers/kmd_notify_tests.cpp +++ b/opencl/test/unit_test/helpers/kmd_notify_tests.cpp @@ -455,6 +455,17 @@ TEST_F(KmdNotifyTests, givenEnabledKmdNotifyMechanismWhenAcLineIsDisconnectedThe EXPECT_EQ(hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, params.waitTimeout); } +TEST_F(KmdNotifyTests, givenEnabledKmdNotifyMechanismAndTaskCountToWaitLargerThanHwTagPlusOneAndDirectSubmissionDisabledAndQueueThrottleMediumThenDoNotApplyMultiplier) { + hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = true; + hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds = 5; + MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties)); + + auto params = helper.obtainTimeoutParams(false, 1, 10, 2, QueueThrottle::MEDIUM, true, false); + + EXPECT_TRUE(params.enableTimeout); + EXPECT_EQ(hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, params.waitTimeout); +} + TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismAndFlushStampIsZeroWhenAcLineIsDisconnectedThenDontForceEnableTimeout) { hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = false; MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties)); diff --git a/shared/source/helpers/kmd_notify_properties.cpp b/shared/source/helpers/kmd_notify_properties.cpp index 9b605d1c69..775a2240cf 100644 --- a/shared/source/helpers/kmd_notify_properties.cpp +++ b/shared/source/helpers/kmd_notify_properties.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -39,8 +39,8 @@ WaitParams KmdNotifyHelper::obtainTimeoutParams(bool quickKmdSleepRequest, return WaitParams{false, true, 1}; } - int64_t multiplier = (currentHwTag < taskCountToWait) ? static_cast(taskCountToWait - currentHwTag) : 1; - if (!properties->enableKmdNotify && multiplier > KmdNotifyConstants::minimumTaskCountDiffToCheckAcLine) { + const int64_t taskCountDiff = (currentHwTag < taskCountToWait) ? static_cast(taskCountToWait - currentHwTag) : 1; + if (!properties->enableKmdNotify && taskCountDiff > KmdNotifyConstants::minimumTaskCountDiffToCheckAcLine) { updateAcLineStatus(); } @@ -54,7 +54,7 @@ WaitParams KmdNotifyHelper::obtainTimeoutParams(bool quickKmdSleepRequest, } else if (directSubmissionEnabled && properties->enableQuickKmdSleepForDirectSubmission) { params.waitTimeout = properties->delayQuickKmdSleepForDirectSubmissionMicroseconds; } else { - params.waitTimeout = getBaseTimeout(multiplier); + params.waitTimeout = getBaseTimeout(); } params.enableTimeout = (properties->enableKmdNotify || !acLineConnected); diff --git a/shared/source/helpers/kmd_notify_properties.h b/shared/source/helpers/kmd_notify_properties.h index 7dd484b7c5..0544812d5e 100644 --- a/shared/source/helpers/kmd_notify_properties.h +++ b/shared/source/helpers/kmd_notify_properties.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -59,7 +59,7 @@ class KmdNotifyHelper { protected: bool applyQuickKmdSleepForSporadicWait() const; - int64_t getBaseTimeout(const int64_t &multiplier) const; + int64_t getBaseTimeout() const; int64_t getMicrosecondsSinceEpoch() const; const KmdNotifyProperties *properties = nullptr; diff --git a/shared/source/os_interface/linux/kmd_notify_properties_linux.cpp b/shared/source/os_interface/linux/kmd_notify_properties_linux.cpp index 352bcef35f..be2e62fd36 100644 --- a/shared/source/os_interface/linux/kmd_notify_properties_linux.cpp +++ b/shared/source/os_interface/linux/kmd_notify_properties_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,6 +11,6 @@ using namespace NEO; void KmdNotifyHelper::updateAcLineStatus() {} -int64_t KmdNotifyHelper::getBaseTimeout(const int64_t &multiplier) const { - return properties->delayKmdNotifyMicroseconds * multiplier; +int64_t KmdNotifyHelper::getBaseTimeout() const { + return properties->delayKmdNotifyMicroseconds; } diff --git a/shared/source/os_interface/windows/kmd_notify_properties_windows.cpp b/shared/source/os_interface/windows/kmd_notify_properties_windows.cpp index 7ecd4fc400..3f934beeb5 100644 --- a/shared/source/os_interface/windows/kmd_notify_properties_windows.cpp +++ b/shared/source/os_interface/windows/kmd_notify_properties_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -18,6 +18,6 @@ void KmdNotifyHelper::updateAcLineStatus() { } } -int64_t KmdNotifyHelper::getBaseTimeout(const int64_t &multiplier) const { +int64_t KmdNotifyHelper::getBaseTimeout() const { return properties->delayKmdNotifyMicroseconds; } diff --git a/shared/test/unit_test/helpers/linux/kmd_notify_linux_tests.cpp b/shared/test/unit_test/helpers/linux/kmd_notify_linux_tests.cpp index 4699f82451..b2b5a75611 100644 --- a/shared/test/unit_test/helpers/linux/kmd_notify_linux_tests.cpp +++ b/shared/test/unit_test/helpers/linux/kmd_notify_linux_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -18,12 +18,11 @@ class MockKmdNotifyHelper : public KmdNotifyHelper { MockKmdNotifyHelper(const KmdNotifyProperties *newProperties) : KmdNotifyHelper(newProperties){}; }; -TEST(KmdNotifyLinuxTests, givenTaskCountDiffGreaterThanOneWhenBaseTimeoutRequestedThenMultiply) { +TEST(KmdNotifyLinuxTests, givenTaskCountDiffGreaterThanOneWhenBaseTimeoutRequestedThenDoNotMultiply) { auto localProperties = (defaultHwInfo->capabilityTable.kmdNotifyProperties); localProperties.delayKmdNotifyMicroseconds = 10; - const int64_t multiplier = 10; MockKmdNotifyHelper helper(&localProperties); - EXPECT_EQ(localProperties.delayKmdNotifyMicroseconds * multiplier, helper.getBaseTimeout(multiplier)); + EXPECT_EQ(localProperties.delayKmdNotifyMicroseconds, helper.getBaseTimeout()); } } // namespace NEO diff --git a/shared/test/unit_test/helpers/windows/kmd_notify_windows_tests.cpp b/shared/test/unit_test/helpers/windows/kmd_notify_windows_tests.cpp index b2e4716e38..3ae0d8b8fd 100644 --- a/shared/test/unit_test/helpers/windows/kmd_notify_windows_tests.cpp +++ b/shared/test/unit_test/helpers/windows/kmd_notify_windows_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -63,10 +63,9 @@ TEST(KmdNotifyWindowsTests, whenGetSystemPowerStatusReturnErrorThenDontUpdateAcL TEST(KmdNotifyWindowsTests, givenTaskCountDiffGreaterThanOneWhenBaseTimeoutRequestedThenDontMultiply) { auto localProperties = (defaultHwInfo->capabilityTable.kmdNotifyProperties); localProperties.delayKmdNotifyMicroseconds = 10; - const int64_t multiplier = 10; MockKmdNotifyHelper helper(&localProperties); - EXPECT_EQ(localProperties.delayKmdNotifyMicroseconds, helper.getBaseTimeout(multiplier)); + EXPECT_EQ(localProperties.delayKmdNotifyMicroseconds, helper.getBaseTimeout()); } } // namespace NEO