Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ include(${BRANCH_TYPE}/CustomConfig.cmake OPTIONAL)
if (MSVC)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
set(CMAKE_CXX_STANDARD_LIBRARIES "delayimp.lib")
set(CMAKE_CXX_STANDARD_LIBRARIES "winmm.lib")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:OpenCL.dll")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:ze_loader.dll")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4199")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
#include "framework/test_case/register_test_case.h"
#include "framework/utility/file_helper.h"
#include "framework/utility/power_meter.h"
#include "framework/utility/sleep.h"
#include "framework/utility/timer.h"

#include "definitions/kernel_with_work_periodic.h"

#include <gtest/gtest.h>
#include <thread>

static TestResult run(const KernelWithWorkPeriodicArguments &arguments, Statistics &statistics) {
MeasurementFields typeSelector(MeasurementUnit::Microseconds, MeasurementType::Cpu);

Expand Down Expand Up @@ -72,11 +73,11 @@ static TestResult run(const KernelWithWorkPeriodicArguments &arguments, Statisti
const auto submissionDelay = std::chrono::microseconds(arguments.timeBetweenSubmissions);
for (auto i = 0u; i < arguments.iterations; ++i) {
const auto sleepToTimeoutUllsController = std::chrono::microseconds(10000);
std::this_thread::sleep_for(sleepToTimeoutUllsController);
sleep(sleepToTimeoutUllsController);
Timer::Clock::duration executionTime(0);
ASSERT_ZE_RESULT_SUCCESS(powerMeter.measureStart());
for (auto numKernel = 0u; numKernel < arguments.numSubmissions; ++numKernel) {
std::this_thread::sleep_for(submissionDelay);
sleep(submissionDelay);
timer.measureStart();
ASSERT_ZE_RESULT_SUCCESS(zeCommandQueueExecuteCommandLists(levelzero.commandQueue, 1, &cmdList, nullptr));
ASSERT_ZE_RESULT_SUCCESS(zeCommandQueueSynchronize(levelzero.commandQueue, std::numeric_limits<uint64_t>::max()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#include "framework/ocl/utility/queue_families_helper.h"
#include "framework/test_case/register_test_case.h"
#include "framework/utility/file_helper.h"
#include "framework/utility/sleep.h"
#include "framework/utility/timer.h"

#include "definitions/queue_concurrency.h"

#include <chrono>
#include <gtest/gtest.h>
#include <thread>

static TestResult run(const QueueConcurrencyArguments &arguments, Statistics &statistics) {
MeasurementFields typeSelector(MeasurementUnit::Microseconds, MeasurementType::Cpu);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static TestResult run(const QueuePrioritiesArguments &arguments, Statistics &sta
ASSERT_CL_SUCCESS(clEnqueueNDRangeKernel(highPriorityQueue, highPriorityKernel, 1, nullptr, &gws, &lws, 0, nullptr, nullptr));
ASSERT_CL_SUCCESS(clFinish(highPriorityQueue));
ASSERT_CL_SUCCESS(retVal);
std::this_thread::sleep_for(std::chrono::milliseconds(arguments.sleepTime));
sleep(std::chrono::milliseconds(arguments.sleepTime));

// benchmark
size_t gwsLowPriority = 64 * 1024 * 1024;
Expand All @@ -112,7 +112,7 @@ static TestResult run(const QueuePrioritiesArguments &arguments, Statistics &sta
ASSERT_CL_SUCCESS(clEnqueueNDRangeKernel(lowPriorityQueue, lowPriorityKernel, 1, nullptr, &gwsLowPriority, &lws, 0, nullptr, nullptr));
ASSERT_CL_SUCCESS(clFlush(lowPriorityQueue));

std::this_thread::sleep_for(std::chrono::milliseconds(arguments.sleepTime));
sleep(std::chrono::milliseconds(arguments.sleepTime));

// now submit high priority kernel
timer.measureStart();
Expand All @@ -122,7 +122,7 @@ static TestResult run(const QueuePrioritiesArguments &arguments, Statistics &sta
ASSERT_CL_SUCCESS(retVal);
statistics.pushValue(timer.get(), typeSelector.getUnit(), typeSelector.getType());
ASSERT_CL_SUCCESS(clFinish(lowPriorityQueue));
std::this_thread::sleep_for(std::chrono::milliseconds(arguments.sleepTime));
sleep(std::chrono::milliseconds(arguments.sleepTime));
}

// Cleanup
Expand Down
3 changes: 2 additions & 1 deletion source/framework/test_case/test_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "framework/test_map.h"
#include "framework/utility/common_help_message.h"
#include "framework/utility/error.h"
#include "framework/utility/sleep.h"
#include "framework/utility/string_utils.h"

#include <functional>
Expand Down Expand Up @@ -100,7 +101,7 @@ class TestCase : public TestCaseBase {
DEVELOPER_WARNING_IF(!statistics.isFull(), "test did not generate as many values as expected");
statistics.printStatistics(testCaseNameWithConfig);
if (Configuration::get().sleepFor > 0) {
std::this_thread::sleep_for(std::chrono::milliseconds(Configuration::get().sleepFor));
sleep(std::chrono::milliseconds(Configuration::get().sleepFor));
}
} else if (testResult == TestResult::Nooped) {
statistics.printStatistics(testCaseNameWithConfig);
Expand Down
16 changes: 16 additions & 0 deletions source/framework/utility/linux/sleep_linux.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#pragma once

#include <thread>

template <typename Duration>
void sleep(const Duration &duration) {
std::this_thread::sleep_for(duration);
}

13 changes: 13 additions & 0 deletions source/framework/utility/sleep.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#ifdef WIN32
#include "framework/utility/windows/sleep_windows.h"
#else // !WIN32
#include "framework/utility/linux/sleep_linux.h"
#endif // !WIN32

21 changes: 21 additions & 0 deletions source/framework/utility/windows/sleep_windows.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#pragma once

#define NOMINMAX
#include <Windows.h>

#include <thread>
#include <timeapi.h>

template <typename Duration>
void sleep(const Duration &duration) {
timeBeginPeriod(1u);
std::this_thread::sleep_for(duration);
timeEndPeriod(1u);
}