Fail gracefully on unsupported hardware
authorRebecca Palmer <rebecca_palmer@zoho.com>
Fri, 8 Aug 2014 11:07:24 +0000 (12:07 +0100)
committerYang Rong <rong.r.yang@intel.com>
Tue, 12 Aug 2014 06:34:27 +0000 (14:34 +0800)
commit2cbeeba1994c2d196770115b7033a6e66d904d00
tree2e7b14c1e7f400ac3c2761a4de93c085a590c66a
parentf2d209ee6c8994104cb02da6b0c1b985cf394416
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>
src/cl_api.c
src/cl_device_data.h
src/intel/intel_driver.c
src/intel/intel_gpgpu.c