annotate liboffloadmic/runtime/compiler_if_host.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /*
kono
parents:
diff changeset
2 Copyright (c) 2014-2016 Intel Corporation. All Rights Reserved.
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 Redistribution and use in source and binary forms, with or without
kono
parents:
diff changeset
5 modification, are permitted provided that the following conditions
kono
parents:
diff changeset
6 are met:
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 * Redistributions of source code must retain the above copyright
kono
parents:
diff changeset
9 notice, this list of conditions and the following disclaimer.
kono
parents:
diff changeset
10 * Redistributions in binary form must reproduce the above copyright
kono
parents:
diff changeset
11 notice, this list of conditions and the following disclaimer in the
kono
parents:
diff changeset
12 documentation and/or other materials provided with the distribution.
kono
parents:
diff changeset
13 * Neither the name of Intel Corporation nor the names of its
kono
parents:
diff changeset
14 contributors may be used to endorse or promote products derived
kono
parents:
diff changeset
15 from this software without specific prior written permission.
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
kono
parents:
diff changeset
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
kono
parents:
diff changeset
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
kono
parents:
diff changeset
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
kono
parents:
diff changeset
21 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
kono
parents:
diff changeset
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
kono
parents:
diff changeset
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
kono
parents:
diff changeset
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
kono
parents:
diff changeset
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
kono
parents:
diff changeset
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
kono
parents:
diff changeset
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
kono
parents:
diff changeset
28 */
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 /*! \file
kono
parents:
diff changeset
32 \brief The interface between compiler-generated host code and runtime library
kono
parents:
diff changeset
33 */
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 #ifndef COMPILER_IF_HOST_H_INCLUDED
kono
parents:
diff changeset
36 #define COMPILER_IF_HOST_H_INCLUDED
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 #include "offload_host.h"
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 #define OFFLOAD_TARGET_ACQUIRE OFFLOAD_PREFIX(target_acquire)
kono
parents:
diff changeset
41 #define OFFLOAD_TARGET_ACQUIRE1 OFFLOAD_PREFIX(target_acquire1)
kono
parents:
diff changeset
42 #define OFFLOAD_TARGET_ACQUIRE2 OFFLOAD_PREFIX(target_acquire2)
kono
parents:
diff changeset
43 #define OFFLOAD_OFFLOAD OFFLOAD_PREFIX(offload)
kono
parents:
diff changeset
44 #define OFFLOAD_OFFLOAD1 OFFLOAD_PREFIX(offload1)
kono
parents:
diff changeset
45 #define OFFLOAD_OFFLOAD2 OFFLOAD_PREFIX(offload2)
kono
parents:
diff changeset
46 #define OFFLOAD_OFFLOAD3 OFFLOAD_PREFIX(offload3)
kono
parents:
diff changeset
47 #define OFFLOAD_CALL_COUNT OFFLOAD_PREFIX(offload_call_count)
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 /*! \fn OFFLOAD_TARGET_ACQUIRE
kono
parents:
diff changeset
51 \brief Attempt to acquire the target.
kono
parents:
diff changeset
52 \param target_type The type of target.
kono
parents:
diff changeset
53 \param target_number The device number.
kono
parents:
diff changeset
54 \param is_optional Whether CPU fall-back is allowed.
kono
parents:
diff changeset
55 \param status Address of variable to hold offload status.
kono
parents:
diff changeset
56 \param file Filename in which this offload occurred.
kono
parents:
diff changeset
57 \param line Line number in the file where this offload occurred.
kono
parents:
diff changeset
58 */
kono
parents:
diff changeset
59 extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE(
kono
parents:
diff changeset
60 TARGET_TYPE target_type,
kono
parents:
diff changeset
61 int target_number,
kono
parents:
diff changeset
62 int is_optional,
kono
parents:
diff changeset
63 _Offload_status* status,
kono
parents:
diff changeset
64 const char* file,
kono
parents:
diff changeset
65 uint64_t line
kono
parents:
diff changeset
66 );
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 /*! \fn OFFLOAD_TARGET_ACQUIRE1
kono
parents:
diff changeset
69 \brief Acquire the target for offload (OpenMP).
kono
parents:
diff changeset
70 \param device_number Device number or null if not specified.
kono
parents:
diff changeset
71 \param file Filename in which this offload occurred
kono
parents:
diff changeset
72 \param line Line number in the file where this offload occurred.
kono
parents:
diff changeset
73 */
kono
parents:
diff changeset
74 extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE1(
kono
parents:
diff changeset
75 const int* device_number,
kono
parents:
diff changeset
76 const char* file,
kono
parents:
diff changeset
77 uint64_t line
kono
parents:
diff changeset
78 );
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 /*! \fn OFFLOAD_TARGET_ACQUIRE2
kono
parents:
diff changeset
81 \brief Attempt to acquire the target.
kono
parents:
diff changeset
82 \param target_type The type of target.
kono
parents:
diff changeset
83 \param target_number The device number.
kono
parents:
diff changeset
84 \param is_optional Whether CPU fall-back is allowed.
kono
parents:
diff changeset
85 \param status Address of variable to hold offload status.
kono
parents:
diff changeset
86 \param file Filename in which this offload occurred.
kono
parents:
diff changeset
87 \param line Line number in the file where this offload occurred.
kono
parents:
diff changeset
88 \param stream Pointer to stream value.
kono
parents:
diff changeset
89 */
kono
parents:
diff changeset
90 extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE2(
kono
parents:
diff changeset
91 TARGET_TYPE target_type,
kono
parents:
diff changeset
92 int target_number,
kono
parents:
diff changeset
93 int is_optional,
kono
parents:
diff changeset
94 _Offload_status* status,
kono
parents:
diff changeset
95 const char* file,
kono
parents:
diff changeset
96 uint64_t line,
kono
parents:
diff changeset
97 const void** stream
kono
parents:
diff changeset
98 );
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 /*! \fn OFFLOAD_OFFLOAD1
kono
parents:
diff changeset
101 \brief Run function on target using interface for old data persistence.
kono
parents:
diff changeset
102 \param o Offload descriptor created by OFFLOAD_TARGET_ACQUIRE.
kono
parents:
diff changeset
103 \param name Name of offload entry point.
kono
parents:
diff changeset
104 \param is_empty If no code to execute (e.g. offload_transfer)
kono
parents:
diff changeset
105 \param num_vars Number of variable descriptors.
kono
parents:
diff changeset
106 \param vars Pointer to VarDesc array.
kono
parents:
diff changeset
107 \param vars2 Pointer to VarDesc2 array.
kono
parents:
diff changeset
108 \param num_waits Number of "wait" values.
kono
parents:
diff changeset
109 \param waits Pointer to array of wait values.
kono
parents:
diff changeset
110 \param signal Pointer to signal value or NULL.
kono
parents:
diff changeset
111 */
kono
parents:
diff changeset
112 extern "C" int OFFLOAD_OFFLOAD1(
kono
parents:
diff changeset
113 OFFLOAD o,
kono
parents:
diff changeset
114 const char *name,
kono
parents:
diff changeset
115 int is_empty,
kono
parents:
diff changeset
116 int num_vars,
kono
parents:
diff changeset
117 VarDesc *vars,
kono
parents:
diff changeset
118 VarDesc2 *vars2,
kono
parents:
diff changeset
119 int num_waits,
kono
parents:
diff changeset
120 const void** waits,
kono
parents:
diff changeset
121 const void** signal
kono
parents:
diff changeset
122 );
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 /*! \fn OFFLOAD_OFFLOAD2
kono
parents:
diff changeset
125 \brief Run function on target using interface for new data persistence.
kono
parents:
diff changeset
126 \param o Offload descriptor created by OFFLOAD_TARGET_ACQUIRE.
kono
parents:
diff changeset
127 \param name Name of offload entry point.
kono
parents:
diff changeset
128 \param is_empty If no code to execute (e.g. offload_transfer)
kono
parents:
diff changeset
129 \param num_vars Number of variable descriptors.
kono
parents:
diff changeset
130 \param vars Pointer to VarDesc array.
kono
parents:
diff changeset
131 \param vars2 Pointer to VarDesc2 array.
kono
parents:
diff changeset
132 \param num_waits Number of "wait" values.
kono
parents:
diff changeset
133 \param waits Pointer to array of wait values.
kono
parents:
diff changeset
134 \param signal Pointer to signal value or NULL.
kono
parents:
diff changeset
135 \param entry_id A signature for the function doing the offload.
kono
parents:
diff changeset
136 \param stack_addr The stack frame address of the function doing offload.
kono
parents:
diff changeset
137 */
kono
parents:
diff changeset
138 extern "C" int OFFLOAD_OFFLOAD2(
kono
parents:
diff changeset
139 OFFLOAD o,
kono
parents:
diff changeset
140 const char *name,
kono
parents:
diff changeset
141 int is_empty,
kono
parents:
diff changeset
142 int num_vars,
kono
parents:
diff changeset
143 VarDesc *vars,
kono
parents:
diff changeset
144 VarDesc2 *vars2,
kono
parents:
diff changeset
145 int num_waits,
kono
parents:
diff changeset
146 const void** waits,
kono
parents:
diff changeset
147 const void** signal,
kono
parents:
diff changeset
148 int entry_id,
kono
parents:
diff changeset
149 const void *stack_addr
kono
parents:
diff changeset
150 );
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152
kono
parents:
diff changeset
153 /*! \fn OFFLOAD_OFFLOAD3
kono
parents:
diff changeset
154 \brief Run function on target, API introduced in 15.0 Update 1
kono
parents:
diff changeset
155 \brief when targetptr, preallocated feature was introduced.
kono
parents:
diff changeset
156 \param o Offload descriptor created by OFFLOAD_TARGET_ACQUIRE.
kono
parents:
diff changeset
157 \param name Name of offload entry point.
kono
parents:
diff changeset
158 \param is_empty If no code to execute (e.g. offload_transfer)
kono
parents:
diff changeset
159 \param num_vars Number of variable descriptors.
kono
parents:
diff changeset
160 \param vars Pointer to VarDesc array.
kono
parents:
diff changeset
161 \param vars2 Pointer to VarDesc2 array.
kono
parents:
diff changeset
162 \param num_waits Number of "wait" values.
kono
parents:
diff changeset
163 \param waits Pointer to array of wait values.
kono
parents:
diff changeset
164 \param signal Pointer to signal value or NULL.
kono
parents:
diff changeset
165 \param entry_id A signature for the function doing the offload.
kono
parents:
diff changeset
166 \param stack_addr The stack frame address of the function doing offload.
kono
parents:
diff changeset
167 \param offload_flags Flags to indicate Fortran traceback, OpenMP async.
kono
parents:
diff changeset
168 \param stream Pointer to stream value or NULL.
kono
parents:
diff changeset
169 */
kono
parents:
diff changeset
170 extern "C" int OFFLOAD_OFFLOAD3(
kono
parents:
diff changeset
171 OFFLOAD ofld,
kono
parents:
diff changeset
172 const char *name,
kono
parents:
diff changeset
173 int is_empty,
kono
parents:
diff changeset
174 int num_vars,
kono
parents:
diff changeset
175 VarDesc *vars,
kono
parents:
diff changeset
176 VarDesc2 *vars2,
kono
parents:
diff changeset
177 int num_waits,
kono
parents:
diff changeset
178 const void** waits,
kono
parents:
diff changeset
179 const void** signal,
kono
parents:
diff changeset
180 int entry_id,
kono
parents:
diff changeset
181 const void *stack_addr,
kono
parents:
diff changeset
182 OffloadFlags offload_flags,
kono
parents:
diff changeset
183 const void** stream
kono
parents:
diff changeset
184 );
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 // Run function on target (obsolete).
kono
parents:
diff changeset
187 // @param o OFFLOAD object
kono
parents:
diff changeset
188 // @param name function name
kono
parents:
diff changeset
189 extern "C" int OFFLOAD_OFFLOAD(
kono
parents:
diff changeset
190 OFFLOAD o,
kono
parents:
diff changeset
191 const char *name,
kono
parents:
diff changeset
192 int is_empty,
kono
parents:
diff changeset
193 int num_vars,
kono
parents:
diff changeset
194 VarDesc *vars,
kono
parents:
diff changeset
195 VarDesc2 *vars2,
kono
parents:
diff changeset
196 int num_waits,
kono
parents:
diff changeset
197 const void** waits,
kono
parents:
diff changeset
198 const void* signal,
kono
parents:
diff changeset
199 int entry_id = 0,
kono
parents:
diff changeset
200 const void *stack_addr = NULL
kono
parents:
diff changeset
201 );
kono
parents:
diff changeset
202
kono
parents:
diff changeset
203 // Global counter on host.
kono
parents:
diff changeset
204 // This variable is used if P2OPT_offload_do_data_persistence == 2.
kono
parents:
diff changeset
205 // The variable used to identify offload constructs contained in one procedure.
kono
parents:
diff changeset
206 // Call to OFFLOAD_CALL_COUNT() is inserted at HOST on entry of the routine.
kono
parents:
diff changeset
207 extern "C" int OFFLOAD_CALL_COUNT();
kono
parents:
diff changeset
208
kono
parents:
diff changeset
209 #endif // COMPILER_IF_HOST_H_INCLUDED