libgomp-plugin.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* Copyright (C) 2014-2015 Free Software Foundation, Inc.
  2. Contributed by Mentor Embedded.
  3. This file is part of the GNU Offloading and Multi Processing Library
  4. (libgomp).
  5. Libgomp is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. more details.
  13. Under Section 7 of GPL version 3, you are granted additional
  14. permissions described in the GCC Runtime Library Exception, version
  15. 3.1, as published by the Free Software Foundation.
  16. You should have received a copy of the GNU General Public License and
  17. a copy of the GCC Runtime Library Exception along with this program;
  18. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. <http://www.gnu.org/licenses/>. */
  20. /* An interface to various libgomp-internal functions for use by plugins. */
  21. #ifndef LIBGOMP_PLUGIN_H
  22. #define LIBGOMP_PLUGIN_H 1
  23. #include <stddef.h>
  24. #include <stdint.h>
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /* Capabilities of offloading devices. */
  29. #define GOMP_OFFLOAD_CAP_SHARED_MEM (1 << 0)
  30. #define GOMP_OFFLOAD_CAP_NATIVE_EXEC (1 << 1)
  31. #define GOMP_OFFLOAD_CAP_OPENMP_400 (1 << 2)
  32. #define GOMP_OFFLOAD_CAP_OPENACC_200 (1 << 3)
  33. /* Type of offload target device. Keep in sync with include/gomp-constants.h. */
  34. enum offload_target_type
  35. {
  36. OFFLOAD_TARGET_TYPE_HOST = 2,
  37. OFFLOAD_TARGET_TYPE_HOST_NONSHM = 3,
  38. OFFLOAD_TARGET_TYPE_NVIDIA_PTX = 5,
  39. OFFLOAD_TARGET_TYPE_INTEL_MIC = 6
  40. };
  41. /* Auxiliary struct, used for transferring pairs of addresses from plugin
  42. to libgomp. */
  43. struct addr_pair
  44. {
  45. uintptr_t start;
  46. uintptr_t end;
  47. };
  48. /* Miscellaneous functions. */
  49. extern void *GOMP_PLUGIN_malloc (size_t) __attribute__ ((malloc));
  50. extern void *GOMP_PLUGIN_malloc_cleared (size_t) __attribute__ ((malloc));
  51. extern void *GOMP_PLUGIN_realloc (void *, size_t);
  52. extern void GOMP_PLUGIN_debug (int, const char *, ...)
  53. __attribute__ ((format (printf, 2, 3)));
  54. extern void GOMP_PLUGIN_error (const char *, ...)
  55. __attribute__ ((format (printf, 1, 2)));
  56. extern void GOMP_PLUGIN_fatal (const char *, ...)
  57. __attribute__ ((noreturn, format (printf, 1, 2)));
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif