gomp-constants.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* Communication between GCC and libgomp.
  2. Copyright (C) 2014-2015 Free Software Foundation, Inc.
  3. Contributed by Mentor Embedded.
  4. This file is part of the GNU Offloading and Multi Processing Library
  5. (libgomp).
  6. Libgomp is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 3, or (at your option)
  9. any later version.
  10. Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. more details.
  14. Under Section 7 of GPL version 3, you are granted additional
  15. permissions described in the GCC Runtime Library Exception, version
  16. 3.1, as published by the Free Software Foundation.
  17. You should have received a copy of the GNU General Public License and
  18. a copy of the GCC Runtime Library Exception along with this program;
  19. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  20. <http://www.gnu.org/licenses/>. */
  21. #ifndef GOMP_CONSTANTS_H
  22. #define GOMP_CONSTANTS_H 1
  23. /* Memory mapping types. */
  24. /* One byte. */
  25. #define GOMP_MAP_LAST (1 << 8)
  26. #define GOMP_MAP_FLAG_TO (1 << 0)
  27. #define GOMP_MAP_FLAG_FROM (1 << 1)
  28. /* Special map kinds, enumerated starting here. */
  29. #define GOMP_MAP_FLAG_SPECIAL_0 (1 << 2)
  30. #define GOMP_MAP_FLAG_SPECIAL_1 (1 << 3)
  31. #define GOMP_MAP_FLAG_SPECIAL (GOMP_MAP_FLAG_SPECIAL_1 \
  32. | GOMP_MAP_FLAG_SPECIAL_0)
  33. /* Flag to force a specific behavior (or else, trigger a run-time error). */
  34. #define GOMP_MAP_FLAG_FORCE (1 << 7)
  35. enum gomp_map_kind
  36. {
  37. /* If not already present, allocate. */
  38. GOMP_MAP_ALLOC = 0,
  39. /* ..., and copy to device. */
  40. GOMP_MAP_TO = (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO),
  41. /* ..., and copy from device. */
  42. GOMP_MAP_FROM = (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM),
  43. /* ..., and copy to and from device. */
  44. GOMP_MAP_TOFROM = (GOMP_MAP_TO | GOMP_MAP_FROM),
  45. /* The following kind is an internal only map kind, used for pointer based
  46. array sections. OMP_CLAUSE_SIZE for these is not the pointer size,
  47. which is implicitly POINTER_SIZE_UNITS, but the bias. */
  48. GOMP_MAP_POINTER = (GOMP_MAP_FLAG_SPECIAL_0 | 0),
  49. /* Also internal, behaves like GOMP_MAP_TO, but additionally any
  50. GOMP_MAP_POINTER records consecutive after it which have addresses
  51. falling into that range will not be ignored if GOMP_MAP_TO_PSET wasn't
  52. mapped already. */
  53. GOMP_MAP_TO_PSET = (GOMP_MAP_FLAG_SPECIAL_0 | 1),
  54. /* Must already be present. */
  55. GOMP_MAP_FORCE_PRESENT = (GOMP_MAP_FLAG_SPECIAL_0 | 2),
  56. /* Deallocate a mapping, without copying from device. */
  57. GOMP_MAP_FORCE_DEALLOC = (GOMP_MAP_FLAG_SPECIAL_0 | 3),
  58. /* Is a device pointer. OMP_CLAUSE_SIZE for these is unused; is implicitly
  59. POINTER_SIZE_UNITS. */
  60. GOMP_MAP_FORCE_DEVICEPTR = (GOMP_MAP_FLAG_SPECIAL_1 | 0),
  61. /* Allocate. */
  62. GOMP_MAP_FORCE_ALLOC = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC),
  63. /* ..., and copy to device. */
  64. GOMP_MAP_FORCE_TO = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO),
  65. /* ..., and copy from device. */
  66. GOMP_MAP_FORCE_FROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM),
  67. /* ..., and copy to and from device. */
  68. GOMP_MAP_FORCE_TOFROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
  69. };
  70. #define GOMP_MAP_COPY_TO_P(X) \
  71. (!((X) & GOMP_MAP_FLAG_SPECIAL) \
  72. && ((X) & GOMP_MAP_FLAG_TO))
  73. #define GOMP_MAP_COPY_FROM_P(X) \
  74. (!((X) & GOMP_MAP_FLAG_SPECIAL) \
  75. && ((X) & GOMP_MAP_FLAG_FROM))
  76. #define GOMP_MAP_POINTER_P(X) \
  77. ((X) == GOMP_MAP_POINTER)
  78. /* Asynchronous behavior. Keep in sync with
  79. libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_async_t. */
  80. #define GOMP_ASYNC_NOVAL -1
  81. #define GOMP_ASYNC_SYNC -2
  82. /* Device codes. Keep in sync with
  83. libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_device_t as well as
  84. libgomp/libgomp_target.h. */
  85. #define GOMP_DEVICE_NONE 0
  86. #define GOMP_DEVICE_DEFAULT 1
  87. #define GOMP_DEVICE_HOST 2
  88. #define GOMP_DEVICE_HOST_NONSHM 3
  89. #define GOMP_DEVICE_NOT_HOST 4
  90. #define GOMP_DEVICE_NVIDIA_PTX 5
  91. #define GOMP_DEVICE_INTEL_MIC 6
  92. #define GOMP_DEVICE_ICV -1
  93. #define GOMP_DEVICE_HOST_FALLBACK -2
  94. #endif