2014-03-06 12:47 GMT+04:00 Bernd Schmidt <ber...@codesourcery.com>: > I don't see why you want the array of target descriptors - it would take > some effort to construct, and as far as I can tell it's unnecessary. You > can just pass a pointer to the corresponding descriptor to every > GOMP_offload_register call. > > Once again, that seems unnecessarily complicated. The plugins can register > their target ID with libgomp, and when libgomp sees a GOMP_offload_register > call with the corresponding target ID, it can invoke the appropriate plugin > immediately.
Do I understand correctly, that you propose to do so: extern void *_omp_host_func_table[]; extern void *_omp_host_var_table[]; extern void *_omp_host_funcs_end[]; extern void *_omp_host_vars_end[]; void *__OPENMP_TARGET_HOST__[] __attribute__ ((visibility ("protected"))) = { &_omp_host_func_table, &_omp_host_funcs_end, &_omp_host_var_table, &_omp_host_vars_end }; extern void *__OPENMP_TARGET_MIC__[]; extern void *__OPENMP_TARGET_PTX__[]; extern void GOMP_offload_register_host (const void *); extern void GOMP_offload_register_target (const void *); __attribute__ ((constructor)) static void init (void) { GOMP_offload_register_host (__OPENMP_TARGET_HOST__); GOMP_offload_register_target (__OPENMP_TARGET_MIC__); GOMP_offload_register_target (__OPENMP_TARGET_PTX__); } Where __OPENMP_TARGET_MIC__ and __OPENMP_TARGET_PTX__ descriptors should be generated in the corresponding mkoffload tools. -- Ilya