fb38a0f6a9c8e889157b4f3e957d96028cc3e330
[IRC.git] / Robust / src / Runtime / bamboo / multicoreruntime.h
1 #ifndef MULTICORE_RUNTIME
2 #define MULTICORE_RUNTIME
3
4 #ifndef INLINE
5 #define INLINE    inline __attribute__((always_inline))
6 #endif
7
8 #ifndef bool
9 #define bool int
10 #define true 1
11 #define false 0
12 #endif
13
14 ////////////////////////////////////////////////////////////////
15 // global variables                                          //
16 ///////////////////////////////////////////////////////////////
17
18 // record the starting time
19 unsigned long long bamboo_start_time;
20
21 // data structures for msgs
22 #define BAMBOO_OUT_BUF_LENGTH 2048
23 #define BAMBOO_OUT_BUF_MASK (0x7FF)
24 #define BAMBOO_MSG_BUF_LENGTH 2048
25 #define BAMBOO_MSG_BUF_MASK (0x7FF)
26 int msgdata[BAMBOO_MSG_BUF_LENGTH];
27 volatile int msgdataindex;
28 volatile int msgdatalast;
29 int msglength;
30 volatile bool msgdatafull;
31 int outmsgdata[BAMBOO_OUT_BUF_LENGTH];
32 int outmsgindex;
33 int outmsglast;
34 int outmsgleft;
35 volatile bool isMsgHanging;
36
37 #define MSG_INDEXINC_I() \
38   msgdataindex = (msgdataindex + 1) & (BAMBOO_MSG_BUF_MASK) 
39
40 #define MSG_LASTINDEXINC_I() \
41   msgdatalast = (msgdatalast + 1) & (BAMBOO_MSG_BUF_MASK)
42
43 #define MSG_CACHE_I(n) \
44   msgdata[msgdatalast] = (n); \
45   MSG_LASTINDEXINC_I()
46
47 // NOTE: if msgdataindex == msgdatalast, it always means that the buffer if
48 //       full. In the case that the buffer is empty, should never call this
49 //       MACRO
50 #define MSG_REMAINSIZE_I(s) \
51   if(msgdataindex < msgdatalast) { \
52     (*(int*)s) = msgdatalast - msgdataindex; \
53   } else if((msgdataindex == msgdatalast) && (!msgdatafull)) { \
54     (*(int*)s) = 0; \
55   } else { \
56     (*(int*)s) = (BAMBOO_MSG_BUF_LENGTH) - msgdataindex + msgdatalast; \
57   }
58
59 #define OUTMSG_INDEXINC() \
60   outmsgindex = (outmsgindex + 1) & (BAMBOO_OUT_BUF_MASK)
61
62 #define OUTMSG_LASTINDEXINC() \
63   outmsglast = (outmsglast + 1) & (BAMBOO_OUT_BUF_MASK); \
64   if(outmsglast == outmsgindex) { \
65     BAMBOO_EXIT(0xd101); \
66   }
67
68 #define OUTMSG_CACHE(n) \
69   outmsgdata[outmsglast] = (n); \
70   OUTMSG_LASTINDEXINC();
71
72 #define MAX_PACKET_WORDS 5
73
74 /* Message format:
75  *      type + Msgbody
76  * type: 1 -- transfer object
77  *       2 -- transfer stall msg
78  *       3 -- lock request
79  *       4 -- lock grount
80  *       5 -- lock deny
81  *       6 -- lock release
82  *       // add for profile info
83  *       7 -- transfer profile output msg
84  *       8 -- transfer profile output finish msg
85  *       // add for alias lock strategy
86  *       9 -- redirect lock request
87  *       a -- lock grant with redirect info
88  *       b -- lock deny with redirect info
89  *       c -- lock release with redirect info
90  *       d -- status confirm request
91  *       e -- status report msg
92  *       f -- terminate
93  *      10 -- requiring for new memory
94  *      11 -- response for new memory request
95  *      12 -- GC init phase start
96  *      13 -- GC start
97  *      14 -- compact phase start
98  *      15 -- flush phase start
99  *      16 -- init phase finish
100  *      17 -- mark phase finish
101  *      18 -- compact phase finish
102  *      19 -- flush phase finish
103  *      1a -- GC finish
104  *      1b -- marked phase finish confirm request
105  *      1c -- marked phase finish confirm response
106  *      1d -- markedObj msg
107  *      1e -- start moving objs msg
108  *      1f -- ask for mapping info of a markedObj
109  *      20 -- mapping info of a markedObj
110  *      21 -- large objs info request
111  *      22 -- large objs info response
112  *      23 -- large objs mapping info
113  *
114  * ObjMsg: 1 + size of msg + obj's address + (task index + param index)+
115  * StallMsg: 2 + corenum + sendobjs + receiveobjs
116  *             (size is always 4 * sizeof(int))
117  * LockMsg: 3 + lock type + obj pointer + lock + request core
118  *            (size is always 5 * sizeof(int))
119  *          4/5/6 + lock type + obj pointer + lock
120  *            (size is always 4 * sizeof(int))
121  *          9 + lock type + obj pointer +  redirect lock + root request core
122  *            + request core
123  *            (size is always 6 * sizeof(int))
124  *          a/b + lock type + obj pointer + redirect lock
125  *              (size is always 4 * sizeof(int))
126  *          c + lock type + lock + redirect lock
127  *            (size is always 4 * sizeof(int))
128  *          lock type: 0 -- read; 1 -- write
129  * ProfileMsg: 7 + totalexetime
130  *               (size is always 2 * sizeof(int))
131  *             8 + corenum
132  *               (size is always 2 * sizeof(int))
133  * StatusMsg: d (size is always 1 * sizeof(int))
134  *            e + status + corenum + sendobjs + receiveobjs
135  *              (size is always 5 * sizeof(int))
136  *            status: 0 -- stall; 1 -- busy
137  * TerminateMsg: f (size is always 1 * sizeof(int)
138  * MemoryMsg: 10 + size + corenum
139  *              (size is always 3 * sizeof(int))
140  *           11 + base_va + size
141  *              (size is always 3 * sizeof(int))
142  * GCMsg: 12/13 (size is always 1 * sizeof(int))
143  *        14 + size of msg + (num of objs to move + (start address
144  *           + end address + dst core + start dst)+)?
145  *           + (num of incoming objs + (start dst + orig core)+)?
146  *           + (num of large obj lists + (start address + lenght
147  *           + start dst)+)?
148  *        15 (size is always 1 * sizeof(int))
149  *        16 + corenum
150  *           (size is always 2 * sizeof(int))
151  *        17 + corenum + gcsendobjs + gcreceiveobjs
152  *           (size if always 4 * sizeof(int))
153  *        18 + corenum + fulfilled blocks num + (finish compact(1) + current
154  *           heap top)/(need mem(0) + mem need)
155  *           size is always 5 * sizeof(int))
156  *        19 + corenum
157  *              (size is always 2 * sizeof(int))
158  *        1a (size is always 1 * sizeof(int))
159  *        1b (size if always 1 * sizeof(int))
160  *        1c + size of msg + corenum + gcsendobjs + gcreceiveobjs
161  *           (size is always 5 * sizeof(int))
162  *        1d + obj's address + request core
163  *           (size is always 3 * sizeof(int))
164  *        1e + corenum + start addr + end addr
165  *           (size if always 4 * sizeof(int))
166  *        1f + obj's address + corenum
167  *           (size is always 3 * sizeof(int))
168  *        20 + obj's address + dst address
169  *           (size if always 3 * sizeof(int))
170  *        21 (size is always 1 * sizeof(int))
171  *        22 + size of msg + corenum + current heap size
172  *           + (num of large obj lists + (start address + length)+)?
173  *        23 + orig large obj ptr + new large obj ptr
174  *            (size is always 3 * sizeof(int))
175  */
176 typedef enum {
177   MSGSTART = 0xD0,       // 0xD0
178   TRANSOBJ,              // 0xD1
179   TRANSTALL,             // 0xD2
180   LOCKREQUEST,           // 0xD3
181   LOCKGROUNT,            // 0xD4
182   LOCKDENY,              // 0xD5
183   LOCKRELEASE,           // 0xD6
184   PROFILEOUTPUT,         // 0xD7
185   PROFILEFINISH,         // 0xD8
186   REDIRECTLOCK,          // 0xD9
187   REDIRECTGROUNT,        // 0xDa
188   REDIRECTDENY,          // 0xDb
189   REDIRECTRELEASE,       // 0xDc
190   STATUSCONFIRM,         // 0xDd
191   STATUSREPORT,          // 0xDe
192   TERMINATE,             // 0xDf
193   MEMREQUEST,            // 0xE0
194   MEMRESPONSE,           // 0xE1
195 #ifdef MULTICORE_GC
196   GCSTARTPRE,            // 0xE2
197   GCSTARTINIT,           // 0xE3
198   GCSTART,               // 0xE4
199   GCSTARTCOMPACT,        // 0xE5
200   GCSTARTMAPINFO,        // 0xE6
201   GCSTARTFLUSH,          // 0xE7
202   GCFINISHPRE,           // 0xE8
203   GCFINISHINIT,          // 0xE9
204   GCFINISHMARK,          // 0xEa
205   GCFINISHCOMPACT,       // 0xEb
206   GCFINISHMAPINFO,       // 0xEc
207   GCFINISHFLUSH,         // 0xEd
208   GCFINISH,              // 0xEe
209   GCMARKCONFIRM,         // 0xEf
210   GCMARKREPORT,          // 0xF0
211   GCMARKEDOBJ,           // 0xF1
212   GCMOVESTART,           // 0xF2
213   GCMAPREQUEST,          // 0xF3
214   GCMAPINFO,             // 0xF4
215   GCMAPTBL,              // 0xF5
216   GCLOBJREQUEST,         // 0xF6
217   GCLOBJINFO,            // 0xF7
218   GCLOBJMAPPING,         // 0xF8
219 #ifdef GC_PROFILE
220   GCPROFILES,            // 0xF9
221 #endif
222 #ifdef GC_CACHE_ADAPT
223   GCSTARTPOSTINIT,       // 0xFa
224   GCSTARTPREF,           // 0xFb
225   GCFINISHPOSTINIT,      // 0xFc
226   GCFINISHPREF,          // 0xFd
227 #endif // GC_CACHE_ADAPT
228 #endif
229   MSGEND
230 } MSGTYPE;
231
232 /////////////////////////////////////////////////////////////////////////////////
233 // NOTE: BAMBOO_TOTALCORE -- number of the available cores in the processor.
234 //                           No greater than the number of all the cores in
235 //                           the processor
236 //       NUMCORES -- number of cores chosen to deploy the application. It can
237 //                   be greater than that required to fully parallelize the
238 //                   application. The same as NUMCORES.
239 //       NUMCORESACTIVE -- number of cores that really execute the
240 //                         application. No greater than NUMCORES
241 //       NUMCORES4GC -- number of cores for gc. No greater than NUMCORES.
242 //                      NOTE: currently only support ontinuous cores as gc
243 //                            cores, i.e. 0~NUMCORES4GC-1
244 ////////////////////////////////////////////////////////////////////////////////
245 // data structures of status for termination
246 // only check working cores
247 volatile int corestatus[NUMCORESACTIVE]; // records status of each core
248                                          // 1: running tasks
249                                          // 0: stall
250 volatile int numsendobjs[NUMCORESACTIVE]; // records how many objects a core
251                                           // has sent out
252 volatile int numreceiveobjs[NUMCORESACTIVE]; // records how many objects a
253                                              // core has received
254 volatile int numconfirm;
255 volatile bool waitconfirm;
256 bool busystatus;
257 int self_numsendobjs;
258 int self_numreceiveobjs;
259
260 // get rid of lock msgs for GC version
261 #ifndef MULTICORE_GC
262 // data structures for locking
263 struct RuntimeHash locktable;
264 static struct RuntimeHash* locktbl = &locktable;
265 struct RuntimeHash * lockRedirectTbl;
266 struct RuntimeHash * objRedirectLockTbl;
267 #endif
268 struct LockValue {
269   int redirectlock;
270   int value;
271 };
272 int lockobj;
273 int lock2require;
274 int lockresult;
275 bool lockflag;
276
277 // data structures for waiting objs
278 struct Queue objqueue;
279 struct Queue * totransobjqueue; // queue to hold objs to be transferred
280                                 // should be cleared whenever enter a task
281
282 // data structures for shared memory allocation
283 #ifdef TILERA_BME
284 #define BAMBOO_BASE_VA 0xd000000
285 #elif defined TILERA_ZLINUX
286 #ifdef MULTICORE_GC
287 #define BAMBOO_BASE_VA 0xd000000
288 #endif // MULTICORE_GC
289 #endif // TILERA_BME
290
291 #ifdef BAMBOO_MEMPROF
292 #define GC_BAMBOO_NUMCORES 56
293 #else
294 #define GC_BAMBOO_NUMCORES 62
295 #endif
296
297 #ifdef GC_DEBUG
298 #include "structdefs.h"
299 #define BAMBOO_NUM_BLOCKS (NUMCORES4GC*(2+1)+3)
300 #define BAMBOO_PAGE_SIZE (64 * 64)
301 #define BAMBOO_SMEM_SIZE (BAMBOO_PAGE_SIZE)
302 #define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_SMEM_SIZE) *(BAMBOO_NUM_BLOCKS))
303
304 #elif defined GC_CACHE_ADAPT
305 #define BAMBOO_NUM_BLOCKS ((GC_BAMBOO_NUMCORES)*(2+14))
306 #define BAMBOO_PAGE_SIZE (64 * 1024) // 64K
307 #ifdef GC_LARGEPAGESIZE
308 #define BAMBOO_PAGE_SIZE (4 * 64 * 1024)
309 #define BAMBOO_SMEM_SIZE (4 * (BAMBOO_PAGE_SIZE))
310 #elif defined GC_SMALLPAGESIZE
311 #define BAMBOO_SMEM_SIZE (BAMBOO_PAGE_SIZE)
312 #elif defined GC_SMALLPAGESIZE2
313 #define BAMBOO_PAGE_SIZE (16 * 1024)  // (4096)
314 #define BAMBOO_SMEM_SIZE (BAMBOO_PAGE_SIZE)
315 #elif defined GC_LARGEPAGESIZE2
316 #define BAMBOO_PAGE_SIZE (4 * 64 * 1024) // 64K
317 #define BAMBOO_SMEM_SIZE ((BAMBOO_PAGE_SIZE))
318 #else
319 #define BAMBOO_SMEM_SIZE (4 * (BAMBOO_PAGE_SIZE))
320 #endif // GC_LARGEPAGESIZE
321 #define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_SMEM_SIZE) * (BAMBOO_NUM_BLOCKS))
322
323 #else // GC_DEBUG
324 #ifdef GC_LARGESHAREDHEAP
325 #define BAMBOO_NUM_BLOCKS ((GC_BAMBOO_NUMCORES)*(2+2))
326 #elif defined GC_LARGESHAREDHEAP2
327 #define BAMBOO_NUM_BLOCKS ((GC_BAMBOO_NUMCORES)*(2+2))
328 #else
329 #define BAMBOO_NUM_BLOCKS ((GC_BAMBOO_NUMCORES)*(2+3)) //(15 * 1024) //(64 * 4 * 0.75) //(1024 * 1024 * 3.5)  3G
330 #endif
331 #ifdef GC_LARGEPAGESIZE
332 #define BAMBOO_PAGE_SIZE (4 * 1024 * 1024)  // (4096)
333 #define BAMBOO_SMEM_SIZE (BAMBOO_PAGE_SIZE)
334 #elif defined GC_SMALLPAGESIZE
335 #define BAMBOO_PAGE_SIZE (256 * 1024)  // (4096)
336 #define BAMBOO_SMEM_SIZE (BAMBOO_PAGE_SIZE)
337 #elif defined GC_SMALLPAGESIZE2
338 #define BAMBOO_PAGE_SIZE (64 * 1024)  // (4096)
339 #define BAMBOO_SMEM_SIZE (BAMBOO_PAGE_SIZE)
340 #else
341 #define BAMBOO_PAGE_SIZE (1024 * 1024)  // (4096)
342 #define BAMBOO_SMEM_SIZE (BAMBOO_PAGE_SIZE)
343 #endif // GC_LARGEPAGESIZE
344 #define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_SMEM_SIZE) * (BAMBOO_NUM_BLOCKS)) //(1024 * 1024 * 240) //((unsigned long long int)(3.0 * 1024 * 1024 * 1024)) // 3G 
345 #endif // GC_DEBUG
346
347 #ifdef MULTICORE_GC
348 volatile bool gc_localheap_s;
349 #endif
350
351 #ifdef MULTICORE_GC
352 #include "multicoregarbage.h"
353
354 typedef enum {
355   SMEMLOCAL = 0x0,// 0x0, using local mem only
356   SMEMFIXED,      // 0x1, use local mem in lower address space(1 block only)
357                   //      and global mem in higher address space
358   SMEMMIXED,      // 0x2, like FIXED mode but use a threshold to control
359   SMEMGLOBAL,     // 0x3, using global mem only
360   SMEMEND
361 } SMEMSTRATEGY;
362
363 SMEMSTRATEGY bamboo_smem_mode; //-DSMEML: LOCAL; -DSMEMF: FIXED;
364                                //-DSMEMM: MIXED; -DSMEMG: GLOBAL;
365
366 struct freeMemItem {
367   INTPTR ptr;
368   int size;
369   int startblock;
370   int endblock;
371   struct freeMemItem * next;
372 };
373
374 struct freeMemList {
375   struct freeMemItem * head;
376   struct freeMemItem * backuplist; // hold removed freeMemItem for reuse;
377                                    // only maintain 1 freemMemItem
378 };
379
380 // table recording the number of allocated bytes on each block
381 // Note: this table resides on the bottom of the shared heap for all cores
382 //       to access
383 volatile int * bamboo_smemtbl;
384 volatile int bamboo_free_block;
385 int bamboo_reserved_smem; // reserved blocks on the top of the shared heap
386                           // e.g. 20% of the heap and should not be allocated
387                           // otherwise gc is invoked
388 volatile INTPTR bamboo_smem_zero_top;
389 #define BAMBOO_SMEM_ZERO_UNIT_SIZE (4 * 1024) // 4KB
390 #else
391 //volatile mspace bamboo_free_msp;
392 INTPTR bamboo_free_smemp;
393 int bamboo_free_smem_size;
394 #endif
395 volatile bool smemflag;
396 volatile INTPTR bamboo_cur_msp;
397 volatile int bamboo_smem_size;
398
399 // for test TODO
400 int total_num_t6;
401
402 // data structures for profile mode
403 #ifdef PROFILE
404
405 #define TASKINFOLENGTH 3000 // 0
406 #ifdef PROFILE_INTERRUPT
407 #define INTERRUPTINFOLENGTH 50 //0
408 #endif // PROFILE_INTERRUPT
409
410 bool stall;
411 int totalexetime;
412
413 typedef struct task_info {
414   char* taskName;
415   unsigned long long startTime;
416   unsigned long long endTime;
417   unsigned long long exitIndex;
418   struct Queue * newObjs;
419 } TaskInfo;
420
421 TaskInfo * taskInfoArray[TASKINFOLENGTH];
422 int taskInfoIndex;
423 bool taskInfoOverflow;
424 #ifdef PROFILE_INTERRUPT
425 typedef struct interrupt_info {
426   unsigned long long startTime;
427   unsigned long long endTime;
428 } InterruptInfo;
429
430 InterruptInfo * interruptInfoArray[INTERRUPTINFOLENGTH];
431 int interruptInfoIndex;
432 bool interruptInfoOverflow;
433 #endif // PROFILE_INTERUPT
434 volatile int profilestatus[NUMCORESACTIVE]; // records status of each core
435                                             // 1: running tasks
436                                             // 0: stall
437 #endif // #ifdef PROFILE
438
439 #ifndef INTERRUPT
440 bool reside;
441 #endif
442 /////////////////////////////////////////////////////////////
443
444 ////////////////////////////////////////////////////////////
445 // these are functions should be implemented in           //
446 // multicore runtime for any multicore processors         //
447 ////////////////////////////////////////////////////////////
448 #ifdef TASK
449 #ifdef MULTICORE
450 INLINE void initialization(void);
451 INLINE void initCommunication(void);
452 INLINE void fakeExecution(void);
453 INLINE void terminate(void);
454 INLINE void initlock(struct ___Object___ * v);
455 #ifdef BAMBOO_MEMPROF
456 INLINE void terminatememprof(void);
457 #endif
458
459 // lock related functions
460 bool getreadlock(void* ptr);
461 void releasereadlock(void* ptr);
462 bool getwritelock(void* ptr);
463 void releasewritelock(void* ptr);
464 bool getwritelock_I(void* ptr);
465 void releasewritelock_I(void * ptr);
466 #ifndef MULTICORE_GC
467 void releasewritelock_r(void * lock, void * redirectlock);
468 #endif
469 /* this function is to process lock requests.
470  * can only be invoked in receiveObject() */
471 // if return -1: the lock request is redirected
472 //            0: the lock request is approved
473 //            1: the lock request is denied
474 INLINE int processlockrequest(int locktype,
475                               int lock,
476                               int obj,
477                               int requestcore,
478                               int rootrequestcore,
479                               bool cache);
480 INLINE void processlockrelease(int locktype,
481                                int lock,
482                                int redirectlock,
483                                bool redirect);
484
485 // msg related functions
486 INLINE void send_hanging_msg(bool isInterrupt);
487 INLINE void send_msg_1(int targetcore,
488                        unsigned long n0,
489                                            bool isInterrupt);
490 INLINE void send_msg_2(int targetcore,
491                        unsigned long n0,
492                        unsigned long n1,
493                                            bool isInterrupt);
494 INLINE void send_msg_3(int targetcore,
495                        unsigned long n0,
496                        unsigned long n1,
497                        unsigned long n2,
498                                            bool isInterrupt);
499 INLINE void send_msg_4(int targetcore,
500                        unsigned long n0,
501                        unsigned long n1,
502                        unsigned long n2,
503                        unsigned long n3,
504                                            bool isInterrupt);
505 INLINE void send_msg_5(int targetcore,
506                        unsigned long n0,
507                        unsigned long n1,
508                        unsigned long n2,
509                        unsigned long n3,
510                        unsigned long n4,
511                                            bool isInterrupt);
512 INLINE void send_msg_6(int targetcore,
513                        unsigned long n0,
514                        unsigned long n1,
515                        unsigned long n2,
516                        unsigned long n3,
517                        unsigned long n4,
518                        unsigned long n5,
519                                            bool isInterrupt);
520 INLINE void cache_msg_1(int targetcore,
521                         unsigned long n0);
522 INLINE void cache_msg_2(int targetcore,
523                         unsigned long n0,
524                         unsigned long n1);
525 INLINE void cache_msg_3(int targetcore,
526                         unsigned long n0,
527                         unsigned long n1,
528                         unsigned long n2);
529 INLINE void cache_msg_4(int targetcore,
530                         unsigned long n0,
531                         unsigned long n1,
532                         unsigned long n2,
533                         unsigned long n3);
534 INLINE void cache_msg_5(int targetcore,
535                         unsigned long n0,
536                         unsigned long n1,
537                         unsigned long n2,
538                         unsigned long n3,
539                         unsigned long n4);
540 INLINE void cache_msg_6(int targetcore,
541                         unsigned long n0,
542                         unsigned long n1,
543                         unsigned long n2,
544                         unsigned long n3,
545                         unsigned long n4,
546                         unsigned long n5);
547 INLINE void transferObject(struct transObjInfo * transObj);
548 INLINE int receiveMsg(uint32_t send_port_pending);
549
550 #ifdef MULTICORE_GC
551 INLINE void transferMarkResults();
552 #endif
553
554 #ifdef PROFILE
555 INLINE void profileTaskStart(char * taskname);
556 INLINE void profileTaskEnd(void);
557 void outputProfileData();
558 #endif  // #ifdef PROFILE
559 ///////////////////////////////////////////////////////////
560
561 /////////////////////////////////////////////////////////////////////////////
562 // For each version of BAMBOO runtime, there should be a header file named //
563 // runtim_arch.h defining following MARCOS:                                //
564 // BAMBOO_NUM_OF_CORE: the # of current residing core                      //
565 // BAMBOO_GET_NUM_OF_CORE(): compute the # of current residing core        //
566 // BAMBOO_COORDS(c, x, y): convert the cpu # to coords (*x, *y)            //
567 // BAMBOO_DEBUGPRINT(x): print out integer x                               //
568 // BAMBOO_DEBUGPRINT_REG(x): print out value of variable x                 //
569 // BAMBOO_EXIT_APP(x): exit the whole application                          //
570 // BAMBOO_EXIT(x): error exit routine with error #                         //
571 // BAMBOO_DIE(x): error exit routine with error msg                        //
572 // BAMBOO_GET_EXE_TIME(): rountine to get current clock cycle number       //
573 // BAMBOO_MSG_AVAIL(): checking if there are msgs coming in                //
574 // BAMBOO_GCMSG_AVAIL(): checking if there are gcmsgs coming in            //
575 // BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(): change to runtime mode from    //
576 //                                          client mode                    //
577 // BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(): change to client mode from     //
578 //                                          runtime mode                   //
579 // BAMBOO_ENTER_SEND_MODE_FROM_CLIENT(): change to send mode from          //
580 //                                       client mode                       //
581 // BAMBOO_ENTER_CLIENT_MODE_FROM_SEND(): change to client mode from        //
582 //                                       send mode                         //
583 // BAMBOO_ENTER_RUNTIME_MODE_FROM_SEND(): change to runtime mode from      //
584 //                                        send mode                        //
585 // BAMBOO_ENTER_SEND_MODE_FROM_RUNTIME(): change to send mode from         //
586 //                                        runtime mode                     //
587 // BAMBOO_WAITING_FOR_LOCK(): routine executed while waiting for lock      //
588 //                            request response                             //
589 // BAMBOO_LOCAL_MEM_CALLOC(x, y): allocate an array of x elements each of  //
590 //                                whose size in bytes is y on local memory //
591 //                                which is given by the hypervisor         //
592 // BAMBOO_LOCAL_MEM_FREE(x): free space with ptr x on local memory         //
593 // BAMBOO_LOCAL_MEM_CLOSE(): close the local heap                          //
594 // BAMBOO_LOCAL_MEM_CALLOC_S(x, y): allocate an array of x elements each of//
595 //                                  whose size in bytes is y on local      //
596 //                                  memory which is not from the hypervisor//
597 //                                  but is allocated from the free memory  //
598 // BAMBOO_LOCAL_MEM_FREE_S(x): free space with ptr x on self-allocated     //
599 //                             local memory                                //
600 // BAMBOO_LOCAL_MEM_CLOSE_S(): close the self-allocated local heap        //
601 // BAMBOO_SHARE_MEM_CALLOC_I(x, y): allocate an array of x elements each of//
602 //                                whose size in bytes is y on shared memory//
603 // BAMBOO_SHARE_MEM_CLOSE(): close the shared heap                         //
604 // BAMBOO_CACHE_LINE_SIZE: the cache line size                             //
605 // BAMBOO_CACHE_LINE_MASK: mask for a cache line                           //
606 // BAMBOO_CACHE_FLUSH_RANGE(x, y): flush cache lines started at x with     //
607 //                                 length y                                //
608 // BAMBOO_CACHE_FLUSH_ALL(): flush the whole cache of a core if necessary  //
609 // BAMBOO_MEMSET_WH(x, y, z): memset the specified region of memory (start //
610 //                            address x, size z) to value y with write     //
611 //                            hint, the processor will not fetch the       //
612 //                            current content of the memory and directly   //
613 //                            write                                        //
614 // BAMBOO_CLEAN_DTLB(): zero-out all the dtlb entries                      //
615 // BAMBOO_CACHE_FLUSH_L2(): Flush the contents of this tile's L2 back to   //
616 //                          main memory                                    //
617 // BAMBOO_CACHE_FLUSH_RANGE_NO_FENCE(x, y): flush a range of mem without   //
618 //                                          mem fence                      //
619 // BAMBOO_CACHE_MEM_FENCE_INCOHERENT(): fence to guarantee visibility of   //
620 //                                      stores to incoherent memory        //
621 /////////////////////////////////////////////////////////////////////////////
622
623 #endif  // #ifdef MULTICORE
624 #endif  // #ifdef TASK
625 #endif  // #ifndef MULTICORE_RUNTIME