-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgasnetex.h
More file actions
1215 lines (1075 loc) · 47.8 KB
/
gasnetex.h
File metadata and controls
1215 lines (1075 loc) · 47.8 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* $Source: github.com:BerkeleyLab/gasnet.git/gasnetex.h $
* Description: GASNet Header
* Copyright 2002, Dan Bonachea <bonachea@cs.berkeley.edu>
* Terms of use are as specified in license.txt
*/
#ifndef _GASNETEX_H
#define _GASNETEX_H
#define _IN_GASNETEX_H
#define _INCLUDED_GASNETEX_H
#ifdef _INCLUDED_GASNET_TOOLS_H
#error Objects that use both GASNet-EX and GASNet tools must \
include gasnetex.h before gasnet_tools.h
#endif
#if defined(_INCLUDED_GASNET_INTERNAL_H) && !defined(_IN_GASNET_INTERNAL_H)
#error Internal GASNet code should not directly include gasnetex.h, just gasnet_internal.h
#endif
#ifdef __cplusplus
extern "C" { // cannot use GASNETI_BEGIN_EXTERNC here due to a header dependency cycle
#endif
/* Usage:
see the GASNet specification and top-level README for details on how to use the GASNet interface
clients should use the automatically-generated Makefile *.mak fragments to get the correct compile settings
*/
/* autoconf-generated configuration header */
#include <gasnet_config.h>
/* public spec version numbers */
#define GEX_SPEC_VERSION_MAJOR GASNETI_EX_SPEC_VERSION_MAJOR
#define GEX_SPEC_VERSION_MINOR GASNETI_EX_SPEC_VERSION_MINOR
/* ------------------------------------------------------------------------------------ */
/* check threading configuration */
#if defined(GASNET_SEQ) && !defined(GASNET_PARSYNC) && !defined(GASNET_PAR)
#undef GASNET_SEQ
#define GASNET_SEQ 1
#define GASNETI_THREAD_MODEL SEQ
#elif !defined(GASNET_SEQ) && defined(GASNET_PARSYNC) && !defined(GASNET_PAR)
#undef GASNET_PARSYNC
#define GASNET_PARSYNC 1
#define GASNETI_THREAD_MODEL PARSYNC
#elif !defined(GASNET_SEQ) && !defined(GASNET_PARSYNC) && defined(GASNET_PAR)
#undef GASNET_PAR
#define GASNET_PAR 1
#define GASNETI_THREAD_MODEL PAR
#else
#error Client code must #define exactly one of (GASNET_PAR, GASNET_PARSYNC, GASNET_SEQ) before #including gasnetex.h
#endif
/* GASNETI_CLIENT_THREADS = GASNet client has multiple application threads */
#if GASNET_PAR || GASNET_PARSYNC
#define GASNETI_CLIENT_THREADS 1
#elif defined(GASNETI_CLIENT_THREADS)
#error bad defn of GASNETI_CLIENT_THREADS
#endif
#if !((defined(GASNET_DEBUG) && !defined(GASNET_NDEBUG)) || (!defined(GASNET_DEBUG) && defined(GASNET_NDEBUG)))
#error Conflicting or incorrect definitions of GASNET_DEBUG and GASNET_NDEBUG
#endif
/* codify other configuration settings */
#ifdef GASNET_DEBUG
#undef GASNET_DEBUG
#define GASNET_DEBUG 1
#define GASNETI_DEBUG_P 1
#define GASNETI_DEBUG_CONFIG debug
#else
#define GASNETI_DEBUG_P 0
#define GASNETI_DEBUG_CONFIG nodebug
#endif
#ifdef GASNET_TRACE
#undef GASNET_TRACE
#define GASNET_TRACE 1
#define GASNETI_TRACE_CONFIG trace
#else
#define GASNETI_TRACE_CONFIG notrace
#endif
#ifdef GASNET_STATS
#undef GASNET_STATS
#define GASNET_STATS 1
#define GASNETI_STATS_CONFIG stats
#else
#define GASNETI_STATS_CONFIG nostats
#endif
#ifdef GASNET_DEBUGMALLOC
#undef GASNET_DEBUGMALLOC
#define GASNET_DEBUGMALLOC 1
#define GASNETI_MALLOC_CONFIG debugmalloc
#else
#define GASNETI_MALLOC_CONFIG nodebugmalloc
#endif
#if defined(GASNET_SRCLINES) || defined(GASNET_DEBUG)
#define GASNETI_SRCLINES_FORCE
#endif
#if defined(GASNET_SRCLINES) || defined(GASNET_TRACE)
#undef GASNET_SRCLINES
#define GASNET_SRCLINES 1
#define GASNETI_SRCLINES_CONFIG srclines
#else
#define GASNETI_SRCLINES_CONFIG nosrclines
#endif
#if defined(GASNET_STATS) || defined(GASNET_TRACE)
#define GASNETI_STATS_OR_TRACE 1
#elif defined(GASNETI_STATS_OR_TRACE)
#error bad def of GASNETI_STATS_OR_TRACE
#endif
/* basic utilities used in the headers */
#include <gasnet_basic.h>
GASNETI_BEGIN_NOWARN
/* ------------------------------------------------------------------------------------ */
/* check segment configuration */
#if defined(GASNET_SEGMENT_FAST) && !defined(GASNET_SEGMENT_LARGE) && !defined(GASNET_SEGMENT_EVERYTHING)
#undef GASNET_SEGMENT_FAST
#define GASNET_SEGMENT_FAST 1
#define GASNETI_SEGMENT_CONFIG FAST
#elif !defined(GASNET_SEGMENT_FAST) && defined(GASNET_SEGMENT_LARGE) && !defined(GASNET_SEGMENT_EVERYTHING)
#undef GASNET_SEGMENT_LARGE
#define GASNET_SEGMENT_LARGE 1
#define GASNETI_SEGMENT_CONFIG LARGE
#elif !defined(GASNET_SEGMENT_FAST) && !defined(GASNET_SEGMENT_LARGE) && defined(GASNET_SEGMENT_EVERYTHING)
#undef GASNET_SEGMENT_EVERYTHING
#define GASNET_SEGMENT_EVERYTHING 1
#define GASNETI_SEGMENT_CONFIG EVERYTHING
#else
#error Segment configuration must be exactly one of (GASNET_SEGMENT_FAST, GASNET_SEGMENT_LARGE, GASNET_SEGMENT_EVERYTHING)
#endif
/* Too early to know if conduit supports PSHM, so safety check below uses this instead. */
#if defined(GASNETI_PSHM_ENABLED)
#define GASNETI_PSHM_CONFIG_ENABLED pshm
#else
#define GASNETI_PSHM_CONFIG_ENABLED nopshm
#endif
/* additional safety check, in case a very smart linker removes all of the checks at the end of this file */
#define gasnetc_Client_Init _CONCAT(_CONCAT(_CONCAT(_CONCAT(_CONCAT(_CONCAT(_CONCAT(_CONCAT(_CONCAT(_CONCAT(_CONCAT( \
gex_Client_Init_GASNET_, \
GASNET_RELEASE_VERSION_MAJOR), \
GASNET_RELEASE_VERSION_MINOR), \
GASNET_RELEASE_VERSION_PATCH), \
GASNETI_THREAD_MODEL), \
GASNETI_PSHM_CONFIG_ENABLED), \
GASNETI_SEGMENT_CONFIG), \
GASNETI_DEBUG_CONFIG), \
GASNETI_TRACE_CONFIG), \
GASNETI_STATS_CONFIG), \
GASNETI_MALLOC_CONFIG), \
GASNETI_SRCLINES_CONFIG)
#define gex_Client_Init gasnetc_Client_Init
/* ------------------------------------------------------------------------------------ */
// Default (read-only) shared-memory MaxMedium value "recommended" to conduits.
// Value of GASNETC_MAX_MEDIUM_NBRHD determines the actual maximum.
// See template-conduit/gasnet_core.h for more info.
#if !GASNETI_PSHM_ENABLED
#define GASNETC_MAX_MEDIUM_NBRHD_DFLT 65536
#elif PLATFORM_ARCH_64
#define GASNETC_MAX_MEDIUM_NBRHD_DFLT 65416
#else
#define GASNETC_MAX_MEDIUM_NBRHD_DFLT 65436
#endif
/* ------------------------------------------------------------------------------------ */
/* GASNet forward definitions, which may override some of the defaults below */
#include <gasnet_core_fwd.h>
#include <gasnet_extended_fwd.h>
#include <gasnet_vis_fwd.h>
#include <gasnet_coll_fwd.h>
#include <gasnet_ratomic_fwd.h>
/* GASNET_PSHM = GASNet conduit is using PSHM */
#ifdef GASNET_PSHM
#undef GASNET_PSHM
#define GASNET_PSHM 1
#define GASNETI_PSHM_P 1
#else
#define GASNETI_PSHM_P 0
#endif
// GASNET_RCV_THREAD = conduit is built with support for a "receive progress thread"
#ifdef GASNET_RCV_THREAD
#undef GASNET_RCV_THREAD
#define GASNET_RCV_THREAD 1
#endif
// GASNET_SND_THREAD = conduit is built with support for a "send progress thread"
#ifdef GASNET_SND_THREAD
#undef GASNET_SND_THREAD
#define GASNET_SND_THREAD 1
#endif
/* GASNETI_CONDUIT_THREADS = GASNet conduit has one or more private threads
which may be used to run conduit and/or client code */
#if defined(GASNETI_CONDUIT_THREADS) && (GASNETI_CONDUIT_THREADS != 1)
#error bad defn of GASNETI_CONDUIT_THREADS
#endif
// GASNET_HIDDEN_AM_CONCURRENCY_LEVEL: non-zero iff the conduit *may* run AM
// handlers on a thread not owned by the client.
//
// gex_System_QueryHiddenAMConcurrencyLevel(): more precise query at runtime
// which can consider things like the environment or library/hardware
// capabilities.
#ifdef GASNET_HIDDEN_AM_CONCURRENCY_LEVEL
// Trust conduit's definitions of macro and function
extern int gex_System_QueryHiddenAMConcurrencyLevel(void);
#elif GASNETI_CONDUIT_THREADS
#define GASNET_HIDDEN_AM_CONCURRENCY_LEVEL 1
#define gex_System_QueryHiddenAMConcurrencyLevel() 1
#else
#define GASNET_HIDDEN_AM_CONCURRENCY_LEVEL 0
#define gex_System_QueryHiddenAMConcurrencyLevel() 0
#endif
/* GASNETI_THREADS = Threads exist at conduit and/or client level,
and/or compiling for a tools-only client with thread-safety
*/
#if GASNETI_CLIENT_THREADS || GASNETI_CONDUIT_THREADS
#define GASNETI_THREADS 1
#define _GASNETI_PARSEQ _PAR
#elif defined(GASNETI_THREADS)
#error bad defn of GASNETI_THREADS
#else
#define _GASNETI_PARSEQ _SEQ
#endif
/* basic utilities used in the headers, which may require GASNETI_THREADS */
#include <gasnet_toolhelp.h>
/* GASNet memory barriers */
#include <gasnet_membar.h>
/* GASNet atomic memory operations */
#include <gasnet_atomicops.h>
/* ------------------------------------------------------------------------------------ */
/* constants */
/* selected constants and simple types */
#include <gasnet_fwd.h>
#ifndef GASNETC_HANDLER_BASE
#define GASNETC_HANDLER_BASE 1
#endif
#ifndef GASNETE_HANDLER_BASE
#define GASNETE_HANDLER_BASE 64
#endif
#ifndef GASNETI_CLIENT_HANDLER_BASE
#define GASNETI_CLIENT_HANDLER_BASE 128
#endif
#ifndef GASNETC_MAX_NUMHANDLERS
#define GASNETC_MAX_NUMHANDLERS 256
#endif
#define GEX_AM_INDEX_BASE GASNETI_CLIENT_HANDLER_BASE
#ifndef GASNET_MAXNODES
/* an integer representing the maximum number of nodes supported in a single GASNet job */
#define GASNET_MAXNODES (0x7FFFFFFFu)
#endif
#ifndef GASNET_MAXEPS
// an integer representing the max supported number of endpoints per process
// should be kept _STRINGIFY()-friendly (e.g. `4095` not `((1<<12)-1)`)
// Defaults and sanity checks
#define GASNETI_MAXEPS_LIMIT 4096 // Maximum due to 12-bit field in TM-pair
#ifndef GASNETC_MAXEPS_MAX
#define GASNETC_MAXEPS_MAX GASNETI_MAXEPS_LIMIT
#elif (GASNETC_MAXEPS_MAX > GASNETI_MAXEPS_LIMIT)
#error GASNETC_MAXEPS_MAX exceeds GASNETI_MAXEPS_LIMIT
#endif
#if (GASNETC_MAXEPS_DFLT > GASNETI_MAXEPS_LIMIT)
#error GASNETC_MAXEPS_DFLT exceeds GASNETI_MAXEPS_LIMIT
#endif
#if !defined(GASNETC_MAXEPS_DFLT)
// Conduit lacks multi-ep support
#define GASNET_MAXEPS 1
#elif !defined(GASNETI_MAXEPS_CONFIGURE)
// No configure-time value provided - use conduit-specific default
#define GASNET_MAXEPS GASNETC_MAXEPS_DFLT
#else
// Take MIN of user's --with-maxeps setting and the maximum
#if (GASNETI_MAXEPS_CONFIGURE <= GASNETC_MAXEPS_MAX)
#define GASNET_MAXEPS GASNETI_MAXEPS_CONFIGURE
#else
#define GASNET_MAXEPS GASNETC_MAXEPS_MAX
#endif
#endif
#endif
#if !defined(GASNET_ALIGNED_SEGMENTS) || \
(defined(GASNET_ALIGNED_SEGMENTS) && GASNET_ALIGNED_SEGMENTS != 0 && GASNET_ALIGNED_SEGMENTS != 1)
/* defined to be 1 if gasnet_init guarantees that the remote-access memory segment will be aligned */
/* at the same virtual address on all nodes. defined to 0 otherwise */
#error GASNet core failed to define GASNET_ALIGNED_SEGMENTS to 0 or 1
#endif
#if GASNET_ALIGNED_SEGMENTS
#define GASNETI_ALIGN_CONFIG align
#else
#define GASNETI_ALIGN_CONFIG noalign
#endif
#if GASNET_PSHM
#define GASNETI_PSHM_CONFIG pshm
#else
#define GASNETI_PSHM_CONFIG nopshm
#endif
#ifndef GASNET_BARRIERFLAG_ANONYMOUS
/* barrier flags */
#define GASNET_BARRIERFLAG_ANONYMOUS 1
#define GASNET_BARRIERFLAG_MISMATCH 2
/* UNNAMED includes ANONYMOUS to yield a trivial default implementation: */
#define GASNETE_BARRIERFLAG_UNNAMED 8
#define GASNET_BARRIERFLAG_UNNAMED (GASNET_BARRIERFLAG_ANONYMOUS|GASNETE_BARRIERFLAG_UNNAMED)
/* reserve bits for use by conduit-specific implementations */
#define GASNETE_BARRIERFLAG_CONDUIT0 0x80000000
#define GASNETE_BARRIERFLAG_CONDUIT1 0x40000000
#endif
/* Errors: GASNET_OK must be zero */
#define GASNET_OK 0
#ifndef _GASNET_ERRORS
#define _GASNET_ERRORS
#define _GASNET_ERR_BASE 10000
#define GASNET_ERR_NOT_INIT (_GASNET_ERR_BASE+1)
#define GASNET_ERR_RESOURCE (_GASNET_ERR_BASE+2)
#define GASNET_ERR_BAD_ARG (_GASNET_ERR_BASE+3)
#define GASNET_ERR_NOT_READY (_GASNET_ERR_BASE+4)
#define GASNET_ERR_BARRIER_MISMATCH (_GASNET_ERR_BASE+5)
#endif
extern const char *gasnet_ErrorName(int);
extern const char *gasnet_ErrorDesc(int);
/* ------------------------------------------------------------------------------------ */
// feature macros
// GASNET_SUPPORTS_AM_CANCEL
// Value indicates revision date of the gex_AM_Cancel() API
//
// History:
// 20240418 - Initial revison
#define GASNET_SUPPORTS_AM_CANCEL 20240418L
// GASNET_SUPPORTS_AM_COMMIT_V2
// Value indicates revision date of the gex_AM_Commit*_v2() APIs
//
// History:
// 20240906 - Initial revison
#define GASNET_SUPPORTS_AM_COMMIT_V2 20240906L
/* ------------------------------------------------------------------------------------ */
/* core types */
// TODO-EX: need comments here?
typedef uint8_t gex_AM_Index_t;
typedef int32_t gex_AM_Arg_t;
/* an opaque type passed to core API handlers which may be used to query message information */
struct gasneti_token_s;
typedef struct gasneti_token_s *gex_Token_t;
struct gasneti_team_member_s;
typedef struct gasneti_team_member_s *gex_TM_t;
#define GEX_TM_INVALID ((gex_TM_t)(uintptr_t)0)
struct gasneti_client_s;
typedef struct gasneti_client_s *gex_Client_t;
#define GEX_CLIENT_INVALID ((gex_Client_t)(uintptr_t)0)
struct gasneti_endpoint_s;
typedef struct gasneti_endpoint_s *gex_EP_t;
#define GEX_EP_INVALID ((gex_EP_t)(uintptr_t)0)
struct gasneti_segment_s;
typedef struct gasneti_segment_s *gex_Segment_t;
#define GEX_SEGMENT_INVALID ((gex_Segment_t)(uintptr_t)0)
struct gasneti_memkind_s;
typedef struct gasneti_memkind_s *gex_MK_t;
#define GEX_MK_INVALID ((gex_MK_t)(uintptr_t)0)
#define GEX_MK_HOST ((gex_MK_t)(uintptr_t)1)
typedef void (*gex_AM_Fn_t)();
/* struct type used to perform handler registration */
typedef struct {
gex_AM_Index_t gex_index; // 0 on input == don't care
gex_AM_Fn_t gex_fnptr;
gex_Flags_t gex_flags;
unsigned int gex_nargs;
// Optional fields (both are "shallow copy")
const void *gex_cdata; // Available to handler
const char *gex_name; // Used in debug messages
} gex_AM_Entry_t;
#if GASNET_DEBUG
#define GASNETI_OBJECT_HEADER_DEBUG gasneti_magic_t _magic;
#else
#define GASNETI_OBJECT_HEADER_DEBUG
#endif
#define GASNETI_OBJECT_HEADER \
GASNETI_OBJECT_HEADER_DEBUG \
const void * _cdata; \
gex_Flags_t _flags;
// Needed to break client/tm0 and client/ep_tbl cycles
struct gasneti_team_member_internal_s;
struct gasneti_endpoint_internal_s;
#ifndef _GEX_CLIENT_T
#define GASNETI_CLIENT_COMMON \
GASNETI_OBJECT_HEADER \
struct gasneti_team_member_internal_s *_tm0; \
const char * _name; \
gasneti_weakatomic32_t _next_ep_index; \
struct gasneti_endpoint_internal_s *_ep_tbl[GASNET_MAXEPS];
typedef struct { GASNETI_CLIENT_COMMON } *gasneti_Client_t;
#if GASNET_DEBUG
extern gasneti_Client_t gasneti_import_client(gex_Client_t _client);
extern gasneti_Client_t gasneti_import_client_valid(gex_Client_t _client);
extern gex_Client_t gasneti_export_client(gasneti_Client_t _real_client);
#else
#define gasneti_import_client(x) ((gasneti_Client_t)(x))
#define gasneti_import_client_valid gasneti_import_client
#define gasneti_export_client(x) ((gex_Client_t)(x))
#endif
#define gex_Client_SetCData(client,val) ((void)(gasneti_import_client_valid(client)->_cdata = (val)))
#define gex_Client_QueryCData(client) ((void*)gasneti_import_client_valid(client)->_cdata)
#define gex_Client_QueryFlags(client) ((gex_Flags_t)gasneti_import_client_valid(client)->_flags)
#define gex_Client_QueryName(client) ((const char*)gasneti_import_client_valid(client)->_name)
#endif
#ifndef _GEX_SEGMENT_T
#define GASNETI_SEGMENT_COMMON \
GASNETI_OBJECT_HEADER \
gasneti_Client_t _client; \
void * _addr; \
void * _ub; \
uintptr_t _size; \
gex_MK_t _kind; \
void * _opaque_mk_use; \
unsigned int _opaque_container_use; \
int _client_allocated;
typedef struct { GASNETI_SEGMENT_COMMON } *gasneti_Segment_t;
#if GASNET_DEBUG
extern gasneti_Segment_t gasneti_import_segment(gex_Segment_t _segment);
extern gasneti_Segment_t gasneti_import_segment_valid(gex_Segment_t _segment);
extern gex_Segment_t gasneti_export_segment(gasneti_Segment_t _real_segment);
#else
#define gasneti_import_segment(x) ((gasneti_Segment_t)(x))
#define gasneti_import_segment_valid gasneti_import_segment
#define gasneti_export_segment(x) ((gex_Segment_t)(x))
#endif
#define gex_Segment_SetCData(seg,val) ((void)(gasneti_import_segment_valid(seg)->_cdata = (val)))
#define gex_Segment_QueryCData(seg) ((void*)gasneti_import_segment_valid(seg)->_cdata)
#define gex_Segment_QueryClient(seg) gasneti_export_client(gasneti_import_segment_valid(seg)->_client)
#define gex_Segment_QueryFlags(seg) ((gex_Flags_t)gasneti_import_segment_valid(seg)->_flags)
#define gex_Segment_QueryAddr(seg) ((void*)gasneti_import_segment_valid(seg)->_addr)
#define gex_Segment_QuerySize(seg) ((uintptr_t)gasneti_import_segment_valid(seg)->_size)
#endif
#ifndef _GEX_EP_T
#define GASNETI_EP_COMMON \
GASNETI_OBJECT_HEADER \
gasneti_Client_t _client; \
gasneti_Segment_t _segment; \
gex_EP_Capabilities_t _caps, _orig_caps; \
gex_Rank_t _index; \
gex_AM_Entry_t _amtbl[GASNETC_MAX_NUMHANDLERS]; \
gasneti_mutex_t _amtbl_lock;
#ifdef __cplusplus // ensure this struct is anonymous to prevent C++ linkage issues
#define gasneti_endpoint_internal_s
#endif
typedef struct gasneti_endpoint_internal_s { GASNETI_EP_COMMON } *gasneti_EP_t;
#if GASNET_DEBUG
extern gasneti_EP_t gasneti_import_ep(gex_EP_t _ep);
extern gasneti_EP_t gasneti_import_ep_valid(gex_EP_t _ep);
extern gex_EP_t gasneti_export_ep(gasneti_EP_t _real_ep);
#else
#define gasneti_import_ep(x) ((gasneti_EP_t)(x))
#define gasneti_import_ep_valid gasneti_import_ep
#define gasneti_export_ep(x) ((gex_EP_t)(x))
#endif
#define gex_EP_SetCData(ep,val) ((void)(gasneti_import_ep_valid(ep)->_cdata = (val)))
#define gex_EP_QueryCData(ep) ((void*)gasneti_import_ep_valid(ep)->_cdata)
#define gex_EP_QueryClient(ep) gasneti_export_client(gasneti_import_ep_valid(ep)->_client)
#define gex_EP_QueryFlags(ep) ((gex_Flags_t)gasneti_import_ep_valid(ep)->_flags)
#define gex_EP_QuerySegment(ep) gasneti_export_segment(gasneti_import_ep_valid(ep)->_segment)
#define gex_EP_QueryIndex(ep) ((gex_EP_Index_t)gasneti_import_ep_valid(ep)->_index)
#endif
#ifndef _GEX_TM_T
#define GASNETI_TM_COMMON \
GASNETI_OBJECT_HEADER \
gasneti_EP_t _ep; \
gex_Rank_t _rank; \
gex_Rank_t _size; \
void * _coll_team; \
gex_Rank_t * _rank_map; \
gex_EP_Index_t * _index_map;
#ifdef __cplusplus // ensure this struct is anonymous to prevent C++ linkage issues
#define gasneti_team_member_internal_s
#endif
typedef struct gasneti_team_member_internal_s { GASNETI_TM_COMMON } *gasneti_TM_t;
#if GASNET_DEBUG
extern gasneti_TM_t gasneti_import_tm(gex_TM_t _tm);
extern gasneti_TM_t gasneti_import_tm_nonpair(gex_TM_t _tm);
extern gex_TM_t gasneti_export_tm(gasneti_TM_t _real_tm);
#else
#define gasneti_import_tm(x) ((gasneti_TM_t)(x))
#define gasneti_import_tm_nonpair(x) ((gasneti_TM_t)(x))
#define gasneti_export_tm(x) ((gex_TM_t)(x))
#endif
#define gex_TM_SetCData(tm,val) ((void)(gasneti_import_tm_nonpair(tm)->_cdata = (val)))
#define gex_TM_QueryCData(tm) ((void*)gasneti_import_tm_nonpair(tm)->_cdata)
#define gex_TM_QueryClient(tm) gasneti_export_client(gasneti_import_tm_nonpair(tm)->_ep->_client)
#define gex_TM_QueryEP(tm) gasneti_export_ep(gasneti_import_tm_nonpair(tm)->_ep)
#define gex_TM_QueryFlags(tm) ((gex_Flags_t)gasneti_import_tm_nonpair(tm)->_flags)
#define gex_TM_QueryRank(tm) ((gex_Rank_t)gasneti_import_tm_nonpair(tm)->_rank)
#define gex_TM_QuerySize(tm) ((gex_Rank_t)gasneti_import_tm_nonpair(tm)->_size)
#endif
// TODO-EX: remove these legacy checks
#ifdef _GASNET_NODE_T
#error "out-of-date #define of _GASNET_NODE_T"
#endif
#ifdef _GASNET_HANDLER_T
#error "out-of-date #define of _GASNET_HANDLER_T"
#endif
#ifdef _GASNET_TOKEN_T
#error "out-of-date #define of _GASNET_TOKEN_T"
#endif
#ifdef _GASNET_HANDLERARG_T
#error "out-of-date #define of _GASNET_HANDLERARG_T"
#endif
#ifdef _GASNET_REGISTER_VALUE_T
#error "out-of-date #define of _GASNET_REGISTER_VALUE_T"
#endif
#ifdef _GASNET_HANDLE_T
#error "out-of-date #define of _GASNET_HANDLE_T"
#endif
#ifdef _GASNET_HANDLERENTRY_T
#error "out-of-date #define of _GASNET_HANDLERENTRY_T"
#endif
// TM-pair encoding macros
// Packed bits as [rem:loc:reserved:tag] = [12:12:7:1]
// Note: the 7 reserved bits will eventually be needed for client index
// Note: this fits in 32 bits, but LP64 could have wider (or better aligned?) fields
// Alternatively, gex_TM_t might be uint64_t to provide wide fields even on ILP32
#define GASNETI_TM_PAIR_TAG_WIDTH 1
#define GASNETI_TM_PAIR_RSV_WIDTH 7
#define GASNETI_TM_PAIR_IDX_WIDTH 12
#define GASNETI_TM_PAIR_IDX_MASK ((1<<GASNETI_TM_PAIR_IDX_WIDTH)-1)
#define GASNETI_TM_PAIR_LOC_IDX_SHIFT (GASNETI_TM_PAIR_TAG_WIDTH + \
GASNETI_TM_PAIR_RSV_WIDTH)
#define GASNETI_TM_PAIR_REM_IDX_SHIFT (GASNETI_TM_PAIR_TAG_WIDTH + \
GASNETI_TM_PAIR_RSV_WIDTH + \
GASNETI_TM_PAIR_IDX_WIDTH)
// TM-pair type is integral, distinct from pointer types used for non-pair case
// This is NOT a object type, but must masquerade as TM including pointer swizzling
typedef uintptr_t gasneti_TM_Pair_t;
#if GASNET_DEBUG
extern gasneti_TM_Pair_t gasneti_import_tm_pair(gex_TM_t _tm_pair);
extern gex_TM_t gasneti_export_tm_pair(gasneti_TM_Pair_t _real_tm_pair);
#else
#define gasneti_import_tm_pair(x) ((gasneti_TM_Pair_t)(x))
#define gasneti_export_tm_pair(x) ((gex_TM_t)(x))
#endif
// Encode a TM-pair
GASNETI_INLINE(gex_TM_Pair)
gex_TM_t gex_TM_Pair(gex_EP_t _loc_ep, gex_EP_Index_t _rem_idx)
{
gex_EP_Index_t _loc_idx = gex_EP_QueryIndex(_loc_ep);
gasneti_static_assert(GASNET_MAXEPS <= (1 << GASNETI_TM_PAIR_IDX_WIDTH));
gasneti_assert_uint(_loc_idx ,<, GASNET_MAXEPS);
gasneti_assert_uint(_rem_idx ,<, GASNET_MAXEPS);
gasneti_TM_Pair_t _i_pair = 1 // TAG bit
| (_loc_idx << GASNETI_TM_PAIR_LOC_IDX_SHIFT)
| (_rem_idx << GASNETI_TM_PAIR_REM_IDX_SHIFT);
return gasneti_export_tm_pair(_i_pair);
}
/* struct type used to return info from gex_Token_Info() */
typedef struct {
gex_Rank_t gex_srcrank;
gex_EP_t gex_ep;
const gex_AM_Entry_t *gex_entry;
int gex_is_req;
int gex_is_long;
} gex_Token_Info_t;
/* constants to request specific info from gex_Token_Info() */
typedef unsigned int gex_TI_t;
#define GEX_TI_SRCRANK ((gex_TI_t)1<<0)
#define GEX_TI_ENTRY ((gex_TI_t)1<<1)
#define GEX_TI_IS_REQ ((gex_TI_t)1<<2)
#define GEX_TI_IS_LONG ((gex_TI_t)1<<3)
#define GEX_TI_EP ((gex_TI_t)1<<4)
#define GEX_TI_ALL (((gex_TI_t)1<<5) - 1)
// Default implementation
#ifndef gex_Token_Info
#define gex_Token_Info gasnetc_Token_Info
#endif
extern gex_TI_t gex_Token_Info(
gex_Token_t _token,
gex_Token_Info_t *_info,
gex_TI_t _mask);
#ifndef _GASNET_SEGINFO_T
#define _GASNET_SEGINFO_T
typedef struct gasneti_seginfo_s {
void *addr;
uintptr_t size;
} gasnet_seginfo_t;
#endif
#ifndef _GASNET_NODEINFO_T
#define _GASNET_NODEINFO_T
typedef struct gasneti_nodeinfo_s {
gex_Rank_t host; /* 0-based identifier for procs on same compute node */
gex_Rank_t supernode; /* 0-based identifier for procs which comprise a shared-memory supernode */
#if GASNET_PSHM
/* Value one must add to find locally mapped address, if any. */
uintptr_t offset;
uintptr_t auxoffset; // TODO-EX: this needs to move elsewhere
#endif
} gasnet_nodeinfo_t;
#endif
#ifndef _GASNET_THREADINFO_T
#define _GASNET_THREADINFO_T
typedef void *gasnet_threadinfo_t;
#endif
typedef const struct {
gex_Rank_t gex_jobrank;
// Avert your eyes - space below is reserved for internal use
// Nothing to see here (yet)
} gex_RankInfo_t;
extern void gex_System_QueryNbrhdInfo(
gex_RankInfo_t **_info_p,
gex_Rank_t *_info_count_p,
gex_Rank_t *_my_info_index_p);
extern void gex_System_QueryHostInfo(
gex_RankInfo_t **_info_p,
gex_Rank_t *_info_count_p,
gex_Rank_t *_my_info_index_p);
extern void gex_System_QueryMyPosition(
gex_Rank_t *_nbrhd_set_size_p,
gex_Rank_t *_nbrhd_set_rank_p,
gex_Rank_t *_host_set_size_p,
gex_Rank_t *_host_set_rank_p);
extern int gex_EP_Create(
gex_EP_t *_ep_p,
gex_Client_t _client,
gex_EP_Capabilities_t _capabilities,
gex_Flags_t _flags);
extern int gex_EP_RegisterHandlers(
gex_EP_t _ep,
gex_AM_Entry_t *_table,
size_t _numentries);
extern int gex_EP_BindSegment(
gex_EP_t _ep,
gex_Segment_t _segment,
gex_Flags_t _flags);
extern int gex_EP_PublishBoundSegment(
gex_TM_t _tm,
gex_EP_t *_eps,
size_t _num_eps,
gex_Flags_t _flags);
// DEPRECATED. Superseded by gex_EP_QueryBoundSegmentNB
extern int gex_Segment_QueryBound(
gex_TM_t _tm,
gex_Rank_t _rank,
void **_owneraddr_p,
void **_localaddr_p,
uintptr_t *_size_p);
extern gex_Event_t gex_EP_QueryBoundSegmentNB(
gex_TM_t _tm,
gex_Rank_t _rank,
void **_owneraddr_p,
void **_localaddr_p,
uintptr_t *_size_p,
gex_Flags_t _flags) GASNETI_WARN_UNUSED_RESULT;
extern int gex_Segment_Attach(
gex_Segment_t *_segment_p,
gex_TM_t _tm,
uintptr_t _length);
extern int gex_Segment_Create(
gex_Segment_t *_segment_p,
gex_Client_t _client,
gex_Addr_t _address,
uintptr_t _length,
gex_MK_t _kind,
gex_Flags_t _flags);
extern void gex_Segment_Destroy(
gex_Segment_t _segment,
gex_Flags_t _flags);
/* ------------------------------------------------------------------------------------ */
/* extended types */
/* the largest unsigned integer type that can fit entirely in a single CPU register for the current architecture and ABI. */
/* SIZEOF_GEX_RMA_VALUE_T is a preprocess-time literal integer constant (i.e. not "sizeof()")indicating the size of this type in bytes */
// Bug 3953: Our implementation guarantees a 64-bit gex_RMA_Value_t, although this is not currently required by the GASNet spec
typedef uint64_t gex_RMA_Value_t;
#define SIZEOF_GEX_RMA_VALUE_T 8
#ifndef _GEX_MEMVEC_T
#define _GEX_MEMVEC_T
typedef struct {
void *gex_addr; // TODO-EX: gex_Addr_t
size_t gex_len;
} gex_Memvec_t;
#endif
#define _GEX_MAKE_DT_ENUM(name) gasneti_dt_idx_##name = (_GEX_DT_##name)
typedef enum {
_GEX_MAKE_DT_ENUM(I32),
_GEX_MAKE_DT_ENUM(U32),
_GEX_MAKE_DT_ENUM(I64),
_GEX_MAKE_DT_ENUM(U64),
_GEX_MAKE_DT_ENUM(FLT),
_GEX_MAKE_DT_ENUM(DBL),
_GEX_MAKE_DT_ENUM(USER)
} gasneti_dt_idx_t;
#undef _GEX_MAKE_DT_ENUM
#define _GEX_MAKE_OP_ENUM(name) gasneti_op_idx_##name = (_GEX_OP_##name)
typedef enum {
_GEX_MAKE_OP_ENUM(AND),
_GEX_MAKE_OP_ENUM(OR),
_GEX_MAKE_OP_ENUM(XOR),
_GEX_MAKE_OP_ENUM(ADD),
_GEX_MAKE_OP_ENUM(SUB),
_GEX_MAKE_OP_ENUM(MULT),
_GEX_MAKE_OP_ENUM(MIN),
_GEX_MAKE_OP_ENUM(MAX),
_GEX_MAKE_OP_ENUM(INC),
_GEX_MAKE_OP_ENUM(DEC),
_GEX_MAKE_OP_ENUM(FAND),
_GEX_MAKE_OP_ENUM(FOR),
_GEX_MAKE_OP_ENUM(FXOR),
_GEX_MAKE_OP_ENUM(FADD),
_GEX_MAKE_OP_ENUM(FSUB),
_GEX_MAKE_OP_ENUM(FMULT),
_GEX_MAKE_OP_ENUM(FMIN),
_GEX_MAKE_OP_ENUM(FMAX),
_GEX_MAKE_OP_ENUM(FINC),
_GEX_MAKE_OP_ENUM(FDEC),
_GEX_MAKE_OP_ENUM(SET),
_GEX_MAKE_OP_ENUM(GET),
_GEX_MAKE_OP_ENUM(SWAP),
_GEX_MAKE_OP_ENUM(FCAS),
_GEX_MAKE_OP_ENUM(CAS),
_GEX_MAKE_OP_ENUM(USER),
_GEX_MAKE_OP_ENUM(USER_NC)
} gasneti_op_idx_t;
#undef _GEX_MAKE_OP_ENUM
/* ------------------------------------------------------------------------------------ */
// Error checking (or pass-through) for AM payload queries
#if GASNET_DEBUG
extern size_t gex_AM_MaxRequestMedium(
gex_TM_t _tm, gex_Rank_t _rank,
const gex_Event_t *_lc_opt, gex_Flags_t _flags,
unsigned int _nargs);
extern size_t gex_AM_MaxReplyMedium(
gex_TM_t _tm, gex_Rank_t _rank,
const gex_Event_t *_lc_opt, gex_Flags_t _flags,
unsigned int _nargs);
extern size_t gex_AM_MaxRequestLong(
gex_TM_t _tm, gex_Rank_t _rank,
const gex_Event_t *_lc_opt, gex_Flags_t _flags,
unsigned int _nargs);
extern size_t gex_AM_MaxReplyLong(
gex_TM_t _tm, gex_Rank_t _rank,
const gex_Event_t *_lc_opt, gex_Flags_t _flags,
unsigned int _nargs);
extern size_t gex_Token_MaxReplyMedium(
gex_Token_t _token,
const gex_Event_t *_lc_opt, gex_Flags_t _flags,
unsigned int _nargs);
extern size_t gex_Token_MaxReplyLong(
gex_Token_t _token,
const gex_Event_t *_lc_opt, gex_Flags_t _flags,
unsigned int _nargs);
#else
#define gex_AM_MaxRequestMedium gasnetc_AM_MaxRequestMedium
#define gex_AM_MaxReplyMedium gasnetc_AM_MaxReplyMedium
#define gex_AM_MaxRequestLong gasnetc_AM_MaxRequestLong
#define gex_AM_MaxReplyLong gasnetc_AM_MaxReplyLong
#define gex_Token_MaxReplyMedium gasnetc_Token_MaxReplyMedium
#define gex_Token_MaxReplyLong gasnetc_Token_MaxReplyLong
#endif
/* ------------------------------------------------------------------------------------ */
/* Active Message Source Descriptor */
struct gasneti_srcdesc_s;
typedef struct gasneti_srcdesc_s *gex_AM_SrcDesc_t;
#define GEX_AM_SRCDESC_NO_OP ((gex_AM_SrcDesc_t)(uintptr_t)0)
#ifndef _GASNETI_AM_SRCDESC_T
typedef struct gasneti_AM_SrcDesc {
#if GASNET_DEBUG
#define GASNETI_AM_SRCDESC_MAGIC GASNETI_MAKE_MAGIC('A','S','D','t')
#define GASNETI_AM_SRCDESC_BAD_MAGIC GASNETI_MAKE_BAD_MAGIC('A','S','D','t')
gasneti_magic_t _magic;
int _isreq;
int _category; // true type: gasneti_category_t
#endif
void * _addr;
size_t _size;
// TODO: Want to omit _thread field when unused, but GASNETI_THREADINFO_OPT not defined until much later
gasnet_threadinfo_t _thread;
void * _tofree; // passed to gasneti_free() when sd reset
void * _gex_buf; // gasnet-owned buffer, if any
union {
struct {
gex_TM_t _tm;
gex_Rank_t _rank;
} _request;
struct {
gex_Token_t _token;
} _reply;
} _dest; // (tm,rank) or token, as passed to Prepare
void * _dest_addr; // Long only
void * _void_p; // PSHM and conduit-independent pointer
gex_Event_t * _lc_opt;
gex_Flags_t _flags;
int8_t _nargs;
int8_t _is_nbrhd;
#if GASNET_PSHM
struct {
gex_Rank_t _pshmrank; // should be gasneti_pshm_rank_t
gex_Rank_t _jobrank;
int8_t _loopback;
} _pshm;
#endif
#ifdef GASNETI_AM_SRCDESC_EXTRA
GASNETI_AM_SRCDESC_EXTRA
#endif
} *gasneti_AM_SrcDesc_t;
#if GASNET_DEBUG
extern gasneti_AM_SrcDesc_t gasneti_import_srcdesc(gex_AM_SrcDesc_t _srcdesc);
extern gasneti_AM_SrcDesc_t gasneti_import_srcdesc_valid(gex_AM_SrcDesc_t _srcdesc);
extern gex_AM_SrcDesc_t gasneti_export_srcdesc(gasneti_AM_SrcDesc_t _real_srcdesc);
#else
#define gasneti_import_srcdesc(x) ((gasneti_AM_SrcDesc_t)(x))
#define gasneti_import_srcdesc_valid gasneti_import_srcdesc
#define gasneti_export_srcdesc(x) ((gex_AM_SrcDesc_t)(x))
#endif
#define gex_AM_SrcDescAddr(sd) ((void*)gasneti_import_srcdesc_valid(sd)->_addr)
#define gex_AM_SrcDescSize(sd) ((size_t)gasneti_import_srcdesc_valid(sd)->_size)
#ifndef gex_AM_CancelRequestMedium
extern int gasnetc_AM_CancelRequestMedium(
gex_AM_SrcDesc_t _sd,
gex_Flags_t _flags);
#define gex_AM_CancelRequestMedium(sd,flags) gasnetc_AM_CancelRequestMedium(sd,flags)
#endif
#ifndef gex_AM_CancelReplyMedium
extern int gasnetc_AM_CancelReplyMedium(
gex_AM_SrcDesc_t _sd,
gex_Flags_t _flags);
#define gex_AM_CancelReplyMedium(sd,flags) gasnetc_AM_CancelReplyMedium(sd,flags)
#endif
#ifndef gex_AM_CancelRequestLong
extern int gasnetc_AM_CancelRequestLong(
gex_AM_SrcDesc_t _sd,
gex_Flags_t _flags);
#define gex_AM_CancelRequestLong(sd,flags) gasnetc_AM_CancelRequestLong(sd,flags)
#endif
#ifndef gex_AM_CancelReplyLong
extern int gasnetc_AM_CancelReplyLong(
gex_AM_SrcDesc_t _sd,
gex_Flags_t _flags);
#define gex_AM_CancelReplyLong(sd,flags) gasnetc_AM_CancelReplyLong(sd,flags)
#endif
#endif
/* ------------------------------------------------------------------------------------ */
/* progress threads */
// default trivial implementation
#ifndef gex_System_QueryProgressThreads
#define gex_System_QueryProgressThreads gasneti_query_progress_threads
#endif
typedef struct {
const char * gex_device_list;
unsigned int gex_thread_roles;
void * (*gex_progress_fn) (void *);
void * gex_progress_arg;
} gex_ProgressThreadInfo_t;
#define GEX_THREAD_ROLE_RCV (1U << 0)
#define GEX_THREAD_ROLE_SND (1U << 1)
extern int gex_System_QueryProgressThreads(
gex_Client_t _client,
unsigned int *_count_p,
const gex_ProgressThreadInfo_t **_info_p,
gex_Flags_t _flags);
/* ------------------------------------------------------------------------------------ */
/* conditional and internal flags (others in gasnet_fwd.h) */
#define GEX_FLAG_PEER_NEVER_NBRHD (1U << 14)
#if GASNET_PSHM
#define GEX_FLAG_PEER_NEVER_SELF (1U << 15)
#else
#define GEX_FLAG_PEER_NEVER_SELF GEX_FLAG_PEER_NEVER_NBRHD
#endif
#if defined(_IN_GASNET_INTERNAL_H)
#define GASNETI_FLAG_LC_OPT_IN (1U << 31)
#define GASNETI_FLAG_COLL_SUBORDINATE (1U << 30)
#define GASNETI_FLAG_PEER_SEG_AUX (1U << 29)
#endif
#define GASNETI_FLAG_INIT_LEGACY (1U << 31)
#if GASNET_DEBUG
#define GASNETI_FLAG_G2EX_DEBUG (1U << 30)
#else
#define GASNETI_FLAG_G2EX_DEBUG 0
#endif
/* ------------------------------------------------------------------------------------ */
// GASNETC_MAX_{ARGS,MEDIUM,LONG}_NBRHD
// These are compile-time constants used by the "neighborhood" AM support,
// which includes "loopback" (same-process) and "AMPSHM" (shared-memory).
// As described below, these defaults are not suitable for all conduits.
// Any/all conduit-specific overrides belong in gasnet_core_fwd.h.
#ifndef GASNETC_MAX_ARGS_NBRHD
// Assumes gex_AM_MaxArgs() is a compile time constant.
// If not, the conduit must define GASNETC_MAX_ARGS_NBRHD to a compile-time
// constant in its gasnet_core_fwd.h.
// The value may be a conservative upper-bound if the real value cannot be
// known until run time (at the cost of wasted memory).
#define GASNETC_MAX_ARGS_NBRHD (gex_AM_MaxArgs())
#endif
#ifndef GASNETC_MAX_MEDIUM_NBRHD
// This default assumes gex_AM_LUB{Request,Reply}Medium() expand to their
// *greatest* upper-bound. If that is not true for a given conduit, then it
// must define GASNETC_MAX_MEDIUM_NBRHD in its gasnet_core_fwd.h to an
// expression which evaluates to the correct value no later than execution
// of gasneti_pshm_init().
// The value may be a conservative upper-bound if the real value cannot be
// known that early (at the cost of wasted memory).
#define GASNETC_MAX_MEDIUM_NBRHD MAX(gex_AM_LUBRequestMedium(),gex_AM_LUBReplyMedium())
#endif
#ifndef GASNETC_MAX_LONG_NBRHD
// Same assumption and usage as GASNETC_MAX_MEDIUM_NBRHD, above, but for Long.
#define GASNETC_MAX_LONG_NBRHD MAX(gex_AM_LUBRequestLong(),gex_AM_LUBReplyLong())
#endif