2015-01-05 13:33:28 +01:00
|
|
|
/* Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
[PATCH 5/7] OpenMP 4.0 offloading infrastructure: libgomp.
libgomp/
* libgomp.map (GOMP_4.0.1): New symbol version.
Add GOMP_offload_register.
* libgomp_target.h: New file.
* splay-tree.h: New file.
* target.c: Include config.h, libgomp_target.h, dlfcn.h, splay-tree.h.
(gomp_target_init): New forward declaration.
(gomp_is_initialized): New static variable.
(splay_tree_node, splay_tree, splay_tree_key): New typedefs.
(struct target_mem_desc, struct splay_tree_key_s, offload_image_descr):
New structures.
(offload_images, num_offload_images, devices, num_devices): New static
variables.
(splay_compare): New static function.
(struct gomp_device_descr): New structure.
(gomp_get_num_devices): Call gomp_target_init.
(resolve_device, gomp_map_vars_existing, gomp_map_vars, gomp_unmap_tgt)
(gomp_unmap_vars, gomp_update, gomp_init_device): New static functions.
(GOMP_offload_register): New function.
(GOMP_target): Arrange for host callback to be performed in a separate
initial thread and contention group, inheriting ICVs from
gomp_global_icv etc. Call gomp_map_vars and gomp_unmap_vars.
Add device initialization and lookup for target function in splay tree.
(GOMP_target_data): Add device initialization and call gomp_map_vars.
(GOMP_target_end_data): Call gomp_unmap_vars.
(GOMP_target_update): Add device initialization and call gomp_update.
(gomp_load_plugin_for_device, gomp_register_images_for_device)
(gomp_target_init): New static functions.
Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com>
Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
From-SVN: r217492
2014-11-13 14:49:47 +01:00
|
|
|
|
|
|
|
This file is part of the GNU OpenMP Library (libgomp).
|
|
|
|
|
|
|
|
Libgomp is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
more details.
|
|
|
|
|
|
|
|
Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
permissions described in the GCC Runtime Library Exception, version
|
|
|
|
3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License and
|
|
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#ifndef LIBGOMP_TARGET_H
|
|
|
|
#define LIBGOMP_TARGET_H 1
|
|
|
|
|
|
|
|
/* Type of offload target device. */
|
|
|
|
enum offload_target_type
|
|
|
|
{
|
|
|
|
OFFLOAD_TARGET_TYPE_HOST,
|
|
|
|
OFFLOAD_TARGET_TYPE_INTEL_MIC
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Auxiliary struct, used for transferring a host-target address range mapping
|
|
|
|
from plugin to libgomp. */
|
|
|
|
struct mapping_table
|
|
|
|
{
|
|
|
|
uintptr_t host_start;
|
|
|
|
uintptr_t host_end;
|
|
|
|
uintptr_t tgt_start;
|
|
|
|
uintptr_t tgt_end;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* LIBGOMP_TARGET_H */
|