Sorry, if support multiple type device later, can't check the type in the api function, should check the device type when get device. I will send a patch to let cl_get_gt_device function return device when type is CL_DEVICE_TYPE_GPU and CL_DEVICE_TYPE_DEFAULT.
> -----Original Message----- > From: Yang, Rong R > Sent: Friday, February 10, 2017 15:40 > To: 'Xiuli Pan' <[email protected]>; [email protected] > Cc: [email protected]; Pan, Xiuli <[email protected]> > Subject: RE: [Beignet] [PATCH] API: Fix device type bugs > > There are two types of relative return error, one is > CL_INVALID_DEVICE_TYPE, for invalid value, another is > CL_DEVICE_NOT_FOUND, for no matched device. > The original check for CL_INVALID_DEVICE_TYPE is right, but miss the > CL_DEVICE_NOT_FOUND check. > Giuseppe's patch will return CL_DEVICE_NOT_FOUND, but I think is more > clear to check it in the api's function. > I will send a new version. > > > -----Original Message----- > > From: Beignet [mailto:[email protected]] On Behalf > > Of Xiuli Pan > > Sent: Friday, February 10, 2017 15:04 > > To: [email protected] > > Cc: [email protected]; Pan, Xiuli <[email protected]> > > Subject: [Beignet] [PATCH] API: Fix device type bugs > > > > From: Pan Xiuli <[email protected]> > > > > Beignet only support GPU now, we should return > CL_INVALID_DEVICE_TYPE > > for CPU and ACCELERATOR. > > Contributor: Giuseppe Bilotta <[email protected]> > > > > Signed-off-by: Pan Xiuli <[email protected]> > > --- > > src/cl_api_context.c | 3 +-- > > src/cl_api_device_id.c | 4 +--- > > 2 files changed, 2 insertions(+), 5 deletions(-) > > > > diff --git a/src/cl_api_context.c b/src/cl_api_context.c index > > e8184b1..85d6480 100644 > > --- a/src/cl_api_context.c > > +++ b/src/cl_api_context.c > > @@ -71,8 +71,7 @@ clCreateContextFromType(const > cl_context_properties > > *properties, > > cl_int err = CL_SUCCESS; > > cl_device_id *devices = NULL; > > cl_uint num_devices = 0; > > - const cl_device_type valid_type = CL_DEVICE_TYPE_GPU | > > CL_DEVICE_TYPE_CPU | CL_DEVICE_TYPE_ACCELERATOR | > > - CL_DEVICE_TYPE_DEFAULT | > > CL_DEVICE_TYPE_CUSTOM; > > + const cl_device_type valid_type = CL_DEVICE_TYPE_GPU | > > + CL_DEVICE_TYPE_DEFAULT | CL_DEVICE_TYPE_CUSTOM; > > > > do { > > /* Assure parameters correctness */ diff --git > > a/src/cl_api_device_id.c b/src/cl_api_device_id.c index > > 4ffef78..84e0882 100644 > > --- a/src/cl_api_device_id.c > > +++ b/src/cl_api_device_id.c > > @@ -26,9 +26,7 @@ clGetDeviceIDs(cl_platform_id platform, > > cl_device_id *devices, > > cl_uint *num_devices) > > { > > - const cl_device_type valid_type = CL_DEVICE_TYPE_GPU | > > CL_DEVICE_TYPE_CPU | > > - CL_DEVICE_TYPE_ACCELERATOR | > > CL_DEVICE_TYPE_DEFAULT | > > - CL_DEVICE_TYPE_CUSTOM; > > + const cl_device_type valid_type = CL_DEVICE_TYPE_GPU | > > + CL_DEVICE_TYPE_DEFAULT | CL_DEVICE_TYPE_CUSTOM; > > > > /* Check parameter consistency */ > > if (UNLIKELY(devices == NULL && num_devices == NULL)) > > -- > > 2.7.4 > > > > _______________________________________________ > > Beignet mailing list > > [email protected] > > https://lists.freedesktop.org/mailman/listinfo/beignet _______________________________________________ Beignet mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/beignet
