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 #ifndef MCA_RCACHE_H
27 #define MCA_RCACHE_H
28 #include "opal/mca/mca.h"
29 #include "opal/mca/mpool/mpool.h"
30 #include "opal/threads/mutex.h"
31
32
33
34 struct mca_rcache_base_module_t;
35 typedef struct mca_rcache_base_module_t mca_rcache_base_module_t;
36
37 enum {
38
39 MCA_RCACHE_FLAGS_CACHE_BYPASS = 0x0001,
40
41 MCA_RCACHE_FLAGS_PERSIST = 0x0002,
42
43 MCA_RCACHE_FLAGS_SO_MEM = 0x0004,
44
45 MCA_RCACHE_FLAGS_CUDA_GPU_MEM = 0x0008,
46
47 MCA_RCACHE_FLAGS_CUDA_REGISTER_MEM = 0x0010,
48
49 MCA_RCACHE_FLAGS_INVALID = 0x0080,
50
51 MCA_RCACHE_FLAGS_MOD_RESV0 = 0x0100,
52
53 MCA_RCACHE_FLAGS_MOD_RESV1 = 0x0200,
54
55 MCA_RCACHE_FLAGS_MOD_RESV2 = 0x0400,
56
57 MCA_RCACHE_FLAGS_MOD_RESV3 = 0x0800,
58
59 MCA_RCACHE_FLAGS_RESV0 = 0x1000,
60
61 MCA_RCACHE_FLAGS_RESV1 = 0x2000,
62
63 MCA_RCACHE_FLAGS_RESV2 = 0x4000,
64
65 MCA_RCACHE_FLAGS_RESV3 = 0x8000,
66 };
67
68
69 enum {
70
71 MCA_RCACHE_ACCESS_LOCAL_WRITE = 0x01,
72
73 MCA_RCACHE_ACCESS_REMOTE_READ = 0x02,
74
75 MCA_RCACHE_ACCESS_REMOTE_WRITE = 0x04,
76
77 MCA_RCACHE_ACCESS_REMOTE_ATOMIC = 0x08,
78
79 MCA_RCACHE_ACCESS_ANY = 0x0f,
80 };
81
82
83 struct mca_rcache_base_registration_t {
84
85 opal_free_list_item_t super;
86
87 mca_rcache_base_module_t *rcache;
88
89 unsigned char *base;
90
91 unsigned char *bound;
92
93 unsigned char *alloc_base;
94
95 opal_atomic_int32_t ref_count;
96
97 opal_atomic_uint32_t flags;
98
99 void *rcache_context;
100 #if OPAL_CUDA_GDR_SUPPORT
101
102 unsigned long long gpu_bufID;
103 #endif
104
105 int32_t access_flags;
106 unsigned char padding[64];
107 };
108
109 typedef struct mca_rcache_base_registration_t mca_rcache_base_registration_t;
110
111 OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_rcache_base_registration_t);
112
113 struct mca_rcache_base_resources_t {
114 char *cache_name;
115 void *reg_data;
116 size_t sizeof_reg;
117 int (*register_mem) (void *reg_data, void *base, size_t size,
118 mca_rcache_base_registration_t *reg);
119 int (*deregister_mem) (void *reg_data, mca_rcache_base_registration_t *reg);
120 };
121 typedef struct mca_rcache_base_resources_t mca_rcache_base_resources_t;
122
123
124
125
126
127 typedef struct mca_rcache_base_module_t *(*mca_rcache_base_component_init_fn_t)(mca_rcache_base_resources_t *);
128
129
130
131
132 typedef int (*mca_rcache_base_module_register_fn_t) (mca_rcache_base_module_t *rcache,
133 void *addr, size_t size, uint32_t flags,
134 int32_t access_flags,
135 mca_rcache_base_registration_t **reg);
136
137
138
139
140 typedef int (*mca_rcache_base_module_deregister_fn_t) (mca_rcache_base_module_t *rcache,
141 mca_rcache_base_registration_t *reg);
142
143
144
145
146
147 typedef int (*mca_rcache_base_module_find_fn_t) (mca_rcache_base_module_t *rcache, void *addr,
148 size_t size, mca_rcache_base_registration_t **reg);
149
150
151
152
153 typedef int (*mca_rcache_base_module_invalidate_range_fn_t) (mca_rcache_base_module_t *rcache,
154 void *addr, size_t size);
155
156
157
158
159
160
161
162 typedef bool (*mca_rcache_base_module_evict_fn_t) (mca_rcache_base_module_t *rcache);
163
164
165
166
167 typedef void (*mca_rcache_base_module_finalize_fn_t)(mca_rcache_base_module_t *rcache);
168
169
170
171
172
173
174 struct mca_rcache_base_component_2_0_0_t{
175 mca_base_component_t rcache_version;
176 mca_base_component_data_t rcache_data;
177 mca_rcache_base_component_init_fn_t rcache_init;
178 };
179
180 typedef struct mca_rcache_base_component_2_0_0_t mca_rcache_base_component_2_0_0_t;
181
182 typedef struct mca_rcache_base_component_2_0_0_t mca_rcache_base_component_t;
183
184
185
186
187
188 struct mca_rcache_base_module_t {
189 mca_rcache_base_component_t *rcache_component;
190
191 mca_rcache_base_module_register_fn_t rcache_register;
192 mca_rcache_base_module_deregister_fn_t rcache_deregister;
193 mca_rcache_base_module_find_fn_t rcache_find;
194 mca_rcache_base_module_invalidate_range_fn_t rcache_invalidate_range;
195 mca_rcache_base_module_finalize_fn_t rcache_finalize;
196 mca_rcache_base_module_evict_fn_t rcache_evict;
197 opal_mutex_t lock;
198 };
199
200 #define RCACHE_MAJOR_VERSION 3
201 #define RCACHE_MINOR_VERSION 0
202 #define RCACHE_RELEASE_VERSION 0
203
204
205
206
207 #define MCA_RCACHE_BASE_VERSION_3_0_0 \
208 OPAL_MCA_BASE_VERSION_2_1_0("rcache", RCACHE_MAJOR_VERSION, RCACHE_MAJOR_VERSION, RCACHE_RELEASE_VERSION)
209
210 #endif
211