Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to align CTS and Spec for Event. #2687

Merged
merged 2 commits into from
Feb 12, 2025
Merged
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
24 changes: 24 additions & 0 deletions test/conformance/event/urEventCreateWithNativeHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,27 @@ TEST_P(urEventCreateWithNativeHandleTest, SuccessWithProperties) {
sizeof(ur_execution_info_t), &exec_info,
nullptr));
}

TEST_P(urEventCreateWithNativeHandleTest, InvalidNullHandle) {
ur_native_handle_t native_event = 0;

UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
urEventGetNativeHandle(event, &native_event));

uur::raii::Event evt = nullptr;
ASSERT_EQ_RESULT(
urEventCreateWithNativeHandle(native_event, nullptr, nullptr, evt.ptr()),
UR_RESULT_ERROR_INVALID_NULL_HANDLE);
}

TEST_P(urEventCreateWithNativeHandleTest, InvalidNullPointer) {
ur_native_handle_t native_event = 0;

UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
urEventGetNativeHandle(event, &native_event));

uur::raii::Event evt = nullptr;
ASSERT_EQ_RESULT(
urEventCreateWithNativeHandle(native_event, context, nullptr, nullptr),
UR_RESULT_ERROR_INVALID_NULL_POINTER);
}
38 changes: 38 additions & 0 deletions test/conformance/event/urEventGetProfilingInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,41 @@ TEST_P(urEventGetProfilingInfoForWaitWithBarrier, Success) {

ASSERT_GE(complete_value, submit_value);
}

struct urEventGetProfilingInfoInvalidQueue : uur::urQueueTest {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(urQueueTest::SetUp());
ASSERT_SUCCESS(urMemBufferCreate(context, UR_MEM_FLAG_WRITE_ONLY, size,
nullptr, &buffer));

input.assign(count, 42);
ASSERT_SUCCESS(urEnqueueMemBufferWrite(queue, buffer, false, 0, size,
input.data(), 0, nullptr, &event));
ASSERT_SUCCESS(urEventWait(1, &event));
}

void TearDown() override {
if (buffer) {
EXPECT_SUCCESS(urMemRelease(buffer));
}
UUR_RETURN_ON_FATAL_FAILURE(urQueueTest::TearDown());
};

const size_t count = 1024;
const size_t size = sizeof(uint32_t) * count;
ur_mem_handle_t buffer = nullptr;
ur_event_handle_t event = nullptr;
std::vector<uint32_t> input;
};

UUR_INSTANTIATE_DEVICE_TEST_SUITE(urEventGetProfilingInfoInvalidQueue);

TEST_P(urEventGetProfilingInfoInvalidQueue, ProfilingInfoNotAvailable) {
UUR_KNOWN_FAILURE_ON(uur::NativeCPU{});

const ur_profiling_info_t property_name = UR_PROFILING_INFO_COMMAND_QUEUED;
size_t property_size;
ASSERT_EQ_RESULT(
urEventGetProfilingInfo(event, property_name, 0, nullptr, &property_size),
UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE);
}
7 changes: 7 additions & 0 deletions test/conformance/event/urEventSetCallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,11 @@ TEST_P(urEventSetCallbackNegativeTest, InvalidEnumeration) {
UR_RESULT_ERROR_INVALID_ENUMERATION);
}

TEST_P(urEventSetCallbackNegativeTest, UnsupportedEnumeration) {
ASSERT_EQ_RESULT(
urEventSetCallback(event, ur_execution_info_t::UR_EXECUTION_INFO_QUEUED,
emptyCallback, nullptr),
UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION);
}

UUR_INSTANTIATE_DEVICE_TEST_SUITE(urEventSetCallbackNegativeTest);