Legion Runtime
legion_types.h
Go to the documentation of this file.
1 /* Copyright 2024 Stanford University, NVIDIA Corporation
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __LEGION_TYPES_H__
17 #define __LEGION_TYPES_H__
18 
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <assert.h>
26 #include <string.h>
27 #include <stdint.h>
28 #include <limits.h>
29 
30 #include <map>
31 #include <set>
32 #include <list>
33 #include <limits>
34 #include <deque>
35 #include <vector>
36 #include <typeinfo>
37 #include <type_traits>
38 #include <unordered_set>
39 #include <unordered_map>
40 
41 #include "legion/legion_config.h"
42 
43 // Make sure we have the appropriate defines in place for including realm
44 #include "realm.h"
45 #include "realm/dynamic_templates.h"
46 
47 // this may be set before including legion.h to eliminate deprecation warnings
48 // for just the Legion API
49 #ifndef LEGION_DEPRECATED
50 #if __cplusplus >= 201402L
51 #define LEGION_DEPRECATED(x) [[deprecated(x)]]
52 #else
53 #define LEGION_DEPRECATED(x)
54 #endif
55 #endif
56 
57 // Macros for disabling and re-enabling deprecated warnings
58 #if defined(__GNUC__)
59 #define LEGION_DISABLE_DEPRECATED_WARNINGS \
60  _Pragma("GCC diagnostic push") \
61  _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
62 #define LEGION_REENABLE_DEPRECATED_WARNINGS \
63  _Pragma("GCC diagnostic pop")
64 #elif defined(__clang__)
65 #define LEGION_DISABLE_DEPRECATED_WARNINGS \
66  _Pragma("clang diagnostic push") \
67  _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
68 #define LEGION_REENABLE_DEPRECATED_WARNINGS \
69  _Pragma("clang diagnostic pop")
70 #elif defined(__PGIC__)
71 #define LEGION_DISABLE_DEPRECATED_WARNINGS \
72  _Pragma("warning (push)") \
73  _Pragma("diag_suppress 1445")
74 #define LEGION_REENABLE_DEPRECATED_WARNINGS \
75  _Pragma("warning (pop)")
76 #elif defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)
77 #define LEGION_DISABLE_DEPRECATED_WARNINGS \
78  _Pragma("warning push") \
79  _Pragma("warning disable 1478")
80 #define LEGION_REENABLE_DEPRECATED_WARNINGS \
81  _Pragma("warning pop")
82 #else
83 #warning "Don't know how to suppress deprecated warnings for this compiler"
84 #define LEGION_DISABLE_DEPRECATED_WARNINGS
85 #define LEGION_REENABLE_DEPRECATED_WARNINGS
86 #endif
87 
88 // If we're doing full LEGION_SPY then turn off event pruning
89 #ifdef LEGION_SPY
90 #ifndef LEGION_DISABLE_EVENT_PRUNING
91 #define LEGION_DISABLE_EVENT_PRUNING
92 #endif
93 #endif
94 
95 // forward declarations from bitmask.h
96 template<typename T, unsigned int MAX,
97  unsigned SHIFT, unsigned MASK> class BitMask;
98 template<typename T, unsigned int MAX,
99  unsigned SHIFT, unsigned MASK> class TLBitMask;
100 #ifdef __SSE2__
101 template<unsigned int MAX> class SSEBitMask;
102 template<unsigned int MAX> class SSETLBitMask;
103 #endif
104 #ifdef __AVX__
105 template<unsigned int MAX> class AVXBitMask;
106 template<unsigned int MAX> class AVXTLBitMask;
107 #endif
108 #ifdef __ALTIVEC__
109 template<unsigned int MAX> class PPCBitMask;
110 template<unsigned int MAX> class PPCTLBitMask;
111 #endif
112 #ifdef __ARM_NEON
113 template<unsigned int MAX> class NeonBitMask;
114 template<unsigned int MAX> class NeonTLBitMask;
115 #endif
116 template<typename DT, unsigned BLOAT, bool BIDIR> class CompoundBitMask;
117 
118 namespace BindingLib { class Utility; } // BindingLib namespace
119 
120 namespace Legion {
121 
122  typedef ::legion_error_t LegionErrorType;
123  typedef ::legion_privilege_mode_t PrivilegeMode;
124  typedef ::legion_allocate_mode_t AllocateMode;
125  typedef ::legion_coherence_property_t CoherenceProperty;
126  typedef ::legion_region_flags_t RegionFlags;
127  typedef ::legion_projection_type_t ProjectionType;
128  typedef ::legion_partition_kind_t PartitionKind;
129  typedef ::legion_external_resource_t ExternalResource;
130  typedef ::legion_timing_measurement_t TimingMeasurement;
131  typedef ::legion_dependence_type_t DependenceType;
132  typedef ::legion_mappable_type_id_t MappableType;
133  typedef ::legion_file_mode_t LegionFileMode;
134  typedef ::legion_execution_constraint_t ExecutionConstraintKind;
135  typedef ::legion_layout_constraint_t LayoutConstraintKind;
136  typedef ::legion_equality_kind_t EqualityKind;
137  typedef ::legion_dimension_kind_t DimensionKind;
138  typedef ::legion_isa_kind_t ISAKind;
139  typedef ::legion_resource_constraint_t ResourceKind;
140  typedef ::legion_launch_constraint_t LaunchKind;
141  typedef ::legion_specialized_constraint_t SpecializedKind;
142 
143  // Forward declarations for user level objects
144  // legion.h
145  class IndexSpace;
146  template<int DIM, typename T> class IndexSpaceT;
147  class IndexPartition;
148  template<int DIM, typename T> class IndexPartitionT;
149  class FieldSpace;
150  class LogicalRegion;
151  template<int DIM, typename T> class LogicalRegionT;
152  class LogicalPartition;
153  template<int DIM, typename T> class LogicalPartitionT;
154  class IndexAllocator;
155  class FieldAllocator;
156  class UntypedBuffer;
157  class ArgumentMap;
158  class Lock;
159  struct LockRequest;
160  class Grant;
161  class PhaseBarrier;
162  struct RegionRequirement;
163  struct OutputRequirement;
164  struct IndexSpaceRequirement;
165  struct FieldSpaceRequirement;
166  struct TaskLauncher;
167  struct IndexTaskLauncher;
168  typedef IndexTaskLauncher IndexLauncher; // for backwards compatibility
169  struct InlineLauncher;
170  struct CopyLauncher;
171  struct AcquireLauncher;
172  struct ReleaseLauncher;
173  struct FillLauncher;
174  struct LayoutConstraintRegistrar;
175  struct TaskVariantRegistrar;
176  class Future;
177  class FutureMap;
178  class Predicate;
179  class PhysicalRegion;
180  class OutputRegion;
181  class ExternalResources;
182  class UntypedDeferredValue;
183  template<typename>
184  class DeferredValue;
185  template<typename, bool>
186  class DeferredReduction;
187  template<typename, int, typename, bool>
188  class DeferredBuffer;
189  template<typename COORD_T>
190  class UntypedDeferredBuffer;
191  template<PrivilegeMode,typename,int,typename,typename,bool>
192  class FieldAccessor;
193  template<typename, bool, int, typename, typename, bool>
194  class ReductionAccessor;
195  template<typename, int, typename, typename, bool>
196  class PaddingAccessor;
197 #ifdef LEGION_MULTI_REGION_ACCESSOR
198  template<typename, int,typename,typename,bool,bool,int>
199  class MultiRegionAccessor;
200 #endif
201  template<typename,int,typename,typename>
203  namespace ArraySyntax {
204  template<typename, PrivilegeMode> class AccessorRefHelper;
205  template<typename> class AffineRefHelper;
206  }
207  class PieceIterator;
208  template<int,typename>
209  class PieceIteratorT;
210  template<PrivilegeMode,typename,int,typename>
211  class SpanIterator;
212  struct InputArgs;
214  class ProjectionFunctor;
215  class ShardingFunctor;
216  class Task;
217  class Copy;
218  class InlineMapping;
219  class Acquire;
220  class Release;
221  class Close;
222  class Fill;
223  class Partition;
224  class MustEpoch;
225  class PointTransformFunctor;
226  class Runtime;
227  class LegionHandshake;
228  class MPILegionHandshake;
229  // For backwards compatibility
230  typedef Runtime HighLevelRuntime;
231  // Helper for saving instantiated template functions
232  struct SerdezRedopFns;
233  // Some typedefs for making things nicer for users with C++11 support
234  template<typename FT, int N, typename T = ::legion_coord_t>
235  using GenericAccessor = Realm::GenericAccessor<FT,N,T>;
236  template<typename FT, int N, typename T = ::legion_coord_t>
237  using AffineAccessor = Realm::AffineAccessor<FT,N,T>;
238  template<typename FT, int N, typename T = ::legion_coord_t>
239  using MultiAffineAccessor = Realm::MultiAffineAccessor<FT,N,T>;
240 
241  // Forward declarations for wrapper tasks
242  // legion.h
243  class LegionTaskWrapper;
244  class LegionSerialization;
245 
246  // Forward declarations for C wrapper objects
247  // legion_c_util.h
248  class TaskResult;
249  class CObjectWrapper;
250 
251  // legion_domain.h
252  class DomainPoint;
253  class Domain;
254  class IndexSpaceAllocator;
255 
256  // legion_utilities.h
257  class Serializer;
258  class Deserializer;
259 
260  // legion_constraint.h
261  class ISAConstraint;
262  class ProcessorConstraint;
263  class ResourceConstraint;
264  class LaunchConstraint;
265  class ColocationConstraint;
266  class ExecutionConstraintSet;
267 
268  class SpecializedConstraint;
269  class MemoryConstraint;
270  class FieldConstraint;
271  class PaddingConstraint;
272  class OrderingConstraint;
273  class TilingConstraint;
274  class DimensionConstraint;
275  class AlignmentConstraint;
276  class OffsetConstraint;
277  class PointerConstraint;
278  class LayoutConstraintSet;
279  class TaskLayoutConstraintSet;
280 
281  namespace Mapping {
282  class PhysicalInstance;
283  class CollectiveView;
284  class MapperEvent;
285  class ProfilingRequestSet;
286  class Mapper;
287  class MapperRuntime;
288  class AutoLock;
289  class DefaultMapper;
290  class ShimMapper;
291  class TestMapper;
292  class DebugMapper;
293  class ReplayMapper;
294 
295  // The following types are effectively overlaid on the Realm versions
296  // to allow for Legion-specific profiling measurements
297  enum ProfilingMeasurementID {
298  PMID_LEGION_FIRST = Realm::PMID_REALM_LAST,
299  PMID_RUNTIME_OVERHEAD,
300  };
301  };
302 
303  namespace Internal {
304 
305  enum OpenState {
306  NOT_OPEN = 0,
307  OPEN_READ_ONLY = 1,
308  OPEN_READ_WRITE = 2, // unknown dirty information below
309  OPEN_REDUCE = 3, // make sure to check reduction value
310  };
311 
312  // Internal reduction operators
313  // Currently we don't use any, but 0 is reserved
314  enum {
315  REDOP_ID_AVAILABLE = 1,
316  };
317 
318  // Realm dependent partitioning kinds
319  enum DepPartOpKind {
320  DEP_PART_UNION = 0, // a single union
321  DEP_PART_UNIONS = 1, // many parallel unions
322  DEP_PART_UNION_REDUCTION = 2, // union reduction to a single space
323  DEP_PART_INTERSECTION = 3, // a single intersection
324  DEP_PART_INTERSECTIONS = 4, // many parallel intersections
325  DEP_PART_INTERSECTION_REDUCTION = 5, // intersection reduction to a space
326  DEP_PART_DIFFERENCE = 6, // a single difference
327  DEP_PART_DIFFERENCES = 7, // many parallel differences
328  DEP_PART_EQUAL = 8, // an equal partition operation
329  DEP_PART_BY_FIELD = 9, // create a partition from a field
330  DEP_PART_BY_IMAGE = 10, // create partition by image
331  DEP_PART_BY_IMAGE_RANGE = 11, // create partition by image range
332  DEP_PART_BY_PREIMAGE = 12, // create partition by preimage
333  DEP_PART_BY_PREIMAGE_RANGE = 13, // create partition by preimage range
334  DEP_PART_ASSOCIATION = 14, // create an association
335  DEP_PART_WEIGHTS = 15, // create partition by weights
336  };
337 
338  // Collective copy kinds
339  enum CollectiveKind {
340  COLLECTIVE_NONE = 0,
341  // Filling a collective instance (both normal and reductions)
342  COLLECTIVE_FILL = 1,
343  // Broadcasting one normal instance to a collective normal instance
344  COLLECTIVE_BROADCAST = 2,
345  // Reducing a collective reduction instance to either a
346  // single normal or a single reduction instance
347  COLLECTIVE_REDUCTION = 3,
348  // Performing an all-reduce from a collective reduction instance
349  // to a collective normal or reduction instance using a butterfly
350  // network reduction (both instances using the same nodes)
351  COLLECTIVE_BUTTERFLY_ALLREDUCE = 4,
352  // Performing an all-reduce by doing a reduction down to a single
353  // instance and then broadcasting the result out from that instance
354  // (instances don't exist on the same set of nodes)
355  COLLECTIVE_HOURGLASS_ALLREDUCE = 5,
356  // Copy from one collective normal instanace to another collective
357  // normal instance for each of the points in the destination
358  COLLECTIVE_POINT_TO_POINT = 6,
359  // Apply a reduction from a single reduction instance to
360  // a collective normal instance
361  COLLECTIVE_REDUCECAST = 7,
362  // Degenerate case: apply a copy-across from a collective reduction
363  // instance to any kind of other instance without doing an all-reduce
364  COLLECTIVE_HAMMER_REDUCTION = 8,
365  };
366 
367  // Enumeration of Legion runtime tasks
368  enum LgTaskID {
369  LG_SCHEDULER_ID,
370  LG_POST_END_ID,
371  LG_TRIGGER_READY_ID,
372  LG_TRIGGER_EXECUTION_ID,
373  LG_TRIGGER_RESOLUTION_ID,
374  LG_TRIGGER_COMMIT_ID,
375  LG_DEFERRED_EXECUTION_ID,
376  LG_DEFERRED_COMPLETION_ID,
377  LG_DEFERRED_COMMIT_ID,
378  LG_PRE_PIPELINE_ID,
379  LG_TRIGGER_DEPENDENCE_ID,
380  LG_TRIGGER_COMPLETION_ID,
381  LG_TRIGGER_OP_ID,
382  LG_TRIGGER_TASK_ID,
383  LG_DEFER_MAPPER_SCHEDULER_TASK_ID,
384  LG_MUST_INDIV_ID,
385  LG_MUST_INDEX_ID,
386  LG_MUST_MAP_ID,
387  LG_MUST_DIST_ID,
388  LG_MUST_LAUNCH_ID,
389  LG_CONTRIBUTE_COLLECTIVE_ID,
390  LG_FUTURE_CALLBACK_TASK_ID,
391  LG_CALLBACK_RELEASE_TASK_ID,
392  LG_FUTURE_BROADCAST_TASK_ID,
393  LG_TOP_FINISH_TASK_ID,
394  LG_MAPPER_TASK_ID,
395  LG_DISJOINTNESS_TASK_ID,
396  LG_ISSUE_FRAME_TASK_ID,
397  LG_TASK_IMPL_SEMANTIC_INFO_REQ_TASK_ID,
398  LG_INDEX_SPACE_SEMANTIC_INFO_REQ_TASK_ID,
399  LG_INDEX_PART_SEMANTIC_INFO_REQ_TASK_ID,
400  LG_FIELD_SPACE_SEMANTIC_INFO_REQ_TASK_ID,
401  LG_FIELD_SEMANTIC_INFO_REQ_TASK_ID,
402  LG_DEFER_FIELD_INFOS_TASK_ID,
403  LG_REGION_SEMANTIC_INFO_REQ_TASK_ID,
404  LG_PARTITION_SEMANTIC_INFO_REQ_TASK_ID,
405  LG_INDEX_SPACE_DEFER_CHILD_TASK_ID,
406  LG_INDEX_PART_DEFER_CHILD_TASK_ID,
407  LG_INDEX_PART_DEFER_SHARD_RECTS_TASK_ID,
408  LG_DEFERRED_ENQUEUE_TASK_ID,
409  LG_DEFER_MAPPER_MESSAGE_TASK_ID,
410  LG_REMOTE_VIEW_CREATION_TASK_ID,
411  LG_DEFERRED_DISTRIBUTE_TASK_ID,
412  LG_DEFER_PERFORM_MAPPING_TASK_ID,
413  LG_FINALIZE_OUTPUT_TREE_TASK_ID,
414  LG_DEFERRED_LAUNCH_TASK_ID,
415  LG_MISPREDICATION_TASK_ID,
416  LG_DEFER_TRIGGER_TASK_COMPLETE_TASK_ID,
417  LG_ORDER_CONCURRENT_LAUNCH_TASK_ID,
418  LG_DEFER_MATERIALIZED_VIEW_TASK_ID,
419  LG_DEFER_REDUCTION_VIEW_TASK_ID,
420  LG_DEFER_PHI_VIEW_REGISTRATION_TASK_ID,
421  LG_DEFER_COMPOSITE_COPY_TASK_ID,
422  LG_TIGHTEN_INDEX_SPACE_TASK_ID,
423  LG_REPLAY_SLICE_TASK_ID,
424  LG_TRANSITIVE_REDUCTION_TASK_ID,
425  LG_DELETE_TEMPLATE_TASK_ID,
426  LG_DEFER_MAKE_OWNER_TASK_ID,
427  LG_DEFER_APPLY_STATE_TASK_ID,
428  LG_COPY_FILL_AGGREGATION_TASK_ID,
429  LG_COPY_FILL_DELETION_TASK_ID,
430  LG_FINALIZE_EQ_SETS_TASK_ID,
431  LG_FINALIZE_OUTPUT_EQ_SET_TASK_ID,
432  LG_DEFERRED_COPY_ACROSS_TASK_ID,
433  LG_DEFER_REMOTE_OP_DELETION_TASK_ID,
434  LG_DEFER_REMOTE_INSTANCE_TASK_ID,
435  LG_DEFER_REMOTE_REDUCTION_TASK_ID,
436  LG_DEFER_REMOTE_UPDATE_TASK_ID,
437  LG_DEFER_REMOTE_ACQUIRE_TASK_ID,
438  LG_DEFER_REMOTE_RELEASE_TASK_ID,
439  LG_DEFER_REMOTE_COPIES_ACROSS_TASK_ID,
440  LG_DEFER_REMOTE_OVERWRITE_TASK_ID,
441  LG_DEFER_REMOTE_FILTER_TASK_ID,
442  LG_DEFER_PERFORM_TRAVERSAL_TASK_ID,
443  LG_DEFER_PERFORM_ANALYSIS_TASK_ID,
444  LG_DEFER_PERFORM_REMOTE_TASK_ID,
445  LG_DEFER_PERFORM_UPDATE_TASK_ID,
446  LG_DEFER_PERFORM_REGISTRATION_TASK_ID,
447  LG_DEFER_PERFORM_OUTPUT_TASK_ID,
448  LG_DEFER_PHYSICAL_MANAGER_TASK_ID,
449  LG_DEFER_DELETE_PHYSICAL_MANAGER_TASK_ID,
450  LG_DEFER_VERIFY_PARTITION_TASK_ID,
451  LG_DEFER_RELEASE_ACQUIRED_TASK_ID,
452  LG_DEFER_COPY_ACROSS_TASK_ID,
453  LG_DEFER_COLLECTIVE_MESSAGE_TASK_ID,
454  LG_FREE_EAGER_INSTANCE_TASK_ID,
455  LG_MALLOC_INSTANCE_TASK_ID,
456  LG_FREE_INSTANCE_TASK_ID,
457  LG_DEFER_TRACE_PRECONDITION_TASK_ID,
458  LG_DEFER_TRACE_POSTCONDITION_TASK_ID,
459  LG_DEFER_TRACE_UPDATE_TASK_ID,
460  LG_FINALIZE_OUTPUT_ID,
461  LG_DEFER_DELETE_FUTURE_INSTANCE_TASK_ID,
462  LG_FREE_EXTERNAL_TASK_ID,
463  LG_DEFER_CONSENSUS_MATCH_TASK_ID,
464  LG_DEFER_COLLECTIVE_TASK_ID,
465  LG_DEFER_RECORD_COMPLETE_REPLAY_TASK_ID,
466  LG_DEFER_ISSUE_FILL_TASK_ID,
467  LG_DEFER_MUST_EPOCH_RETURN_TASK_ID,
468  LG_YIELD_TASK_ID,
469  // this marks the beginning of task IDs tracked by the shutdown algorithm
470  LG_BEGIN_SHUTDOWN_TASK_IDS,
471  LG_RETRY_SHUTDOWN_TASK_ID = LG_BEGIN_SHUTDOWN_TASK_IDS,
472  // Message ID goes at the end so we can append additional
473  // message IDs here for the profiler and separate meta-tasks
474  LG_MESSAGE_ID,
475  LG_LAST_TASK_ID, // This one should always be last
476  };
477 
478  // Make this a macro so we can keep it close to
479  // declaration of the task IDs themselves
480 #define LG_TASK_DESCRIPTIONS(name) \
481  const char *name[LG_LAST_TASK_ID] = { \
482  "Scheduler", \
483  "Post-Task Execution", \
484  "Trigger Ready", \
485  "Trigger Execution", \
486  "Trigger Resolution", \
487  "Trigger Commit", \
488  "Deferred Execution", \
489  "Deferred Completion", \
490  "Deferred Commit", \
491  "Prepipeline Stage", \
492  "Logical Dependence Analysis", \
493  "Trigger Completion", \
494  "Trigger Operation Mapping", \
495  "Trigger Task Mapping", \
496  "Defer Mapper Scheduler", \
497  "Must Individual Task Dependence Analysis", \
498  "Must Index Task Dependence Analysis", \
499  "Must Task Physical Dependence Analysis", \
500  "Must Task Distribution", \
501  "Must Task Launch", \
502  "Contribute Collective", \
503  "Future Callback", \
504  "Future Callback Release", \
505  "Future Broadcast", \
506  "Top Finish", \
507  "Mapper Task", \
508  "Disjointness Test", \
509  "Issue Frame", \
510  "Task Impl Semantic Request", \
511  "Index Space Semantic Request", \
512  "Index Partition Semantic Request", \
513  "Field Space Semantic Request", \
514  "Field Semantic Request", \
515  "Defer Field Infos Request", \
516  "Region Semantic Request", \
517  "Partition Semantic Request", \
518  "Defer Index Space Child Request", \
519  "Defer Index Partition Child Request", \
520  "Defer Index Partition Find Shard Rects", \
521  "Deferred Enqueue Task", \
522  "Deferred Mapper Message", \
523  "Remote View Creation", \
524  "Deferred Distribute Task", \
525  "Defer Task Perform Mapping", \
526  "Finalize Output Regions Eq KD Tree", \
527  "Deferred Task Launch", \
528  "Handle Mapping Mispredication", \
529  "Defer Trigger Task Complete", \
530  "Order Concurrent Launch", \
531  "Defer Materialized View Registration", \
532  "Defer Reduction View Registration", \
533  "Defer Phi View Registration", \
534  "Defer Composite Copy", \
535  "Tighten Index Space", \
536  "Replay Physical Trace", \
537  "Template Transitive Reduction", \
538  "Delete Physical Template", \
539  "Defer Equivalence Set Make Owner", \
540  "Defer Equivalence Set Apply State", \
541  "Copy Fill Aggregation", \
542  "Copy Fill Deletion", \
543  "Finalize Equivalence Sets", \
544  "Finalize Output Equivalence Set", \
545  "Deferred Copy Across", \
546  "Defer Remote Op Deletion", \
547  "Defer Remote Instance Request", \
548  "Defer Remote Reduction Request", \
549  "Defer Remote Update Equivalence Set", \
550  "Defer Remote Acquire", \
551  "Defer Remote Release", \
552  "Defer Remote Copy Across", \
553  "Defer Remote Overwrite Equivalence Set", \
554  "Defer Remote Filter Equivalence Set", \
555  "Defer Physical Analysis Traversal Stage", \
556  "Defer Physical Analysis Analyze Equivalence Set Stage", \
557  "Defer Physical Analysis Remote Stage", \
558  "Defer Physical Analysis Update Stage", \
559  "Defer Physical Analysis Registration Stage", \
560  "Defer Physical Analysis Output Stage", \
561  "Defer Physical Manager Registration", \
562  "Defer Physical Manager Deletion", \
563  "Defer Verify Partition", \
564  "Defer Release Acquired Instances", \
565  "Defer Copy-Across Execution for Preimages", \
566  "Defer Collective Instance Message", \
567  "Free Eager Instance", \
568  "Malloc Instance", \
569  "Free Instance", \
570  "Defer Trace Precondition Test", \
571  "Defer Trace Postcondition Test", \
572  "Defer Trace Update", \
573  "Finalize Output Region Instance", \
574  "Defer Delete Future Instance", \
575  "Free External Allocation", \
576  "Defer Consensus Match", \
577  "Defer Collective Async", \
578  "Defer Record Complete Replay", \
579  "Defer Issue Fill", \
580  "Defer Must Epoch Return Resources", \
581  "Yield", \
582  "Retry Shutdown", \
583  "Remote Message", \
584  };
585 
586  enum MappingCallKind {
587  GET_MAPPER_NAME_CALL,
588  GET_MAPER_SYNC_MODEL_CALL,
589  SELECT_TASK_OPTIONS_CALL,
590  PREMAP_TASK_CALL,
591  SLICE_TASK_CALL,
592  MAP_TASK_CALL,
593  REPLICATE_TASK_CALL,
594  SELECT_VARIANT_CALL,
595  POSTMAP_TASK_CALL,
596  TASK_SELECT_SOURCES_CALL,
597  TASK_SPECULATE_CALL,
598  TASK_REPORT_PROFILING_CALL,
599  TASK_SELECT_SHARDING_FUNCTOR_CALL,
600  MAP_INLINE_CALL,
601  INLINE_SELECT_SOURCES_CALL,
602  INLINE_REPORT_PROFILING_CALL,
603  MAP_COPY_CALL,
604  COPY_SELECT_SOURCES_CALL,
605  COPY_SPECULATE_CALL,
606  COPY_REPORT_PROFILING_CALL,
607  COPY_SELECT_SHARDING_FUNCTOR_CALL,
608  CLOSE_SELECT_SOURCES_CALL,
609  CLOSE_REPORT_PROFILING_CALL,
610  CLOSE_SELECT_SHARDING_FUNCTOR_CALL,
611  MAP_ACQUIRE_CALL,
612  ACQUIRE_SPECULATE_CALL,
613  ACQUIRE_REPORT_PROFILING_CALL,
614  ACQUIRE_SELECT_SHARDING_FUNCTOR_CALL,
615  MAP_RELEASE_CALL,
616  RELEASE_SELECT_SOURCES_CALL,
617  RELEASE_SPECULATE_CALL,
618  RELEASE_REPORT_PROFILING_CALL,
619  RELEASE_SELECT_SHARDING_FUNCTOR_CALL,
620  SELECT_PARTITION_PROJECTION_CALL,
621  MAP_PARTITION_CALL,
622  PARTITION_SELECT_SOURCES_CALL,
623  PARTITION_REPORT_PROFILING_CALL,
624  PARTITION_SELECT_SHARDING_FUNCTOR_CALL,
625  FILL_SELECT_SHARDING_FUNCTOR_CALL,
626  MAP_FUTURE_MAP_REDUCTION_CALL,
627  CONFIGURE_CONTEXT_CALL,
628  SELECT_TUNABLE_VALUE_CALL,
629  MUST_EPOCH_SELECT_SHARDING_FUNCTOR_CALL,
630  MAP_MUST_EPOCH_CALL,
631  MAP_DATAFLOW_GRAPH_CALL,
632  MEMOIZE_OPERATION_CALL,
633  SELECT_TASKS_TO_MAP_CALL,
634  SELECT_STEAL_TARGETS_CALL,
635  PERMIT_STEAL_REQUEST_CALL,
636  HANDLE_MESSAGE_CALL,
637  HANDLE_TASK_RESULT_CALL,
638  HANDLE_INSTANCE_COLLECTION_CALL,
639  APPLICATION_MAPPER_CALL,
640  LAST_MAPPER_CALL,
641  };
642 
643 #define MAPPER_CALL_NAMES(name) \
644  const char *name[LAST_MAPPER_CALL] = { \
645  "get_mapper_name", \
646  "get_mapper_sync_model", \
647  "select_task_options", \
648  "premap_task", \
649  "slice_task", \
650  "map_task", \
651  "replicate_task", \
652  "select_task_variant", \
653  "postmap_task", \
654  "select_task_sources", \
655  "speculate (for task)", \
656  "report profiling (for task)", \
657  "select sharding functor (for task)", \
658  "map_inline", \
659  "select_inline_sources", \
660  "report profiling (for inline)", \
661  "map_copy", \
662  "select_copy_sources", \
663  "speculate (for copy)", \
664  "report_profiling (for copy)", \
665  "select sharding functor (for copy)", \
666  "select_close_sources", \
667  "report_profiling (for close)", \
668  "select sharding functor (for close)", \
669  "map_acquire", \
670  "speculate (for acquire)", \
671  "report_profiling (for acquire)", \
672  "select sharding functor (for acquire)", \
673  "map_release", \
674  "select_release_sources", \
675  "speculate (for release)", \
676  "report_profiling (for release)", \
677  "select sharding functor (for release)", \
678  "select partition projection", \
679  "map_partition", \
680  "select_partition_sources", \
681  "report_profiling (for partition)", \
682  "select sharding functor (for partition)", \
683  "select sharding functor (for fill)", \
684  "map future map reduction", \
685  "configure_context", \
686  "select_tunable_value", \
687  "select sharding functor (for must epoch)", \
688  "map_must_epoch", \
689  "map_dataflow_graph", \
690  "memoize_operation", \
691  "select_tasks_to_map", \
692  "select_steal_targets", \
693  "permit_steal_request", \
694  "handle_message", \
695  "handle_task_result", \
696  "handle_instance_collection", \
697  "application mapper call", \
698  }
699 
700  // Methodology for assigning priorities to meta-tasks:
701  // Minimum and low priority are for things like profiling
702  // that we don't want to interfere with normal execution.
703  // Resource priority is reserved for tasks that have been
704  // granted resources like reservations. Running priority
705  // is the highest and guarantees that we drain out any
706  // previously running tasks over starting new ones. The rest
707  // of the priorities are classified as either 'throughput'
708  // or 'latency' sensitive. Under each of these two major
709  // categories there are four sub-priorities:
710  // - work: general work to be done
711  // - deferred: work that was already scheduled but
712  // for which a continuation had to be
713  // made so we don't want to wait behind
714  // work that hasn't started yet
715  // - messsage: a message from a remote node that we
716  // should handle sooner than our own
717  // work since work on the other node is
718  // blocked waiting on our response
719  // - response: a response message from a remote node
720  // that we should handle to unblock work
721  // on our own node
722  enum LgPriority {
723  LG_MIN_PRIORITY = INT_MIN,
724  LG_LOW_PRIORITY = -1,
725  // Throughput priorities
726  LG_THROUGHPUT_WORK_PRIORITY = 0,
727  LG_THROUGHPUT_DEFERRED_PRIORITY = 1,
728  LG_THROUGHPUT_MESSAGE_PRIORITY = 2,
729  LG_THROUGHPUT_RESPONSE_PRIORITY = 3,
730  // Latency priorities
731  LG_LATENCY_WORK_PRIORITY = 4,
732  LG_LATENCY_DEFERRED_PRIORITY = 5,
733  LG_LATENCY_MESSAGE_PRIORITY = 6,
734  LG_LATENCY_RESPONSE_PRIORITY = 7,
735  // Resource priorities
736  LG_RESOURCE_PRIORITY = 8,
737  // Running priorities
738  LG_RUNNING_PRIORITY = 9,
739  };
740 
741  enum VirtualChannelKind {
742  // The default and work virtual channels are unordered
743  DEFAULT_VIRTUAL_CHANNEL = 0, // latency priority
744  THROUGHPUT_VIRTUAL_CHANNEL = 1, // throughput priority
745  LAST_UNORDERED_VIRTUAL_CHANNEL = THROUGHPUT_VIRTUAL_CHANNEL,
746  // All the rest of these are ordered (latency-priority) channels
747  MAPPER_VIRTUAL_CHANNEL = 1,
748  TASK_VIRTUAL_CHANNEL = 2,
749  INDEX_SPACE_VIRTUAL_CHANNEL = 3,
750  FIELD_SPACE_VIRTUAL_CHANNEL = 4,
751  REFERENCE_VIRTUAL_CHANNEL = 6,
752  UPDATE_VIRTUAL_CHANNEL = 7, // deferred-priority
753  SUBSET_VIRTUAL_CHANNEL = 8,
754  COLLECTIVE_VIRTUAL_CHANNEL = 9,
755  LAYOUT_CONSTRAINT_VIRTUAL_CHANNEL = 10,
756  EXPRESSION_VIRTUAL_CHANNEL = 11,
757  MIGRATION_VIRTUAL_CHANNEL = 12,
758  TRACING_VIRTUAL_CHANNEL = 13,
759  RENDEZVOUS_VIRTUAL_CHANNEL = 14,
760  MAX_NUM_VIRTUAL_CHANNELS = 15, // this one must be last
761  };
762 
763  enum MessageKind {
764  SEND_STARTUP_BARRIER,
765  TASK_MESSAGE,
766  STEAL_MESSAGE,
767  ADVERTISEMENT_MESSAGE,
768  SEND_REGISTRATION_CALLBACK,
769  SEND_REMOTE_TASK_REPLAY,
770  SEND_REMOTE_TASK_PROFILING_RESPONSE,
771  SEND_SHARED_OWNERSHIP,
772  SEND_INDEX_SPACE_REQUEST,
773  SEND_INDEX_SPACE_RESPONSE,
774  SEND_INDEX_SPACE_RETURN,
775  SEND_INDEX_SPACE_SET,
776  SEND_INDEX_SPACE_CHILD_REQUEST,
777  SEND_INDEX_SPACE_CHILD_RESPONSE,
778  SEND_INDEX_SPACE_COLORS_REQUEST,
779  SEND_INDEX_SPACE_COLORS_RESPONSE,
780  SEND_INDEX_SPACE_REMOTE_EXPRESSION_REQUEST,
781  SEND_INDEX_SPACE_REMOTE_EXPRESSION_RESPONSE,
782  SEND_INDEX_SPACE_GENERATE_COLOR_REQUEST,
783  SEND_INDEX_SPACE_GENERATE_COLOR_RESPONSE,
784  SEND_INDEX_SPACE_RELEASE_COLOR,
785  SEND_INDEX_PARTITION_NOTIFICATION,
786  SEND_INDEX_PARTITION_REQUEST,
787  SEND_INDEX_PARTITION_RESPONSE,
788  SEND_INDEX_PARTITION_RETURN,
789  SEND_INDEX_PARTITION_CHILD_REQUEST,
790  SEND_INDEX_PARTITION_CHILD_RESPONSE,
791  SEND_INDEX_PARTITION_CHILD_REPLICATION,
792  SEND_INDEX_PARTITION_DISJOINT_UPDATE,
793  SEND_INDEX_PARTITION_SHARD_RECTS_REQUEST,
794  SEND_INDEX_PARTITION_SHARD_RECTS_RESPONSE,
795  SEND_INDEX_PARTITION_REMOTE_INTERFERENCE_REQUEST,
796  SEND_INDEX_PARTITION_REMOTE_INTERFERENCE_RESPONSE,
797  SEND_FIELD_SPACE_NODE,
798  SEND_FIELD_SPACE_REQUEST,
799  SEND_FIELD_SPACE_RETURN,
800  SEND_FIELD_SPACE_ALLOCATOR_REQUEST,
801  SEND_FIELD_SPACE_ALLOCATOR_RESPONSE,
802  SEND_FIELD_SPACE_ALLOCATOR_INVALIDATION,
803  SEND_FIELD_SPACE_ALLOCATOR_FLUSH,
804  SEND_FIELD_SPACE_ALLOCATOR_FREE,
805  SEND_FIELD_SPACE_INFOS_REQUEST,
806  SEND_FIELD_SPACE_INFOS_RESPONSE,
807  SEND_FIELD_ALLOC_REQUEST,
808  SEND_FIELD_SIZE_UPDATE,
809  SEND_FIELD_FREE,
810  SEND_FIELD_FREE_INDEXES,
811  SEND_FIELD_SPACE_LAYOUT_INVALIDATION,
812  SEND_LOCAL_FIELD_ALLOC_REQUEST,
813  SEND_LOCAL_FIELD_ALLOC_RESPONSE,
814  SEND_LOCAL_FIELD_FREE,
815  SEND_LOCAL_FIELD_UPDATE,
816  SEND_TOP_LEVEL_REGION_REQUEST,
817  SEND_TOP_LEVEL_REGION_RETURN,
818  INDEX_SPACE_DESTRUCTION_MESSAGE,
819  INDEX_PARTITION_DESTRUCTION_MESSAGE,
820  FIELD_SPACE_DESTRUCTION_MESSAGE,
821  LOGICAL_REGION_DESTRUCTION_MESSAGE,
822  INDIVIDUAL_REMOTE_FUTURE_SIZE,
823  INDIVIDUAL_REMOTE_OUTPUT_REGISTRATION,
824  INDIVIDUAL_REMOTE_MAPPED,
825  INDIVIDUAL_REMOTE_COMPLETE,
826  INDIVIDUAL_REMOTE_COMMIT,
827  SLICE_REMOTE_MAPPED,
828  SLICE_REMOTE_COMPLETE,
829  SLICE_REMOTE_COMMIT,
830  SLICE_VERIFY_CONCURRENT_EXECUTION,
831  SLICE_CONCURRENT_ALLREDUCE_REQUEST,
832  SLICE_CONCURRENT_ALLREDUCE_RESPONSE,
833  SLICE_FIND_INTRA_DEP,
834  SLICE_RECORD_INTRA_DEP,
835  SLICE_REMOTE_COLLECTIVE_RENDEZVOUS,
836  SLICE_REMOTE_VERSIONING_COLLECTIVE_RENDEZVOUS,
837  SLICE_REMOTE_OUTPUT_EXTENTS,
838  SLICE_REMOTE_OUTPUT_REGISTRATION,
839  DISTRIBUTED_REMOTE_REGISTRATION,
840  DISTRIBUTED_DOWNGRADE_REQUEST,
841  DISTRIBUTED_DOWNGRADE_RESPONSE,
842  DISTRIBUTED_DOWNGRADE_SUCCESS,
843  DISTRIBUTED_DOWNGRADE_UPDATE,
844  DISTRIBUTED_DOWNGRADE_RESTART,
845  DISTRIBUTED_GLOBAL_ACQUIRE_REQUEST,
846  DISTRIBUTED_GLOBAL_ACQUIRE_RESPONSE,
847  DISTRIBUTED_VALID_ACQUIRE_REQUEST,
848  DISTRIBUTED_VALID_ACQUIRE_RESPONSE,
849  SEND_ATOMIC_RESERVATION_REQUEST,
850  SEND_ATOMIC_RESERVATION_RESPONSE,
851  SEND_PADDED_RESERVATION_REQUEST,
852  SEND_PADDED_RESERVATION_RESPONSE,
853  SEND_CREATED_REGION_CONTEXTS,
854  SEND_MATERIALIZED_VIEW,
855  SEND_FILL_VIEW,
856  SEND_FILL_VIEW_VALUE,
857  SEND_PHI_VIEW,
858  SEND_REDUCTION_VIEW,
859  SEND_REPLICATED_VIEW,
860  SEND_ALLREDUCE_VIEW,
861  SEND_INSTANCE_MANAGER,
862  SEND_MANAGER_UPDATE,
863  SEND_COLLECTIVE_DISTRIBUTE_FILL,
864  SEND_COLLECTIVE_DISTRIBUTE_POINT,
865  SEND_COLLECTIVE_DISTRIBUTE_POINTWISE,
866  SEND_COLLECTIVE_DISTRIBUTE_REDUCTION,
867  SEND_COLLECTIVE_DISTRIBUTE_BROADCAST,
868  SEND_COLLECTIVE_DISTRIBUTE_REDUCECAST,
869  SEND_COLLECTIVE_DISTRIBUTE_HOURGLASS,
870  SEND_COLLECTIVE_DISTRIBUTE_ALLREDUCE,
871  SEND_COLLECTIVE_HAMMER_REDUCTION,
872  SEND_COLLECTIVE_FUSE_GATHER,
873  SEND_COLLECTIVE_USER_REQUEST,
874  SEND_COLLECTIVE_USER_RESPONSE,
875  SEND_COLLECTIVE_REGISTER_USER,
876  SEND_COLLECTIVE_REMOTE_INSTANCES_REQUEST,
877  SEND_COLLECTIVE_REMOTE_INSTANCES_RESPONSE,
878  SEND_COLLECTIVE_NEAREST_INSTANCES_REQUEST,
879  SEND_COLLECTIVE_NEAREST_INSTANCES_RESPONSE,
880  SEND_COLLECTIVE_REMOTE_REGISTRATION,
881  SEND_COLLECTIVE_FINALIZE_MAPPING,
882  SEND_COLLECTIVE_VIEW_CREATION,
883  SEND_COLLECTIVE_VIEW_DELETION,
884  SEND_COLLECTIVE_VIEW_RELEASE,
885  SEND_COLLECTIVE_VIEW_NOTIFICATION,
886  SEND_COLLECTIVE_VIEW_MAKE_VALID,
887  SEND_COLLECTIVE_VIEW_MAKE_INVALID,
888  SEND_COLLECTIVE_VIEW_INVALIDATE_REQUEST,
889  SEND_COLLECTIVE_VIEW_INVALIDATE_RESPONSE,
890  SEND_COLLECTIVE_VIEW_ADD_REMOTE_REFERENCE,
891  SEND_COLLECTIVE_VIEW_REMOVE_REMOTE_REFERENCE,
892  SEND_CREATE_TOP_VIEW_REQUEST,
893  SEND_CREATE_TOP_VIEW_RESPONSE,
894  SEND_VIEW_REQUEST,
895  SEND_VIEW_REGISTER_USER,
896  SEND_VIEW_FIND_COPY_PRE_REQUEST,
897  SEND_VIEW_ADD_COPY_USER,
898  SEND_VIEW_FIND_LAST_USERS_REQUEST,
899  SEND_VIEW_FIND_LAST_USERS_RESPONSE,
900  SEND_VIEW_REPLICATION_REQUEST,
901  SEND_VIEW_REPLICATION_RESPONSE,
902  SEND_VIEW_REPLICATION_REMOVAL,
903  SEND_MANAGER_REQUEST,
904  SEND_FUTURE_RESULT,
905  SEND_FUTURE_RESULT_SIZE,
906  SEND_FUTURE_SUBSCRIPTION,
907  SEND_FUTURE_CREATE_INSTANCE_REQUEST,
908  SEND_FUTURE_CREATE_INSTANCE_RESPONSE,
909  SEND_FUTURE_MAP_REQUEST,
910  SEND_FUTURE_MAP_RESPONSE,
911  SEND_REPL_COMPUTE_EQUIVALENCE_SETS,
912  SEND_REPL_OUTPUT_EQUIVALENCE_SET,
913  SEND_REPL_REFINE_EQUIVALENCE_SETS,
914  SEND_REPL_EQUIVALENCE_SET_NOTIFICATION,
915  SEND_REPL_INTRA_SPACE_DEP,
916  SEND_REPL_BROADCAST_UPDATE,
917  SEND_REPL_CREATED_REGIONS,
918  SEND_REPL_TRACE_EVENT_REQUEST,
919  SEND_REPL_TRACE_EVENT_RESPONSE,
920  SEND_REPL_TRACE_FRONTIER_REQUEST,
921  SEND_REPL_TRACE_FRONTIER_RESPONSE,
922  SEND_REPL_TRACE_UPDATE,
923  SEND_REPL_IMPLICIT_RENDEZVOUS,
924  SEND_REPL_FIND_COLLECTIVE_VIEW,
925  SEND_MAPPER_MESSAGE,
926  SEND_MAPPER_BROADCAST,
927  SEND_TASK_IMPL_SEMANTIC_REQ,
928  SEND_INDEX_SPACE_SEMANTIC_REQ,
929  SEND_INDEX_PARTITION_SEMANTIC_REQ,
930  SEND_FIELD_SPACE_SEMANTIC_REQ,
931  SEND_FIELD_SEMANTIC_REQ,
932  SEND_LOGICAL_REGION_SEMANTIC_REQ,
933  SEND_LOGICAL_PARTITION_SEMANTIC_REQ,
934  SEND_TASK_IMPL_SEMANTIC_INFO,
935  SEND_INDEX_SPACE_SEMANTIC_INFO,
936  SEND_INDEX_PARTITION_SEMANTIC_INFO,
937  SEND_FIELD_SPACE_SEMANTIC_INFO,
938  SEND_FIELD_SEMANTIC_INFO,
939  SEND_LOGICAL_REGION_SEMANTIC_INFO,
940  SEND_LOGICAL_PARTITION_SEMANTIC_INFO,
941  SEND_REMOTE_CONTEXT_REQUEST,
942  SEND_REMOTE_CONTEXT_RESPONSE,
943  SEND_REMOTE_CONTEXT_PHYSICAL_REQUEST,
944  SEND_REMOTE_CONTEXT_PHYSICAL_RESPONSE,
945  SEND_REMOTE_CONTEXT_FIND_COLLECTIVE_VIEW_REQUEST,
946  SEND_REMOTE_CONTEXT_FIND_COLLECTIVE_VIEW_RESPONSE,
947  SEND_COMPUTE_EQUIVALENCE_SETS_REQUEST,
948  SEND_COMPUTE_EQUIVALENCE_SETS_RESPONSE,
949  SEND_COMPUTE_EQUIVALENCE_SETS_PENDING,
950  SEND_OUTPUT_EQUIVALENCE_SET_REQUEST,
951  SEND_OUTPUT_EQUIVALENCE_SET_RESPONSE,
952  SEND_CANCEL_EQUIVALENCE_SETS_SUBSCRIPTION,
953  SEND_INVALIDATE_EQUIVALENCE_SETS_SUBSCRIPTION,
954  SEND_EQUIVALENCE_SET_CREATION,
955  SEND_EQUIVALENCE_SET_REUSE,
956  SEND_EQUIVALENCE_SET_REQUEST,
957  SEND_EQUIVALENCE_SET_RESPONSE,
958  SEND_EQUIVALENCE_SET_REPLICATION_REQUEST,
959  SEND_EQUIVALENCE_SET_REPLICATION_RESPONSE,
960  SEND_EQUIVALENCE_SET_MIGRATION,
961  SEND_EQUIVALENCE_SET_OWNER_UPDATE,
962  SEND_EQUIVALENCE_SET_CLONE_REQUEST,
963  SEND_EQUIVALENCE_SET_CLONE_RESPONSE,
964  SEND_EQUIVALENCE_SET_CAPTURE_REQUEST,
965  SEND_EQUIVALENCE_SET_CAPTURE_RESPONSE,
966  SEND_EQUIVALENCE_SET_REMOTE_REQUEST_INSTANCES,
967  SEND_EQUIVALENCE_SET_REMOTE_REQUEST_INVALID,
968  SEND_EQUIVALENCE_SET_REMOTE_REQUEST_ANTIVALID,
969  SEND_EQUIVALENCE_SET_REMOTE_UPDATES,
970  SEND_EQUIVALENCE_SET_REMOTE_ACQUIRES,
971  SEND_EQUIVALENCE_SET_REMOTE_RELEASES,
972  SEND_EQUIVALENCE_SET_REMOTE_COPIES_ACROSS,
973  SEND_EQUIVALENCE_SET_REMOTE_OVERWRITES,
974  SEND_EQUIVALENCE_SET_REMOTE_FILTERS,
975  SEND_EQUIVALENCE_SET_REMOTE_CLONES,
976  SEND_EQUIVALENCE_SET_REMOTE_INSTANCES,
977  SEND_INSTANCE_REQUEST,
978  SEND_INSTANCE_RESPONSE,
979  SEND_EXTERNAL_CREATE_REQUEST,
980  SEND_EXTERNAL_CREATE_RESPONSE,
981  SEND_EXTERNAL_ATTACH,
982  SEND_EXTERNAL_DETACH,
983  SEND_GC_PRIORITY_UPDATE,
984  SEND_GC_REQUEST,
985  SEND_GC_RESPONSE,
986  SEND_GC_ACQUIRE,
987  SEND_GC_FAILED,
988  SEND_GC_MISMATCH,
989  SEND_GC_NOTIFY,
990  SEND_GC_DEBUG_REQUEST,
991  SEND_GC_DEBUG_RESPONSE,
992  SEND_GC_RECORD_EVENT,
993  SEND_ACQUIRE_REQUEST,
994  SEND_ACQUIRE_RESPONSE,
995  SEND_VARIANT_BROADCAST,
996  SEND_CONSTRAINT_REQUEST,
997  SEND_CONSTRAINT_RESPONSE,
998  SEND_CONSTRAINT_RELEASE,
999  SEND_TOP_LEVEL_TASK_COMPLETE,
1000  SEND_MPI_RANK_EXCHANGE,
1001  SEND_REPLICATE_DISTRIBUTION,
1002  SEND_REPLICATE_COLLECTIVE_VERSIONING,
1003  SEND_REPLICATE_COLLECTIVE_MAPPING,
1004  SEND_REPLICATE_VIRTUAL_RENDEZVOUS,
1005  SEND_REPLICATE_POST_MAPPED,
1006  SEND_REPLICATE_POST_EXECUTION,
1007  SEND_REPLICATE_TRIGGER_COMPLETE,
1008  SEND_REPLICATE_TRIGGER_COMMIT,
1009  SEND_CONTROL_REPLICATE_RENDEZVOUS_MESSAGE,
1010  SEND_LIBRARY_MAPPER_REQUEST,
1011  SEND_LIBRARY_MAPPER_RESPONSE,
1012  SEND_LIBRARY_TRACE_REQUEST,
1013  SEND_LIBRARY_TRACE_RESPONSE,
1014  SEND_LIBRARY_PROJECTION_REQUEST,
1015  SEND_LIBRARY_PROJECTION_RESPONSE,
1016  SEND_LIBRARY_SHARDING_REQUEST,
1017  SEND_LIBRARY_SHARDING_RESPONSE,
1018  SEND_LIBRARY_TASK_REQUEST,
1019  SEND_LIBRARY_TASK_RESPONSE,
1020  SEND_LIBRARY_REDOP_REQUEST,
1021  SEND_LIBRARY_REDOP_RESPONSE,
1022  SEND_LIBRARY_SERDEZ_REQUEST,
1023  SEND_LIBRARY_SERDEZ_RESPONSE,
1024  SEND_REMOTE_OP_REPORT_UNINIT,
1025  SEND_REMOTE_OP_PROFILING_COUNT_UPDATE,
1026  SEND_REMOTE_OP_COMPLETION_EFFECT,
1027  SEND_REMOTE_TRACE_UPDATE,
1028  SEND_REMOTE_TRACE_RESPONSE,
1029  SEND_FREE_EXTERNAL_ALLOCATION,
1030  SEND_NOTIFY_COLLECTED_INSTANCES,
1031  SEND_CREATE_FUTURE_INSTANCE_REQUEST,
1032  SEND_CREATE_FUTURE_INSTANCE_RESPONSE,
1033  SEND_FREE_FUTURE_INSTANCE,
1034  SEND_REMOTE_DISTRIBUTED_ID_REQUEST,
1035  SEND_REMOTE_DISTRIBUTED_ID_RESPONSE,
1036  SEND_CONTROL_REPLICATION_FUTURE_ALLREDUCE,
1037  SEND_CONTROL_REPLICATION_FUTURE_BROADCAST,
1038  SEND_CONTROL_REPLICATION_FUTURE_REDUCTION,
1039  SEND_CONTROL_REPLICATION_VALUE_ALLREDUCE,
1040  SEND_CONTROL_REPLICATION_VALUE_BROADCAST,
1041  SEND_CONTROL_REPLICATION_VALUE_EXCHANGE,
1042  SEND_CONTROL_REPLICATION_BUFFER_BROADCAST,
1043  SEND_CONTROL_REPLICATION_SHARD_SYNC_TREE,
1044  SEND_CONTROL_REPLICATION_SHARD_EVENT_TREE,
1045  SEND_CONTROL_REPLICATION_SINGLE_TASK_TREE,
1046  SEND_CONTROL_REPLICATION_CROSS_PRODUCT_PARTITION,
1047  SEND_CONTROL_REPLICATION_SHARDING_GATHER_COLLECTIVE,
1048  SEND_CONTROL_REPLICATION_INDIRECT_COPY_EXCHANGE,
1049  SEND_CONTROL_REPLICATION_FIELD_DESCRIPTOR_EXCHANGE,
1050  SEND_CONTROL_REPLICATION_FIELD_DESCRIPTOR_GATHER,
1051  SEND_CONTROL_REPLICATION_DEPPART_RESULT_SCATTER,
1052  SEND_CONTROL_REPLICATION_BUFFER_EXCHANGE,
1053  SEND_CONTROL_REPLICATION_FUTURE_NAME_EXCHANGE,
1054  SEND_CONTROL_REPLICATION_MUST_EPOCH_MAPPING_BROADCAST,
1055  SEND_CONTROL_REPLICATION_MUST_EPOCH_MAPPING_EXCHANGE,
1056  SEND_CONTROL_REPLICATION_MUST_EPOCH_DEPENDENCE_EXCHANGE,
1057  SEND_CONTROL_REPLICATION_MUST_EPOCH_COMPLETION_EXCHANGE,
1058  SEND_CONTROL_REPLICATION_CHECK_COLLECTIVE_MAPPING,
1059  SEND_CONTROL_REPLICATION_CHECK_COLLECTIVE_SOURCES,
1060  SEND_CONTROL_REPLICATION_TEMPLATE_INDEX_EXCHANGE,
1061  SEND_CONTROL_REPLICATION_UNORDERED_EXCHANGE,
1062  SEND_CONTROL_REPLICATION_CONSENSUS_MATCH,
1063  SEND_CONTROL_REPLICATION_VERIFY_CONTROL_REPLICATION_EXCHANGE,
1064  SEND_CONTROL_REPLICATION_OUTPUT_SIZE_EXCHANGE,
1065  SEND_CONTROL_REPLICATION_INDEX_ATTACH_LAUNCH_SPACE,
1066  SEND_CONTROL_REPLICATION_INDEX_ATTACH_UPPER_BOUND,
1067  SEND_CONTROL_REPLICATION_INDEX_ATTACH_EXCHANGE,
1068  SEND_CONTROL_REPLICATION_SHARD_PARTICIPANTS_EXCHANGE,
1069  SEND_CONTROL_REPLICATION_IMPLICIT_SHARDING_FUNCTOR,
1070  SEND_CONTROL_REPLICATION_CREATE_FILL_VIEW,
1071  SEND_CONTROL_REPLICATION_VERSIONING_RENDEZVOUS,
1072  SEND_CONTROL_REPLICATION_VIEW_RENDEZVOUS,
1073  SEND_CONTROL_REPLICATION_CONCURRENT_EXECUTION_VALIDATION,
1074  SEND_CONTROL_REPLICATION_CONCURRENT_ALLREDUCE,
1075  SEND_CONTROL_REPLICATION_PROJECTION_TREE_EXCHANGE,
1076  SEND_CONTROL_REPLICATION_TIMEOUT_MATCH_EXCHANGE,
1077  SEND_CONTROL_REPLICATION_MASK_EXCHANGE,
1078  SEND_CONTROL_REPLICATION_PREDICATE_EXCHANGE,
1079  SEND_CONTROL_REPLICATION_CROSS_PRODUCT_EXCHANGE,
1080  SEND_CONTROL_REPLICATION_SLOW_BARRIER,
1081  SEND_SHUTDOWN_NOTIFICATION,
1082  SEND_SHUTDOWN_RESPONSE,
1083  LAST_SEND_KIND, // This one must be last
1084  };
1085 
1086 #define LG_MESSAGE_DESCRIPTIONS(name) \
1087  const char *name[LAST_SEND_KIND] = { \
1088  "Send Startup Barrier", \
1089  "Task Message", \
1090  "Steal Message", \
1091  "Advertisement Message", \
1092  "Send Registration Callback", \
1093  "Send Remote Task Replay", \
1094  "Send Remote Task Profiling Response", \
1095  "Send Shared Ownership", \
1096  "Send Index Space Request", \
1097  "Send Index Space Response", \
1098  "Send Index Space Return", \
1099  "Send Index Space Set", \
1100  "Send Index Space Child Request", \
1101  "Send Index Space Child Response", \
1102  "Send Index Space Colors Request", \
1103  "Send Index Space Colors Response", \
1104  "Send Index Space Remote Expression Request", \
1105  "Send Index Space Remote Expression Response", \
1106  "Send Index Space Generate Color Request", \
1107  "Send Index Space Generate Color Response", \
1108  "Send Index Space Release Color", \
1109  "Send Index Partition Notification", \
1110  "Send Index Partition Request", \
1111  "Send Index Partition Response", \
1112  "Send Index Partition Return", \
1113  "Send Index Partition Child Request", \
1114  "Send Index Partition Child Response", \
1115  "Send Index Partition Child Replication", \
1116  "Send Index Partition Disjoint Update", \
1117  "Send Index Partition Shard Rects Request", \
1118  "Send Index Partition Shard Rects Response", \
1119  "Send Index Partition Remote Interference Request", \
1120  "Send Index Partition Remote Interference Response", \
1121  "Send Field Space Node", \
1122  "Send Field Space Request", \
1123  "Send Field Space Return", \
1124  "Send Field Space Allocator Request", \
1125  "Send Field Space Allocator Response", \
1126  "Send Field Space Allocator Invalidation", \
1127  "Send Field Space Allocator Flush", \
1128  "Send Field Space Allocator Free", \
1129  "Send Field Space Infos Request", \
1130  "Send Field Space Infos Response", \
1131  "Send Field Alloc Request", \
1132  "Send Field Size Update", \
1133  "Send Field Free", \
1134  "Send Field Free Indexes", \
1135  "Send Field Space Layout Invalidation", \
1136  "Send Local Field Alloc Request", \
1137  "Send Local Field Alloc Response", \
1138  "Send Local Field Free", \
1139  "Send Local Field Update", \
1140  "Send Top Level Region Request", \
1141  "Send Top Level Region Return", \
1142  "Index Space Destruction", \
1143  "Index Partition Destruction", \
1144  "Field Space Destruction", \
1145  "Logical Region Destruction", \
1146  "Individual Remote Future Size", \
1147  "Individual Remote Output Region Registration", \
1148  "Individual Remote Mapped", \
1149  "Individual Remote Complete", \
1150  "Individual Remote Commit", \
1151  "Slice Remote Mapped", \
1152  "Slice Remote Complete", \
1153  "Slice Remote Commit", \
1154  "Slice Verify Concurrent Execution", \
1155  "Slice Concurrent Allreduce Request", \
1156  "Slice Concurrent Allreduce Response", \
1157  "Slice Find Intra-Space Dependence", \
1158  "Slice Record Intra-Space Dependence", \
1159  "Slice Remote Collective Rendezvous", \
1160  "Slice Remote Collective Versioning Rendezvous", \
1161  "Slice Remote Output Region Extents", \
1162  "Slice Remote Output Region Registration", \
1163  "Distributed Remote Registration", \
1164  "Distributed Downgrade Request", \
1165  "Distributed Downgrade Response", \
1166  "Distributed Downgrade Success", \
1167  "Distributed Downgrade Update", \
1168  "Distributed Downgrade Restart", \
1169  "Distributed Global Acquire Request", \
1170  "Distributed Global Acquire Response", \
1171  "Distributed Valid Acquire Request", \
1172  "Distributed Valid Acquire Response", \
1173  "Send Atomic Reservation Request", \
1174  "Send Atomic Reservation Response", \
1175  "Send Padded Reservation Request", \
1176  "Send Padded Reservation Response", \
1177  "Send Created Region Contexts", \
1178  "Send Materialized View", \
1179  "Send Fill View", \
1180  "Send Fill View Value", \
1181  "Send Phi View", \
1182  "Send Reduction View", \
1183  "Send Replicated View", \
1184  "Send Allreduce View", \
1185  "Send Instance Manager", \
1186  "Send Manager Update", \
1187  "Send Collective Distribute Fill", \
1188  "Send Collective Distribute Point", \
1189  "Send Collective Distribute Pointwise", \
1190  "Send Collective Distribute Reduction", \
1191  "Send Collective Distribute Broadcast", \
1192  "Send Collective Distribute Reducecast", \
1193  "Send Collective Distribute Hourglass", \
1194  "Send Collective Distribute Allreduce", \
1195  "Send Collective Hammer Reduction", \
1196  "Send Collective Fuse Gather", \
1197  "Send Collective User Request", \
1198  "Send Collective User Response", \
1199  "Send Collective Individual Register User", \
1200  "Send Collective Remote Instances Request", \
1201  "Send Collective Remote Instances Response", \
1202  "Send Collective Nearest Instances Request", \
1203  "Send Collective Nearest Instances Response", \
1204  "Send Collective Remote Registration", \
1205  "Send Collective Finalize Mapping", \
1206  "Send Collective View Creation", \
1207  "Send Collective View Deletion", \
1208  "Send Collective View Release", \
1209  "Send Collective View Deletion Notification", \
1210  "Send Collective View Make Valid", \
1211  "Send Collective View Make Invalid", \
1212  "Send Collective View Invalidate Request", \
1213  "Send Collective View Invalidate Response", \
1214  "Send Collective View Add Remote Reference", \
1215  "Send Collective View Remove Remote Reference", \
1216  "Send Create Top View Request", \
1217  "Send Create Top View Response", \
1218  "Send View Request", \
1219  "Send View Register User", \
1220  "Send View Find Copy Preconditions Request", \
1221  "Send View Add Copy User", \
1222  "Send View Find Last Users Request", \
1223  "Send View Find Last Users Response", \
1224  "Send View Replication Request", \
1225  "Send View Replication Response", \
1226  "Send View Replication Removal", \
1227  "Send Manager Request", \
1228  "Send Future Result", \
1229  "Send Future Result Size", \
1230  "Send Future Subscription", \
1231  "Send Future Create Instance Request", \
1232  "Send Future Create Instance Response", \
1233  "Send Future Map Future Request", \
1234  "Send Future Map Future Response", \
1235  "Send Replicate Compute Equivalence Sets", \
1236  "Send Replicate Register Output Equivalence Set", \
1237  "Send Replicate Refine Equivalence Sets", \
1238  "Send Replicate Equivalence Set Notification", \
1239  "Send Replicate Intra Space Dependence", \
1240  "Send Replicate Broadcast Update", \
1241  "Send Replicate Created Regions Return", \
1242  "Send Replicate Trace Event Request", \
1243  "Send Replicate Trace Event Response", \
1244  "Send Replicate Trace Frontier Request", \
1245  "Send Replicate Trace Frontier Response", \
1246  "Send Replicate Trace Update", \
1247  "Send Replicate Implicit Rendezvous", \
1248  "Send Replicate Find or Create Collective View", \
1249  "Send Mapper Message", \
1250  "Send Mapper Broadcast", \
1251  "Send Task Impl Semantic Req", \
1252  "Send Index Space Semantic Req", \
1253  "Send Index Partition Semantic Req", \
1254  "Send Field Space Semantic Req", \
1255  "Send Field Semantic Req", \
1256  "Send Logical Region Semantic Req", \
1257  "Send Logical Partition Semantic Req", \
1258  "Send Task Impl Semantic Info", \
1259  "Send Index Space Semantic Info", \
1260  "Send Index Partition Semantic Info", \
1261  "Send Field Space Semantic Info", \
1262  "Send Field Semantic Info", \
1263  "Send Logical Region Semantic Info", \
1264  "Send Logical Partition Semantic Info", \
1265  "Send Remote Context Request", \
1266  "Send Remote Context Response", \
1267  "Send Remote Context Physical Request", \
1268  "Send Remote Context Physical Response", \
1269  "Send Remote Context Find Collective View Request", \
1270  "Send Remote Context Find Collective View Response", \
1271  "Send Compute Equivalence Sets Request", \
1272  "Send Compute Equivalence Sets Response", \
1273  "Send Compute Equivalence Sets Pending", \
1274  "Send Register Output Equivalence Set Request", \
1275  "Send Register Output Equivalence Set Response", \
1276  "Send Cancel Equivalence Sets Subscription", \
1277  "Send Invalidate Equivalence Sets Subscription", \
1278  "Send Equivalence Set Creation", \
1279  "Send Equivalence Set Reuse", \
1280  "Send Equivalence Set Request", \
1281  "Send Equivalence Set Response", \
1282  "Send Equivalence Set Replication Request", \
1283  "Send Equivalence Set Replication Response", \
1284  "Send Equivalence Set Migration", \
1285  "Send Equivalence Set Owner Update", \
1286  "Send Equivalence Set Clone Request", \
1287  "Send Equivalence Set Clone Response", \
1288  "Send Equivalence Set Tracing Capture Request", \
1289  "Send Equivalence Set Tracing Capture Response", \
1290  "Send Equivalence Set Remote Request Instances", \
1291  "Send Equivalence Set Remote Request Invalid", \
1292  "Send Equivalence Set Remote Request Antivalid", \
1293  "Send Equivalence Set Remote Updates", \
1294  "Send Equivalence Set Remote Acquires", \
1295  "Send Equivalence Set Remote Releases", \
1296  "Send Equivalence Set Remote Copies Across", \
1297  "Send Equivalence Set Remote Overwrites", \
1298  "Send Equivalence Set Remote Filters", \
1299  "Send Equivalence Set Remote Clones", \
1300  "Send Equivalence Set Remote Instances", \
1301  "Send Instance Request", \
1302  "Send Instance Response", \
1303  "Send External Create Request", \
1304  "Send External Create Response", \
1305  "Send External Attach", \
1306  "Send External Detach", \
1307  "Send GC Priority Update", \
1308  "Send GC Request", \
1309  "Send GC Response", \
1310  "Send GC Acquire Request", \
1311  "Send GC Acquire Failed", \
1312  "Send GC Packed Reference Mismatch", \
1313  "Send GC Notify Collected", \
1314  "Send GC Debug Request", \
1315  "Send GC Debug Response", \
1316  "Send GC Record Event", \
1317  "Send Acquire Request", \
1318  "Send Acquire Response", \
1319  "Send Task Variant Broadcast", \
1320  "Send Constraint Request", \
1321  "Send Constraint Response", \
1322  "Send Constraint Release", \
1323  "Top Level Task Complete", \
1324  "Send MPI Rank Exchange", \
1325  "Send Replication Distribution", \
1326  "Send Replication Collective Versioning", \
1327  "Send Replication Collective Mapping", \
1328  "Send Replication Virtual Mapping Rendezvous", \
1329  "Send Replication Post Mapped", \
1330  "Send Replication Post Execution", \
1331  "Send Replication Trigger Complete", \
1332  "Send Replication Trigger Commit", \
1333  "Send Control Replication Rendezvous Message", \
1334  "Send Library Mapper Request", \
1335  "Send Library Mapper Response", \
1336  "Send Library Trace Request", \
1337  "Send Library Trace Response", \
1338  "Send Library Projection Request", \
1339  "Send Library Projection Response", \
1340  "Send Library Sharding Request", \
1341  "Send Library Sharding Response", \
1342  "Send Library Task Request", \
1343  "Send Library Task Response", \
1344  "Send Library Redop Request", \
1345  "Send Library Redop Response", \
1346  "Send Library Serdez Request", \
1347  "Send Library Serdez Response", \
1348  "Remote Op Report Uninitialized", \
1349  "Remote Op Profiling Count Update", \
1350  "Remote Op Completion Effect", \
1351  "Send Remote Trace Update", \
1352  "Send Remote Trace Response", \
1353  "Send Free External Allocation", \
1354  "Send Notify Collected Instances", \
1355  "Send Create Future Instance Request", \
1356  "Send Create Future Instance Response", \
1357  "Send Free Future Instance", \
1358  "Send Remote Distributed ID Request", \
1359  "Send Remote Distributed ID Response", \
1360  "Control Replication Collective Future All-Reduce", \
1361  "Control Replication Collective Future Broadcast", \
1362  "Control Replication Collective Future Reduction", \
1363  "Control Replication Collective Value All-Reduce", \
1364  "Control Replication Collective Value Broadcast", \
1365  "Control Replication Collective Value Exchange", \
1366  "Control Replication Collective Buffer Broadcast", \
1367  "Control Replication Collective Shard Sync Tree", \
1368  "Control Replication Collective Shard Event Tree", \
1369  "Control Replication Collective Single Task Tree", \
1370  "Control Replication Collective Cross Product Partition", \
1371  "Control Replication Collective Sharding Gather Collective", \
1372  "Control Replication Collective Indirect Copy Exchange", \
1373  "Control Replication Collective Field Descriptor Exchange", \
1374  "Control Replication Collective Field Descriptor Gather", \
1375  "Control Replication Collective Deppart Result Scatter", \
1376  "Control Replication Collective Buffer Exchange", \
1377  "Control Replication Collective Future Name Exchange", \
1378  "Control Replication Collective Must Epoch Mapping Broadcast",\
1379  "Control Replication Collective Must Epoch Mapping Exchange", \
1380  "Control Replication Collective Must Epoch Dependence Exchange",\
1381  "Control Replication Collective Must Epoch Completion Exchange",\
1382  "Control Replication Collective Check Mapping", \
1383  "Control Replication Collective Check Sources", \
1384  "Control Replication Collective Template Index Exchange", \
1385  "Control Replication Collective Unordered Exchange", \
1386  "Control Replication Collective Consensus Match", \
1387  "Control Replication Collective Verify Control Replication Exchange",\
1388  "Control Replication Collective Output Size Exchange", \
1389  "Control Replication Collective Index Attach Launch Space", \
1390  "Control Replication Collective Index Attach Upper Bound", \
1391  "Control Replication Collective Index Attach Exchange", \
1392  "Control Replication Collective Shard Participants Exchange", \
1393  "Control Replication Collective Implicit Sharding Functor", \
1394  "Control Replication Collective Create Fill View", \
1395  "Control Replication Collective Versioning Rendezvous", \
1396  "Control Replication Collective View Rendezvous", \
1397  "Control Replication Collective Concurrent Execution Validation",\
1398  "Control Replication Collective Concurrent Allreduce", \
1399  "Control Replication Collective Projection Tree Exchange", \
1400  "Control Replication Collective Timeout Match Exchange", \
1401  "Control Replication Collective Mask Exchange", \
1402  "Control Replication Collective Predicate Exchange", \
1403  "Control Replication Collective Cross Product Exchange", \
1404  "Control Replication Collective Slow Barrier", \
1405  "Send Shutdown Notification", \
1406  "Send Shutdown Response", \
1407  };
1408 
1409  // Runtime task numbering
1410  enum {
1411  LG_STARTUP_TASK_ID = Realm::Processor::TASK_ID_PROCESSOR_INIT,
1412  LG_SHUTDOWN_TASK_ID = Realm::Processor::TASK_ID_PROCESSOR_SHUTDOWN,
1413  LG_TASK_ID = Realm::Processor::TASK_ID_FIRST_AVAILABLE,
1414 #ifdef LEGION_SEPARATE_META_TASKS
1415  LG_LEGION_PROFILING_ID = LG_TASK_ID+LG_LAST_TASK_ID+LAST_SEND_KIND,
1416  LG_ENDPOINT_TASK_ID = LG_TASK_ID+LG_LAST_TASK_ID+LAST_SEND_KIND+1,
1417  LG_APP_PROC_TASK_ID = LG_TASK_ID+LG_LAST_TASK_ID+LAST_SEND_KIND+2,
1418  LG_TASK_ID_AVAILABLE = LG_APP_PROC_TASK_ID+LG_LAST_TASK_ID,
1419 #else
1420  LG_LEGION_PROFILING_ID = LG_TASK_ID+1,
1421  LG_ENDPOINT_TASK_ID = LG_TASK_ID+2,
1422  LG_APP_PROC_TASK_ID = LG_TASK_ID+3,
1423  LG_TASK_ID_AVAILABLE = LG_TASK_ID+4,
1424 #endif
1425  };
1426 
1427  enum RuntimeCallKind {
1428  // Mapper runtime call kinds
1429  MAPPER_SEND_MESSAGE_CALL,
1430  MAPPER_BROADCAST_CALL,
1431  MAPPER_UNPACK_INSTANCE_CALL,
1432  MAPPER_CREATE_EVENT_CALL,
1433  MAPPER_HAS_TRIGGERED_CALL,
1434  MAPPER_TRIGGER_EVENT_CALL,
1435  MAPPER_WAIT_EVENT_CALL,
1436  MAPPER_FIND_EXECUTION_CONSTRAINTS_CALL,
1437  MAPPER_FIND_TASK_LAYOUT_CONSTRAINTS_CALL,
1438  MAPPER_FIND_LAYOUT_CONSTRAINTS_CALL,
1439  MAPPER_REGISTER_LAYOUT_CALL,
1440  MAPPER_RELEASE_LAYOUT_CALL,
1441  MAPPER_CONSTRAINTS_CONFLICT_CALL,
1442  MAPPER_CONSTRAINTS_ENTAIL_CALL,
1443  MAPPER_FIND_VALID_VARIANTS_CALL,
1444  MAPPER_FIND_TASK_VARIANT_NAME_CALL,
1445  MAPPER_IS_LEAF_VARIANT_CALL,
1446  MAPPER_IS_INNER_VARIANT_CALL,
1447  MAPPER_IS_IDEMPOTENT_VARIANT_CALL,
1448  MAPPER_IS_REPLICABLE_VARIANT_CALL,
1449  MAPPER_REGISTER_TASK_VARIANT_CALL,
1450  MAPPER_FILTER_VARIANTS_CALL,
1451  MAPPER_FILTER_INSTANCES_CALL,
1452  MAPPER_CREATE_PHYSICAL_INSTANCE_CALL,
1453  MAPPER_FIND_OR_CREATE_PHYSICAL_INSTANCE_CALL,
1454  MAPPER_FIND_PHYSICAL_INSTANCE_CALL,
1455  MAPPER_FIND_PHYSICAL_INSTANCES_CALL,
1456  MAPPER_SET_GC_PRIORITY_CALL,
1457  MAPPER_ACQUIRE_INSTANCE_CALL,
1458  MAPPER_ACQUIRE_INSTANCES_CALL,
1459  MAPPER_ACQUIRE_AND_FILTER_INSTANCES_CALL,
1460  MAPPER_RELEASE_INSTANCE_CALL,
1461  MAPPER_RELEASE_INSTANCES_CALL,
1462  MAPPER_SUBSCRIBE_INSTANCE_CALL,
1463  MAPPER_UNSUBSCRIBE_INSTANCE_CALL,
1464  MAPPER_COLLECT_INSTANCE_CALL,
1465  MAPPER_COLLECT_INSTANCES_CALL,
1466  MAPPER_ACQUIRE_FUTURE_CALL,
1467  MAPPER_CREATE_INDEX_SPACE_CALL,
1468  MAPPER_UNION_INDEX_SPACES_CALL,
1469  MAPPER_INTERSECT_INDEX_SPACES_CALL,
1470  MAPPER_SUBTRACT_INDEX_SPACES_CALL,
1471  MAPPER_INDEX_SPACE_EMPTY_CALL,
1472  MAPPER_INDEX_SPACES_OVERLAP_CALL,
1473  MAPPER_INDEX_SPACE_DOMINATES_CALL,
1474  MAPPER_HAS_INDEX_PARTITION_CALL,
1475  MAPPER_GET_INDEX_PARTITION_CALL,
1476  MAPPER_GET_INDEX_SUBSPACE_CALL,
1477  MAPPER_GET_INDEX_SPACE_DOMAIN_CALL,
1478  MAPPER_GET_INDEX_PARTITION_CS_CALL,
1479  MAPPER_GET_INDEX_PARTITION_CS_NAME_CALL,
1480  MAPPER_GET_INDEX_SPACE_PARTITION_COLORS_CALL,
1481  MAPPER_IS_INDEX_PARTITION_DISJOINT_CALL,
1482  MAPPER_IS_INDEX_PARTITION_COMPLETE_CALL,
1483  MAPPER_GET_INDEX_SPACE_COLOR_CALL,
1484  MAPPER_GET_INDEX_SPACE_COLOR_POINT_CALL,
1485  MAPPER_GET_INDEX_PARTITION_COLOR_CALL,
1486  MAPPER_GET_PARENT_INDEX_SPACE_CALL,
1487  MAPPER_HAS_PARENT_INDEX_PARTITION_CALL,
1488  MAPPER_GET_PARENT_INDEX_PARTITION_CALL,
1489  MAPPER_GET_INDEX_SPACE_DEPTH_CALL,
1490  MAPPER_GET_INDEX_PARTITION_DEPTH_CALL,
1491  MAPPER_GET_FIELD_SIZE_CALL,
1492  MAPPER_GET_FIELD_SPACE_FIELDS_CALL,
1493  MAPPER_GET_LOGICAL_PARTITION_CALL,
1494  MAPPER_GET_LOGICAL_PARTITION_BY_COLOR_CALL,
1495  MAPPER_GET_LOGICAL_PARTITION_BY_TREE_CALL,
1496  MAPPER_GET_LOGICAL_SUBREGION_CALL,
1497  MAPPER_GET_LOGICAL_SUBREGION_BY_COLOR_CALL,
1498  MAPPER_GET_LOGICAL_SUBREGION_BY_TREE_CALL,
1499  MAPPER_GET_LOGICAL_REGION_COLOR_CALL,
1500  MAPPER_GET_LOGICAL_REGION_COLOR_POINT_CALL,
1501  MAPPER_GET_LOGICAL_PARTITION_COLOR_CALL,
1502  MAPPER_GET_PARENT_LOGICAL_REGION_CALL,
1503  MAPPER_HAS_PARENT_LOGICAL_PARTITION_CALL,
1504  MAPPER_GET_PARENT_LOGICAL_PARTITION_CALL,
1505  MAPPER_RETRIEVE_SEMANTIC_INFO_CALL,
1506  MAPPER_RETRIEVE_NAME_CALL,
1507  MAPPER_AUTO_LOCK_CALL,
1508  // Old runtime call kinds
1509  PACK_BASE_TASK_CALL,
1510  UNPACK_BASE_TASK_CALL,
1511  TASK_PRIVILEGE_CHECK_CALL,
1512  CLONE_TASK_CALL,
1513  COMPUTE_POINT_REQUIREMENTS_CALL,
1514  INTRA_TASK_ALIASING_CALL,
1515  ACTIVATE_SINGLE_CALL,
1516  DEACTIVATE_SINGLE_CALL,
1517  SELECT_INLINE_VARIANT_CALL,
1518  INLINE_CHILD_TASK_CALL,
1519  PACK_SINGLE_TASK_CALL,
1520  UNPACK_SINGLE_TASK_CALL,
1521  PACK_REMOTE_CONTEXT_CALL,
1522  HAS_CONFLICTING_INTERNAL_CALL,
1523  FIND_CONFLICTING_CALL,
1524  FIND_CONFLICTING_INTERNAL_CALL,
1525  CHECK_REGION_DEPENDENCE_CALL,
1526  FIND_PARENT_REGION_REQ_CALL,
1527  FIND_PARENT_REGION_CALL,
1528  CHECK_PRIVILEGE_CALL,
1529  TRIGGER_SINGLE_CALL,
1530  INITIALIZE_MAP_TASK_CALL,
1531  FINALIZE_MAP_TASK_CALL,
1532  VALIDATE_VARIANT_SELECTION_CALL,
1533  MAP_ALL_REGIONS_CALL,
1534  INITIALIZE_REGION_TREE_CONTEXTS_CALL,
1535  INVALIDATE_REGION_TREE_CONTEXTS_CALL,
1536  CREATE_INSTANCE_TOP_VIEW_CALL,
1537  LAUNCH_TASK_CALL,
1538  ACTIVATE_MULTI_CALL,
1539  DEACTIVATE_MULTI_CALL,
1540  SLICE_INDEX_SPACE_CALL,
1541  CLONE_MULTI_CALL,
1542  MULTI_TRIGGER_EXECUTION_CALL,
1543  PACK_MULTI_CALL,
1544  UNPACK_MULTI_CALL,
1545  ACTIVATE_INDIVIDUAL_CALL,
1546  DEACTIVATE_INDIVIDUAL_CALL,
1547  INDIVIDUAL_PERFORM_MAPPING_CALL,
1548  INDIVIDUAL_RETURN_VIRTUAL_CALL,
1549  INDIVIDUAL_TRIGGER_COMPLETE_CALL,
1550  INDIVIDUAL_TRIGGER_COMMIT_CALL,
1551  INDIVIDUAL_POST_MAPPED_CALL,
1552  INDIVIDUAL_PACK_TASK_CALL,
1553  INDIVIDUAL_UNPACK_TASK_CALL,
1554  INDIVIDUAL_PACK_REMOTE_COMPLETE_CALL,
1555  INDIVIDUAL_UNPACK_REMOTE_COMPLETE_CALL,
1556  POINT_ACTIVATE_CALL,
1557  POINT_DEACTIVATE_CALL,
1558  POINT_TASK_COMPLETE_CALL,
1559  POINT_TASK_COMMIT_CALL,
1560  POINT_PACK_TASK_CALL,
1561  POINT_UNPACK_TASK_CALL,
1562  POINT_TASK_POST_MAPPED_CALL,
1563  REMOTE_TASK_ACTIVATE_CALL,
1564  REMOTE_TASK_DEACTIVATE_CALL,
1565  REMOTE_UNPACK_CONTEXT_CALL,
1566  INDEX_ACTIVATE_CALL,
1567  INDEX_DEACTIVATE_CALL,
1568  INDEX_COMPUTE_FAT_PATH_CALL,
1569  INDEX_PREMAP_TASK_CALL,
1570  INDEX_DISTRIBUTE_CALL,
1571  INDEX_PERFORM_MAPPING_CALL,
1572  INDEX_COMPLETE_CALL,
1573  INDEX_COMMIT_CALL,
1574  INDEX_PERFORM_INLINING_CALL,
1575  INDEX_CLONE_AS_SLICE_CALL,
1576  INDEX_HANDLE_FUTURE,
1577  INDEX_RETURN_SLICE_MAPPED_CALL,
1578  INDEX_RETURN_SLICE_COMPLETE_CALL,
1579  INDEX_RETURN_SLICE_COMMIT_CALL,
1580  SLICE_ACTIVATE_CALL,
1581  SLICE_DEACTIVATE_CALL,
1582  SLICE_APPLY_VERSION_INFO_CALL,
1583  SLICE_DISTRIBUTE_CALL,
1584  SLICE_PERFORM_MAPPING_CALL,
1585  SLICE_LAUNCH_CALL,
1586  SLICE_MAP_AND_LAUNCH_CALL,
1587  SLICE_PACK_TASK_CALL,
1588  SLICE_UNPACK_TASK_CALL,
1589  SLICE_CLONE_AS_SLICE_CALL,
1590  SLICE_HANDLE_FUTURE_CALL,
1591  SLICE_CLONE_AS_POINT_CALL,
1592  SLICE_ENUMERATE_POINTS_CALL,
1593  SLICE_MAPPED_CALL,
1594  SLICE_COMPLETE_CALL,
1595  SLICE_COMMIT_CALL,
1596  REALM_SPAWN_META_CALL,
1597  REALM_SPAWN_TASK_CALL,
1598  REALM_CREATE_INSTANCE_CALL,
1599  REALM_ISSUE_COPY_CALL,
1600  REALM_ISSUE_FILL_CALL,
1601  REGION_TREE_LOGICAL_ANALYSIS_CALL,
1602  REGION_TREE_LOGICAL_FENCE_CALL,
1603  REGION_TREE_VERSIONING_ANALYSIS_CALL,
1604  REGION_TREE_ADVANCE_VERSION_NUMBERS_CALL,
1605  REGION_TREE_INITIALIZE_CONTEXT_CALL,
1606  REGION_TREE_INVALIDATE_CONTEXT_CALL,
1607  REGION_TREE_PREMAP_ONLY_CALL,
1608  REGION_TREE_PHYSICAL_REGISTER_ONLY_CALL,
1609  REGION_TREE_PHYSICAL_REGISTER_USERS_CALL,
1610  REGION_TREE_PHYSICAL_PERFORM_CLOSE_CALL,
1611  REGION_TREE_PHYSICAL_CLOSE_CONTEXT_CALL,
1612  REGION_TREE_PHYSICAL_COPY_ACROSS_CALL,
1613  REGION_TREE_PHYSICAL_REDUCE_ACROSS_CALL,
1614  REGION_TREE_PHYSICAL_CONVERT_MAPPING_CALL,
1615  REGION_TREE_PHYSICAL_FILL_FIELDS_CALL,
1616  REGION_TREE_PHYSICAL_ATTACH_EXTERNAL_CALL,
1617  REGION_TREE_PHYSICAL_DETACH_EXTERNAL_CALL,
1618  REGION_NODE_REGISTER_LOGICAL_USER_CALL,
1619  REGION_NODE_CLOSE_LOGICAL_NODE_CALL,
1620  REGION_NODE_SIPHON_LOGICAL_CHILDREN_CALL,
1621  REGION_NODE_SIPHON_LOGICAL_PROJECTION_CALL,
1622  REGION_NODE_PERFORM_LOGICAL_CLOSES_CALL,
1623  REGION_NODE_FIND_VALID_INSTANCE_VIEWS_CALL,
1624  REGION_NODE_FIND_VALID_REDUCTION_VIEWS_CALL,
1625  REGION_NODE_ISSUE_UPDATE_COPIES_CALL,
1626  REGION_NODE_SORT_COPY_INSTANCES_CALL,
1627  REGION_NODE_ISSUE_GROUPED_COPIES_CALL,
1628  REGION_NODE_ISSUE_UPDATE_REDUCTIONS_CALL,
1629  REGION_NODE_PREMAP_REGION_CALL,
1630  REGION_NODE_REGISTER_REGION_CALL,
1631  REGION_NODE_CLOSE_STATE_CALL,
1632  CURRENT_STATE_RECORD_VERSION_NUMBERS_CALL,
1633  CURRENT_STATE_ADVANCE_VERSION_NUMBERS_CALL,
1634  PHYSICAL_STATE_CAPTURE_STATE_CALL,
1635  PHYSICAL_STATE_APPLY_PATH_ONLY_CALL,
1636  PHYSICAL_STATE_APPLY_STATE_CALL,
1637  PHYSICAL_STATE_MAKE_LOCAL_CALL,
1638  MATERIALIZED_VIEW_FIND_LOCAL_PRECONDITIONS_CALL,
1639  MATERIALIZED_VIEW_FIND_LOCAL_COPY_PRECONDITIONS_CALL,
1640  MATERIALIZED_VIEW_FILTER_PREVIOUS_USERS_CALL,
1641  MATERIALIZED_VIEW_FILTER_CURRENT_USERS_CALL,
1642  MATERIALIZED_VIEW_FILTER_LOCAL_USERS_CALL,
1643  REDUCTION_VIEW_PERFORM_REDUCTION_CALL,
1644  REDUCTION_VIEW_PERFORM_DEFERRED_REDUCTION_CALL,
1645  REDUCTION_VIEW_PERFORM_DEFERRED_REDUCTION_ACROSS_CALL,
1646  REDUCTION_VIEW_FIND_COPY_PRECONDITIONS_CALL,
1647  REDUCTION_VIEW_FIND_USER_PRECONDITIONS_CALL,
1648  REDUCTION_VIEW_FILTER_LOCAL_USERS_CALL,
1649  PHYSICAL_TRACE_EXECUTE_CALL,
1650  PHYSICAL_TRACE_PRECONDITION_CHECK_CALL,
1651  PHYSICAL_TRACE_OPTIMIZE_CALL,
1652  LAST_RUNTIME_CALL_KIND, // This one must be last
1653  };
1654 
1655 #define RUNTIME_CALL_DESCRIPTIONS(name) \
1656  const char *name[LAST_RUNTIME_CALL_KIND] = { \
1657  "MapperRuntime::send_message", \
1658  "MapperRuntime::broadcast", \
1659  "MapperRuntime::unpack_physical_instance", \
1660  "MapperRuntime::create_mapper_event", \
1661  "MapperRuntime::has_mapper_event_triggered", \
1662  "MapperRuntime::trigger_mapper_event", \
1663  "MapperRuntime::wait_on_mapper_event", \
1664  "MapperRuntime::find_execution_constraints", \
1665  "MapperRuntime::find_task_layout_constraints", \
1666  "MapperRuntime::find_layout_constraints", \
1667  "MapperRuntime::register_layout", \
1668  "MapperRuntime::release_layout", \
1669  "MapperRuntime::do_constraints_conflict", \
1670  "MapperRuntime::do_constraints_entail", \
1671  "MapperRuntime::find_valid_variants", \
1672  "MapperRuntime::find_task_variant_name", \
1673  "MapperRuntime::is_leaf_variant", \
1674  "MapperRuntime::is_inner_variant", \
1675  "MapperRuntime::is_idempotent_variant", \
1676  "MapperRuntime::is_replicable_variant", \
1677  "MapperRuntime::register_task_variant", \
1678  "MapperRuntime::filter_variants", \
1679  "MapperRuntime::filter_instances", \
1680  "MapperRuntime::create_physical_instance", \
1681  "MapperRuntime::find_or_create_physical_instance", \
1682  "MapperRuntime::find_physical_instance", \
1683  "MapperRuntime::find_physical_instances", \
1684  "MapperRuntime::set_garbage_collection_priority", \
1685  "MapperRuntime::acquire_instance", \
1686  "MapperRuntime::acquire_instances", \
1687  "MapperRuntime::acquire_and_filter_instances", \
1688  "MapperRuntime::release_instance", \
1689  "MapperRuntime::release_instances", \
1690  "MapperRuntime::subscribe", \
1691  "MapperRuntime::unsubscribe", \
1692  "MapperRuntime::collect_instance", \
1693  "MapperRuntime::collect_instances", \
1694  "MapperRuntime::acquire_future", \
1695  "MapperRuntime::create_index_space", \
1696  "MapperRuntime::union_index_spaces", \
1697  "MapperRuntime::intersect_index_spaces", \
1698  "MapperRuntime::subtract_index_spaces", \
1699  "MapperRuntime::is_index_space_empty", \
1700  "MapperRuntime::index_spaces_overlap", \
1701  "MapperRuntime::index_space_dominates", \
1702  "MapperRuntime::has_index_partition", \
1703  "MapperRuntime::get_index_partition", \
1704  "MapperRuntime::get_index_subspace", \
1705  "MapperRuntime::get_index_space_domain", \
1706  "MapperRuntime::get_index_partition_color_space", \
1707  "MapperRuntime::get_index_partition_color_space_name", \
1708  "MapperRuntime::get_index_space_parition_colors", \
1709  "MapperRuntime::is_index_partition_disjoint", \
1710  "MapperRuntime::is_index_partition_complete", \
1711  "MapperRuntime::get_index_space_color", \
1712  "MapperRuntime::get_index_space_color_point", \
1713  "MapperRuntime::get_index_partition_color", \
1714  "MapperRuntime::get_parent_index_space", \
1715  "MapperRuntime::has_parent_index_partition", \
1716  "MapperRuntime::get_parent_index_partition", \
1717  "MapperRuntime::get_index_space_depth", \
1718  "MapperRuntime::get_index_partition_depth", \
1719  "MapperRuntime::get_field_size", \
1720  "MapperRuntime::get_field_space_fields", \
1721  "MapperRuntime::get_logical_partition", \
1722  "MapperRuntime::get_logical_partition_by_color", \
1723  "MapperRuntime::get_logical_partition_by_tree", \
1724  "MapperRuntime::get_logical_subregion", \
1725  "MapperRuntime::get_logical_subregion_by_color", \
1726  "MapperRuntime::get_logical_subregion_by_tree", \
1727  "MapperRuntime::get_logical_region_color", \
1728  "MapperRuntime::get_logical_region_color_point", \
1729  "MapperRuntime::get_logical_partition_color", \
1730  "MapperRuntime::get_parent_logical_region", \
1731  "MapperRuntime::has_parent_logical_partition", \
1732  "MapperRuntime::get_parent_logical_partition", \
1733  "MapperRuntime::retrieve_semantic_information", \
1734  "MapperRuntime::retrieve_name", \
1735  "MapperRuntime::AutoLock", \
1736  "Pack Base Task", \
1737  "Unpack Base Task", \
1738  "Task Privilege Check", \
1739  "Clone Base Task", \
1740  "Compute Point Requirements", \
1741  "Intra-Task Aliasing", \
1742  "Activate Single", \
1743  "Deactivate Single", \
1744  "Select Inline Variant", \
1745  "Inline Child Task", \
1746  "Pack Single Task", \
1747  "Unpack Single Task", \
1748  "Pack Remote Context", \
1749  "Has Conflicting Internal", \
1750  "Find Conflicting", \
1751  "Find Conflicting Internal", \
1752  "Check Region Dependence", \
1753  "Find Parent Region Requirement", \
1754  "Find Parent Region", \
1755  "Check Privilege", \
1756  "Trigger Single", \
1757  "Initialize Map Task", \
1758  "Finalized Map Task", \
1759  "Validate Variant Selection", \
1760  "Map All Regions", \
1761  "Initialize Region Tree Contexts", \
1762  "Invalidate Region Tree Contexts", \
1763  "Create Instance Top View", \
1764  "Launch Task", \
1765  "Activate Multi", \
1766  "Deactivate Multi", \
1767  "Slice Index Space", \
1768  "Clone Multi Call", \
1769  "Multi Trigger Execution", \
1770  "Pack Multi", \
1771  "Unpack Multi", \
1772  "Activate Individual", \
1773  "Deactivate Individual", \
1774  "Individual Perform Mapping", \
1775  "Individual Return Virtual", \
1776  "Individual Trigger Complete", \
1777  "Individual Trigger Commit", \
1778  "Individual Post Mapped", \
1779  "Individual Pack Task", \
1780  "Individual Unpack Task", \
1781  "Individual Pack Remote Complete", \
1782  "Individual Unpack Remote Complete", \
1783  "Activate Point", \
1784  "Deactivate Point", \
1785  "Point Task Complete", \
1786  "Point Task Commit", \
1787  "Point Task Pack", \
1788  "Point Task Unpack", \
1789  "Point Task Post Mapped", \
1790  "Remote Task Activate", \
1791  "Remote Task Deactivate", \
1792  "Remote Unpack Context", \
1793  "Index Activate", \
1794  "Index Deactivate", \
1795  "Index Compute Fat Path", \
1796  "Index PreMap Task", \
1797  "Index Distribute", \
1798  "Index Perform Mapping", \
1799  "Index Complete", \
1800  "Index Commit", \
1801  "Index Perform Inlining", \
1802  "Index Clone As Slice", \
1803  "Index Handle Future", \
1804  "Index Return Slice Mapped", \
1805  "Index Return Slice Complete", \
1806  "Index Return Slice Commit", \
1807  "Slice Activate", \
1808  "Slice Deactivate", \
1809  "Slice Apply Version Info", \
1810  "Slice Distribute", \
1811  "Slice Perform Mapping", \
1812  "Slice Launch", \
1813  "Slice Map and Launch", \
1814  "Slice Pack Task", \
1815  "Slice Unpack Task", \
1816  "Slice Clone As Slice", \
1817  "Slice Handle Future", \
1818  "Slice Cone as Point", \
1819  "Slice Enumerate Points", \
1820  "Slice Mapped", \
1821  "Slice Complete", \
1822  "Slice Commit", \
1823  "Realm Spawn Meta", \
1824  "Realm Spawn Task", \
1825  "Realm Create Instance", \
1826  "Realm Issue Copy", \
1827  "Realm Issue Fill", \
1828  "Region Tree Logical Analysis", \
1829  "Region Tree Logical Fence", \
1830  "Region Tree Versioning Analysis", \
1831  "Region Tree Advance Version Numbers", \
1832  "Region Tree Initialize Context", \
1833  "Region Tree Invalidate Context", \
1834  "Region Tree Premap Only", \
1835  "Region Tree Physical Register Only", \
1836  "Region Tree Physical Register Users", \
1837  "Region Tree Physical Perform Close", \
1838  "Region Tree Physical Close Context", \
1839  "Region Tree Physical Copy Across", \
1840  "Region Tree Physical Reduce Across", \
1841  "Region Tree Physical Convert Mapping", \
1842  "Region Tree Physical Fill Fields", \
1843  "Region Tree Physical Attach External", \
1844  "Region Tree Physical Detach External", \
1845  "Region Node Register Logical User", \
1846  "Region Node Close Logical Node", \
1847  "Region Node Siphon Logical Children", \
1848  "Region Node Siphon Logical Projection", \
1849  "Region Node Perform Logical Closes", \
1850  "Region Node Find Valid Instance Views", \
1851  "Region Node Find Valid Reduction Views", \
1852  "Region Node Issue Update Copies", \
1853  "Region Node Sort Copy Instances", \
1854  "Region Node Issue Grouped Copies", \
1855  "Region Node Issue Update Reductions", \
1856  "Region Node Premap Region", \
1857  "Region Node Register Region", \
1858  "Region Node Close State", \
1859  "Logical State Record Verison Numbers", \
1860  "Logical State Advance Version Numbers", \
1861  "Physical State Capture State", \
1862  "Physical State Apply Path Only", \
1863  "Physical State Apply State", \
1864  "Physical State Make Local", \
1865  "Materialized View Find Local Preconditions", \
1866  "Materialized View Find Local Copy Preconditions", \
1867  "Materialized View Filter Previous Users", \
1868  "Materialized View Filter Current Users", \
1869  "Materialized View Filter Local Users", \
1870  "Reduction View Perform Reduction", \
1871  "Reduction View Perform Deferred Reduction", \
1872  "Reduction View Perform Deferred Reduction Across", \
1873  "Reduction View Find Copy Preconditions", \
1874  "Reduction View Find User Preconditions", \
1875  "Reduction View Filter Local Users", \
1876  "Physical Trace Execute", \
1877  "Physical Trace Precondition Check", \
1878  "Physical Trace Optimize", \
1879  };
1880 
1881  enum SemanticInfoKind {
1882  INDEX_SPACE_SEMANTIC,
1883  INDEX_PARTITION_SEMANTIC,
1884  FIELD_SPACE_SEMANTIC,
1885  FIELD_SEMANTIC,
1886  LOGICAL_REGION_SEMANTIC,
1887  LOGICAL_PARTITION_SEMANTIC,
1888  TASK_SEMANTIC,
1889  };
1890 
1891  // Static locations for where collectives are allocated
1892  // These are just arbitrary numbers but they should appear
1893  // with at most one logical static collective kind
1894  // Ones that have been commented out are free to be reused
1895  enum CollectiveIndexLocation {
1896  //COLLECTIVE_LOC_0 = 0,
1897  COLLECTIVE_LOC_1 = 1,
1898  COLLECTIVE_LOC_2 = 2,
1899  COLLECTIVE_LOC_3 = 3,
1900  COLLECTIVE_LOC_4 = 4,
1901  COLLECTIVE_LOC_5 = 5,
1902  COLLECTIVE_LOC_6 = 6,
1903  COLLECTIVE_LOC_7 = 7,
1904  COLLECTIVE_LOC_8 = 8,
1905  COLLECTIVE_LOC_9 = 9,
1906  COLLECTIVE_LOC_10 = 10,
1907  COLLECTIVE_LOC_11 = 11,
1908  COLLECTIVE_LOC_12 = 12,
1909  COLLECTIVE_LOC_13 = 13,
1910  COLLECTIVE_LOC_14 = 14,
1911  COLLECTIVE_LOC_15 = 15,
1912  COLLECTIVE_LOC_16 = 16,
1913  COLLECTIVE_LOC_17 = 17,
1914  COLLECTIVE_LOC_18 = 18,
1915  COLLECTIVE_LOC_19 = 19,
1916  COLLECTIVE_LOC_20 = 20,
1917  COLLECTIVE_LOC_21 = 21,
1918  COLLECTIVE_LOC_22 = 22,
1919  COLLECTIVE_LOC_23 = 23,
1920  COLLECTIVE_LOC_24 = 24,
1921  COLLECTIVE_LOC_25 = 25,
1922  COLLECTIVE_LOC_26 = 26,
1923  COLLECTIVE_LOC_27 = 27,
1924  COLLECTIVE_LOC_28 = 28,
1925  COLLECTIVE_LOC_29 = 29,
1926  COLLECTIVE_LOC_30 = 30,
1927  COLLECTIVE_LOC_31 = 31,
1928  COLLECTIVE_LOC_32 = 32,
1929  COLLECTIVE_LOC_33 = 33,
1930  COLLECTIVE_LOC_34 = 34,
1931  COLLECTIVE_LOC_35 = 35,
1932  COLLECTIVE_LOC_36 = 36,
1933  COLLECTIVE_LOC_37 = 37,
1934  COLLECTIVE_LOC_38 = 38,
1935  COLLECTIVE_LOC_39 = 39,
1936  COLLECTIVE_LOC_40 = 40,
1937  COLLECTIVE_LOC_41 = 41,
1938  COLLECTIVE_LOC_42 = 42,
1939  COLLECTIVE_LOC_43 = 43,
1940  COLLECTIVE_LOC_44 = 44,
1941  COLLECTIVE_LOC_45 = 45,
1942  COLLECTIVE_LOC_46 = 46,
1943  COLLECTIVE_LOC_47 = 47,
1944  COLLECTIVE_LOC_48 = 48,
1945  COLLECTIVE_LOC_49 = 49,
1946  COLLECTIVE_LOC_50 = 50,
1947  COLLECTIVE_LOC_51 = 51,
1948  COLLECTIVE_LOC_52 = 52,
1949  COLLECTIVE_LOC_53 = 53,
1950  COLLECTIVE_LOC_54 = 54,
1951  COLLECTIVE_LOC_55 = 55,
1952  COLLECTIVE_LOC_56 = 56,
1953  COLLECTIVE_LOC_57 = 57,
1954  COLLECTIVE_LOC_58 = 58,
1955  COLLECTIVE_LOC_59 = 59,
1956  COLLECTIVE_LOC_60 = 60,
1957  COLLECTIVE_LOC_61 = 61,
1958  COLLECTIVE_LOC_62 = 62,
1959  COLLECTIVE_LOC_63 = 63,
1960  COLLECTIVE_LOC_64 = 64,
1961  COLLECTIVE_LOC_65 = 65,
1962  COLLECTIVE_LOC_66 = 66,
1963  //COLLECTIVE_LOC_67 = 67,
1964  //COLLECTIVE_LOC_68 = 68,
1965  //COLLECTIVE_LOC_69 = 69,
1966  COLLECTIVE_LOC_70 = 70,
1967  COLLECTIVE_LOC_71 = 71,
1968  COLLECTIVE_LOC_72 = 72,
1969  COLLECTIVE_LOC_73 = 73,
1970  COLLECTIVE_LOC_74 = 74,
1971  COLLECTIVE_LOC_75 = 75,
1972  COLLECTIVE_LOC_76 = 76,
1973  COLLECTIVE_LOC_77 = 77,
1974  COLLECTIVE_LOC_78 = 78,
1975  COLLECTIVE_LOC_79 = 79,
1976  COLLECTIVE_LOC_80 = 80,
1977  COLLECTIVE_LOC_81 = 81,
1978  COLLECTIVE_LOC_82 = 82,
1979  COLLECTIVE_LOC_83 = 83,
1980  COLLECTIVE_LOC_84 = 84,
1981  COLLECTIVE_LOC_85 = 85,
1982  COLLECTIVE_LOC_86 = 86,
1983  COLLECTIVE_LOC_87 = 87,
1984  COLLECTIVE_LOC_88 = 88,
1985  COLLECTIVE_LOC_89 = 89,
1986  COLLECTIVE_LOC_90 = 90,
1987  COLLECTIVE_LOC_91 = 91,
1988  COLLECTIVE_LOC_92 = 92,
1989  COLLECTIVE_LOC_93 = 93,
1990  COLLECTIVE_LOC_94 = 94,
1991  COLLECTIVE_LOC_95 = 95,
1992  COLLECTIVE_LOC_96 = 96,
1993  COLLECTIVE_LOC_97 = 97,
1994  COLLECTIVE_LOC_98 = 98,
1995  COLLECTIVE_LOC_99 = 99,
1996  COLLECTIVE_LOC_100 = 100,
1997  COLLECTIVE_LOC_101 = 101,
1998  COLLECTIVE_LOC_102 = 102,
1999  COLLECTIVE_LOC_103 = 103,
2000  COLLECTIVE_LOC_104 = 104,
2001  COLLECTIVE_LOC_105 = 105,
2002  };
2003 
2004  // legion_types.h
2005  class LocalLock;
2006  class AutoLock;
2007  class AutoTryLock;
2008  class LgEvent; // base event type for legion
2009  class ApEvent; // application event
2010  class ApUserEvent; // application user event
2011  class ApBarrier; // application barrier
2012  class RtEvent; // runtime event
2013  class RtUserEvent; // runtime user event
2014  class RtBarrier;
2015 
2016  // legion_utilities.h
2017  struct RegionUsage;
2018  template<typename T> class Fraction;
2019  template<typename T, unsigned LOG2MAX> class BitPermutation;
2020 
2021  // Forward declarations for runtime level objects
2022  // runtime.h
2023  class Collectable;
2024  class FieldAllocatorImpl;
2025  class ArgumentMapImpl;
2026  class FutureImpl;
2027  class FutureInstance;
2028  class FutureMapImpl;
2029  class ReplFutureMapImpl;
2030  class PhysicalRegionImpl;
2031  class OutputRegionImpl;
2032  class ExternalResourcesImpl;
2033  class PieceIteratorImpl;
2034  class GrantImpl;
2035  class PredicateImpl;
2036  class LegionHandshakeImpl;
2037  class ProcessorManager;
2038  class MemoryManager;
2039  class VirtualChannel;
2040  class MessageManager;
2041  class ShutdownManager;
2042  class TaskImpl;
2043  class VariantImpl;
2044  class LayoutConstraints;
2045  class ProjectionFunction;
2046  class ShardingFunction;
2047  class Runtime;
2048  // A small interface class for handling profiling responses
2049  struct ProfilingResponseBase;
2051  public:
2052  virtual void handle_profiling_response(
2053  const ProfilingResponseBase *base,
2054  const Realm::ProfilingResponse &response,
2055  const void *orig, size_t orig_length) = 0;
2056  };
2058  public:
2060  : handler(h) { }
2061  public:
2062  ProfilingResponseHandler *const handler;
2063  };
2064 
2065  // legion_ops.h
2066  class Provenance;
2067  class Operation;
2068  class MemoizableOp;
2069  class PredicatedOp;
2070  class MapOp;
2071  class CopyOp;
2072  class IndexCopyOp;
2073  class PointCopyOp;
2074  class FenceOp;
2075  class FrameOp;
2076  class CreationOp;
2077  class DeletionOp;
2078  class InternalOp;
2079  class CloseOp;
2080  class MergeCloseOp;
2081  class PostCloseOp;
2082  class VirtualCloseOp;
2083  class RefinementOp;
2084  class ResetOp;
2085  class AcquireOp;
2086  class ReleaseOp;
2087  class DynamicCollectiveOp;
2088  class FuturePredOp;
2089  class NotPredOp;
2090  class AndPredOp;
2091  class OrPredOp;
2092  class MustEpochOp;
2093  class PendingPartitionOp;
2094  class DependentPartitionOp;
2095  class PointDepPartOp;
2096  class FillOp;
2097  class IndexFillOp;
2098  class PointFillOp;
2099  class DiscardOp;
2100  class AttachOp;
2101  class IndexAttachOp;
2102  class PointAttachOp;
2103  class DetachOp;
2104  class IndexDetachOp;
2105  class PointDetachOp;
2106  class TimingOp;
2107  class TunableOp;
2108  class AllReduceOp;
2109  class ExternalMappable;
2110  class RemoteOp;
2111  class RemoteMapOp;
2112  class RemoteCopyOp;
2113  class RemoteCloseOp;
2114  class RemoteAcquireOp;
2115  class RemoteReleaseOp;
2116  class RemoteFillOp;
2117  class RemotePartitionOp;
2118  class RemoteReplayOp;
2119  class RemoteSummaryOp;
2120  template<typename OP>
2121  class Memoizable;
2122  template<typename OP>
2123  class Predicated;
2124 
2125 
2126  // legion_tasks.h
2127  class ExternalTask;
2128  class TaskOp;
2129  class RemoteTaskOp;
2130  class SingleTask;
2131  class MultiTask;
2132  class IndividualTask;
2133  class PointTask;
2134  class ShardTask;
2135  class IndexTask;
2136  class SliceTask;
2137  class RemoteTask;
2138 
2139  // legion_context.h
2140  class TaskContext;
2141  class InnerContext;;
2142  class TopLevelContext;
2143  class ReplicateContext;
2144  class RemoteContext;
2145  class LeafContext;
2146 
2147  // legion_trace.h
2148  class LogicalTrace;
2149  class TraceCaptureOp;
2150  class TraceCompleteOp;
2151  class TraceReplayOp;
2152  class TraceBeginOp;
2153  class TraceSummaryOp;
2154  class PhysicalTrace;
2155  class TraceViewSet;
2156  class TraceConditionSet;
2157  class PhysicalTemplate;
2158  class ShardedPhysicalTemplate;
2159  class Instruction;
2160  class GetTermEvent;
2161  class ReplayMapping;
2162  class CreateApUserEvent;
2163  class TriggerEvent;
2164  class MergeEvent;
2165  class AssignFenceCompletion;
2166  class IssueCopy;
2167  class IssueFill;
2168  class IssueAcross;
2169  class GetOpTermEvent;
2170  class SetOpSyncEvent;
2171  class SetEffects;
2172  class CompleteReplay;
2173  class AcquireReplay;
2174  class ReleaseReplay;
2175  class BarrierArrival;
2176  class BarrierAdvance;
2177 
2178  // region_tree.h
2179  class RegionTreeForest;
2180  class CopyAcrossExecutor;
2181  class CopyAcrossUnstructured;
2182  class IndexSpaceExpression;
2183  class IndexSpaceExprRef;
2184  class IndexSpaceOperation;
2185  template<int DIM, typename T> class IndexSpaceOperationT;
2186  template<int DIM, typename T> class IndexSpaceUnion;
2187  template<int DIM, typename T> class IndexSpaceIntersection;
2188  template<int DIM, typename T> class IndexSpaceDifference;
2189  class ExpressionTrieNode;
2190  class IndexTreeNode;
2191  class IndexSpaceNode;
2192  template<int DIM, typename T> class IndexSpaceNodeT;
2193  class IndexPartNode;
2194  template<int DIM, typename T> class IndexPartNodeT;
2195  class FieldSpaceNode;
2196  class RegionTreeNode;
2197  class RegionNode;
2198  class PartitionNode;
2199  class ColorSpaceIterator;
2200  template<int DIM, typename T> class ColorSpaceLinearizationT;
2201  template<int DIM, typename T, typename RT = void> class KDNode;
2202  class EqKDTree;
2203  template<int DIM, typename T> class EqKDTreeT;
2204 
2205  class RegionTreePath;
2206  class PathTraverser;
2207  class NodeTraverser;
2208 
2209  class LogicalState;
2210  class LogicalAnalysis;
2211  class PhysicalAnalysis;
2212  class EquivalenceSet;
2213  class EqSetTracker;
2214  class VersionManager;
2215  class VersionInfo;
2216  class ProjectionNode;
2217  class ProjectionRegion;
2218  class ProjectionPartition;
2219  class RefinementTracker;
2220  class RegionRefinementTracker;
2221  class PartitionRefinementTracker;
2222 
2223  class Collectable;
2224  class Notifiable;
2225  class ImplicitReferenceTracker;
2226  class DistributedCollectable;
2227  class LayoutDescription;
2228  class InstanceManager; // base class for all instances
2229  class CopyAcrossHelper;
2230  class LogicalView; // base class for instance and reduction
2231  class InstanceKey;
2232  class InstanceView;
2233  class CollectableView; // pure virtual class
2234  class IndividualView;
2235  class CollectiveView;
2236  class MaterializedView;
2237  class ReplicatedView;
2238  class ReductionView;
2239  class AllreduceView;
2240  class DeferredView;
2241  class FillView;
2242  class PhiView;
2243  class MappingRef;
2244  class InstanceRef;
2245  class InstanceSet;
2246  class InnerTaskView;
2247  class VirtualManager;
2248  class PhysicalManager;
2249  class InstanceBuilder;
2250 
2251  class RegionAnalyzer;
2252  class RegionMapper;
2253 
2254  struct LogicalUser;
2255  struct PhysicalUser;
2256  struct LogicalTraceInfo;
2257  struct PhysicalTraceInfo;
2258  class TreeCloseImpl;
2259  class TreeClose;
2260  struct CloseInfo;
2261  struct FieldDataDescriptor;
2262  struct PendingRemoteExpression;
2263  class ProjectionSummary;
2264  class ProjectionInfo;
2265 
2266 
2267  // legion_spy.h
2268  class TreeStateLogger;
2269 
2270  // legion_profiling.h
2271  class LegionProfiler;
2272  class LegionProfInstance;
2273 
2274  // mapper_manager.h
2275  class MappingCallInfo;
2276  class MapperManager;
2277  class SerializingManager;
2278  class ConcurrentManager;
2279  typedef Mapping::MapperEvent MapperEvent;
2280  typedef Mapping::ProfilingMeasurementID ProfilingMeasurementID;
2281 
2282  // legion_replication.h
2283  class ShardedMapping;
2284  class ReplIndividualTask;
2285  class ReplIndexTask;
2286  class ReplMergeCloseOp;
2287  class ReplVirtualCloseOp;
2288  class ReplRefinementOp;
2289  class ReplResetOp;
2290  class ReplFillOp;
2291  class ReplIndexFillOp;
2292  class ReplDiscardOp;
2293  class ReplCopyOp;
2294  class ReplIndexCopyOp;
2295  class ReplDeletionOp;
2296  class ReplPendingPartitionOp;
2297  class ReplDependentPartitionOp;
2298  class ReplMustEpochOp;
2299  class ReplTimingOp;
2300  class ReplTunableOp;
2301  class ReplAllReduceOp;
2302  class ReplFenceOp;
2303  class ReplMapOp;
2304  class ReplAttachOp;
2305  class ReplIndexAttachOp;
2306  class ReplDetachOp;
2307  class ReplIndexDetachOp;
2308  class ReplAcquireOp;
2309  class ReplReleaseOp;
2310  class ReplTraceOp;
2311  class ReplTraceCaptureOp;
2312  class ReplTraceCompleteOp;
2313  class ReplTraceReplayOp;
2314  class ReplTraceBeginOp;
2315  class ReplTraceSummaryOp;
2316  class ShardMapping;
2317  class CollectiveMapping;
2318  class ShardManager;
2319  class ShardCollective;
2320  class GatherCollective;
2321  template<bool>
2323  template<typename T> class BarrierExchangeCollective;
2324  template<typename T> class ValueBroadcast;
2325  template<typename T, bool> class AllReduceCollective;
2326  class CrossProductCollective;
2327  class ShardingGatherCollective;
2328  class FieldDescriptorExchange;
2329  class FieldDescriptorGather;
2330  class FutureBroadcast;
2331  class FutureExchange;
2332  class FutureNameExchange;
2333  class MustEpochMappingBroadcast;
2334  class MustEpochMappingExchange;
2335  class PredicateCollective;
2336  class UnorderedExchange;
2337  class ShardRendezvous;
2338  class ProjectionTreeExchange;
2339  class TimeoutMatchExchange;
2340 
2341  // Nasty global variable for TLS support of figuring out
2342  // our context implicitly
2343  extern thread_local TaskContext *implicit_context;
2344  // Same thing for the runtime
2345  extern thread_local Runtime *implicit_runtime;
2346  // Another nasty global variable for tracking the fast
2347  // reservations that we are holding
2348  extern thread_local AutoLock *local_lock_list;
2349  // One more nasty global variable that we use for tracking
2350  // the provenance of meta-task operations for profiling
2351  // purposes, this has no bearing on correctness
2352  extern thread_local ::legion_unique_id_t implicit_provenance;
2353  // Use this to track if we're inside of a registration
2354  // callback function which we know to be deduplicated
2355  enum RegistrationCallbackMode {
2356  NO_REGISTRATION_CALLBACK = 0,
2357  LOCAL_REGISTRATION_CALLBACK = 1,
2358  GLOBAL_REGISTRATION_CALLBACK = 2,
2359  };
2360  extern thread_local unsigned inside_registration_callback;
2361  // This data structure tracks references to any live
2362  // temporary index space expressions that have been
2363  // handed back by the region tree inside the execution
2364  // of a meta-task or a runtime API call. It also tracks
2365  // changes to remote distributed collectable that can be
2366  // delayed and batched together.
2367  extern thread_local ImplicitReferenceTracker *implicit_reference_tracker;
2368 #ifdef DEBUG_LEGION_WAITS
2369  extern thread_local int meta_task_id;
2370 #endif
2371 #ifdef DEBUG_LEGION_CALLERS
2372  extern thread_local LgTaskID implicit_task_kind;
2373  extern thread_local LgTaskID implicit_task_caller;
2374 #endif
2375 
2380  template<typename T>
2381  struct LgTaskArgs {
2382  public:
2383  LgTaskArgs(::legion_unique_id_t uid)
2384  : provenance(uid),
2385 #ifdef DEBUG_LEGION_CALLERS
2386  lg_call_id(implicit_task_kind),
2387 #endif
2388  lg_task_id(T::TASK_ID) { }
2389  public:
2390  // In this order for alignment reasons
2391  const ::legion_unique_id_t provenance;
2392 #ifdef DEBUG_LEGION_CALLERS
2393  const LgTaskID lg_call_id;
2394 #endif
2395  const LgTaskID lg_task_id;
2396  };
2397 
2398 #define FRIEND_ALL_RUNTIME_CLASSES \
2399  friend class Legion::Runtime; \
2400  friend class Internal::Runtime; \
2401  friend class Internal::FutureImpl; \
2402  friend class Internal::FutureMapImpl; \
2403  friend class Internal::PhysicalRegionImpl; \
2404  friend class Internal::ExternalResourcesImpl; \
2405  friend class Internal::TaskImpl; \
2406  friend class Internal::VariantImpl; \
2407  friend class Internal::ProcessorManager; \
2408  friend class Internal::MemoryManager; \
2409  friend class Internal::Operation; \
2410  friend class Internal::PredicatedOp; \
2411  friend class Internal::MapOp; \
2412  friend class Internal::CopyOp; \
2413  friend class Internal::IndexCopyOp; \
2414  friend class Internal::PointCopyOp; \
2415  friend class Internal::FenceOp; \
2416  friend class Internal::DynamicCollectiveOp; \
2417  friend class Internal::FuturePredOp; \
2418  friend class Internal::CreationOp; \
2419  friend class Internal::DeletionOp; \
2420  friend class Internal::CloseOp; \
2421  friend class Internal::MergeCloseOp; \
2422  friend class Internal::PostCloseOp; \
2423  friend class Internal::VirtualCloseOp; \
2424  friend class Internal::RefinementOp; \
2425  friend class Internal::ResetOp; \
2426  friend class Internal::AcquireOp; \
2427  friend class Internal::ReleaseOp; \
2428  friend class Internal::PredicateImpl; \
2429  friend class Internal::NotPredOp; \
2430  friend class Internal::AndPredOp; \
2431  friend class Internal::OrPredOp; \
2432  friend class Internal::MustEpochOp; \
2433  friend class Internal::PendingPartitionOp; \
2434  friend class Internal::DependentPartitionOp; \
2435  friend class Internal::PointDepPartOp; \
2436  friend class Internal::FillOp; \
2437  friend class Internal::IndexFillOp; \
2438  friend class Internal::PointFillOp; \
2439  friend class Internal::DiscardOp; \
2440  friend class Internal::AttachOp; \
2441  friend class Internal::IndexAttachOp; \
2442  friend class Internal::ReplIndexAttachOp; \
2443  friend class Internal::PointAttachOp; \
2444  friend class Internal::DetachOp; \
2445  friend class Internal::IndexDetachOp; \
2446  friend class Internal::ReplIndexDetachOp; \
2447  friend class Internal::PointDetachOp; \
2448  friend class Internal::TimingOp; \
2449  friend class Internal::TunableOp; \
2450  friend class Internal::AllReduceOp; \
2451  friend class Internal::TraceSummaryOp; \
2452  friend class Internal::ExternalMappable; \
2453  friend class Internal::ExternalTask; \
2454  friend class Internal::TaskOp; \
2455  friend class Internal::SingleTask; \
2456  friend class Internal::MultiTask; \
2457  friend class Internal::IndividualTask; \
2458  friend class Internal::PointTask; \
2459  friend class Internal::IndexTask; \
2460  friend class Internal::SliceTask; \
2461  friend class Internal::ReplIndividualTask; \
2462  friend class Internal::ReplIndexTask; \
2463  friend class Internal::ReplFillOp; \
2464  friend class Internal::ReplIndexFillOp; \
2465  friend class Internal::ReplDiscardOp; \
2466  friend class Internal::ReplCopyOp; \
2467  friend class Internal::ReplIndexCopyOp; \
2468  friend class Internal::ReplDeletionOp; \
2469  friend class Internal::ReplPendingPartitionOp; \
2470  friend class Internal::ReplDependentPartitionOp; \
2471  friend class Internal::ReplMustEpochOp; \
2472  friend class Internal::ReplMapOp; \
2473  friend class Internal::ReplTimingOp; \
2474  friend class Internal::ReplTunableOp; \
2475  friend class Internal::ReplAllReduceOp; \
2476  friend class Internal::ReplFenceOp; \
2477  friend class Internal::ReplAttachOp; \
2478  friend class Internal::ReplDetachOp; \
2479  friend class Internal::ReplAcquireOp; \
2480  friend class Internal::ReplReleaseOp; \
2481  friend class Internal::MemoizableOp; \
2482  template<typename OP> \
2483  friend class Internal::Memoizable; \
2484  friend class Internal::ShardManager; \
2485  friend class Internal::RegionTreeForest; \
2486  friend class Internal::IndexSpaceNode; \
2487  template<int, typename> \
2488  friend class Internal::IndexSpaceNodeT; \
2489  friend class Internal::IndexPartNode; \
2490  friend class Internal::FieldSpaceNode; \
2491  friend class Internal::RegionTreeNode; \
2492  friend class Internal::RegionNode; \
2493  friend class Internal::PartitionNode; \
2494  friend class Internal::LogicalView; \
2495  friend class Internal::InstanceView; \
2496  friend class Internal::DeferredView; \
2497  friend class Internal::ReductionView; \
2498  friend class Internal::MaterializedView; \
2499  friend class Internal::FillView; \
2500  friend class Internal::LayoutDescription; \
2501  friend class Internal::InstanceManager; \
2502  friend class Internal::PhysicalManager; \
2503  friend class Internal::TreeStateLogger; \
2504  friend class Internal::MapperManager; \
2505  friend class Internal::InstanceRef; \
2506  friend class Internal::LegionHandshakeImpl; \
2507  friend class Internal::ArgumentMapImpl; \
2508  friend class Internal::FutureMapImpl; \
2509  friend class Internal::ReplFutureMapImpl; \
2510  friend class Internal::TaskContext; \
2511  friend class Internal::InnerContext; \
2512  friend class Internal::TopLevelContext; \
2513  friend class Internal::RemoteContext; \
2514  friend class Internal::LeafContext; \
2515  friend class Internal::ReplicateContext; \
2516  friend class Internal::InstanceBuilder; \
2517  friend class Internal::FutureNameExchange; \
2518  friend class Internal::MustEpochMappingExchange; \
2519  friend class Internal::MustEpochMappingBroadcast; \
2520  friend class BindingLib::Utility; \
2521  friend class CObjectWrapper;
2522 
2523 #define LEGION_EXTERN_LOGGER_DECLARATIONS \
2524  extern Realm::Logger log_run; \
2525  extern Realm::Logger log_task; \
2526  extern Realm::Logger log_index; \
2527  extern Realm::Logger log_field; \
2528  extern Realm::Logger log_region; \
2529  extern Realm::Logger log_inst; \
2530  extern Realm::Logger log_variant; \
2531  extern Realm::Logger log_allocation; \
2532  extern Realm::Logger log_migration; \
2533  extern Realm::Logger log_prof; \
2534  extern Realm::Logger log_garbage; \
2535  extern Realm::Logger log_spy; \
2536  extern Realm::Logger log_shutdown; \
2537  extern Realm::Logger log_tracing;
2538 
2539  }; // Internal namespace
2540 
2541  // Typedefs that are needed everywhere
2542  typedef Realm::Runtime RealmRuntime;
2543  typedef Realm::Machine Machine;
2544  typedef Realm::Memory Memory;
2545  typedef Realm::Processor Processor;
2546  typedef Realm::ProcessorGroup ProcessorGroup;
2547  typedef Realm::CodeDescriptor CodeDescriptor;
2548  typedef Realm::Reservation Reservation;
2549  typedef Realm::CompletionQueue CompletionQueue;
2550  typedef ::legion_reduction_op_id_t ReductionOpID;
2551  typedef Realm::ReductionOpUntyped ReductionOp;
2552  typedef ::legion_custom_serdez_id_t CustomSerdezID;
2553  typedef Realm::CustomSerdezUntyped SerdezOp;
2554  typedef Realm::Machine::ProcessorMemoryAffinity ProcessorMemoryAffinity;
2555  typedef Realm::Machine::MemoryMemoryAffinity MemoryMemoryAffinity;
2556  typedef Realm::DynamicTemplates::TagType TypeTag;
2557  typedef Realm::Logger Logger;
2558  typedef ::legion_coord_t coord_t;
2559  typedef std::map<CustomSerdezID,
2560  const Realm::CustomSerdezUntyped *> SerdezOpTable;
2561  typedef std::map<Realm::ReductionOpID,
2562  Realm::ReductionOpUntyped *> ReductionOpTable;
2563  typedef void (*SerdezInitFnptr)(const ReductionOp*, void *&, size_t&);
2564  typedef void (*SerdezFoldFnptr)(const ReductionOp*, void *&,
2565  size_t&, const void*);
2566  typedef std::map<Realm::ReductionOpID, SerdezRedopFns> SerdezRedopTable;
2567  typedef ::legion_projection_type_t HandleType;
2568  typedef ::legion_address_space_t AddressSpace;
2569  typedef ::legion_task_priority_t TaskPriority;
2570  typedef ::legion_task_priority_t RealmPriority;
2571  typedef ::legion_garbage_collection_priority_t GCPriority;
2572  typedef ::legion_color_t Color;
2573  typedef ::legion_field_id_t FieldID;
2574  typedef ::legion_trace_id_t TraceID;
2575  typedef ::legion_mapper_id_t MapperID;
2576  typedef ::legion_context_id_t ContextID;
2577  typedef ::legion_instance_id_t InstanceID;
2578  typedef ::legion_index_space_id_t IndexSpaceID;
2579  typedef ::legion_index_partition_id_t IndexPartitionID;
2580  typedef ::legion_index_tree_id_t IndexTreeID;
2581  typedef ::legion_field_space_id_t FieldSpaceID;
2582  typedef ::legion_generation_id_t GenerationID;
2583  typedef ::legion_type_handle TypeHandle;
2584  typedef ::legion_projection_id_t ProjectionID;
2585  typedef ::legion_sharding_id_t ShardingID;
2586  typedef ::legion_region_tree_id_t RegionTreeID;
2587  typedef ::legion_distributed_id_t DistributedID;
2588  typedef ::legion_address_space_t AddressSpaceID;
2589  typedef ::legion_tunable_id_t TunableID;
2590  typedef ::legion_local_variable_id_t LocalVariableID;
2591  typedef ::legion_mapping_tag_id_t MappingTagID;
2592  typedef ::legion_semantic_tag_t SemanticTag;
2593  typedef ::legion_variant_id_t VariantID;
2594  typedef ::legion_code_descriptor_id_t CodeDescriptorID;
2595  typedef ::legion_unique_id_t UniqueID;
2596  typedef ::legion_version_id_t VersionID;
2597  typedef ::legion_projection_epoch_id_t ProjectionEpochID;
2598  typedef ::legion_task_id_t TaskID;
2599  typedef ::legion_layout_constraint_id_t LayoutConstraintID;
2600  typedef ::legion_shard_id_t ShardID;
2601  typedef ::legion_internal_color_t LegionColor;
2602  typedef void (*RegistrationCallbackFnptr)(Machine machine,
2603  Runtime *rt, const std::set<Processor> &local_procs);
2604  typedef void (*RegistrationWithArgsCallbackFnptr)(
2605  const RegistrationCallbackArgs &args);
2606  typedef LogicalRegion (*RegionProjectionFnptr)(LogicalRegion parent,
2607  const DomainPoint&, Runtime *rt);
2608  typedef LogicalRegion (*PartitionProjectionFnptr)(LogicalPartition parent,
2609  const DomainPoint&, Runtime *rt);
2610  typedef bool (*PredicateFnptr)(const void*, size_t,
2611  const std::vector<Future> futures);
2612  typedef void (*RealmFnptr)(const void*,size_t,
2613  const void*,size_t,Processor);
2614  // Magical typedefs
2615  // (don't forget to update ones in old HighLevel namespace in legion.inl)
2616  typedef Internal::TaskContext* Context;
2617  // Anothing magical typedef
2618  namespace Mapping {
2619  typedef Internal::MappingCallInfo* MapperContext;
2620  typedef Internal::InstanceManager* PhysicalInstanceImpl;
2621  typedef Internal::CollectiveView* CollectiveViewImpl;
2622  // This type import is experimental to facilitate coordination and
2623  // synchronization between different mappers and may be revoked later
2624  // as we develop new abstractions for mappers to interact
2625  typedef Internal::LocalLock LocalLock;
2626  };
2627 
2628  namespace Internal {
2629  // The invalid color
2630  const LegionColor INVALID_COLOR = LLONG_MAX;
2631  // This is only needed internally
2632  typedef Realm::RegionInstance PhysicalInstance;
2633  typedef Realm::CopySrcDstField CopySrcDstField;
2634  typedef unsigned long long CollectiveID;
2635  typedef unsigned long long IndexSpaceExprID;
2636  struct ContextCoordinate;
2637  typedef ContextCoordinate TraceLocalID;
2638  typedef std::vector<ContextCoordinate> TaskTreeCoordinates;
2639  // Helper for encoding templates
2641  public Realm::DynamicTemplates::ListProduct2<Realm::DIMCOUNTS,
2642  Realm::DIMTYPES> {
2643  typedef Realm::DynamicTemplates::ListProduct2<Realm::DIMCOUNTS,
2644  Realm::DIMTYPES> SUPER;
2645  public:
2646  template<int N, typename T> __CUDA_HD__
2647  static inline constexpr TypeTag encode_tag(void) {
2648 #if __cplusplus >= 201402L
2649  constexpr TypeTag type =
2650  SUPER::template encode_tag<Realm::DynamicTemplates::Int<N>, T>();
2651  static_assert(type != 0, "All types should be non-zero for Legion");
2652  return type;
2653 #else
2654  return SUPER::template encode_tag<Realm::DynamicTemplates::Int<N>, T>();
2655 #endif
2656  }
2657  template<int N, typename T>
2658  static inline void check_type(const TypeTag t) {
2659 #ifdef DEBUG_LEGION
2660 #ifndef NDEBUG
2661  const TypeTag t1 = encode_tag<N,T>();
2662 #endif
2663  assert(t1 == t);
2664 #endif
2665  }
2666  struct DimHelper {
2667  public:
2668  template<typename N, typename T>
2669  static inline void demux(int *result) { *result = N::N; }
2670  };
2671  static inline int get_dim(const TypeTag t) {
2672  int result = 0;
2673  SUPER::demux<DimHelper>(t, &result);
2674  return result;
2675  }
2676  };
2677  // Pull some of the mapper types into the internal space
2678  typedef Mapping::Mapper Mapper;
2679  typedef Mapping::PhysicalInstance MappingInstance;
2680  typedef Mapping::CollectiveView MappingCollective;
2681  // A little bit of logic here to figure out the
2682  // kind of bit mask to use for FieldMask
2683 
2684 // The folowing macros are used in the FieldMask instantiation of BitMask
2685 // If you change one you probably have to change the others too
2686 #define LEGION_FIELD_MASK_FIELD_TYPE uint64_t
2687 #define LEGION_FIELD_MASK_FIELD_SHIFT 6
2688 #define LEGION_FIELD_MASK_FIELD_MASK 0x3F
2689 #define LEGION_FIELD_MASK_FIELD_ALL_ONES 0xFFFFFFFFFFFFFFFF
2690 
2691 #if defined(__AVX__)
2692 #if (LEGION_MAX_FIELDS > 256)
2693  typedef AVXTLBitMask<LEGION_MAX_FIELDS> FieldMask;
2694 #elif (LEGION_MAX_FIELDS > 128)
2695  typedef AVXBitMask<LEGION_MAX_FIELDS> FieldMask;
2696 #elif (LEGION_MAX_FIELDS > 64)
2697  typedef SSEBitMask<LEGION_MAX_FIELDS> FieldMask;
2698 #else
2699  typedef BitMask<LEGION_FIELD_MASK_FIELD_TYPE,LEGION_MAX_FIELDS,
2700  LEGION_FIELD_MASK_FIELD_SHIFT,
2701  LEGION_FIELD_MASK_FIELD_MASK> FieldMask;
2702 #endif
2703 #elif defined(__SSE2__)
2704 #if (LEGION_MAX_FIELDS > 128)
2705  typedef SSETLBitMask<LEGION_MAX_FIELDS> FieldMask;
2706 #elif (LEGION_MAX_FIELDS > 64)
2707  typedef SSEBitMask<LEGION_MAX_FIELDS> FieldMask;
2708 #else
2709  typedef BitMask<LEGION_FIELD_MASK_FIELD_TYPE,LEGION_MAX_FIELDS,
2710  LEGION_FIELD_MASK_FIELD_SHIFT,
2711  LEGION_FIELD_MASK_FIELD_MASK> FieldMask;
2712 #endif
2713 #elif defined(__ALTIVEC__)
2714 #if (LEGION_MAX_FIELDS > 128)
2715  typedef PPCTLBitMask<LEGION_MAX_FIELDS> FieldMask;
2716 #elif (LEGION_MAX_FIELDS > 64)
2717  typedef PPCBitMask<LEGION_MAX_FIELDS> FieldMask;
2718 #else
2719  typedef BitMask<LEGION_FIELD_MASK_FIELD_TYPE,LEGION_MAX_FIELDS,
2720  LEGION_FIELD_MASK_FIELD_SHIFT,
2721  LEGION_FIELD_MASK_FIELD_MASK> FieldMask;
2722 #endif
2723 #elif defined(__ARM_NEON)
2724 #if (LEGION_MAX_FIELDS > 128)
2725  typedef NeonTLBitMask<LEGION_MAX_FIELDS> FieldMask;
2726 #elif (LEGION_MAX_FIELDS > 64)
2727  typedef NeonBitMask<LEGION_MAX_FIELDS> FieldMask;
2728 #else
2729  typedef BitMask<LEGION_FIELD_MASK_FIELD_TYPE,LEGION_MAX_FIELDS,
2730  LEGION_FIELD_MASK_FIELD_SHIFT,
2731  LEGION_FIELD_MASK_FIELD_MASK> FieldMask;
2732 #endif
2733 #else
2734 #if (LEGION_MAX_FIELDS > 64)
2735  typedef TLBitMask<LEGION_FIELD_MASK_FIELD_TYPE,LEGION_MAX_FIELDS,
2736  LEGION_FIELD_MASK_FIELD_SHIFT,
2737  LEGION_FIELD_MASK_FIELD_MASK> FieldMask;
2738 #else
2739  typedef BitMask<LEGION_FIELD_MASK_FIELD_TYPE,LEGION_MAX_FIELDS,
2740  LEGION_FIELD_MASK_FIELD_SHIFT,
2741  LEGION_FIELD_MASK_FIELD_MASK> FieldMask;
2742 #endif
2743 #endif
2744  typedef BitPermutation<FieldMask,LEGION_FIELD_LOG2> FieldPermutation;
2745  typedef Fraction<unsigned long> InstFrac;
2746 #undef LEGION_FIELD_MASK_FIELD_SHIFT
2747 #undef LEGION_FIELD_MASK_FIELD_MASK
2748 
2749  // Similar logic as field masks for node masks
2750 
2751 // The following macros are used in the NodeMask instantiation of BitMask
2752 // If you change one you probably have to change the others too
2753 #define LEGION_NODE_MASK_NODE_TYPE uint64_t
2754 #define LEGION_NODE_MASK_NODE_SHIFT 6
2755 #define LEGION_NODE_MASK_NODE_MASK 0x3F
2756 #define LEGION_NODE_MASK_NODE_ALL_ONES 0xFFFFFFFFFFFFFFFF
2757 
2758 #if defined(__AVX__)
2759 #if (LEGION_MAX_NUM_NODES > 256)
2760  typedef AVXTLBitMask<LEGION_MAX_NUM_NODES> NodeMask;
2761 #elif (LEGION_MAX_NUM_NODES > 128)
2762  typedef AVXBitMask<LEGION_MAX_NUM_NODES> NodeMask;
2763 #elif (LEGION_MAX_NUM_NODES > 64)
2764  typedef SSEBitMask<LEGION_MAX_NUM_NODES> NodeMask;
2765 #else
2766  typedef BitMask<LEGION_NODE_MASK_NODE_TYPE,LEGION_MAX_NUM_NODES,
2767  LEGION_NODE_MASK_NODE_SHIFT,
2768  LEGION_NODE_MASK_NODE_MASK> NodeMask;
2769 #endif
2770 #elif defined(__SSE2__)
2771 #if (LEGION_MAX_NUM_NODES > 128)
2772  typedef SSETLBitMask<LEGION_MAX_NUM_NODES> NodeMask;
2773 #elif (LEGION_MAX_NUM_NODES > 64)
2774  typedef SSEBitMask<LEGION_MAX_NUM_NODES> NodeMask;
2775 #else
2776  typedef BitMask<LEGION_NODE_MASK_NODE_TYPE,LEGION_MAX_NUM_NODES,
2777  LEGION_NODE_MASK_NODE_SHIFT,
2778  LEGION_NODE_MASK_NODE_MASK> NodeMask;
2779 #endif
2780 #elif defined(__ALTIVEC__)
2781 #if (LEGION_MAX_NUM_NODES > 128)
2782  typedef PPCTLBitMask<LEGION_MAX_NUM_NODES> NodeMask;
2783 #elif (LEGION_MAX_NUM_NODES > 64)
2784  typedef PPCBitMask<LEGION_MAX_NUM_NODES> NodeMask;
2785 #else
2786  typedef BitMask<LEGION_NODE_MASK_NODE_TYPE,LEGION_MAX_NUM_NODES,
2787  LEGION_NODE_MASK_NODE_SHIFT,
2788  LEGION_NODE_MASK_NODE_MASK> NodeMask;
2789 #endif
2790 #elif defined(__ARM_NEON)
2791 #if (LEGION_MAX_NUM_NODES > 128)
2792  typedef NeonTLBitMask<LEGION_MAX_NUM_NODES> NodeMask;
2793 #elif (LEGION_MAX_NUM_NODES > 64)
2794  typedef NeonBitMask<LEGION_MAX_NUM_NODES> NodeMask;
2795 #else
2796  typedef BitMask<LEGION_NODE_MASK_NODE_TYPE,LEGION_MAX_NUM_NODES,
2797  LEGION_NODE_MASK_NODE_SHIFT,
2798  LEGION_NODE_MASK_NODE_MASK> NodeMask;
2799 #endif
2800 #else
2801 #if (LEGION_MAX_NUM_NODES > 64)
2802  typedef TLBitMask<LEGION_NODE_MASK_NODE_TYPE,LEGION_MAX_NUM_NODES,
2803  LEGION_NODE_MASK_NODE_SHIFT,
2804  LEGION_NODE_MASK_NODE_MASK> NodeMask;
2805 #else
2806  typedef BitMask<LEGION_NODE_MASK_NODE_TYPE,LEGION_MAX_NUM_NODES,
2807  LEGION_NODE_MASK_NODE_SHIFT,
2808  LEGION_NODE_MASK_NODE_MASK> NodeMask;
2809 #endif
2810 #endif
2811  typedef CompoundBitMask<NodeMask,1/*bloat*/,true/*bidir*/> NodeSet;
2812 
2813 #undef LEGION_NODE_MASK_NODE_SHIFT
2814 #undef LEGION_NODE_MASK_NODE_MASK
2815 
2816 // The following macros are used in the ProcessorMask instantiation of BitMask
2817 // If you change one you probably have to change the others too
2818 #define LEGION_PROC_MASK_PROC_TYPE uint64_t
2819 #define LEGION_PROC_MASK_PROC_SHIFT 6
2820 #define LEGION_PROC_MASK_PROC_MASK 0x3F
2821 #define LEGION_PROC_MASK_PROC_ALL_ONES 0xFFFFFFFFFFFFFFFF
2822 
2823 #if defined(__AVX__)
2824 #if (LEGION_MAX_NUM_PROCS > 256)
2825  typedef AVXTLBitMask<LEGION_MAX_NUM_PROCS> ProcessorMask;
2826 #elif (LEGION_MAX_NUM_PROCS > 128)
2827  typedef AVXBitMask<LEGION_MAX_NUM_PROCS> ProcessorMask;
2828 #elif (LEGION_MAX_NUM_PROCS > 64)
2829  typedef SSEBitMask<LEGION_MAX_NUM_PROCS> ProcessorMask;
2830 #else
2831  typedef BitMask<LEGION_PROC_MASK_PROC_TYPE,LEGION_MAX_NUM_PROCS,
2832  LEGION_PROC_MASK_PROC_SHIFT,
2833  LEGION_PROC_MASK_PROC_MASK> ProcessorMask;
2834 #endif
2835 #elif defined(__SSE2__)
2836 #if (LEGION_MAX_NUM_PROCS > 128)
2837  typedef SSETLBitMask<LEGION_MAX_NUM_PROCS> ProcessorMask;
2838 #elif (LEGION_MAX_NUM_PROCS > 64)
2839  typedef SSEBitMask<LEGION_MAX_NUM_PROCS> ProcessorMask;
2840 #else
2841  typedef BitMask<LEGION_PROC_MASK_PROC_TYPE,LEGION_MAX_NUM_PROCS,
2842  LEGION_PROC_MASK_PROC_SHIFT,
2843  LEGION_PROC_MASK_PROC_MASK> ProcessorMask;
2844 #endif
2845 #elif defined(__ALTIVEC__)
2846 #if (LEGION_MAX_NUM_PROCS > 128)
2847  typedef PPCTLBitMask<LEGION_MAX_NUM_PROCS> ProcessorMask;
2848 #elif (LEGION_MAX_NUM_PROCS > 64)
2849  typedef PPCBitMask<LEGION_MAX_NUM_PROCS> ProcessorMask;
2850 #else
2851  typedef BitMask<LEGION_PROC_MASK_PROC_TYPE,LEGION_MAX_NUM_PROCS,
2852  LEGION_PROC_MASK_PROC_SHIFT,
2853  LEGION_PROC_MASK_PROC_MASK> ProcessorMask;
2854 #endif
2855 #elif defined(__ARM_NEON)
2856 #if (LEGION_MAX_NUM_PROCS > 128)
2857  typedef NeonTLBitMask<LEGION_MAX_NUM_PROCS> ProcessorMask;
2858 #elif (LEGION_MAX_NUM_PROCS > 64)
2859  typedef NeonBitMask<LEGION_MAX_NUM_PROCS> ProcessorMask;
2860 #else
2861  typedef BitMask<LEGION_PROC_MASK_PROC_TYPE,LEGION_MAX_NUM_PROCS,
2862  LEGION_PROC_MASK_PROC_SHIFT,
2863  LEGION_PROC_MASK_PROC_MASK> ProcessorMask;
2864 #endif
2865 #else
2866 #if (LEGION_MAX_NUM_PROCS > 64)
2867  typedef TLBitMask<LEGION_PROC_MASK_PROC_TYPE,LEGION_MAX_NUM_PROCS,
2868  LEGION_PROC_MASK_PROC_SHIFT,
2869  LEGION_PROC_MASK_PROC_MASK> ProcessorMask;
2870 #else
2871  typedef BitMask<LEGION_PROC_MASK_PROC_TYPE,LEGION_MAX_NUM_PROCS,
2872  LEGION_PROC_MASK_PROC_SHIFT,
2873  LEGION_PROC_MASK_PROC_MASK> ProcessorMask;
2874 #endif
2875 #endif
2876 
2877 #undef PROC_SHIFT
2878 #undef PROC_MASK
2879 
2880  // Legion derived event types
2881  class LgEvent : public Realm::Event {
2882  public:
2883  static const LgEvent NO_LG_EVENT;
2884  public:
2885  LgEvent(void) noexcept { id = 0; }
2886  LgEvent(const LgEvent &rhs) = default;
2887  explicit LgEvent(const Realm::Event e) { id = e.id; }
2888  public:
2889  inline LgEvent& operator=(const LgEvent &rhs) = default;
2890  public:
2891  // Override the wait method so we can have our own implementation
2892  inline void wait(void) const;
2893  inline void wait_faultaware(bool &poisoned, bool from_application) const;
2894  protected:
2895  void begin_context_wait(Context ctx, bool from_application) const;
2896  void end_context_wait(Context ctx, bool from_application) const;
2897  };
2898 
2899  class PredEvent : public LgEvent {
2900  public:
2901  static const PredEvent NO_PRED_EVENT;
2902  public:
2903  PredEvent(void) noexcept : LgEvent() { }
2904  PredEvent(const PredEvent &rhs) = default;
2905  explicit PredEvent(const Realm::Event &e) : LgEvent(e) { }
2906  public:
2907  inline PredEvent& operator=(const PredEvent &rhs) = default;
2908  };
2909 
2910  class PredUserEvent : public PredEvent {
2911  public:
2912  static const PredUserEvent NO_PRED_USER_EVENT;
2913  public:
2914  PredUserEvent(void) noexcept : PredEvent() { }
2915  PredUserEvent(const PredUserEvent &rhs) = default;
2916  explicit PredUserEvent(const Realm::UserEvent &e) : PredEvent(e) { }
2917  public:
2918  inline PredUserEvent& operator=(const PredUserEvent &rhs) = default;
2919  inline operator Realm::UserEvent() const
2920  { Realm::UserEvent e; e.id = id; return e; }
2921  };
2922 
2923  class ApEvent : public LgEvent {
2924  public:
2925  static const ApEvent NO_AP_EVENT;
2926  public:
2927  ApEvent(void) noexcept : LgEvent() { }
2928  ApEvent(const ApEvent &rhs) = default;
2929  explicit ApEvent(const Realm::Event &e) : LgEvent(e) { }
2930  explicit ApEvent(const PredEvent &e) { id = e.id; }
2931  public:
2932  inline ApEvent& operator=(const ApEvent &rhs) = default;
2933  inline bool has_triggered_faultignorant(void) const
2934  { bool poisoned = false;
2935  return has_triggered_faultaware(poisoned); }
2936  inline void wait_faultaware(bool &poisoned) const
2937  { return LgEvent::wait_faultaware(poisoned, true/*application*/); }
2938  inline void wait_faultignorant(void) const
2939  { bool poisoned = false;
2940  LgEvent::wait_faultaware(poisoned, true/*application*/); }
2941  private:
2942  // Make these private because we always want to be conscious of faults
2943  // when testing or waiting on application events
2944  inline bool has_triggered(void) const { return LgEvent::has_triggered(); }
2945  inline void wait(void) const { LgEvent::wait(); }
2946  };
2947 
2948  class ApUserEvent : public ApEvent {
2949  public:
2950  static const ApUserEvent NO_AP_USER_EVENT;
2951  public:
2952  ApUserEvent(void) noexcept : ApEvent() { }
2953  ApUserEvent(const ApUserEvent &rhs) = default;
2954  explicit ApUserEvent(const Realm::UserEvent &e) : ApEvent(e) { }
2955  public:
2956  inline ApUserEvent& operator=(const ApUserEvent &rhs) = default;
2957  inline operator Realm::UserEvent() const
2958  { Realm::UserEvent e; e.id = id; return e; }
2959  };
2960 
2961  class ApBarrier : public ApEvent {
2962  public:
2963  static const ApBarrier NO_AP_BARRIER;
2964  public:
2965  ApBarrier(void) noexcept : ApEvent(), timestamp(0) { }
2966  ApBarrier(const ApBarrier &rhs) = default;
2967  explicit ApBarrier(const Realm::Barrier &b)
2968  : ApEvent(b), timestamp(b.timestamp) { }
2969  public:
2970  inline ApBarrier& operator=(const ApBarrier &rhs) = default;
2971  inline operator Realm::Barrier() const
2972  { Realm::Barrier b; b.id = id;
2973  b.timestamp = timestamp; return b; }
2974  public:
2975  inline bool get_result(void *value, size_t value_size) const
2976  { Realm::Barrier b; b.id = id;
2977  b.timestamp = timestamp; return b.get_result(value, value_size); }
2978  inline void destroy_barrier(void)
2979  { Realm::Barrier b; b.id = id;
2980  b.timestamp = timestamp; b.destroy_barrier(); }
2981  public:
2982  Realm::Barrier::timestamp_t timestamp;
2983  };
2984 
2985  class RtEvent : public LgEvent {
2986  public:
2987  static const RtEvent NO_RT_EVENT;
2988  public:
2989  RtEvent(void) noexcept : LgEvent() { }
2990  RtEvent(const RtEvent &rhs) = default;
2991  explicit RtEvent(const Realm::Event &e) : LgEvent(e) { }
2992  explicit RtEvent(const PredEvent &e) { id = e.id; }
2993  public:
2994  inline RtEvent& operator=(const RtEvent &rhs) = default;
2995  };
2996 
2997  class RtUserEvent : public RtEvent {
2998  public:
2999  static const RtUserEvent NO_RT_USER_EVENT;
3000  public:
3001  RtUserEvent(void) noexcept : RtEvent() { }
3002  RtUserEvent(const RtUserEvent &rhs) = default;
3003  explicit RtUserEvent(const Realm::UserEvent &e) : RtEvent(e) { }
3004  public:
3005  inline RtUserEvent& operator=(const RtUserEvent &rhs) = default;
3006  inline operator Realm::UserEvent() const
3007  { Realm::UserEvent e; e.id = id; return e; }
3008  };
3009 
3010  class RtBarrier : public RtEvent {
3011  public:
3012  static const RtBarrier NO_RT_BARRIER;
3013  public:
3014  RtBarrier(void) noexcept : RtEvent(), timestamp(0) { }
3015  RtBarrier(const RtBarrier &rhs) = default;
3016  explicit RtBarrier(const Realm::Barrier &b)
3017  : RtEvent(b), timestamp(b.timestamp) { }
3018  public:
3019  inline RtBarrier& operator=(const RtBarrier &rhs) = default;
3020  inline operator Realm::Barrier() const
3021  { Realm::Barrier b; b.id = id;
3022  b.timestamp = timestamp; return b; }
3023  public:
3024  inline bool get_result(void *value, size_t value_size) const
3025  { Realm::Barrier b; b.id = id;
3026  b.timestamp = timestamp; return b.get_result(value, value_size); }
3027  inline RtBarrier get_previous_phase(void)
3028  { Realm::Barrier b; b.id = id;
3029  return RtBarrier(b.get_previous_phase()); }
3030  inline void destroy_barrier(void)
3031  { Realm::Barrier b; b.id = id;
3032  b.timestamp = timestamp; b.destroy_barrier(); }
3033  public:
3034  Realm::Barrier::timestamp_t timestamp;
3035  };
3036 
3037  // Local lock for accelerating lock taking
3038  class LocalLock {
3039  public:
3040  inline LocalLock(void) { }
3041  public:
3042  inline LocalLock(const LocalLock &rhs)
3043  {
3044  // should never be called
3045  assert(false);
3046  }
3047  inline ~LocalLock(void) { }
3048  public:
3049  inline LocalLock& operator=(const LocalLock &rhs)
3050  {
3051  // should never be called
3052  assert(false);
3053  return *this;
3054  }
3055  private:
3056  // These are only accessible via AutoLock
3057  friend class AutoLock;
3058  friend class AutoTryLock;
3059  friend class Mapping::AutoLock;
3060  inline RtEvent lock(void) { return RtEvent(wrlock()); }
3061  inline RtEvent wrlock(void) { return RtEvent(reservation.wrlock()); }
3062  inline RtEvent rdlock(void) { return RtEvent(reservation.rdlock()); }
3063  inline bool trylock(void) { return reservation.trylock(); }
3064  inline bool trywrlock(void) { return reservation.trywrlock(); }
3065  inline bool tryrdlock(void) { return reservation.tryrdlock(); }
3066  inline void unlock(void) { reservation.unlock(); }
3067  private:
3068  inline void advise_sleep_entry(Realm::UserEvent guard)
3069  { reservation.advise_sleep_entry(guard); }
3070  inline void advise_sleep_exit(void)
3071  { reservation.advise_sleep_exit(); }
3072  protected:
3073  Realm::FastReservation reservation;
3074  };
3075 
3077  // AutoLock
3079  // An auto locking class for taking a lock and releasing it when
3080  // the object goes out of scope
3081  class AutoLock {
3082  public:
3083  inline AutoLock(LocalLock &r, int mode = 0, bool excl = true)
3084  : local_lock(r), previous(Internal::local_lock_list),
3085  exclusive(excl), held(true)
3086  {
3087 #ifdef DEBUG_REENTRANT_LOCKS
3088  if (previous != NULL)
3089  previous->check_for_reentrant_locks(&local_lock);
3090 #endif
3091  if (exclusive)
3092  {
3093  RtEvent ready = local_lock.wrlock();
3094  while (ready.exists())
3095  {
3096  ready.wait();
3097  ready = local_lock.wrlock();
3098  }
3099  }
3100  else
3101  {
3102  RtEvent ready = local_lock.rdlock();
3103  while (ready.exists())
3104  {
3105  ready.wait();
3106  ready = local_lock.rdlock();
3107  }
3108  }
3109  Internal::local_lock_list = this;
3110  }
3111  protected:
3112  // Helper constructor for AutoTryLock and Mapping::AutoLock
3113  inline AutoLock(int mode, bool excl, LocalLock &r)
3114  : local_lock(r), previous(Internal::local_lock_list),
3115  exclusive(excl), held(false)
3116  {
3117 #ifdef DEBUG_REENTRANT_LOCKS
3118  if (previous != NULL)
3119  previous->check_for_reentrant_locks(&local_lock);
3120 #endif
3121  }
3122  public:
3123  AutoLock(AutoLock &&rhs) = delete;
3124  AutoLock(const AutoLock &rhs) = delete;
3125  inline ~AutoLock(void)
3126  {
3127  if (held)
3128  {
3129 #ifdef DEBUG_LEGION
3130  assert(Internal::local_lock_list == this);
3131 #endif
3132  local_lock.unlock();
3133  Internal::local_lock_list = previous;
3134  }
3135  else
3136  assert(Internal::local_lock_list == previous);
3137  }
3138  public:
3139  AutoLock& operator=(AutoLock &&rhs) = delete;
3140  AutoLock& operator=(const AutoLock &rhs) = delete;
3141  public:
3142  inline void release(void)
3143  {
3144 #ifdef DEBUG_LEGION
3145  assert(held);
3146  assert(Internal::local_lock_list == this);
3147 #endif
3148  local_lock.unlock();
3149  Internal::local_lock_list = previous;
3150  held = false;
3151  }
3152  inline void reacquire(void)
3153  {
3154 #ifdef DEBUG_LEGION
3155  assert(!held);
3156  assert(Internal::local_lock_list == previous);
3157 #endif
3158 #ifdef DEBUG_REENTRANT_LOCKS
3159  if (previous != NULL)
3160  previous->check_for_reentrant_locks(&local_lock);
3161 #endif
3162  if (exclusive)
3163  {
3164  RtEvent ready = local_lock.wrlock();
3165  while (ready.exists())
3166  {
3167  ready.wait();
3168  ready = local_lock.wrlock();
3169  }
3170  }
3171  else
3172  {
3173  RtEvent ready = local_lock.rdlock();
3174  while (ready.exists())
3175  {
3176  ready.wait();
3177  ready = local_lock.rdlock();
3178  }
3179  }
3180  Internal::local_lock_list = this;
3181  held = true;
3182  }
3183  public:
3184  inline void advise_sleep_entry(Realm::UserEvent guard) const
3185  {
3186  if (held)
3187  local_lock.advise_sleep_entry(guard);
3188  if (previous != NULL)
3189  previous->advise_sleep_entry(guard);
3190  }
3191  inline void advise_sleep_exit(void) const
3192  {
3193  if (held)
3194  local_lock.advise_sleep_exit();
3195  if (previous != NULL)
3196  previous->advise_sleep_exit();
3197  }
3198 #ifdef DEBUG_REENTRANT_LOCKS
3199  inline void check_for_reentrant_locks(LocalLock *to_acquire) const
3200  {
3201  assert(to_acquire != &local_lock);
3202  if (previous != NULL)
3203  previous->check_for_reentrant_locks(to_acquire);
3204  }
3205 #endif
3206  protected:
3207  LocalLock &local_lock;
3208  AutoLock *const previous;
3209  const bool exclusive;
3210  bool held;
3211  };
3212 
3213  // AutoTryLock is an extension of AutoLock that supports try lock
3214  class AutoTryLock : public AutoLock {
3215  public:
3216  inline AutoTryLock(LocalLock &r, int mode = 0, bool excl = true)
3217  : AutoLock(mode, excl, r)
3218  {
3219  if (exclusive)
3220  ready = local_lock.wrlock();
3221  else
3222  ready = local_lock.rdlock();
3223  held = !ready.exists();
3224  if (held)
3225  Internal::local_lock_list = this;
3226  }
3227  AutoTryLock(const AutoTryLock &rhs) = delete;
3228  public:
3229  AutoTryLock& operator=(const AutoTryLock &rhs) = delete;
3230  public:
3231  // Allow an easy test for whether we got the lock or not
3232  inline bool has_lock(void) const { return held; }
3233  inline RtEvent try_next(void) const { return ready; }
3234  protected:
3235  RtEvent ready;
3236  };
3237 
3238  // Special method that we need here for waiting on events
3239 
3240  //--------------------------------------------------------------------------
3241  inline void LgEvent::wait(void) const
3242  //--------------------------------------------------------------------------
3243  {
3244 #ifdef DEBUG_LEGION_WAITS
3245  const int local_meta_task_id = Internal::meta_task_id;
3246  const long long start = Realm::Clock::current_time_in_microseconds();
3247 #endif
3248  // Save the context locally
3249  Internal::TaskContext *local_ctx = Internal::implicit_context;
3250  // Save the task provenance information
3251  UniqueID local_provenance = Internal::implicit_provenance;
3252 #ifdef DEBUG_LEGION_CALLERS
3253  LgTaskID local_kind = Internal::implicit_task_kind;
3254  LgTaskID local_caller = Internal::implicit_task_caller;
3255 #endif
3256  // Save whether we are in a registration callback
3257  unsigned local_callback = Internal::inside_registration_callback;
3258  // Save the reference tracker that we have
3259  ImplicitReferenceTracker *local_tracker = implicit_reference_tracker;
3260  Internal::implicit_reference_tracker = NULL;
3261  // Check to see if we have any local locks to notify
3262  if (Internal::local_lock_list != NULL)
3263  {
3264  // Make a copy of the local locks here
3265  AutoLock *local_lock_list_copy = Internal::local_lock_list;
3266  // Set this back to NULL until we are done waiting
3267  Internal::local_lock_list = NULL;
3268  // Make a user event and notify all the thread locks
3269  const Realm::UserEvent done = Realm::UserEvent::create_user_event();
3270  local_lock_list_copy->advise_sleep_entry(done);
3271  if (local_ctx != NULL)
3272  begin_context_wait(local_ctx, false/*from application*/);
3273  // Now we can do the wait
3274  if (!Processor::get_executing_processor().exists())
3275  Realm::Event::external_wait();
3276  else
3277  Realm::Event::wait();
3278  if (local_ctx != NULL)
3279  end_context_wait(local_ctx, false/*from application*/);
3280  // When we wake up, notify that we are done and exited the wait
3281  local_lock_list_copy->advise_sleep_exit();
3282  // Trigger the user-event
3283  done.trigger();
3284  // Restore our local lock list
3285  Internal::local_lock_list = local_lock_list_copy;
3286  }
3287  else // Just do the normal wait
3288  {
3289  if (local_ctx != NULL)
3290  begin_context_wait(local_ctx, false/*from application*/);
3291  if (!Processor::get_executing_processor().exists())
3292  Realm::Event::external_wait();
3293  else
3294  Realm::Event::wait();
3295  if (local_ctx != NULL)
3296  end_context_wait(local_ctx, false/*from application*/);
3297  }
3298  // Write the context back
3299  Internal::implicit_context = local_ctx;
3300  // Write the provenance information back
3301  Internal::implicit_provenance = local_provenance;
3302 #ifdef DEBUG_LEGION_CALLERS
3303  Internal::implicit_task_kind = local_kind;
3304  Internal::implicit_task_caller = local_caller;
3305 #endif
3306  // Write the registration callback information back
3307  Internal::inside_registration_callback = local_callback;
3308 #ifdef DEBUG_LEGION
3309  assert(Internal::implicit_reference_tracker == NULL);
3310 #endif
3311  // Write the local reference tracker back
3312  Internal::implicit_reference_tracker = local_tracker;
3313 #ifdef DEBUG_LEGION_WAITS
3314  Internal::meta_task_id = local_meta_task_id;
3315  const long long stop = Realm::Clock::current_time_in_microseconds();
3316  if (((stop - start) >= LIMIT) && (local_meta_task_id == BAD_TASK_ID))
3317  assert(false);
3318 #endif
3319  }
3320 
3321  //--------------------------------------------------------------------------
3322  inline void LgEvent::wait_faultaware(bool &poisoned, bool from_app) const
3323  //--------------------------------------------------------------------------
3324  {
3325 #ifdef DEBUG_LEGION_WAITS
3326  const int local_meta_task_id = Internal::meta_task_id;
3327  const long long start = Realm::Clock::current_time_in_microseconds();
3328 #endif
3329  // Save the context locally
3330  Internal::TaskContext *local_ctx = Internal::implicit_context;
3331  // Save the task provenance information
3332  UniqueID local_provenance = Internal::implicit_provenance;
3333 #ifdef DEBUG_LEGION_CALLERS
3334  LgTaskID local_kind = Internal::implicit_task_kind;
3335  LgTaskID local_caller = Internal::implicit_task_caller;
3336 #endif
3337  // Save whether we are in a registration callback
3338  unsigned local_callback = Internal::inside_registration_callback;
3339  // Save the reference tracker that we have
3340  ImplicitReferenceTracker *local_tracker = implicit_reference_tracker;
3341  Internal::implicit_reference_tracker = NULL;
3342  // Check to see if we have any local locks to notify
3343  if (Internal::local_lock_list != NULL)
3344  {
3345  // Make a copy of the local locks here
3346  AutoLock *local_lock_list_copy = Internal::local_lock_list;
3347  // Set this back to NULL until we are done waiting
3348  Internal::local_lock_list = NULL;
3349  // Make a user event and notify all the thread locks
3350  const Realm::UserEvent done = Realm::UserEvent::create_user_event();
3351  local_lock_list_copy->advise_sleep_entry(done);
3352  if (local_ctx != NULL)
3353  begin_context_wait(local_ctx, from_app);
3354  // Now we can do the wait
3355  if (!Processor::get_executing_processor().exists())
3356  Realm::Event::external_wait_faultaware(poisoned);
3357  else
3358  Realm::Event::wait_faultaware(poisoned);
3359  if (local_ctx != NULL)
3360  end_context_wait(local_ctx, from_app);
3361  // When we wake up, notify that we are done and exited the wait
3362  local_lock_list_copy->advise_sleep_exit();
3363  // Trigger the user-event
3364  done.trigger();
3365  // Restore our local lock list
3366  Internal::local_lock_list = local_lock_list_copy;
3367  }
3368  else // Just do the normal wait
3369  {
3370  if (local_ctx != NULL)
3371  begin_context_wait(local_ctx, from_app);
3372  if (!Processor::get_executing_processor().exists())
3373  Realm::Event::external_wait_faultaware(poisoned);
3374  else
3375  Realm::Event::wait_faultaware(poisoned);
3376  if (local_ctx != NULL)
3377  end_context_wait(local_ctx, from_app);
3378  }
3379  // Write the context back
3380  Internal::implicit_context = local_ctx;
3381  // Write the provenance information back
3382  Internal::implicit_provenance = local_provenance;
3383 #ifdef DEBUG_LEGION_CALLERS
3384  Internal::implicit_task_kind = local_kind;
3385  Internal::implicit_task_caller = local_caller;
3386 #endif
3387  // Write the registration callback information back
3388  Internal::inside_registration_callback = local_callback;
3389 #ifdef DEBUG_LEGION
3390  assert(Internal::implicit_reference_tracker == NULL);
3391 #endif
3392  // Write the local reference tracker back
3393  Internal::implicit_reference_tracker = local_tracker;
3394 #ifdef DEBUG_LEGION_WAITS
3395  Internal::meta_task_id = local_meta_task_id;
3396  const long long stop = Realm::Clock::current_time_in_microseconds();
3397  if (((stop - start) >= LIMIT) && (local_meta_task_id == BAD_TASK_ID))
3398  assert(false);
3399 #endif
3400  }
3401 
3402  }; // namespace Internal
3403 
3404  // A class for preventing serialization of Legion objects
3405  // which cannot be serialized
3406  template<typename T>
3408  public:
3409  inline size_t legion_buffer_size(void);
3410  inline size_t legion_serialize(void *buffer);
3411  inline size_t legion_deserialize(const void *buffer);
3412  };
3413 
3414 }; // Legion namespace
3415 
3416 #endif // __LEGION_TYPES_H__
Definition: legion_types.h:97
Definition: legion_types.h:116
Definition: legion.h:4452
Definition: legion_types.h:204
Definition: legion_types.h:205
Definition: legion_c_util.h:53
Definition: legion.h:4500
Definition: legion.h:4401
Definition: legion_domain.h:253
Definition: legion_domain.h:132
Definition: legion.h:4518
Definition: legion.h:4430
Definition: legion_types.h:2322
Definition: legion_types.h:2325
Definition: legion_types.h:2961
Definition: legion_types.h:2923
Definition: legion_types.h:2948
Definition: legion_types.h:3081
Definition: legion_types.h:3214
Definition: legion_types.h:2323
Definition: legion_types.h:2019
Definition: legion_types.h:2200
Definition: legion_types.h:2203
Definition: legion_types.h:2018
Definition: legion_types.h:2194
Definition: legion_types.h:2188
Definition: legion_types.h:2187
Definition: legion_types.h:2192
Definition: legion_types.h:2185
Definition: legion_types.h:2186
Definition: legion_types.h:2201
Definition: legion_types.h:2881
Definition: legion_types.h:3038
Definition: legion_types.h:2121
Definition: legion_types.h:2899
Definition: legion_types.h:2910
Definition: legion_types.h:2123
Definition: legion_types.h:2050
Definition: legion_types.h:3010
Definition: legion_types.h:2985
Definition: legion_types.h:2997
Definition: legion_types.h:2324
Definition: legion.h:4145
Definition: legion.h:300
Definition: legion.h:233
Definition: legion.h:4210
Definition: legion.h:4579
Definition: legion.h:4546
Definition: legion.h:3538
Definition: legion.h:3578
Definition: legion.h:4968
Definition: legion.h:4661
Definition: legion.h:4474
Definition: legion.h:5008
Definition: legion.h:4899
Definition: legion.h:3613
Definition: legion.h:4330
Definition: legion_types.h:202
Definition: legion_types.h:3407
Definition: legion_types.h:99
Definition: legion.h:4604
Definition: legion_types.h:2381
Definition: legion_types.h:2666
Definition: legion_types.h:2642
Definition: legion_types.h:2057
Definition: legion.h:4614