[Beignet] [PATCH] API: Fix device type bugs

Yang, Rong R rong.r.yang at intel.com
Fri Feb 10 07:55:12 UTC 2017


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' <xiuli.pan at intel.com>; beignet at lists.freedesktop.org
> Cc: giuseppe.bilotta at gmail.com; Pan, Xiuli <xiuli.pan at intel.com>
> 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:beignet-bounces at lists.freedesktop.org] On Behalf
> > Of Xiuli Pan
> > Sent: Friday, February 10, 2017 15:04
> > To: beignet at lists.freedesktop.org
> > Cc: giuseppe.bilotta at gmail.com; Pan, Xiuli <xiuli.pan at intel.com>
> > Subject: [Beignet] [PATCH] API: Fix device type bugs
> >
> > From: Pan Xiuli <xiuli.pan at intel.com>
> >
> > Beignet only support GPU now, we should return
> CL_INVALID_DEVICE_TYPE
> > for CPU and ACCELERATOR.
> > Contributor: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
> >
> > Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
> > ---
> >  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
> > Beignet at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list