-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathworker.h
53 lines (39 loc) · 1.62 KB
/
worker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef _CILK_WORKER_H
#define _CILK_WORKER_H
#include "rts-config.h"
struct __cilkrts_stack_frame;
struct local_state;
struct global_state;
struct local_hyper_table;
enum __cilkrts_worker_state {
WORKER_IDLE = 10,
WORKER_SCHED,
WORKER_STEAL,
WORKER_RUN
};
struct __cilkrts_worker {
// Worker id, a small integer
const worker_id self;
// 4 byte hole on 64 bit systems
// Current hyperobject table
struct local_hyper_table *hyper_table;
// Global state of the runtime system, opaque to the client.
struct global_state *const g;
// Additional per-worker state hidden from the client.
struct local_state *const l;
// Cache line boundary on 64 bit systems with 64 byte cache lines
// Optional state, only maintained if __cilkrts_use_extension == true.
void *extension;
void *ext_stack;
// T, H, and E pointers in the THE protocol.
// T and E are frequently accessed and should be in a hot cache line.
// H could be moved elsewhere because it is only touched when stealing.
_Atomic(struct __cilkrts_stack_frame **) tail;
_Atomic(struct __cilkrts_stack_frame **) exc __attribute__((aligned(64)));
_Atomic(struct __cilkrts_stack_frame **) head __attribute__((aligned(CILK_CACHE_LINE)));
// Limit of the Lazy Task Queue, to detect queue overflow (debug only)
struct __cilkrts_stack_frame **const ltq_limit;
} __attribute__((aligned(1024))); // This alignment reduces false sharing
// induced by hardware prefetchers on some
// systems, such as Intel CPUs.
#endif /* _CILK_WORKER_H */