annotate libcilkrts/runtime/scheduler.h @ 143:76e1cf5455ef

add cbc_gc test
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 19:24:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* scheduler.h -*-C++-*-
kono
parents:
diff changeset
2 *
kono
parents:
diff changeset
3 *************************************************************************
kono
parents:
diff changeset
4 *
kono
parents:
diff changeset
5 * Copyright (C) 2009-2016, Intel Corporation
kono
parents:
diff changeset
6 * All rights reserved.
kono
parents:
diff changeset
7 *
kono
parents:
diff changeset
8 * Redistribution and use in source and binary forms, with or without
kono
parents:
diff changeset
9 * modification, are permitted provided that the following conditions
kono
parents:
diff changeset
10 * are met:
kono
parents:
diff changeset
11 *
kono
parents:
diff changeset
12 * * Redistributions of source code must retain the above copyright
kono
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer.
kono
parents:
diff changeset
14 * * Redistributions in binary form must reproduce the above copyright
kono
parents:
diff changeset
15 * notice, this list of conditions and the following disclaimer in
kono
parents:
diff changeset
16 * the documentation and/or other materials provided with the
kono
parents:
diff changeset
17 * distribution.
kono
parents:
diff changeset
18 * * Neither the name of Intel Corporation nor the names of its
kono
parents:
diff changeset
19 * contributors may be used to endorse or promote products derived
kono
parents:
diff changeset
20 * from this software without specific prior written permission.
kono
parents:
diff changeset
21 *
kono
parents:
diff changeset
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
kono
parents:
diff changeset
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
kono
parents:
diff changeset
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
kono
parents:
diff changeset
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
kono
parents:
diff changeset
26 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
kono
parents:
diff changeset
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
kono
parents:
diff changeset
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
kono
parents:
diff changeset
29 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
kono
parents:
diff changeset
30 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
kono
parents:
diff changeset
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
kono
parents:
diff changeset
32 * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
kono
parents:
diff changeset
33 * POSSIBILITY OF SUCH DAMAGE.
kono
parents:
diff changeset
34 *
kono
parents:
diff changeset
35 * *********************************************************************
kono
parents:
diff changeset
36 *
kono
parents:
diff changeset
37 * PLEASE NOTE: This file is a downstream copy of a file mainitained in
kono
parents:
diff changeset
38 * a repository at cilkplus.org. Changes made to this file that are not
kono
parents:
diff changeset
39 * submitted through the contribution process detailed at
kono
parents:
diff changeset
40 * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
kono
parents:
diff changeset
41 * time that a new version is released. Changes only submitted to the
kono
parents:
diff changeset
42 * GNU compiler collection or posted to the git repository at
kono
parents:
diff changeset
43 * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
kono
parents:
diff changeset
44 * not tracked.
kono
parents:
diff changeset
45 *
kono
parents:
diff changeset
46 * We welcome your contributions to this open source project. Thank you
kono
parents:
diff changeset
47 * for your assistance in helping us improve Cilk Plus.
kono
parents:
diff changeset
48 **************************************************************************/
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 /**
kono
parents:
diff changeset
51 * @file scheduler.h
kono
parents:
diff changeset
52 *
kono
parents:
diff changeset
53 * @brief scheduler.h declares routines for the Intel Cilk Plus scheduler,
kono
parents:
diff changeset
54 * making it the heart of the Intel Cilk Plus implementation.
kono
parents:
diff changeset
55 */
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 #ifndef INCLUDED_SCHEDULER_DOT_H
kono
parents:
diff changeset
58 #define INCLUDED_SCHEDULER_DOT_H
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 #include <cilk/common.h>
kono
parents:
diff changeset
61 #include <internal/abi.h>
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 #include "rts-common.h"
kono
parents:
diff changeset
64 #include "full_frame.h"
kono
parents:
diff changeset
65 #include "reducer_impl.h"
kono
parents:
diff changeset
66 #include "global_state.h"
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 #ifdef CILK_RECORD_REPLAY
kono
parents:
diff changeset
69 #include "record-replay.h"
kono
parents:
diff changeset
70 #endif
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 __CILKRTS_BEGIN_EXTERN_C
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 /**
kono
parents:
diff changeset
76 * @brief Flag to disable parallel reductions.
kono
parents:
diff changeset
77 *
kono
parents:
diff changeset
78 * Set to 0 to allow parallel reductions.
kono
parents:
diff changeset
79 */
kono
parents:
diff changeset
80 #define DISABLE_PARALLEL_REDUCERS 0
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 /**
kono
parents:
diff changeset
83 * @brief Debugging level for parallel reductions.
kono
parents:
diff changeset
84 *
kono
parents:
diff changeset
85 * Print debugging messages and assertions for parallel reducers. 0 is
kono
parents:
diff changeset
86 * no debugging. A higher value generates more output.
kono
parents:
diff changeset
87 */
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 #ifndef REDPAR_DEBUG
kono
parents:
diff changeset
90 #define REDPAR_DEBUG 0
kono
parents:
diff changeset
91 #endif
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 /**
kono
parents:
diff changeset
94 * @brief Lock the worker mutex to allow exclusive access to the
kono
parents:
diff changeset
95 * values in the @c __cilkrts_worker and local_state structures.
kono
parents:
diff changeset
96 *
kono
parents:
diff changeset
97 * @pre @c w->l->do_not_steal must not be set. Essentially this
kono
parents:
diff changeset
98 * condition asserts that the worker is not locked recursively.
kono
parents:
diff changeset
99 *
kono
parents:
diff changeset
100 * @param w The worker to lock.
kono
parents:
diff changeset
101 */
kono
parents:
diff changeset
102 COMMON_PORTABLE
kono
parents:
diff changeset
103 void __cilkrts_worker_lock(__cilkrts_worker *w);
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 /**
kono
parents:
diff changeset
106 * @brief Unlock the worker mutex.
kono
parents:
diff changeset
107 *
kono
parents:
diff changeset
108 * @pre @c w->l->do_not_steal must be set. Essentially this condition
kono
parents:
diff changeset
109 * asserts that the worker has been previously locked.
kono
parents:
diff changeset
110 *
kono
parents:
diff changeset
111 * @param w The worker to unlock.
kono
parents:
diff changeset
112 */
kono
parents:
diff changeset
113 COMMON_PORTABLE
kono
parents:
diff changeset
114 void __cilkrts_worker_unlock(__cilkrts_worker *w);
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 /**
kono
parents:
diff changeset
117 * @brief Push the next full frame to be made active in this worker
kono
parents:
diff changeset
118 * and increment its join counter.
kono
parents:
diff changeset
119 *
kono
parents:
diff changeset
120 * __cilkrts_push_next_frame and pop_next_frame work on a one-element queue.
kono
parents:
diff changeset
121 * This queue is used to communicate across the runtime from the code that
kono
parents:
diff changeset
122 * wants to activate a frame to the code that can actually begin execution
kono
parents:
diff changeset
123 * on that frame. They are asymetrical in that push increments the join
kono
parents:
diff changeset
124 * counter but pop does not decrement it. Rather, a single push/pop
kono
parents:
diff changeset
125 * combination makes a frame active and increments its join counter once.
kono
parents:
diff changeset
126 *
kono
parents:
diff changeset
127 * @note A system worker may chose to push work onto a user worker if
kono
parents:
diff changeset
128 * the work is the continuation from a sync which only the user worker
kono
parents:
diff changeset
129 * may complete.
kono
parents:
diff changeset
130 *
kono
parents:
diff changeset
131 * @param w The worker which the frame is to be pushed onto.
kono
parents:
diff changeset
132 * @param ff The full_frame which is to be continued by the worker.
kono
parents:
diff changeset
133 */
kono
parents:
diff changeset
134 COMMON_PORTABLE
kono
parents:
diff changeset
135 void __cilkrts_push_next_frame(__cilkrts_worker *w,
kono
parents:
diff changeset
136 full_frame *ff);
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 /**
kono
parents:
diff changeset
139 * @brief Sync on this worker.
kono
parents:
diff changeset
140 *
kono
parents:
diff changeset
141 * If this worker is the last to reach the sync, execution may resume
kono
parents:
diff changeset
142 * on this worker after the sync.
kono
parents:
diff changeset
143 *
kono
parents:
diff changeset
144 * If this worker is not the last spawned child to reach the sync,
kono
parents:
diff changeset
145 * then execution is suspended and the worker will re-enter the
kono
parents:
diff changeset
146 * scheduling loop, looking for work it can steal.
kono
parents:
diff changeset
147 *
kono
parents:
diff changeset
148 * This function will jump into the runtime to switch to the scheduling
kono
parents:
diff changeset
149 * stack to implement most of its logic.
kono
parents:
diff changeset
150 *
kono
parents:
diff changeset
151 * @param w The worker which is executing the sync.
kono
parents:
diff changeset
152 * @param sf The __cilkrts_stack_frame containing the sync.
kono
parents:
diff changeset
153 */
kono
parents:
diff changeset
154 COMMON_PORTABLE
kono
parents:
diff changeset
155 NORETURN __cilkrts_c_sync(__cilkrts_worker *w,
kono
parents:
diff changeset
156 __cilkrts_stack_frame *sf);
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 /**
kono
parents:
diff changeset
159 * @brief Worker @c w completely promotes its own deque, simulating the case
kono
parents:
diff changeset
160 * where the whole deque is stolen.
kono
parents:
diff changeset
161 *
kono
parents:
diff changeset
162 * We use this mechanism to force the allocation of new storage for
kono
parents:
diff changeset
163 * reducers for race-detection purposes.
kono
parents:
diff changeset
164 *
kono
parents:
diff changeset
165 * This method is called from the reducer lookup logic when
kono
parents:
diff changeset
166 * @c g->force_reduce is set.
kono
parents:
diff changeset
167 *
kono
parents:
diff changeset
168 * @warning Use of "force_reduce" is known to have bugs when run with
kono
parents:
diff changeset
169 * more than 1 worker.
kono
parents:
diff changeset
170 *
kono
parents:
diff changeset
171 * @param w The worker which is to have all entries in its deque
kono
parents:
diff changeset
172 * promoted to full frames.
kono
parents:
diff changeset
173 */
kono
parents:
diff changeset
174 COMMON_PORTABLE
kono
parents:
diff changeset
175 void __cilkrts_promote_own_deque(__cilkrts_worker *w);
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 /**
kono
parents:
diff changeset
178 * Called when a spawned function attempts to return and
kono
parents:
diff changeset
179 * __cilkrts_undo_detach() fails. This can happen for two reasons:
kono
parents:
diff changeset
180 *
kono
parents:
diff changeset
181 * @li If another worker is considering stealing our parent, it bumps the
kono
parents:
diff changeset
182 * exception pointer while it did so, which will cause __cilkrts_undo_detach()
kono
parents:
diff changeset
183 * to fail. If the other worker didn't complete the steal of our parent, we
kono
parents:
diff changeset
184 * still may be able to return to it, either because the steal attempt failed,
kono
parents:
diff changeset
185 * or we won the race for the tail pointer.
kono
parents:
diff changeset
186 *
kono
parents:
diff changeset
187 * @li If the function's parent has been stolen then we cannot return. Instead
kono
parents:
diff changeset
188 * we'll longjmp into the runtime to switch onto the scheduling stack to
kono
parents:
diff changeset
189 * execute do_return_from_spawn() and determine what to do. Either this
kono
parents:
diff changeset
190 * worker is the last one to the sync, in which case we need to jump to the
kono
parents:
diff changeset
191 * sync, or this worker is not the last one to the sync, in which case we'll
kono
parents:
diff changeset
192 * abandon this work and jump to the scheduling loop to search for more work
kono
parents:
diff changeset
193 * we can steal.
kono
parents:
diff changeset
194 *
kono
parents:
diff changeset
195 * @param w The worker which attempting to return from a spawn to
kono
parents:
diff changeset
196 * a stolen parent.
kono
parents:
diff changeset
197 * @param returning_sf The stack frame which is returning.
kono
parents:
diff changeset
198 */
kono
parents:
diff changeset
199 COMMON_PORTABLE
kono
parents:
diff changeset
200 void __cilkrts_c_THE_exception_check(__cilkrts_worker *w,
kono
parents:
diff changeset
201 __cilkrts_stack_frame *returning_sf);
kono
parents:
diff changeset
202
kono
parents:
diff changeset
203 /**
kono
parents:
diff changeset
204 * @brief Return an exception to an stolen parent.
kono
parents:
diff changeset
205 *
kono
parents:
diff changeset
206 * Used by the gcc implementation of exceptions to return an exception
kono
parents:
diff changeset
207 * to a stolen parent
kono
parents:
diff changeset
208 *
kono
parents:
diff changeset
209 * @param w The worker which attempting to return from a spawn with an
kono
parents:
diff changeset
210 * exception to a stolen parent.
kono
parents:
diff changeset
211 * @param returning_sf The stack frame which is returning.
kono
parents:
diff changeset
212 */
kono
parents:
diff changeset
213 COMMON_PORTABLE
kono
parents:
diff changeset
214 NORETURN __cilkrts_exception_from_spawn(__cilkrts_worker *w,
kono
parents:
diff changeset
215 __cilkrts_stack_frame *returning_sf);
kono
parents:
diff changeset
216
kono
parents:
diff changeset
217 /**
kono
parents:
diff changeset
218 * @brief Used by the Windows implementations of exceptions to migrate an exception
kono
parents:
diff changeset
219 * across fibers.
kono
parents:
diff changeset
220 *
kono
parents:
diff changeset
221 * Call this function when an exception has been thrown and has to
kono
parents:
diff changeset
222 * traverse across a steal. The exception has already been wrapped
kono
parents:
diff changeset
223 * up, so all that remains is to longjmp() into the continuation,
kono
parents:
diff changeset
224 * sync, and re-raise it.
kono
parents:
diff changeset
225 *
kono
parents:
diff changeset
226 * @param sf The __cilkrts_stack_frame for the frame that is attempting to
kono
parents:
diff changeset
227 * return an exception to a stolen parent.
kono
parents:
diff changeset
228 */
kono
parents:
diff changeset
229 void __cilkrts_migrate_exception (__cilkrts_stack_frame *sf);
kono
parents:
diff changeset
230
kono
parents:
diff changeset
231 /**
kono
parents:
diff changeset
232 * @brief Return from a call, not a spawn, where this frame has ever
kono
parents:
diff changeset
233 * been stolen.
kono
parents:
diff changeset
234 *
kono
parents:
diff changeset
235 * @param w The worker that is returning from a frame which was ever stolen.
kono
parents:
diff changeset
236 */
kono
parents:
diff changeset
237 COMMON_PORTABLE
kono
parents:
diff changeset
238 void __cilkrts_return(__cilkrts_worker *w);
kono
parents:
diff changeset
239
kono
parents:
diff changeset
240 /**
kono
parents:
diff changeset
241 * @brief Special return from the initial frame.
kono
parents:
diff changeset
242 *
kono
parents:
diff changeset
243 * This method will be called from @c __cilkrts_leave_frame if
kono
parents:
diff changeset
244 * @c CILK_FRAME_LAST is set.
kono
parents:
diff changeset
245 *
kono
parents:
diff changeset
246 * This function will do the things necessary to cleanup, and unbind the
kono
parents:
diff changeset
247 * thread from the Intel Cilk Plus runtime. If this is the last user
kono
parents:
diff changeset
248 * worker unbinding from the runtime, all system worker threads will be
kono
parents:
diff changeset
249 * suspended.
kono
parents:
diff changeset
250 *
kono
parents:
diff changeset
251 * @pre @c w must be the currently executing worker, and must be a user
kono
parents:
diff changeset
252 * worker.
kono
parents:
diff changeset
253 *
kono
parents:
diff changeset
254 * @param w The worker that's returning from the initial frame.
kono
parents:
diff changeset
255 */
kono
parents:
diff changeset
256 COMMON_PORTABLE
kono
parents:
diff changeset
257 void __cilkrts_c_return_from_initial(__cilkrts_worker *w);
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 /**
kono
parents:
diff changeset
260 * @brief Used by exception handling code to pop an entry from the
kono
parents:
diff changeset
261 * worker's deque.
kono
parents:
diff changeset
262 *
kono
parents:
diff changeset
263 * @param w Worker to pop the entry from
kono
parents:
diff changeset
264 *
kono
parents:
diff changeset
265 * @return __cilkrts_stack_frame of parent call
kono
parents:
diff changeset
266 * @return NULL if the deque is empty
kono
parents:
diff changeset
267 */
kono
parents:
diff changeset
268 COMMON_PORTABLE
kono
parents:
diff changeset
269 __cilkrts_stack_frame *__cilkrts_pop_tail(__cilkrts_worker *w);
kono
parents:
diff changeset
270
kono
parents:
diff changeset
271 /**
kono
parents:
diff changeset
272 * @brief Modifies the worker's protected_tail to prevent frames from
kono
parents:
diff changeset
273 * being stolen.
kono
parents:
diff changeset
274 *
kono
parents:
diff changeset
275 * The Dekker protocol has been extended to only steal if head+1 is also
kono
parents:
diff changeset
276 * less than protected_tail.
kono
parents:
diff changeset
277 *
kono
parents:
diff changeset
278 * @param w The worker to be modified.
kono
parents:
diff changeset
279 * @param new_protected_tail The new setting for protected_tail, or NULL if the
kono
parents:
diff changeset
280 * entire deque is to be protected
kono
parents:
diff changeset
281 *
kono
parents:
diff changeset
282 * @return Previous value of protected tail.
kono
parents:
diff changeset
283 */
kono
parents:
diff changeset
284 COMMON_PORTABLE
kono
parents:
diff changeset
285 __cilkrts_stack_frame *volatile *__cilkrts_disallow_stealing(
kono
parents:
diff changeset
286 __cilkrts_worker *w,
kono
parents:
diff changeset
287 __cilkrts_stack_frame *volatile *new_protected_tail);
kono
parents:
diff changeset
288
kono
parents:
diff changeset
289 /**
kono
parents:
diff changeset
290 * @brief Restores the protected tail to a previous state, possibly
kono
parents:
diff changeset
291 * allowing frames to be stolen.
kono
parents:
diff changeset
292 *
kono
parents:
diff changeset
293 * @param w The worker to be modified.
kono
parents:
diff changeset
294 * @param saved_protected_tail A previous setting for protected_tail that is
kono
parents:
diff changeset
295 * to be restored
kono
parents:
diff changeset
296 */
kono
parents:
diff changeset
297 COMMON_PORTABLE
kono
parents:
diff changeset
298 void __cilkrts_restore_stealing(
kono
parents:
diff changeset
299 __cilkrts_worker *w,
kono
parents:
diff changeset
300 __cilkrts_stack_frame *volatile *saved_protected_tail);
kono
parents:
diff changeset
301
kono
parents:
diff changeset
302 /**
kono
parents:
diff changeset
303 * @brief Initialize a @c __cilkrts_worker.
kono
parents:
diff changeset
304 *
kono
parents:
diff changeset
305 * @note The memory for the worker must have been allocated outside
kono
parents:
diff changeset
306 * this call.
kono
parents:
diff changeset
307 *
kono
parents:
diff changeset
308 * @param g The global_state_t.
kono
parents:
diff changeset
309 * @param self The index into the global_state's array of workers for this
kono
parents:
diff changeset
310 * worker, or -1 if this worker was allocated from the heap and cannot be
kono
parents:
diff changeset
311 * stolen from.
kono
parents:
diff changeset
312 * @param w The worker to be initialized.
kono
parents:
diff changeset
313 *
kono
parents:
diff changeset
314 * @return The initialized __cilkrts_worker.
kono
parents:
diff changeset
315 */
kono
parents:
diff changeset
316 COMMON_PORTABLE
kono
parents:
diff changeset
317 __cilkrts_worker *make_worker(global_state_t *g,
kono
parents:
diff changeset
318 int self,
kono
parents:
diff changeset
319 __cilkrts_worker *w);
kono
parents:
diff changeset
320
kono
parents:
diff changeset
321 /**
kono
parents:
diff changeset
322 * @brief Free up any resources allocated for a worker.
kono
parents:
diff changeset
323 *
kono
parents:
diff changeset
324 * @note The memory for the @c __cilkrts_worker itself must be
kono
parents:
diff changeset
325 * deallocated outside this call.
kono
parents:
diff changeset
326 *
kono
parents:
diff changeset
327 * @param w The worker to be destroyed.
kono
parents:
diff changeset
328 */
kono
parents:
diff changeset
329 COMMON_PORTABLE
kono
parents:
diff changeset
330 void destroy_worker (__cilkrts_worker *w);
kono
parents:
diff changeset
331
kono
parents:
diff changeset
332 /**
kono
parents:
diff changeset
333 * @brief Initialize the runtime.
kono
parents:
diff changeset
334 *
kono
parents:
diff changeset
335 * If necessary, allocates and initializes the global state. If
kono
parents:
diff changeset
336 * necessary, unsuspends the system workers.
kono
parents:
diff changeset
337 *
kono
parents:
diff changeset
338 * @param start Specifies whether the workers are to be unsuspended if
kono
parents:
diff changeset
339 * they are suspended. Allows __cilkrts_init() to start up the runtime without
kono
parents:
diff changeset
340 * releasing the system threads.
kono
parents:
diff changeset
341 */
kono
parents:
diff changeset
342 COMMON_PORTABLE
kono
parents:
diff changeset
343 void __cilkrts_init_internal(int start);
kono
parents:
diff changeset
344
kono
parents:
diff changeset
345 /**
kono
parents:
diff changeset
346 * @brief Part of the sequence to shutdown the runtime.
kono
parents:
diff changeset
347 *
kono
parents:
diff changeset
348 * Specifically, this call frees the @c global_state_t for the runtime.
kono
parents:
diff changeset
349 *
kono
parents:
diff changeset
350 * @param g The global_state_t.
kono
parents:
diff changeset
351 */
kono
parents:
diff changeset
352 COMMON_PORTABLE
kono
parents:
diff changeset
353 void __cilkrts_deinit_internal(global_state_t *g);
kono
parents:
diff changeset
354
kono
parents:
diff changeset
355 /**
kono
parents:
diff changeset
356 * Obsolete. We no longer need to import or export reducer maps.
kono
parents:
diff changeset
357 */
kono
parents:
diff changeset
358 COMMON_PORTABLE
kono
parents:
diff changeset
359 cilkred_map *__cilkrts_xchg_reducer(
kono
parents:
diff changeset
360 __cilkrts_worker *w, cilkred_map *newmap) cilk_nothrow;
kono
parents:
diff changeset
361
kono
parents:
diff changeset
362 /**
kono
parents:
diff changeset
363 * @brief Called when a user thread is bound to the runtime.
kono
parents:
diff changeset
364 *
kono
parents:
diff changeset
365 * If this action increments the count of bound user threads from 0 to
kono
parents:
diff changeset
366 * 1, the system worker threads are unsuspended.
kono
parents:
diff changeset
367 *
kono
parents:
diff changeset
368 * If this action increments the count of bound user threads from 0 to
kono
parents:
diff changeset
369 * 1, the system worker threads are unsuspended.
kono
parents:
diff changeset
370 *
kono
parents:
diff changeset
371 * @pre Global lock must be held.
kono
parents:
diff changeset
372 * @param g The runtime global state.
kono
parents:
diff changeset
373 */
kono
parents:
diff changeset
374 COMMON_PORTABLE
kono
parents:
diff changeset
375 void __cilkrts_enter_cilk(global_state_t *g);
kono
parents:
diff changeset
376
kono
parents:
diff changeset
377 /**
kono
parents:
diff changeset
378 * @brief Called when a user thread is unbound from the runtime.
kono
parents:
diff changeset
379 *
kono
parents:
diff changeset
380 * If this action decrements the count of bound user threads to 0, the
kono
parents:
diff changeset
381 * system worker threads are suspended.
kono
parents:
diff changeset
382 *
kono
parents:
diff changeset
383 *
kono
parents:
diff changeset
384 * @pre Global lock must be held.
kono
parents:
diff changeset
385 *
kono
parents:
diff changeset
386 * @param g The runtime global state.
kono
parents:
diff changeset
387 */
kono
parents:
diff changeset
388 COMMON_PORTABLE
kono
parents:
diff changeset
389 void __cilkrts_leave_cilk(global_state_t *g);
kono
parents:
diff changeset
390
kono
parents:
diff changeset
391
kono
parents:
diff changeset
392 /**
kono
parents:
diff changeset
393 * @brief cilk_fiber_proc that runs the main scheduler loop on a
kono
parents:
diff changeset
394 * user worker.
kono
parents:
diff changeset
395 *
kono
parents:
diff changeset
396 * @pre fiber's owner field should be set to the correct __cilkrts_worker
kono
parents:
diff changeset
397 * @pre fiber must be a user worker.
kono
parents:
diff changeset
398 *
kono
parents:
diff changeset
399 * @param fiber The scheduling fiber object.
kono
parents:
diff changeset
400 */
kono
parents:
diff changeset
401 void scheduler_fiber_proc_for_user_worker(cilk_fiber *fiber);
kono
parents:
diff changeset
402
kono
parents:
diff changeset
403
kono
parents:
diff changeset
404 /**
kono
parents:
diff changeset
405 * @brief Prints out Cilk runtime statistics.
kono
parents:
diff changeset
406 *
kono
parents:
diff changeset
407 * @param g The runtime global state.
kono
parents:
diff changeset
408 *
kono
parents:
diff changeset
409 * This method is useful only for debugging purposes. No guarantees
kono
parents:
diff changeset
410 * are made as to the validity of this data. :)
kono
parents:
diff changeset
411 */
kono
parents:
diff changeset
412 COMMON_PORTABLE
kono
parents:
diff changeset
413 void __cilkrts_dump_stats_to_stderr(global_state_t *g);
kono
parents:
diff changeset
414
kono
parents:
diff changeset
415 #ifdef CILK_RECORD_REPLAY
kono
parents:
diff changeset
416 COMMON_PORTABLE
kono
parents:
diff changeset
417 char * walk_pedigree_nodes(char *p, const __cilkrts_pedigree *pnode);
kono
parents:
diff changeset
418
kono
parents:
diff changeset
419 /**
kono
parents:
diff changeset
420 * @brief Used by exception handling code to simulate the popping of
kono
parents:
diff changeset
421 * an entry from the worker's deque.
kono
parents:
diff changeset
422 *
kono
parents:
diff changeset
423 * @param w Worker whose deque we want to check
kono
parents:
diff changeset
424 *
kono
parents:
diff changeset
425 * @return @c __cilkrts_stack_frame of parent call
kono
parents:
diff changeset
426 * @return NULL if the deque is empty
kono
parents:
diff changeset
427 */
kono
parents:
diff changeset
428 COMMON_PORTABLE
kono
parents:
diff changeset
429 __cilkrts_stack_frame *simulate_pop_tail(__cilkrts_worker *w);
kono
parents:
diff changeset
430
kono
parents:
diff changeset
431 #endif
kono
parents:
diff changeset
432
kono
parents:
diff changeset
433 __CILKRTS_END_EXTERN_C
kono
parents:
diff changeset
434
kono
parents:
diff changeset
435 #endif // ! defined(INCLUDED_SCHEDULER_DOT_H)