On Mon, Mar 23, 2015 at 10:44:39PM +0300, Ilya Verbin wrote: > If it is too late for such global changes (rework initialization in libgomp, > change mic and ptx plugins), then here is a small workaround patch to fix > offloading from libraries. Likely, it will not affect OpenACC programs with > one > image. make check-target-libgomp passed.
Sorry for not getting to this earlier, really busy with severe regressions bugfixing lately. Anyway, IMHO it is not too late to fixing it properly, after all, the current code is majorly broken. As I've said earlier, e.g. the lack of mutex guarding gomp_target_init (which is using pthread_once guaranteed to be run just once) vs. concurrent GOMP_offload_register calls (if those are run from ctors, then I guess something like dl_load_lock ensures at least on glibc that multiple GOMP_offload_register calls aren't performed at the same time) in accessing/reallocating offload_images and num_offload_images and the lack of support to register further images after the gomp_target_init call (if you dlopen further shared libraries) is really bad. And it would be really nice to support the unloading. But I'm afraid I'm lost in what is the latest posted patch for that, and how has it been tested (whether just on MIC or MIC emul, or also for nvptx). So can you please post a link to the latest full patch and how it has been tested, and if it is still error prone if say one thread executes GOMP_target the first time and another at the same time dlopens some shared library that has offloading regions in it, fix that too? We still have a week or so to get this sorted out. Jakub