refactor: split definition of L0 event completion timeout

reduce the value for unit tests

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2025-06-18 12:10:08 +00:00
committed by Compute-Runtime-Automation
parent b8cebd7105
commit b1eb32f447
5 changed files with 16 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2020-2024 Intel Corporation
# Copyright (C) 2020-2025 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -9,6 +9,7 @@ target_sources(${TARGET_NAME_L0}
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/disallow_deferred_deleter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/create_builtin_functions_lib.cpp
${CMAKE_CURRENT_SOURCE_DIR}/event_completion_timeout.cpp
${NEO_SHARED_DIRECTORY}/helpers/file_io.cpp
)

View File

@@ -0,0 +1,10 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/core/source/event/event.h"
const uint64_t L0::Event::completionTimeoutMs = 5000; // 5 seconds

View File

@@ -416,6 +416,7 @@ struct Event : _ze_event_handle_t {
bool isSharableCounterBased = false;
bool mitigateHostVisibleSignal = false;
uint64_t timestampRefreshIntervalInNanoSec = 0;
static const uint64_t completionTimeoutMs;
};
struct EventPool : _ze_event_pool_handle_t {

View File

@@ -860,7 +860,6 @@ void EventImp<TagSizeT>::resetDeviceCompletionData(bool resetAllPackets) {
template <typename TagSizeT>
void EventImp<TagSizeT>::synchronizeTimestampCompletionWithTimeout() {
std::chrono::high_resolution_clock::time_point startTime = std::chrono::high_resolution_clock::now();
constexpr uint64_t timeoutMs = 1000 * 5; // 5s
uint64_t timeDiff = 0;
do {
@@ -868,7 +867,7 @@ void EventImp<TagSizeT>::synchronizeTimestampCompletionWithTimeout() {
calculateProfilingData();
timeDiff = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - startTime).count();
} while (!isTimestampPopulated() && (timeDiff < timeoutMs));
} while (!isTimestampPopulated() && (timeDiff < completionTimeoutMs));
DEBUG_BREAK_IF(!isTimestampPopulated());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,6 +8,7 @@
#include "level_zero/core/test/unit_tests/mocks/mock_event.h"
namespace L0 {
const uint64_t L0::Event::completionTimeoutMs = 1;
namespace ult {
Mock<Event>::Mock() : WhiteBox<::L0::Event>(0, nullptr),