mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Strengthen testing of CL_DEVICE_TYPE query and use of CL_DEVICE_TYPE* (#1977)
Issue: #1930
This commit is contained in:
committed by
GitHub
parent
b8981f5fb8
commit
746544af80
@@ -15,6 +15,8 @@
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <bitset>
|
||||
|
||||
#include "harness/testHarness.h"
|
||||
#include "harness/typeWrappers.h"
|
||||
|
||||
@@ -99,6 +101,20 @@ int test_device_info(cl_device_id device, cl_context context, cl_command_queue q
|
||||
return -1;
|
||||
}
|
||||
|
||||
cl_device_type device_type;
|
||||
err_ret = clGetDeviceInfo(device, CL_DEVICE_TYPE, sizeof(cl_device_type),
|
||||
&device_type, &ret_len);
|
||||
test_error(err_ret, "clGetDeviceInfo(CL_DEVICE_TYPE) failed");
|
||||
std::bitset<sizeof(cl_device_type)> type_bits(device_type);
|
||||
|
||||
if (type_bits.count() > 1 || (device_type & CL_DEVICE_TYPE_DEFAULT))
|
||||
{
|
||||
log_error("clGetDeviceInfo(CL_DEVICE_TYPE) must report a single device "
|
||||
"type, which must not be CL_DEVICE_TYPE_DEFAULT or "
|
||||
"CL_DEVICE_TYPE_ALL.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user