Hi, This patch fixes offloading from dlopened libraries, part 1 is for libgomp and part 2 is for intelmic plugin (it's not finished yet).
How it works: When a library is loaded it calls GOMP_offload_register as usually. At this time some devices may already be initialized, and some may be not. Therefore libgomp goes through all devices and for the initialized devices calls GOMP_OFFLOAD_load_image, then receives corresponding addresses and inserts them into splay tree. Also it fills offload_images array for lazy Initialization. When the library is unloaded it calls GOMP_offload_unregister. This function also need to go through all devices and to call GOMP_OFFLOAD_unload_image for all initialized devices. Also it removes mapped addresses from corresponding splay trees and pending images from the array. Any thoughts on that? Thomas, Julian, Will this approach work for OpenACC+PTX? I hope that it is general enough. Yeah, I understand that this change will require some efforts on your part to rebase the patches, but it would be good to define a common libgomp<->plugin interface as early as possible. Thanks, -- Ilya