2014-03-06 15:53 GMT+04:00 Bernd Schmidt <ber...@codesourcery.com>: > No. I don't think we need a global constructor for registering > __OPENMP_TARGET_HOST__ - this would unnecessarily bloat crtbegin/crtend. We > also shouldn't need to have the target tables known outside of the image > constructed by the mkoffload tools. The way I imagine it, every mkoffload > tool creates its own constructor that looks like something like this: > > > __attribute__ ((constructor)) static void > init (void) > { > GOMP_offload_register_target (__OPENMP_TARGET_HOST__, > PTX_ID, ptx_target_table); > } > > That creates a mapping between host and target table for PTX_ID. If there > are multiple shared libraries with offload support, you can still obtain the > ordering you want from these GOMP_offload_register_target calls. Everything > is nicely private to the mkoffload-generated image. > > It's implemented in almost this fashion (slightly different naming and args, > and no real support in libgomp) in the patch kit I sent.
OK, now I get it, this looks good. I will rewrite the patch for libgomp posted above to support this scheme. Since we will pass __OPENMP_HOST_TABLE__ to GOMP_offload_register, there is no need to pass it to GOMP_target[data/update], right? -- Ilya