Fail gracefully on unsupported hardware
If no compatible hardware is present, clGetDeviceIDs is supposed to
report CL_DEVICE_NOT_FOUND to the caller, but in Beignet this currently
ends the whole program with exit(-1) or assert(0). This fixes this.
This is required to have a "just works" OpenCL in Debian/Ubuntu, as
their package manager doesn't know the hardware and hence commonly will
install Beignet on hardware that doesn't support it; returning an error
allows the caller to try other ICDs until it finds the right one, or to
run without using OpenCL. Previous discussion:
http://lists.alioth.debian.org/pipermail/pkg-opencl-devel/Week-of-Mon-
20140217/000096.html
http://lists.alioth.debian.org/pipermail/pkg-opencl-devel/Week-of-Mon-
20140217/000100.html
Testing if you only have supported hardware: use a chroot, the GPU
isn't visible from inside.
Identical patch in case line wrap mangles this:
https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=27;filename=fail_gracefully_without_hardware;att=1;bug=745363
Signed-off-by: Rebecca Palmer <rebecca_palmer@zoho.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>