diff --git a/conformance_tests/core/test_ipc/src/test_ipc_event.cpp b/conformance_tests/core/test_ipc/src/test_ipc_event.cpp index 28cc6b1d..f2e08470 100644 --- a/conformance_tests/core/test_ipc/src/test_ipc_event.cpp +++ b/conformance_tests/core/test_ipc/src/test_ipc_event.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2019-2023 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,6 +12,7 @@ #include "logging/logging.hpp" #include "test_ipc_event.hpp" #include "net/test_ipc_comm.hpp" +#include #include #include @@ -171,6 +172,9 @@ static void run_workload(ze_event_handle_t ×tamp_event, lzt::synchronize(command_queue, UINT64_MAX); + bipc::named_semaphore semaphore(bipc::open_only, "ipc_event_test_semaphore"); + semaphore.post(); + // get time data if (mapped_timestamp) { std::vector kernel_timestamp_buffer{}; @@ -197,6 +201,9 @@ static void run_ipc_event_test(parent_test_t parent_test, child_test_t child_test, bool multi_device, bool isImmediate) { #ifdef __linux__ + bipc::named_semaphore::remove("ipc_event_test_semaphore"); + bipc::named_semaphore semaphore(bipc::create_only, "ipc_event_test_semaphore", 0); + bipc::shared_memory_object::remove("ipc_event_test"); // launch child boost::process::child c("./ipc/test_ipc_event_helper"); @@ -272,6 +279,7 @@ static void run_ipc_event_test(parent_test_t parent_test, if (parent_test == PARENT_TEST_HOST_LAUNCHES_KERNEL) { // ensure the timestamps match + std::memcpy(&test_data, region.get_address(), sizeof(shared_data_t)); EXPECT_EQ(test_data.start_time, startTime); EXPECT_EQ(test_data.end_time, endTime); } diff --git a/conformance_tests/core/test_ipc/src/test_ipc_event_helper.cpp b/conformance_tests/core/test_ipc/src/test_ipc_event_helper.cpp index b1b8c55d..26b919a8 100644 --- a/conformance_tests/core/test_ipc/src/test_ipc_event_helper.cpp +++ b/conformance_tests/core/test_ipc/src/test_ipc_event_helper.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2019-2023 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,6 +11,7 @@ #include "logging/logging.hpp" #include "test_ipc_event.hpp" #include "net/test_ipc_comm.hpp" +#include #include #include @@ -228,6 +229,7 @@ int main() { LOG_DEBUG << "Child exit due to zeInit failure"; exit(1); } + LOG_INFO << "IPC Child zeInit"; shared_data_t shared_data; @@ -247,7 +249,7 @@ int main() { } } shm.truncate(sizeof(shared_data_t)); - bipc::mapped_region region(shm, bipc::read_only); + bipc::mapped_region region(shm, bipc::read_write); std::memcpy(&shared_data, region.get_address(), sizeof(shared_data_t)); ze_ipc_event_pool_handle_t hIpcEventPool{}; @@ -281,6 +283,12 @@ int main() { device_events = true; } + if (shared_data.parent_type == PARENT_TEST_HOST_LAUNCHES_KERNEL) { + // Wait until the child is ready to query the time stamp + bipc::named_semaphore semaphore(bipc::open_only, "ipc_event_test_semaphore"); + semaphore.wait(); + } + const bool isImmediate = shared_data.is_immediate; LOG_INFO << "IPC Child open event handle success"; switch (shared_data.child_type) { @@ -299,13 +307,16 @@ int main() { break; case CHILD_TEST_HOST_TIMESTAMP_READS: child_host_query_timestamp(hEventPool, shared_data, false); + std::memcpy(region.get_address(), &shared_data, sizeof(shared_data_t)); break; case CHILD_TEST_DEVICE_TIMESTAMP_READS: child_device_query_timestamp(hEventPool, device_events, context, shared_data, isImmediate); + std::memcpy(region.get_address(), &shared_data, sizeof(shared_data_t)); break; case CHILD_TEST_HOST_MAPPED_TIMESTAMP_READS: child_host_query_timestamp(hEventPool, shared_data, true); + std::memcpy(region.get_address(), &shared_data, sizeof(shared_data_t)); break; default: LOG_DEBUG << "Unrecognized test case";