mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Test that queues are flushed by clReleaseCommandQueue (#923)
... as required by the OpenCL specification. Also introduce a utility function to manage polling for changes via a user-supplied function. Several tests we introduced lately could have used this. Signed-off-by: Kévin Petit <kpet@free.fr>
This commit is contained in:
@@ -1693,3 +1693,23 @@ Version get_max_OpenCL_C_for_context(cl_context context)
|
||||
});
|
||||
return current_version;
|
||||
}
|
||||
|
||||
bool poll_until(unsigned timeout_ms, unsigned interval_ms,
|
||||
std::function<bool()> fn)
|
||||
{
|
||||
unsigned time_spent_ms = 0;
|
||||
bool ret = false;
|
||||
|
||||
while (time_spent_ms < timeout_ms)
|
||||
{
|
||||
ret = fn();
|
||||
if (ret)
|
||||
{
|
||||
break;
|
||||
}
|
||||
usleep(interval_ms * 1000);
|
||||
time_spent_ms += interval_ms;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#include "deviceInfo.h"
|
||||
#include "harness/alloc.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
/*
|
||||
* The below code is intended to be used at the top of kernels that appear inline in files to set line and file info for the kernel:
|
||||
*
|
||||
@@ -181,4 +183,8 @@ Version get_device_cl_c_version(cl_device_id device);
|
||||
// the OpenCL C version supported by all devices in a context.
|
||||
Version get_max_OpenCL_C_for_context(cl_context context);
|
||||
|
||||
// Poll fn every interval_ms until timeout_ms or it returns true
|
||||
bool poll_until(unsigned timeout_ms, unsigned interval_ms,
|
||||
std::function<bool()> fn);
|
||||
|
||||
#endif // _kernelHelpers_h
|
||||
|
||||
Reference in New Issue
Block a user