-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathack_control.h
More file actions
42 lines (34 loc) · 836 Bytes
/
ack_control.h
File metadata and controls
42 lines (34 loc) · 836 Bytes
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
#pragma once
#include <emu_c_utils/emu_c_utils.h>
// HACK until these macros are added to memoryweb_x86
#ifndef DISABLE_ACKS
#define DISABLE_ACKS()
#define ENABLE_ACKS()
#endif
// One element on each nodelet
volatile replicated long * ack_control_data;
static inline void
ack_control_init()
{
long * tmp = (long*)mw_malloc1dlong(NODELETS());
assert(tmp);
mw_replicated_init((long*)&ack_control_data, (long)tmp);
}
static inline void
ack_control_disable_acks()
{
DISABLE_ACKS();
}
static inline void
ack_control_reenable_acks()
{
// Re-enable ack's
ENABLE_ACKS();
// Do a remote write to each nodelet.
// These will be queued behind all previous remotes
for (long nlet = 0; nlet < NODELETS(); ++nlet) {
ack_control_data[nlet] = 1;
}
// Wait for them to complete
FENCE();
}