Skip to content

Commit

Permalink
Add ipc event query status sub case (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
marekkozl authored Jan 22, 2025
1 parent cc5f9f4 commit d6f60a2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
12 changes: 11 additions & 1 deletion conformance_tests/core/test_ipc/src/test_ipc_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,17 @@ static void run_ipc_event_test(parent_test_t parent_test,
run_workload(hEvent, context, startTime, endTime,
(timestamp_type == MAPPED_KERNEL_TIMESTAMP));
break;
case PARENT_TEST_QUERY_EVENT_STATUS:
break;
default:
FAIL() << "Fatal test error";
}

c.wait(); // wait for the process to exit
ASSERT_EQ(c.exit_code(), 0);

if (parent_test == PARENT_TEST_QUERY_EVENT_STATUS) {
EXPECT_EQ(ZE_RESULT_SUCCESS, zeEventQueryStatus(hEvent));
}
if (parent_test == PARENT_TEST_HOST_LAUNCHES_KERNEL) {
// ensure the timestamps match
std::memcpy(&test_data, region.get_address(), sizeof(shared_data_t));
Expand Down Expand Up @@ -362,6 +366,12 @@ TEST(
CHILD_TEST_HOST_MAPPED_TIMESTAMP_READS, false, false);
}

TEST(zeIPCEventTests,
GivenTwoProcessesWhenEventSignaledByChildThenEventQueryStatusSuccess) {
run_ipc_event_test(PARENT_TEST_QUERY_EVENT_STATUS,
CHILD_TEST_QUERY_EVENT_STATUS, false, false);
}

TEST(
zeIPCEventMultipleDeviceTests,
GivenTwoProcessesWhenEventSignaledByDeviceInParentThenEventSetinChildFromSecondDevicePerspective) {
Expand Down
6 changes: 4 additions & 2 deletions conformance_tests/core/test_ipc/src/test_ipc_event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
typedef enum {
PARENT_TEST_HOST_SIGNALS,
PARENT_TEST_DEVICE_SIGNALS,
PARENT_TEST_HOST_LAUNCHES_KERNEL
PARENT_TEST_HOST_LAUNCHES_KERNEL,
PARENT_TEST_QUERY_EVENT_STATUS
} parent_test_t;

typedef enum {
Expand All @@ -22,7 +23,8 @@ typedef enum {
CHILD_TEST_MULTI_DEVICE_READS,
CHILD_TEST_HOST_TIMESTAMP_READS,
CHILD_TEST_DEVICE_TIMESTAMP_READS,
CHILD_TEST_HOST_MAPPED_TIMESTAMP_READS
CHILD_TEST_HOST_MAPPED_TIMESTAMP_READS,
CHILD_TEST_QUERY_EVENT_STATUS
} child_test_t;

typedef struct {
Expand Down
13 changes: 13 additions & 0 deletions conformance_tests/core/test_ipc/src/test_ipc_event_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ static void child_host_reads(ze_event_pool_handle_t hEventPool) {
EXPECT_EQ(ZE_RESULT_SUCCESS, zeEventDestroy(hEvent));
}

static void child_query_event_status(ze_event_pool_handle_t hEventPool) {
ze_event_handle_t hEvent = nullptr;
EXPECT_EQ(ZE_RESULT_SUCCESS,
zeEventCreate(hEventPool, &defaultEventDesc, &hEvent));
EXPECT_EQ(ZE_RESULT_NOT_READY, zeEventQueryStatus(hEvent));
EXPECT_EQ(ZE_RESULT_SUCCESS, zeEventHostSignal(hEvent));
EXPECT_EQ(ZE_RESULT_SUCCESS, zeEventQueryStatus(hEvent));
EXPECT_EQ(ZE_RESULT_SUCCESS, zeEventDestroy(hEvent));
}

static void child_device_reads(ze_event_pool_handle_t hEventPool,
bool device_events, ze_context_handle_t context,
bool isImmediate) {
Expand Down Expand Up @@ -318,6 +328,9 @@ int main() {
child_host_query_timestamp(hEventPool, shared_data, true);
std::memcpy(region.get_address(), &shared_data, sizeof(shared_data_t));
break;
case CHILD_TEST_QUERY_EVENT_STATUS:
child_query_event_status(hEventPool);
break;
default:
LOG_DEBUG << "Unrecognized test case";
lzt::destroy_context(context);
Expand Down

0 comments on commit d6f60a2

Please sign in to comment.