Skip to content

Commit 9ea42ac

Browse files
fix: Fix the Sysman Engine Test for the workload submission (#337)
If engine utilization prior to workload submission is above 5%, the check for the utilization values before and after workload should be skipped. Related-To: NEO-16864 Signed-off-by: Pratik Bari <[email protected]> * fix: Fix the Sysman Engine Test for the workload submission If engine utilization prior to workload submission exceeds 5%, the check for the utilization values before and after workload should be skipped. Related-To: NEO-16864 Signed-off-by: Pratik Bari <[email protected]> * fix: Fix the Sysman Engine Test for the workload submission Modified the engine workload test to poll pre-utilization for 5 seconds. The test now continuously measures utilization at 500ms intervals over a 5-second period and only skips the workload test if the final pre-utilization value exceeds 5%. Related-To: NEO-16864 Signed-off-by: Pratik Bari <[email protected]> * fix: Fix the Sysman Engine Test for the workload submission Modified the engine workload test to poll pre-utilization for 5 seconds. The test now continuously measures utilization at 500ms intervals over a 5-second period and only skips the workload test if the final pre-utilization value exceeds 5%. Related-To: NEO-16864 Signed-off-by: Pratik Bari <[email protected]> * fix: Fix the Sysman Engine Test for the workload submission Modified the engine workload test to poll pre-utilization for 5 seconds. The test now continuously measures utilization at 500ms intervals over a 5-second period and only skips the workload test if the final pre-utilization value exceeds 5%. Related-To: NEO-16864 Signed-off-by: Pratik Bari <[email protected]> * fix: Fix the Sysman Engine Test for the workload submission Modified the engine workload test to poll pre-utilization for 5 seconds. The test now continuously measures utilization at 500ms intervals over a 5-second period and only skips the workload test if the final pre-utilization value exceeds 5%. Related-To: NEO-16864 Signed-off-by: Pratik Bari <[email protected]> * fix: Fix the Sysman Engine Test for the workload submission Modified the engine workload test to poll pre-utilization for 5 seconds. The test now continuously measures utilization at 500ms intervals over a 5-second period and only skips the workload test if the final pre-utilization value exceeds 5%. Related-To: NEO-16864 Signed-off-by: Pratik Bari <[email protected]> --------- Signed-off-by: Pratik Bari <[email protected]>
1 parent 2b7e6f8 commit 9ea42ac

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

conformance_tests/sysman/test_sysman_engine/src/test_sysman_engine.cpp

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "logging/logging.hpp"
1212
#include "utils/utils.hpp"
1313
#include "test_harness/test_harness.hpp"
14+
#include <thread>
1415
namespace lzt = level_zero_tests;
1516

1617
#include <level_zero/zes_api.h>
@@ -298,26 +299,48 @@ static void workload_for_device(ze_device_handle_t device) {
298299
LZT_TEST_F(
299300
ENGINE_TEST,
300301
GivenValidEngineHandleWhenGpuWorkloadIsSubmittedThenEngineActivityMeasuredIsHigher) {
302+
bool is_engine_workload_executed = false;
301303
for (auto device : devices) {
302304
uint32_t count = 0;
303305
count = lzt::get_engine_handle_count(device);
304306
if (count > 0) {
305307
is_engine_supported = true;
308+
constexpr double pre_utilization_threshold = 0.05;
306309
LOG_INFO << "Engine handles are available on this device! ";
307310
auto engine_handles = lzt::get_engine_handles(device, count);
308311
for (auto engine_handle : engine_handles) {
309312
ASSERT_NE(nullptr, engine_handle);
310313
auto properties = lzt::get_engine_properties(engine_handle);
311314
if (properties.type == ZES_ENGINE_GROUP_COMPUTE_ALL) {
312-
// Get pre-workload utilization
315+
// Poll pre-workload utilization for 5 seconds
316+
auto start_time = std::chrono::steady_clock::now();
313317
auto s1 = lzt::get_engine_activity(engine_handle);
314-
auto s2 = lzt::get_engine_activity(engine_handle);
315318
double pre_utilization = 0.0;
316-
if (s2.timestamp > s1.timestamp) {
317-
pre_utilization = (static_cast<double>(s2.activeTime) -
318-
static_cast<double>(s1.activeTime)) /
319-
(static_cast<double>(s2.timestamp) -
320-
static_cast<double>(s1.timestamp));
319+
320+
while (std::chrono::steady_clock::now() - start_time <
321+
std::chrono::seconds(5)) {
322+
std::this_thread::sleep_for(std::chrono::milliseconds(500));
323+
auto s2 = lzt::get_engine_activity(engine_handle);
324+
if (s2.timestamp > s1.timestamp) {
325+
pre_utilization = (static_cast<double>(s2.activeTime) -
326+
static_cast<double>(s1.activeTime)) /
327+
(static_cast<double>(s2.timestamp) -
328+
static_cast<double>(s1.timestamp));
329+
330+
// If utilization falls below threshold, break and proceed with
331+
// test
332+
if (pre_utilization < pre_utilization_threshold) {
333+
break;
334+
}
335+
}
336+
s1 = s2;
337+
}
338+
339+
// Skip only if utilization remained high throughout the entire period
340+
if (pre_utilization > pre_utilization_threshold) {
341+
LOG_INFO << "Pre-utilization is already high: "
342+
<< pre_utilization * 100 << "%, skipping workload test.";
343+
continue;
321344
}
322345

323346
// submit workload and measure utilization
@@ -330,13 +353,13 @@ LZT_TEST_F(
330353
s1 = lzt::get_engine_activity(engine_handle);
331354
std::thread thread(workload_for_device, core_device);
332355
thread.join();
333-
s2 = lzt::get_engine_activity(engine_handle);
334356
#else // USE_ZESINIT
335357
s1 = lzt::get_engine_activity(engine_handle);
336358
std::thread thread(workload_for_device, device);
337359
thread.join();
338-
s2 = lzt::get_engine_activity(engine_handle);
339360
#endif // USE_ZESINIT
361+
is_engine_workload_executed = true;
362+
auto s2 = lzt::get_engine_activity(engine_handle);
340363
EXPECT_NE(s2.timestamp, s1.timestamp);
341364
if (s2.timestamp > s1.timestamp) {
342365
double post_utilization = (static_cast<double>(s2.activeTime) -
@@ -355,6 +378,10 @@ LZT_TEST_F(
355378
LOG_INFO << "No engine handles found for this device! ";
356379
}
357380
}
381+
if (!is_engine_workload_executed) {
382+
GTEST_SKIP() << "All engines had high pre-utilization. No workload test "
383+
"was executed.";
384+
}
358385
if (!is_engine_supported) {
359386
FAIL() << "No engine handles found on any of the devices! ";
360387
}

0 commit comments

Comments
 (0)