On Mon, Apr 20, 2015 at 17:16:03 +0300, Ilya Verbin wrote: > Hi! > > Currently if a compiler is configured with enabled offloading, the 'devices' > array in libgomp is filled properly with a number of available devices. > However, if a program is compiled with -foffload=disable, the resolve_device > function returns a pointer to the device, and host-fallback is not happening. > The patch below fixes this issue. > make check-target-libgomp passed. OK for trunk? > > > libgomp/ > * libgomp.h (struct gomp_device_descr): Add num_images. > * target.c (resolve_device): Call gomp_init_device. Return NULL if > there is no image loaded to the device. > (gomp_offload_image_to_device): Increase num_images. > (GOMP_offload_unregister): Decrease num_images. > (GOMP_target): Don't call gomp_init_device. > (GOMP_target_data): Ditto. > (GOMP_target_update): Ditto. > (gomp_target_init): Set num_images to 0. > * testsuite/libgomp.c/target-1-disable.c: New test.
Ping. -- Ilya