This source file includes following definitions.
- mtl_ofi_create_send_tag_CQD
- mtl_ofi_create_recv_tag_CQD
- mtl_ofi_create_send_tag
- mtl_ofi_create_recv_tag
- mtl_ofi_get_source
1
2
3
4
5
6
7
8
9
10
11
12 #ifndef MTL_OFI_TYPES_H_HAS_BEEN_INCLUDED
13 #define MTL_OFI_TYPES_H_HAS_BEEN_INCLUDED
14
15 #include "mtl_ofi.h"
16
17 BEGIN_C_DECLS
18
19
20
21
22
23 typedef struct mca_mtl_ofi_context_t {
24
25 struct fid_ep *tx_ep;
26 struct fid_ep *rx_ep;
27
28
29 struct fid_cq *cq;
30
31
32 opal_mutex_t context_lock;
33 } mca_mtl_ofi_context_t;
34
35 typedef struct mca_mtl_ofi_module_t {
36 mca_mtl_base_module_t base;
37
38
39 struct fid_fabric *fabric;
40
41
42 struct fid_domain *domain;
43
44
45 struct fid_av *av;
46
47
48 bool mpi_thread_multiple;
49
50
51 struct fid_ep *sep;
52 mca_mtl_ofi_context_t *ofi_ctxt;
53 int threshold_comm_context_id;
54 int *comm_to_context;
55 int rx_ctx_bits;
56 int total_ctxts_used;
57 int enable_sep;
58 int thread_grouping;
59 int num_ofi_contexts;
60
61
62 size_t epnamelen;
63
64
65 fi_addr_t any_addr;
66
67
68 char *provider_name;
69
70
71 size_t max_inject_size;
72
73
74 int ofi_progress_event_count;
75
76
77 bool fi_cq_data;
78
79
80 unsigned long long source_rank_tag_mask;
81 int num_bits_source_rank;
82 unsigned long long source_rank_mask;
83 unsigned long long mpi_tag_mask;
84 int num_bits_mpi_tag;
85 int num_peers;
86
87
88 unsigned long long sync_send;
89 unsigned long long sync_send_ack;
90 unsigned long long sync_proto_mask;
91
92
93 struct ompi_mtl_ofi_symtable sym_table;
94
95 } mca_mtl_ofi_module_t;
96
97 extern mca_mtl_ofi_module_t ompi_mtl_ofi;
98
99 typedef struct mca_mtl_ofi_component_t {
100
101 mca_mtl_base_component_2_0_0_t super;
102 } mca_mtl_ofi_component_t;
103
104 typedef enum {
105 OFI_REGULAR_EP = 0,
106 OFI_SCALABLE_EP,
107 } mca_mtl_ofi_ep_type;
108
109
110
111
112
113
114
115 #define MTL_OFI_MAX_PROG_EVENT_COUNT 100
116
117
118
119
120
121
122
123
124
125
126 #define MTL_OFI_MINIMUM_CID_BITS (8)
127
128
129
130
131
132
133 #define MTL_OFI_PROTO_BIT_COUNT (2)
134 #define MTL_OFI_HIGHEST_TAG_BIT (0x8000000000000000ULL)
135
136 #define MTL_OFI_CID_MASK_DATA (0xFFFFFFFC00000000ULL)
137 #define MTL_OFI_CID_BIT_COUNT_DATA (30)
138 #define MTL_OFI_TAG_MASK_DATA (0x00000000FFFFFFFFULL)
139 #define MTL_OFI_TAG_BIT_COUNT_DATA (32)
140 #define MTL_OFI_PROTO_MASK_DATA (0x0000000300000000ULL)
141 #define MTL_OFI_SYNC_SEND_DATA (0x0000000100000000ULL)
142 #define MTL_OFI_SYNC_SEND_ACK_DATA (0x0000000200000000ULL)
143
144
145 __opal_attribute_always_inline__ static inline uint64_t
146 mtl_ofi_create_send_tag_CQD(int comm_id, int tag)
147 {
148 uint64_t match_bits = comm_id;
149 match_bits = (match_bits << (MTL_OFI_TAG_BIT_COUNT_DATA
150 + MTL_OFI_PROTO_BIT_COUNT));
151 match_bits |= (tag & MTL_OFI_TAG_MASK_DATA);
152 return match_bits;
153 }
154
155
156 __opal_attribute_always_inline__ static inline void
157 mtl_ofi_create_recv_tag_CQD(uint64_t *match_bits, uint64_t *mask_bits,
158 int comm_id, int tag)
159 {
160 *mask_bits = ompi_mtl_ofi.sync_proto_mask;
161 *match_bits = (uint64_t) comm_id;
162 *match_bits = (*match_bits << (MTL_OFI_PROTO_BIT_COUNT
163 + MTL_OFI_TAG_BIT_COUNT_DATA));
164 if (MPI_ANY_TAG == tag) {
165
166
167
168
169 *mask_bits |= (ompi_mtl_ofi.mpi_tag_mask>>1);
170 } else {
171 *match_bits |= (ompi_mtl_ofi.mpi_tag_mask & tag);
172 }
173 }
174
175
176
177
178
179
180
181
182
183 #define MTL_OFI_CID_BIT_COUNT_1 (12)
184 #define MTL_OFI_SOURCE_TAG_MASK_1 (0x000FFFFC00000000ULL)
185 #define MTL_OFI_SOURCE_BIT_COUNT_1 (18)
186 #define MTL_OFI_SOURCE_MASK_1 (0x000000000003FFFFULL)
187 #define MTL_OFI_TAG_MASK_1 (0x00000000FFFFFFFFULL)
188 #define MTL_OFI_TAG_BIT_COUNT_1 (32)
189 #define MTL_OFI_PROTO_MASK_1 (0x0000000300000000ULL)
190 #define MTL_OFI_SYNC_SEND_1 (0x0000000100000000ULL)
191 #define MTL_OFI_SYNC_SEND_ACK_1 (0x0000000200000000ULL)
192
193
194
195
196
197
198
199
200
201 #define MTL_OFI_CID_BIT_COUNT_2 (24)
202 #define MTL_OFI_SOURCE_TAG_MASK_2 (0x000000FFFFC00000ULL)
203 #define MTL_OFI_SOURCE_BIT_COUNT_2 (18)
204 #define MTL_OFI_SOURCE_MASK_2 (0x000000000003FFFFULL)
205 #define MTL_OFI_TAG_MASK_2 (0x00000000000FFFFFULL)
206 #define MTL_OFI_TAG_BIT_COUNT_2 (20)
207 #define MTL_OFI_PROTO_MASK_2 (0x0000000000300000ULL)
208 #define MTL_OFI_SYNC_SEND_2 (0x0000000000100000ULL)
209 #define MTL_OFI_SYNC_SEND_ACK_2 (0x0000000000200000ULL)
210
211
212 __opal_attribute_always_inline__ static inline uint64_t
213 mtl_ofi_create_send_tag(int comm_id, int source, int tag)
214 {
215 uint64_t match_bits = comm_id;
216 match_bits = (match_bits << ompi_mtl_ofi.num_bits_source_rank);
217 match_bits |= (uint64_t)(source & ompi_mtl_ofi.source_rank_mask);
218 match_bits = (match_bits << (ompi_mtl_ofi.num_bits_mpi_tag
219 + MTL_OFI_PROTO_BIT_COUNT));
220 match_bits |= (tag & ompi_mtl_ofi.mpi_tag_mask);
221 return match_bits;
222 }
223
224
225 __opal_attribute_always_inline__ static inline void
226 mtl_ofi_create_recv_tag(uint64_t *match_bits, uint64_t *mask_bits,
227 int comm_id, int source, int tag)
228 {
229 *mask_bits = ompi_mtl_ofi.sync_proto_mask;
230 *match_bits = comm_id;
231 *match_bits = (*match_bits << ompi_mtl_ofi.num_bits_source_rank);
232
233 if (MPI_ANY_SOURCE == source) {
234 *match_bits = (*match_bits << (ompi_mtl_ofi.num_bits_mpi_tag
235 + MTL_OFI_PROTO_BIT_COUNT));
236 *mask_bits |= ompi_mtl_ofi.source_rank_tag_mask;
237 } else {
238 *match_bits |= (uint64_t)(source & ompi_mtl_ofi.source_rank_mask);
239 *match_bits = (*match_bits << (ompi_mtl_ofi.num_bits_mpi_tag
240 + MTL_OFI_PROTO_BIT_COUNT));
241 }
242
243 if (MPI_ANY_TAG == tag) {
244
245
246
247
248 *mask_bits |= (ompi_mtl_ofi.mpi_tag_mask>>1);
249 } else {
250 *match_bits |= (ompi_mtl_ofi.mpi_tag_mask & tag);
251 }
252 }
253
254 #define MTL_OFI_SET_SYNC_SEND(match_bits) \
255 match_bits |= ompi_mtl_ofi.sync_send
256
257 #define MTL_OFI_IS_SYNC_SEND(match_bits) \
258 (ompi_mtl_ofi.sync_send == (ompi_mtl_ofi.sync_proto_mask & match_bits))
259
260 #define MTL_OFI_IS_SYNC_SEND_ACK(match_bits) \
261 (ompi_mtl_ofi.sync_send_ack == (ompi_mtl_ofi.sync_proto_mask & match_bits))
262
263 #define MTL_OFI_GET_TAG(match_bits) \
264 ((int)(match_bits & ompi_mtl_ofi.mpi_tag_mask))
265
266 __opal_attribute_always_inline__ static inline int
267 mtl_ofi_get_source(struct fi_cq_tagged_entry *wc)
268 {
269 int src;
270 if (ompi_mtl_ofi.fi_cq_data) {
271 src = (int) wc->data;
272 }
273 else {
274 src = (int)((wc->tag >> (MTL_OFI_PROTO_BIT_COUNT +
275 ompi_mtl_ofi.num_bits_mpi_tag)) & ompi_mtl_ofi.source_rank_mask);
276 }
277
278 return src;
279 }
280 END_C_DECLS
281
282 #endif