mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-26 08:49:02 +00:00
Added two tests not calling event calback upon error status (#2028)
#1900 Tested on POCL, callback is not called.
This commit is contained in:
committed by
GitHub
parent
746544af80
commit
6cbe8cae35
@@ -57,6 +57,8 @@ test_definition test_list[] = {
|
|||||||
ADD_TEST(callbacks),
|
ADD_TEST(callbacks),
|
||||||
ADD_TEST(callbacks_simultaneous),
|
ADD_TEST(callbacks_simultaneous),
|
||||||
ADD_TEST(userevents_multithreaded),
|
ADD_TEST(userevents_multithreaded),
|
||||||
|
ADD_TEST(callback_on_error_simple),
|
||||||
|
ADD_TEST(callback_on_error_enqueue_command)
|
||||||
};
|
};
|
||||||
|
|
||||||
const int test_num = ARRAY_SIZE(test_list);
|
const int test_num = ARRAY_SIZE(test_list);
|
||||||
|
|||||||
@@ -116,3 +116,11 @@ extern int test_userevents_multithreaded(cl_device_id deviceID,
|
|||||||
cl_context context,
|
cl_context context,
|
||||||
cl_command_queue queue,
|
cl_command_queue queue,
|
||||||
int num_elements);
|
int num_elements);
|
||||||
|
extern int test_callback_on_error_simple(cl_device_id deviceID,
|
||||||
|
cl_context context,
|
||||||
|
cl_command_queue queue,
|
||||||
|
int num_elements);
|
||||||
|
extern int test_callback_on_error_enqueue_command(cl_device_id deviceID,
|
||||||
|
cl_context context,
|
||||||
|
cl_command_queue queue,
|
||||||
|
int num_elements);
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
#if !defined(_MSC_VER)
|
#if !defined(_MSC_VER)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif // !_MSC_VER
|
#endif // !_MSC_VER
|
||||||
|
#include <chrono>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
extern const char *IGetStatusString(cl_int status);
|
extern const char *IGetStatusString(cl_int status);
|
||||||
|
|
||||||
@@ -71,6 +73,15 @@ void CL_CALLBACK single_event_callback_function_flags(cl_event event,
|
|||||||
sCallbackTriggered_flag[pdata->index] = true;
|
sCallbackTriggered_flag[pdata->index] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CL_CALLBACK combuf_event_callback_function(cl_event event,
|
||||||
|
cl_int commandStatus,
|
||||||
|
void *userData)
|
||||||
|
{
|
||||||
|
bool *pdata = static_cast<bool *>(userData);
|
||||||
|
log_info("\tEvent callback triggered\n");
|
||||||
|
*pdata = true;
|
||||||
|
}
|
||||||
|
|
||||||
int test_callback_event_single(cl_device_id device, cl_context context,
|
int test_callback_event_single(cl_device_id device, cl_context context,
|
||||||
cl_command_queue queue, Action *actionToTest)
|
cl_command_queue queue, Action *actionToTest)
|
||||||
{
|
{
|
||||||
@@ -372,3 +383,76 @@ int test_callbacks_simultaneous(cl_device_id deviceID, cl_context context,
|
|||||||
if (actionEvents) delete[] actionEvents;
|
if (actionEvents) delete[] actionEvents;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int test_callback_on_error_simple(cl_device_id deviceID, cl_context context,
|
||||||
|
cl_command_queue queue, int num_elements)
|
||||||
|
{
|
||||||
|
cl_int error = CL_SUCCESS;
|
||||||
|
clEventWrapper user_event = clCreateUserEvent(context, &error);
|
||||||
|
test_error(error, "clCreateUserEvent failed");
|
||||||
|
|
||||||
|
bool confirmation = false;
|
||||||
|
error = clSetEventCallback(user_event, CL_COMPLETE,
|
||||||
|
combuf_event_callback_function, &confirmation);
|
||||||
|
test_error(error, "clSetEventCallback failed");
|
||||||
|
|
||||||
|
error = clSetUserEventStatus(user_event, CL_INVALID_VALUE);
|
||||||
|
test_error(error, "clSetUserEventStatus failed");
|
||||||
|
|
||||||
|
// Wait for callback
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
|
|
||||||
|
if (!confirmation)
|
||||||
|
{
|
||||||
|
log_error("callback not called upon error status different than "
|
||||||
|
"CL_SUCCESS\n");
|
||||||
|
return TEST_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CL_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_callback_on_error_enqueue_command(cl_device_id deviceID,
|
||||||
|
cl_context context,
|
||||||
|
cl_command_queue queue,
|
||||||
|
int num_elements)
|
||||||
|
{
|
||||||
|
cl_int error = CL_SUCCESS;
|
||||||
|
bool confirmation = false;
|
||||||
|
|
||||||
|
clEventWrapper user_event = clCreateUserEvent(context, &error);
|
||||||
|
test_error(error, "clCreateUserEvent failed");
|
||||||
|
clEventWrapper fill_event;
|
||||||
|
|
||||||
|
const cl_int pattern_pri = 0xA;
|
||||||
|
clMemWrapper in_mem =
|
||||||
|
clCreateBuffer(context, CL_MEM_READ_ONLY, sizeof(cl_int) * num_elements,
|
||||||
|
nullptr, &error);
|
||||||
|
test_error(error, "clCreateBuffer failed");
|
||||||
|
|
||||||
|
error = clEnqueueFillBuffer(queue, in_mem, &pattern_pri, sizeof(cl_int), 0,
|
||||||
|
num_elements * sizeof(cl_int), 1, &user_event,
|
||||||
|
&fill_event);
|
||||||
|
test_error(error, "clEnqueueFillBuffer failed");
|
||||||
|
|
||||||
|
error = clSetEventCallback(fill_event, CL_COMPLETE,
|
||||||
|
combuf_event_callback_function, &confirmation);
|
||||||
|
test_error(error, "clSetEventCallback failed");
|
||||||
|
|
||||||
|
error = clSetUserEventStatus(user_event, CL_INVALID_VALUE);
|
||||||
|
test_error(error, "clSetUserEventStatus failed");
|
||||||
|
|
||||||
|
error = clFinish(queue);
|
||||||
|
|
||||||
|
// Wait for callback
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
|
|
||||||
|
if (!confirmation)
|
||||||
|
{
|
||||||
|
log_error("callback not called upon error status different than "
|
||||||
|
"CL_SUCCESS\n");
|
||||||
|
return TEST_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CL_SUCCESS;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user