Legion Runtime
legion.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 // decide whether we want C and/or C++ bindings (default matches host language)
17 //
18 // each set of bindings has its own include-once ifdef armor, allowing the
19 // second set of bindings to be loaded even if the first already has been
20 #if !defined(LEGION_ENABLE_C_BINDINGS) && !defined(LEGION_DISABLE_C_BINDINGS)
21  #ifndef __cplusplus
22  #define LEGION_ENABLE_C_BINDINGS
23  #endif
24 #endif
25 #if !defined(LEGION_ENABLE_CXX_BINDINGS) && !defined(LEGION_DISABLE_CXX_BINDINGS)
26  #ifdef __cplusplus
27  #define LEGION_ENABLE_CXX_BINDINGS
28  #endif
29 #endif
30 
31 #ifdef LEGION_ENABLE_C_BINDINGS
32 #include "legion/legion_c.h"
33 #endif
34 
35 #ifdef LEGION_ENABLE_CXX_BINDINGS
36 #ifndef __LEGION_RUNTIME_H__
37 #define __LEGION_RUNTIME_H__
38 
52 #if __cplusplus < 201103L
53 #error "Legion requires C++11 as the minimum standard version"
54 #endif
55 
56 #include "legion/legion_types.h"
57 #include "legion/legion_domain.h"
58 #include "legion/legion_constraint.h"
59 #include "legion/legion_redop.h"
60 
61 #define LEGION_PRINT_ONCE(runtime, ctx, file, fmt, ...) \
62 { \
63  char message[4096]; \
64  snprintf(message, 4096, fmt, ##__VA_ARGS__); \
65  runtime->print_once(ctx, file, message); \
66 }
67 
72 namespace Legion {
73 
74  //==========================================================================
75  // Data Description Classes
76  //==========================================================================
77 
85  class IndexSpace {
86  public:
87  static const IndexSpace NO_SPACE;
88  protected:
89  // Only the runtime should be allowed to make these
90  FRIEND_ALL_RUNTIME_CLASSES
91  IndexSpace(IndexSpaceID id, IndexTreeID tid, TypeTag tag);
92  public:
93  IndexSpace(void);
94  public:
95  inline bool operator==(const IndexSpace &rhs) const;
96  inline bool operator!=(const IndexSpace &rhs) const;
97  inline bool operator<(const IndexSpace &rhs) const;
98  inline bool operator>(const IndexSpace &rhs) const;
99  inline IndexSpaceID get_id(void) const { return id; }
100  inline IndexTreeID get_tree_id(void) const { return tid; }
101  inline bool exists(void) const { return (id != 0); }
102  inline TypeTag get_type_tag(void) const { return type_tag; }
103  inline int get_dim(void) const;
104  protected:
105  friend std::ostream& operator<<(std::ostream& os,
106  const IndexSpace& is);
107  IndexSpaceID id;
108  IndexTreeID tid;
109  TypeTag type_tag;
110  };
111 
118  template<int DIM, typename COORD_T = coord_t>
119  class IndexSpaceT : public IndexSpace {
120  private:
121  static_assert(DIM > 0, "DIM must be positive");
122  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
123  protected:
124  // Only the runtime should be allowed to make these
125  FRIEND_ALL_RUNTIME_CLASSES
126  IndexSpaceT(IndexSpaceID id, IndexTreeID tid);
127  public:
128  IndexSpaceT(void);
129  explicit IndexSpaceT(const IndexSpace &rhs);
130  public:
131  inline IndexSpaceT& operator=(const IndexSpace &rhs);
132  };
133 
141  public:
142  static const IndexPartition NO_PART;
143  protected:
144  // Only the runtime should be allowed to make these
145  FRIEND_ALL_RUNTIME_CLASSES
146  IndexPartition(IndexPartitionID id, IndexTreeID tid, TypeTag tag);
147  public:
148  IndexPartition(void);
149  public:
150  inline bool operator==(const IndexPartition &rhs) const;
151  inline bool operator!=(const IndexPartition &rhs) const;
152  inline bool operator<(const IndexPartition &rhs) const;
153  inline bool operator>(const IndexPartition &rhs) const;
154  inline IndexPartitionID get_id(void) const { return id; }
155  inline IndexTreeID get_tree_id(void) const { return tid; }
156  inline bool exists(void) const { return (id != 0); }
157  inline TypeTag get_type_tag(void) const { return type_tag; }
158  inline int get_dim(void) const;
159  protected:
160  friend std::ostream& operator<<(std::ostream& os,
161  const IndexPartition& ip);
162  IndexPartitionID id;
163  IndexTreeID tid;
164  TypeTag type_tag;
165  };
166 
173  template<int DIM, typename COORD_T = coord_t>
175  private:
176  static_assert(DIM > 0, "DIM must be positive");
177  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
178  protected:
179  // Only the runtime should be allowed to make these
180  FRIEND_ALL_RUNTIME_CLASSES
181  IndexPartitionT(IndexPartitionID id, IndexTreeID tid);
182  public:
183  IndexPartitionT(void);
184  explicit IndexPartitionT(const IndexPartition &rhs);
185  public:
186  inline IndexPartitionT& operator=(const IndexPartition &rhs);
187  };
188 
198  class FieldSpace {
199  public:
200  static const FieldSpace NO_SPACE;
201  protected:
202  // Only the runtime should be allowed to make these
203  FRIEND_ALL_RUNTIME_CLASSES
204  FieldSpace(FieldSpaceID id);
205  public:
206  FieldSpace(void);
207  public:
208  inline bool operator==(const FieldSpace &rhs) const;
209  inline bool operator!=(const FieldSpace &rhs) const;
210  inline bool operator<(const FieldSpace &rhs) const;
211  inline bool operator>(const FieldSpace &rhs) const;
212  inline FieldSpaceID get_id(void) const { return id; }
213  inline bool exists(void) const { return (id != 0); }
214  private:
215  friend std::ostream& operator<<(std::ostream& os, const FieldSpace& fs);
216  FieldSpaceID id;
217  };
218 
234  public:
235  static const LogicalRegion NO_REGION;
236  protected:
237  // Only the runtime should be allowed to make these
238  FRIEND_ALL_RUNTIME_CLASSES
239  LogicalRegion(RegionTreeID tid, IndexSpace index, FieldSpace field);
240  public:
241  LogicalRegion(void);
242  public:
243  inline bool operator==(const LogicalRegion &rhs) const;
244  inline bool operator!=(const LogicalRegion &rhs) const;
245  inline bool operator<(const LogicalRegion &rhs) const;
246  public:
247  inline IndexSpace get_index_space(void) const { return index_space; }
248  inline FieldSpace get_field_space(void) const { return field_space; }
249  inline RegionTreeID get_tree_id(void) const { return tree_id; }
250  inline bool exists(void) const { return (tree_id != 0); }
251  inline TypeTag get_type_tag(void) const
252  { return index_space.get_type_tag(); }
253  inline int get_dim(void) const { return index_space.get_dim(); }
254  protected:
255  friend std::ostream& operator<<(std::ostream& os,
256  const LogicalRegion& lr);
257  // These are private so the user can't just arbitrarily change them
258  RegionTreeID tree_id;
259  IndexSpace index_space;
260  FieldSpace field_space;
261  };
262 
269  template<int DIM, typename COORD_T = coord_t>
270  class LogicalRegionT : public LogicalRegion {
271  private:
272  static_assert(DIM > 0, "DIM must be positive");
273  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
274  protected:
275  // Only the runtime should be allowed to make these
276  FRIEND_ALL_RUNTIME_CLASSES
277  LogicalRegionT(RegionTreeID tid, IndexSpace index, FieldSpace field);
278  public:
279  LogicalRegionT(void);
280  explicit LogicalRegionT(const LogicalRegion &rhs);
281  public:
282  inline LogicalRegionT& operator=(const LogicalRegion &rhs);
283  };
284 
301  public:
302  static const LogicalPartition NO_PART;
303  protected:
304  // Only the runtime should be allowed to make these
305  FRIEND_ALL_RUNTIME_CLASSES
306  LogicalPartition(RegionTreeID tid, IndexPartition pid, FieldSpace field);
307  public:
308  LogicalPartition(void);
309  public:
310  inline bool operator==(const LogicalPartition &rhs) const;
311  inline bool operator!=(const LogicalPartition &rhs) const;
312  inline bool operator<(const LogicalPartition &rhs) const;
313  public:
314  inline IndexPartition get_index_partition(void) const
315  { return index_partition; }
316  inline FieldSpace get_field_space(void) const { return field_space; }
317  inline RegionTreeID get_tree_id(void) const { return tree_id; }
318  inline bool exists(void) const { return (tree_id != 0); }
319  inline TypeTag get_type_tag(void) const
320  { return index_partition.get_type_tag(); }
321  inline int get_dim(void) const { return index_partition.get_dim(); }
322  protected:
323  friend std::ostream& operator<<(std::ostream& os,
324  const LogicalPartition& lp);
325  // These are private so the user can't just arbitrary change them
326  RegionTreeID tree_id;
327  IndexPartition index_partition;
328  FieldSpace field_space;
329  };
330 
337  template<int DIM, typename COORD_T = coord_t>
339  private:
340  static_assert(DIM > 0, "DIM must be positive");
341  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
342  protected:
343  // Only the runtime should be allowed to make these
344  FRIEND_ALL_RUNTIME_CLASSES
345  LogicalPartitionT(RegionTreeID tid, IndexPartition pid, FieldSpace field);
346  public:
347  LogicalPartitionT(void);
348  explicit LogicalPartitionT(const LogicalPartition &rhs);
349  public:
350  inline LogicalPartitionT& operator=(const LogicalPartition &rhs);
351  };
352 
353  //==========================================================================
354  // Data Allocation Classes
355  //==========================================================================
356 
373  class FieldAllocator : public Unserializable<FieldAllocator> {
374  public:
375  FieldAllocator(void);
376  FieldAllocator(const FieldAllocator &allocator);
377  FieldAllocator(FieldAllocator &&allocator) noexcept;
378  ~FieldAllocator(void);
379  protected:
380  FRIEND_ALL_RUNTIME_CLASSES
381  // Only the Runtime should be able to make these
382  FieldAllocator(Internal::FieldAllocatorImpl *impl);
383  public:
384  FieldAllocator& operator=(const FieldAllocator &allocator);
385  FieldAllocator& operator=(FieldAllocator &&allocator) noexcept;
386  inline bool operator<(const FieldAllocator &rhs) const;
387  inline bool operator==(const FieldAllocator &rhs) const;
388  inline bool exists(void) const { return (impl != NULL); }
389  public:
391 
410  FieldID allocate_field(size_t field_size,
411  FieldID desired_fieldid = LEGION_AUTO_GENERATE_ID,
412  CustomSerdezID serdez_id = 0,
413  bool local_field = false,
414  const char *provenance = NULL);
415  FieldID allocate_field(const Future &field_size,
416  FieldID desired_fieldid = LEGION_AUTO_GENERATE_ID,
417  CustomSerdezID serdez_id = 0,
418  bool local_field = false,
419  const char *provenance = NULL);
421 
429  void free_field(FieldID fid, const bool unordered = false,
430  const char *provenance = NULL);
431 
439  FieldID allocate_local_field(size_t field_size,
440  FieldID desired_fieldid = LEGION_AUTO_GENERATE_ID,
441  CustomSerdezID serdez_id = 0, const char *provenance = NULL);
443 
460  void allocate_fields(const std::vector<size_t> &field_sizes,
461  std::vector<FieldID> &resulting_fields,
462  CustomSerdezID serdez_id = 0,
463  bool local_fields = false,
464  const char *provenance = NULL);
465  void allocate_fields(const std::vector<Future> &field_sizes,
466  std::vector<FieldID> &resulting_fields,
467  CustomSerdezID serdez_id = 0,
468  bool local_fields = false,
469  const char *provenance = NULL);
471 
479  void free_fields(const std::set<FieldID> &to_free,
480  const bool unordered = false,
481  const char *provenance = NULL);
489  void allocate_local_fields(const std::vector<size_t> &field_sizes,
490  std::vector<FieldID> &resulting_fields,
491  CustomSerdezID serdez_id = 0,
492  const char *provenance = NULL);
497  private:
498  Internal::FieldAllocatorImpl *impl;
499  };
500 
501  //==========================================================================
502  // Pass-By-Value Argument Classes
503  //==========================================================================
504 
513  class UntypedBuffer : public Unserializable<UntypedBuffer> {
514  public:
515  UntypedBuffer(void) : args(NULL), arglen(0) { }
516  UntypedBuffer(const void *arg, size_t argsize)
517  : args(const_cast<void*>(arg)), arglen(argsize) { }
518  UntypedBuffer(const UntypedBuffer &rhs)
519  : args(rhs.args), arglen(rhs.arglen) { }
520  UntypedBuffer(UntypedBuffer &&rhs) noexcept
521  : args(rhs.args), arglen(rhs.arglen) { }
522  public:
523  inline size_t get_size(void) const { return arglen; }
524  inline void* get_ptr(void) const { return args; }
525  public:
526  inline bool operator==(const UntypedBuffer &arg) const
527  { return (args == arg.args) && (arglen == arg.arglen); }
528  inline bool operator<(const UntypedBuffer &arg) const
529  { return (args < arg.args) && (arglen < arg.arglen); }
530  inline UntypedBuffer& operator=(const UntypedBuffer &rhs)
531  { args = rhs.args; arglen = rhs.arglen; return *this; }
532  inline UntypedBuffer& operator=(UntypedBuffer &&rhs) noexcept
533  { args = rhs.args; arglen = rhs.arglen; return *this; }
534  private:
535  void *args;
536  size_t arglen;
537  };
538  // This typedef is here for backwards compatibility since we
539  // used to call an UntypedBuffer a TaskArgument
540  typedef UntypedBuffer TaskArgument;
541 
552  class ArgumentMap : public Unserializable<ArgumentMap> {
553  public:
554  ArgumentMap(void);
555  ArgumentMap(const FutureMap &rhs);
556  ArgumentMap(const ArgumentMap &rhs);
557  ArgumentMap(ArgumentMap &&rhs) noexcept;
558  ~ArgumentMap(void);
559  public:
560  ArgumentMap& operator=(const FutureMap &rhs);
561  ArgumentMap& operator=(const ArgumentMap &rhs);
562  ArgumentMap& operator=(ArgumentMap &&rhs) noexcept;
563  inline bool operator==(const ArgumentMap &rhs) const
564  { return (impl == rhs.impl); }
565  inline bool operator<(const ArgumentMap &rhs) const
566  { return (impl < rhs.impl); }
567  inline bool exists(void) const { return (impl != NULL); }
568  public:
574  bool has_point(const DomainPoint &point);
581  void set_point(const DomainPoint &point, const UntypedBuffer &arg,
582  bool replace = true);
589  void set_point(const DomainPoint &point, const Future &f,
590  bool replace = true);
596  bool remove_point(const DomainPoint &point);
604  UntypedBuffer get_point(const DomainPoint &point) const;
605  public:
614  template<typename PT, unsigned DIM>
615  inline void set_point_arg(const PT point[DIM], const UntypedBuffer &arg,
616  bool replace = false);
622  template<typename PT, unsigned DIM>
623  inline bool remove_point(const PT point[DIM]);
624  private:
625  FRIEND_ALL_RUNTIME_CLASSES
626  Internal::ArgumentMapImpl *impl;
627  private:
628  explicit ArgumentMap(Internal::ArgumentMapImpl *i);
629  };
630 
631  //==========================================================================
632  // Predicate Classes
633  //==========================================================================
634 
645  class Predicate : public Unserializable<Predicate> {
646  public:
647  static const Predicate TRUE_PRED;
648  static const Predicate FALSE_PRED;
649  public:
650  Predicate(void);
651  Predicate(const Predicate &p);
652  Predicate(Predicate &&p) noexcept;
653  explicit Predicate(bool value);
654  ~Predicate(void);
655  protected:
656  FRIEND_ALL_RUNTIME_CLASSES
657  Internal::PredicateImpl *impl;
658  // Only the runtime should be allowed to make these
659  explicit Predicate(Internal::PredicateImpl *impl);
660  public:
661  Predicate& operator=(const Predicate &p);
662  Predicate& operator=(Predicate &&p) noexcept;
663  inline bool operator==(const Predicate &p) const;
664  inline bool operator<(const Predicate &p) const;
665  inline bool operator!=(const Predicate &p) const;
666  inline bool exists(void) const { return (impl != NULL); }
667  private:
668  bool const_value;
669  };
670 
671  //==========================================================================
672  // Simultaneous Coherence Synchronization Classes
673  //==========================================================================
674 
704  class Lock {
705  public:
706  Lock(void);
707  protected:
708  // Only the runtime is allowed to make non-empty locks
709  FRIEND_ALL_RUNTIME_CLASSES
710  Lock(Reservation r);
711  public:
712  bool operator<(const Lock &rhs) const;
713  bool operator==(const Lock &rhs) const;
714  public:
715  void acquire(unsigned mode = 0, bool exclusive = true);
716  void release(void);
717  private:
718  Reservation reservation_lock;
719  };
720 
728  struct LockRequest {
729  public:
730  LockRequest(Lock l, unsigned mode = 0, bool exclusive = true);
731  public:
732  Lock lock;
733  unsigned mode;
734  bool exclusive;
735  };
736 
749  class Grant {
750  public:
751  Grant(void);
752  Grant(const Grant &g);
753  ~Grant(void);
754  protected:
755  // Only the runtime is allowed to make non-empty grants
756  FRIEND_ALL_RUNTIME_CLASSES
757  explicit Grant(Internal::GrantImpl *impl);
758  public:
759  bool operator==(const Grant &g) const
760  { return impl == g.impl; }
761  bool operator<(const Grant &g) const
762  { return impl < g.impl; }
763  Grant& operator=(const Grant &g);
764  protected:
765  Internal::GrantImpl *impl;
766  };
767 
796  class PhaseBarrier {
797  public:
798  PhaseBarrier(void);
799  protected:
800  // Only the runtime is allowed to make non-empty phase barriers
801  FRIEND_ALL_RUNTIME_CLASSES
803  public:
804  bool operator<(const PhaseBarrier &rhs) const;
805  bool operator==(const PhaseBarrier &rhs) const;
806  bool operator!=(const PhaseBarrier &rhs) const;
807  public:
808  void arrive(unsigned count = 1);
809  void wait(void);
810  void alter_arrival_count(int delta);
811  Realm::Barrier get_barrier(void) const { return phase_barrier; }
812  bool exists(void) const;
813  protected:
814  Internal::ApBarrier phase_barrier;
815  friend std::ostream& operator<<(std::ostream& os, const PhaseBarrier& pb);
816  };
817 
833  public:
834  DynamicCollective(void);
835  protected:
836  // Only the runtime is allowed to make non-empty dynamic collectives
837  FRIEND_ALL_RUNTIME_CLASSES
838  DynamicCollective(Internal::ApBarrier b, ReductionOpID redop);
839  public:
840  // All the same operations as a phase barrier
841  void arrive(const void *value, size_t size, unsigned count = 1);
842  protected:
843  ReductionOpID redop;
844  };
845 
846  //==========================================================================
847  // Operation Requirement Classes
848  //==========================================================================
849 
865  public:
866  RegionRequirement(void);
871  const std::set<FieldID> &privilege_fields,
872  const std::vector<FieldID> &instance_fields,
873  PrivilegeMode _priv, CoherenceProperty _prop,
874  LogicalRegion _parent, MappingTagID _tag = 0,
875  bool _verified = false);
879  RegionRequirement(LogicalPartition pid, ProjectionID _proj,
880  const std::set<FieldID> &privilege_fields,
881  const std::vector<FieldID> &instance_fields,
882  PrivilegeMode _priv, CoherenceProperty _prop,
883  LogicalRegion _parent, MappingTagID _tag = 0,
884  bool _verified = false);
888  RegionRequirement(LogicalRegion _handle, ProjectionID _proj,
889  const std::set<FieldID> &privilege_fields,
890  const std::vector<FieldID> &instance_fields,
891  PrivilegeMode _priv, CoherenceProperty _prop,
892  LogicalRegion _parent, MappingTagID _tag = 0,
893  bool _verified = false);
899  const std::set<FieldID> &privilege_fields,
900  const std::vector<FieldID> &instance_fields,
901  ReductionOpID op, CoherenceProperty _prop,
902  LogicalRegion _parent, MappingTagID _tag = 0,
903  bool _verified = false);
907  RegionRequirement(LogicalPartition pid, ProjectionID _proj,
908  const std::set<FieldID> &privilege_fields,
909  const std::vector<FieldID> &instance_fields,
910  ReductionOpID op, CoherenceProperty _prop,
911  LogicalRegion _parent, MappingTagID _tag = 0,
912  bool _verified = false);
916  RegionRequirement(LogicalRegion _handle, ProjectionID _proj,
917  const std::set<FieldID> &privilege_fields,
918  const std::vector<FieldID> &instance_fields,
919  ReductionOpID op, CoherenceProperty _prop,
920  LogicalRegion _parent, MappingTagID _tag = 0,
921  bool _verified = false);
922  public:
923  // Analogous constructors without the privilege and instance fields
924  RegionRequirement(LogicalRegion _handle, PrivilegeMode _priv,
925  CoherenceProperty _prop, LogicalRegion _parent,
926  MappingTagID _tag = 0, bool _verified = false);
927  RegionRequirement(LogicalPartition pid, ProjectionID _proj,
928  PrivilegeMode _priv, CoherenceProperty _prop,
929  LogicalRegion _parent, MappingTagID _tag = 0,
930  bool _verified = false);
931  RegionRequirement(LogicalRegion _handle, ProjectionID _proj,
932  PrivilegeMode _priv, CoherenceProperty _prop,
933  LogicalRegion _parent, MappingTagID _tag = 0,
934  bool _verified = false);
935  RegionRequirement(LogicalRegion _handle, ReductionOpID op,
936  CoherenceProperty _prop, LogicalRegion _parent,
937  MappingTagID _tag = 0, bool _verified = false);
938  RegionRequirement(LogicalPartition pid, ProjectionID _proj,
939  ReductionOpID op, CoherenceProperty _prop,
940  LogicalRegion _parent, MappingTagID _tag = 0,
941  bool _verified = false);
942  RegionRequirement(LogicalRegion _handle, ProjectionID _proj,
943  ReductionOpID op, CoherenceProperty _prop,
944  LogicalRegion _parent, MappingTagID _tag = 0,
945  bool _verified = false);
946  public:
948  ~RegionRequirement(void);
949  RegionRequirement& operator=(const RegionRequirement &req);
950  public:
951  bool operator==(const RegionRequirement &req) const;
952  bool operator<(const RegionRequirement &req) const;
953  public:
959  inline RegionRequirement& add_field(FieldID fid, bool instance = true);
960  inline RegionRequirement& add_fields(const std::vector<FieldID>& fids,
961  bool instance = true);
962 
963  inline RegionRequirement& add_flags(RegionFlags new_flags);
964  public:
965  inline bool is_verified(void) const
966  { return (flags & LEGION_VERIFIED_FLAG); }
967  inline bool is_no_access(void) const
968  { return (flags & LEGION_NO_ACCESS_FLAG); }
969  inline bool is_restricted(void) const
970  { return (flags & LEGION_RESTRICTED_FLAG); }
971  LEGION_DEPRECATED("Premapping regions is no longer supported.")
972  inline bool must_premap(void) const
973  { return false; }
974  public:
975  const void* get_projection_args(size_t *size) const;
976  void set_projection_args(const void *args, size_t size, bool own = false);
977  public:
978  bool has_field_privilege(FieldID fid) const;
979  public:
980  // Fields used for controlling task launches
983  std::set<FieldID> privilege_fields;
984  std::vector<FieldID> instance_fields;
985  PrivilegeMode privilege;
986  CoherenceProperty prop;
988  ReductionOpID redop;
989  MappingTagID tag;
990  RegionFlags flags;
991  public:
992  ProjectionType handle_type;
993  ProjectionID projection;
994  public:
997  };
998 
1068  public:
1069  OutputRequirement(bool valid_requirement = false);
1072  const std::set<FieldID> &fields,
1073  int dim = 1,
1074  bool global_indexing = false);
1075  public:
1077  ~OutputRequirement(void);
1078  OutputRequirement& operator=(const RegionRequirement &req);
1079  OutputRequirement& operator=(const OutputRequirement &req);
1080  public:
1081  bool operator==(const OutputRequirement &req) const;
1082  bool operator<(const OutputRequirement &req) const;
1083  public:
1084  template <int DIM, typename COORD_T>
1085  void set_type_tag();
1086  // Specifies a projection functor id for this requirement.
1087  // For a projection output requirement, a color space must be specified.
1088  // The projection functor must be a bijective mapping from the launch
1089  // domain to the color space. This implies that the launch domain's
1090  // volume must be the same as the color space's.
1091  void set_projection(ProjectionID projection, IndexSpace color_space);
1092  public:
1093  TypeTag type_tag;
1098  };
1099 
1108  public:
1109  IndexSpace handle;
1110  AllocateMode privilege;
1111  IndexSpace parent;
1112  bool verified;
1113  public:
1114  IndexSpaceRequirement(void);
1116  AllocateMode _priv,
1117  IndexSpace _parent,
1118  bool _verified = false);
1119  public:
1120  bool operator<(const IndexSpaceRequirement &req) const;
1121  bool operator==(const IndexSpaceRequirement &req) const;
1122  };
1123 
1136  public:
1137  FieldSpace handle;
1138  AllocateMode privilege;
1139  bool verified;
1140  public:
1141  FieldSpaceRequirement(void);
1143  AllocateMode _priv,
1144  bool _verified = false);
1145  public:
1146  bool operator<(const FieldSpaceRequirement &req) const;
1147  bool operator==(const FieldSpaceRequirement &req) const;
1148  };
1149 
1150  //==========================================================================
1151  // Future Value Classes
1152  //==========================================================================
1153 
1172  class Future : public Unserializable<Future> {
1173  public:
1174  Future(void);
1175  Future(const Future &f);
1176  Future(Future &&f) noexcept;
1177  ~Future(void);
1178  private:
1179  Internal::FutureImpl *impl;
1180  protected:
1181  // Only the runtime should be allowed to make these
1182  FRIEND_ALL_RUNTIME_CLASSES
1183  explicit Future(Internal::FutureImpl *impl);
1184  public:
1185  inline bool exists(void) const { return (impl != NULL); }
1186  inline bool operator==(const Future &f) const
1187  { return impl == f.impl; }
1188  inline bool operator<(const Future &f) const
1189  { return impl < f.impl; }
1190  Future& operator=(const Future &f);
1191  Future& operator=(Future &&f) noexcept;
1192  public:
1201  template<typename T>
1202  inline T get_result(bool silence_warnings = false,
1203  const char *warning_string = NULL) const;
1209  void get_void_result(bool silence_warnings = false,
1210  const char *warning_string = NULL) const;
1222  bool is_empty(bool block = false, bool silence_warnings = false,
1223  const char *warning_string = NULL) const;
1231  bool is_ready(bool subscribe = false) const;
1232  public:
1247  template<typename T, PrivilegeMode PM = LEGION_READ_ONLY>
1248  Span<T,PM> get_span(Memory::Kind memory,
1249  bool silence_warnings = false,
1250  const char *warning_string = NULL) const;
1251 
1265  const void* get_buffer(Memory::Kind memory,
1266  size_t *extent_in_bytes = NULL,
1267  bool check_extent = false,
1268  bool silence_warnings = false,
1269  const char *warning_string = NULL) const;
1270 
1284  template<typename T>
1285  LEGION_DEPRECATED("Use 'Future::get_span' instead")
1286  inline const T& get_reference(bool silence_warnings = false,
1287  const char *warning_string = NULL) const;
1298  LEGION_DEPRECATED("Use 'Future::get_buffer' instead")
1299  inline const void* get_untyped_pointer(bool silence_warnings = false,
1300  const char *warning_string = NULL) const;
1301 
1305  size_t get_untyped_size(void) const;
1306 
1315  const void* get_metadata(size_t *size = NULL) const;
1316  public:
1317  // These methods provide partial support the C++ future interface
1318  template<typename T>
1319  inline T get(void);
1320 
1321  inline bool valid(void) const;
1322 
1323  inline void wait(void) const;
1324  public:
1330  template<typename T>
1331  LEGION_DEPRECATED("Use the version without a runtime pointer argument")
1332  static inline Future from_value(Runtime *rt, const T &value);
1333  template<typename T>
1334  static inline Future from_value(const T &value);
1335 
1340  LEGION_DEPRECATED("Use the version without a runtime pointer argument")
1342  const void *buffer, size_t bytes, bool take_ownership = false);
1344  const void *buffer, size_t bytes, bool take_ownership = false,
1345  const char *provenance = NULL, bool shard_local = false);
1346  static Future from_value(const void *buffer, size_t bytes, bool owned,
1347  const Realm::ExternalInstanceResource &resource,
1348  void (*freefunc)(const Realm::ExternalInstanceResource&) = NULL,
1349  const char *provenance = NULL, bool shard_local = false);
1350  private:
1351  // This should only be available for accessor classes
1352  template<PrivilegeMode, typename, int, typename, typename, bool>
1353  friend class FieldAccessor;
1354  Realm::RegionInstance get_instance(Memory::Kind kind,
1355  size_t field_size, bool check_field_size,
1356  const char *warning_string, bool silence_warnings) const;
1357  void report_incompatible_accessor(const char *accessor_kind,
1358  Realm::RegionInstance instance) const;
1359  };
1360 
1375  public:
1376  FutureMap(void);
1377  FutureMap(const FutureMap &map);
1378  FutureMap(FutureMap &&map) noexcept;
1379  ~FutureMap(void);
1380  private:
1381  Internal::FutureMapImpl *impl;
1382  protected:
1383  // Only the runtime should be allowed to make these
1384  FRIEND_ALL_RUNTIME_CLASSES
1385  explicit FutureMap(Internal::FutureMapImpl *impl);
1386  public:
1387  inline bool exists(void) const { return (impl != NULL); }
1388  inline bool operator==(const FutureMap &f) const
1389  { return impl == f.impl; }
1390  inline bool operator<(const FutureMap &f) const
1391  { return impl < f.impl; }
1392  inline Future operator[](const DomainPoint &point) const
1393  { return get_future(point); }
1394  FutureMap& operator=(const FutureMap &f);
1395  FutureMap& operator=(FutureMap &&f) noexcept;
1396  public:
1405  template<typename T>
1406  inline T get_result(const DomainPoint &point,
1407  bool silence_warnings = false,
1408  const char *warning_string = NULL) const;
1416  Future get_future(const DomainPoint &point) const;
1424  void get_void_result(const DomainPoint &point,
1425  bool silence_warnings = false,
1426  const char *warning_string = NULL) const;
1427  public:
1435  template<typename RT, typename PT, unsigned DIM>
1436  inline RT get_result(const PT point[DIM]) const;
1445  template<typename PT, unsigned DIM>
1446  inline Future get_future(const PT point[DIM]) const;
1452  template<typename PT, unsigned DIM>
1453  inline void get_void_result(const PT point[DIM]) const;
1454  public:
1461  void wait_all_results(bool silence_warnings = false,
1462  const char *warning_string = NULL) const;
1463  public:
1470  };
1471 
1472 
1473  //==========================================================================
1474  // Operation Launcher Classes
1475  //==========================================================================
1476 
1485  struct StaticDependence : public Unserializable<StaticDependence> {
1486  public:
1487  StaticDependence(void);
1488  StaticDependence(unsigned previous_offset,
1489  unsigned previous_req_index,
1490  unsigned current_req_index,
1491  DependenceType dtype,
1492  bool validates = false,
1493  bool shard_only = false);
1494  public:
1495  inline void add_field(FieldID fid);
1496  public:
1497  // The relative offset from this operation to
1498  // previous operation in the stream of operations
1499  // (e.g. 1 is the operation launched immediately before)
1500  unsigned previous_offset;
1501  // Region requirement of the previous operation for the dependence
1502  unsigned previous_req_index;
1503  // Region requirement of the current operation for the dependence
1504  unsigned current_req_index;
1505  // The type of the dependence
1506  DependenceType dependence_type;
1507  // Whether this requirement validates the previous writer
1508  bool validates;
1509  // Whether this dependence is a shard-only dependence for
1510  // control replication or it depends on all other copies
1511  bool shard_only;
1512  // Fields that have the dependence
1513  std::set<FieldID> dependent_fields;
1514  };
1515 
1523  struct TaskLauncher {
1524  public:
1525  TaskLauncher(void);
1526  TaskLauncher(TaskID tid,
1527  UntypedBuffer arg,
1528  Predicate pred = Predicate::TRUE_PRED,
1529  MapperID id = 0,
1530  MappingTagID tag = 0,
1531  UntypedBuffer map_arg = UntypedBuffer(),
1532  const char *provenance = "");
1533  public:
1534  inline IndexSpaceRequirement&
1535  add_index_requirement(const IndexSpaceRequirement &req);
1536  inline RegionRequirement&
1537  add_region_requirement(const RegionRequirement &req);
1538  inline void add_field(unsigned idx, FieldID fid, bool inst = true);
1539  public:
1540  inline void add_future(Future f);
1541  inline void add_grant(Grant g);
1542  inline void add_wait_barrier(PhaseBarrier bar);
1543  inline void add_arrival_barrier(PhaseBarrier bar);
1544  inline void add_wait_handshake(LegionHandshake handshake);
1545  inline void add_arrival_handshake(LegionHandshake handshake);
1546  public:
1547  inline void set_predicate_false_future(Future f);
1548  inline void set_predicate_false_result(UntypedBuffer arg);
1549  public:
1550  inline void set_independent_requirements(bool independent);
1551  public:
1552  TaskID task_id;
1553  std::vector<IndexSpaceRequirement> index_requirements;
1554  std::vector<RegionRequirement> region_requirements;
1555  std::vector<Future> futures;
1556  std::vector<Grant> grants;
1557  std::vector<PhaseBarrier> wait_barriers;
1558  std::vector<PhaseBarrier> arrive_barriers;
1559  UntypedBuffer argument;
1560  Predicate predicate;
1561  MapperID map_id;
1562  MappingTagID tag;
1563  UntypedBuffer map_arg;
1564  DomainPoint point;
1565  // Only used in control replication contexts for
1566  // doing sharding. If left unspecified the runtime
1567  // will use an index space of size 1 containing 'point'
1568  IndexSpace sharding_space;
1569  public:
1570  // If the predicate is set to anything other than
1571  // Predicate::TRUE_PRED, then the application must
1572  // specify a value for the future in the case that
1573  // the predicate resolves to false. UntypedBuffer(NULL,0)
1574  // can be used if the task's return type is void.
1575  Future predicate_false_future;
1576  UntypedBuffer predicate_false_result;
1577  public:
1578  // Provenance string for the runtime and tools to use
1579  std::string provenance;
1580  public:
1581  // Inform the runtime about any static dependences
1582  // These will be ignored outside of static traces
1583  const std::vector<StaticDependence> *static_dependences;
1584  public:
1585  // Users can tell the runtime this task is eligible
1586  // for inlining by the mapper. This will invoke the
1587  // select_task_options call inline as part of the launch
1588  // logic for this task to allow the mapper to decide
1589  // whether to inline the task or not. Note that if the
1590  // mapper pre-empts during execution then resuming it
1591  // may take a long time if another long running task
1592  // gets scheduled on the processor that launched this task.
1593  bool enable_inlining;
1594  public:
1595  // In some cases users (most likely compilers) will want
1596  // to run a light-weight function (e.g. a continuation)
1597  // as a task that just depends on futures once those futures
1598  // are ready on a local processor where the parent task
1599  // is executing. We call this a local function task and it
1600  // must not have any region requirements. It must als be a
1601  // pure function with no side effects. This task will
1602  // not have the option of being distributed to remote nodes.
1603  bool local_function_task;
1604  public:
1605  // Users can inform the runtime that all region requirements
1606  // are independent of each other in this task. Independent
1607  // means that either field sets are independent or region
1608  // requirements are disjoint based on the region tree.
1609  bool independent_requirements;
1610  public:
1611  // Instruct the runtime that it does not need to produce
1612  // a future or future map result for this index task
1613  bool elide_future_return;
1614  public:
1615  bool silence_warnings;
1616  };
1617 
1627  public:
1628  IndexTaskLauncher(void);
1629  IndexTaskLauncher(TaskID tid,
1630  Domain domain,
1631  UntypedBuffer global_arg,
1632  ArgumentMap map,
1633  Predicate pred = Predicate::TRUE_PRED,
1634  bool must = false,
1635  MapperID id = 0,
1636  MappingTagID tag = 0,
1637  UntypedBuffer map_arg = UntypedBuffer(),
1638  const char *provenance = "");
1639  IndexTaskLauncher(TaskID tid,
1640  IndexSpace launch_space,
1641  UntypedBuffer global_arg,
1642  ArgumentMap map,
1643  Predicate pred = Predicate::TRUE_PRED,
1644  bool must = false,
1645  MapperID id = 0,
1646  MappingTagID tag = 0,
1647  UntypedBuffer map_arg = UntypedBuffer(),
1648  const char *provenance = "");
1649  public:
1650  inline IndexSpaceRequirement&
1651  add_index_requirement(const IndexSpaceRequirement &req);
1652  inline RegionRequirement&
1653  add_region_requirement(const RegionRequirement &req);
1654  inline void add_field(unsigned idx, FieldID fid, bool inst = true);
1655  public:
1656  inline void add_future(Future f);
1657  inline void add_grant(Grant g);
1658  inline void add_wait_barrier(PhaseBarrier bar);
1659  inline void add_arrival_barrier(PhaseBarrier bar);
1660  inline void add_wait_handshake(LegionHandshake handshake);
1661  inline void add_arrival_handshake(LegionHandshake handshake);
1662  public:
1663  inline void set_predicate_false_future(Future f);
1664  inline void set_predicate_false_result(UntypedBuffer arg);
1665  public:
1666  inline void set_independent_requirements(bool independent);
1667  public:
1668  TaskID task_id;
1669  Domain launch_domain;
1670  IndexSpace launch_space;
1671  // Will only be used in control replication context. If left
1672  // unset the runtime will use launch_domain/launch_space
1673  IndexSpace sharding_space;
1674  std::vector<IndexSpaceRequirement> index_requirements;
1675  std::vector<RegionRequirement> region_requirements;
1676  std::vector<Future> futures;
1677  // These are appended to the futures for the point
1678  // task after the futures sent to all points above
1679  std::vector<ArgumentMap> point_futures;
1680  std::vector<Grant> grants;
1681  std::vector<PhaseBarrier> wait_barriers;
1682  std::vector<PhaseBarrier> arrive_barriers;
1683  UntypedBuffer global_arg;
1684  ArgumentMap argument_map;
1685  Predicate predicate;
1686  // Specify that all the point tasks in this index launch be
1687  // able to run concurrently, meaning they all must map to
1688  // different processors and they cannot have interfering region
1689  // requirements that might lead to dependences. Note that the
1690  // runtime guarantees that concurrent index launches will not
1691  // deadlock with other concurrent index launches which requires
1692  // additional analysis. Currently concurrent index space launches
1693  // will only be allowed to map to leaf task variants currently.
1694  bool concurrent;
1695  // This will convert this index space launch into a must
1696  // epoch launch which supports interfering region requirements
1697  bool must_parallelism;
1698  MapperID map_id;
1699  MappingTagID tag;
1700  UntypedBuffer map_arg;
1701  public:
1702  // If the predicate is set to anything other than
1703  // Predicate::TRUE_PRED, then the application must
1704  // specify a value for the future in the case that
1705  // the predicate resolves to false. UntypedBuffer(NULL,0)
1706  // can be used if the task's return type is void.
1707  Future predicate_false_future;
1708  UntypedBuffer predicate_false_result;
1709  public:
1710  // Provenance string for the runtime and tools to use
1711  std::string provenance;
1712  public:
1713  // Inform the runtime about any static dependences
1714  // These will be ignored outside of static traces
1715  const std::vector<StaticDependence> *static_dependences;
1716  public:
1717  // Users can tell the runtime this task is eligible
1718  // for inlining by the mapper. This will invoke the
1719  // select_task_options call inline as part of the launch
1720  // logic for this task to allow the mapper to decide
1721  // whether to inline the task or not. Note that if the
1722  // mapper pre-empts during execution then resuming it
1723  // may take a long time if another long running task
1724  // gets scheduled on the processor that launched this task.
1725  bool enable_inlining;
1726  public:
1727  // Users can inform the runtime that all region requirements
1728  // are independent of each other in this task. Independent
1729  // means that either field sets are independent or region
1730  // requirements are disjoint based on the region tree.
1731  bool independent_requirements;
1732  public:
1733  // Instruct the runtime that it does not need to produce
1734  // a future or future map result for this index task
1735  bool elide_future_return;
1736  public:
1737  bool silence_warnings;
1738  public:
1739  // Initial value for reduction
1740  Future initial_value;
1741  };
1742 
1752  public:
1753  InlineLauncher(void);
1754  InlineLauncher(const RegionRequirement &req,
1755  MapperID id = 0,
1756  MappingTagID tag = 0,
1757  LayoutConstraintID layout_id = 0,
1758  UntypedBuffer map_arg = UntypedBuffer(),
1759  const char *provenance = "");
1760  public:
1761  inline void add_field(FieldID fid, bool inst = true);
1762  public:
1763  inline void add_grant(Grant g);
1764  inline void add_wait_barrier(PhaseBarrier bar);
1765  inline void add_arrival_barrier(PhaseBarrier bar);
1766  inline void add_wait_handshake(LegionHandshake handshake);
1767  inline void add_arrival_handshake(LegionHandshake handshake);
1768  public:
1769  RegionRequirement requirement;
1770  std::vector<Grant> grants;
1771  std::vector<PhaseBarrier> wait_barriers;
1772  std::vector<PhaseBarrier> arrive_barriers;
1773  MapperID map_id;
1774  MappingTagID tag;
1775  UntypedBuffer map_arg;
1776  public:
1777  LayoutConstraintID layout_constraint_id;
1778  public:
1779  // Provenance string for the runtime and tools to use
1780  std::string provenance;
1781  public:
1782  // Inform the runtime about any static dependences
1783  // These will be ignored outside of static traces
1784  const std::vector<StaticDependence> *static_dependences;
1785  };
1786 
1811  struct CopyLauncher {
1812  public:
1813  CopyLauncher(Predicate pred = Predicate::TRUE_PRED,
1814  MapperID id = 0, MappingTagID tag = 0,
1815  UntypedBuffer map_arg = UntypedBuffer(),
1816  const char *provenance = "");
1817  public:
1818  inline unsigned add_copy_requirements(const RegionRequirement &src,
1819  const RegionRequirement &dst);
1820  inline void add_src_field(unsigned idx, FieldID fid, bool inst = true);
1821  inline void add_dst_field(unsigned idx, FieldID fid, bool inst = true);
1822  public:
1823  // Specify src/dst indirect requirements (must have exactly 1 field)
1824  inline void add_src_indirect_field(FieldID src_idx_fid,
1825  const RegionRequirement &src_idx_req,
1826  bool is_range_indirection = false,
1827  bool inst = true);
1828  inline void add_dst_indirect_field(FieldID dst_idx_fid,
1829  const RegionRequirement &dst_idx_req,
1830  bool is_range_indirection = false,
1831  bool inst = true);
1832  inline RegionRequirement& add_src_indirect_field(
1833  const RegionRequirement &src_idx_req,
1834  bool is_range_indirection = false);
1835  inline RegionRequirement& add_dst_indirect_field(
1836  const RegionRequirement &dst_idx_req,
1837  bool is_range_indirection = false);
1838  public:
1839  inline void add_grant(Grant g);
1840  inline void add_wait_barrier(PhaseBarrier bar);
1841  inline void add_arrival_barrier(PhaseBarrier bar);
1842  inline void add_wait_handshake(LegionHandshake handshake);
1843  inline void add_arrival_handshake(LegionHandshake handshake);
1844  public:
1845  std::vector<RegionRequirement> src_requirements;
1846  std::vector<RegionRequirement> dst_requirements;
1847  std::vector<RegionRequirement> src_indirect_requirements;
1848  std::vector<RegionRequirement> dst_indirect_requirements;
1849  std::vector<bool> src_indirect_is_range;
1850  std::vector<bool> dst_indirect_is_range;
1851  std::vector<Grant> grants;
1852  std::vector<PhaseBarrier> wait_barriers;
1853  std::vector<PhaseBarrier> arrive_barriers;
1854  Predicate predicate;
1855  MapperID map_id;
1856  MappingTagID tag;
1857  UntypedBuffer map_arg;
1858  DomainPoint point;
1859  // Only used in control replication contexts for
1860  // doing sharding. If left unspecified the runtime
1861  // will use an index space of size 1 containing 'point'
1862  IndexSpace sharding_space;
1863  public:
1864  // Provenance string for the runtime and tools to use
1865  std::string provenance;
1866  public:
1867  // Inform the runtime about any static dependences
1868  // These will be ignored outside of static traces
1869  const std::vector<StaticDependence> *static_dependences;
1870  public:
1871  // Whether the source and destination indirections can lead
1872  // to out-of-range access into the instances to skip
1873  bool possible_src_indirect_out_of_range;
1874  bool possible_dst_indirect_out_of_range;
1875  // Whether the destination indirection can lead to aliasing
1876  // in the destination instances requiring synchronization
1877  bool possible_dst_indirect_aliasing;
1878  public:
1879  bool silence_warnings;
1880  };
1881 
1893  public:
1894  IndexCopyLauncher(void);
1895  IndexCopyLauncher(Domain domain, Predicate pred = Predicate::TRUE_PRED,
1896  MapperID id = 0, MappingTagID tag = 0,
1897  UntypedBuffer map_arg = UntypedBuffer(),
1898  const char *provenance = "");
1899  IndexCopyLauncher(IndexSpace space, Predicate pred = Predicate::TRUE_PRED,
1900  MapperID id = 0, MappingTagID tag = 0,
1901  UntypedBuffer map_arg = UntypedBuffer(),
1902  const char *provenance = "");
1903  public:
1904  inline unsigned add_copy_requirements(const RegionRequirement &src,
1905  const RegionRequirement &dst);
1906  inline void add_src_field(unsigned idx, FieldID fid, bool inst = true);
1907  inline void add_dst_field(unsigned idx, FieldID fid, bool inst = true);
1908  public:
1909  // Specify src/dst indirect requirements (must have exactly 1 field)
1910  inline void add_src_indirect_field(FieldID src_idx_fid,
1911  const RegionRequirement &src_idx_req,
1912  bool is_range_indirection = false,
1913  bool inst = true);
1914  inline void add_dst_indirect_field(FieldID dst_idx_fid,
1915  const RegionRequirement &dst_idx_req,
1916  bool is_range_indirection = false,
1917  bool inst = true);
1918  inline RegionRequirement& add_src_indirect_field(
1919  const RegionRequirement &src_idx_req,
1920  bool is_range_indirection = false);
1921  inline RegionRequirement& add_dst_indirect_field(
1922  const RegionRequirement &dst_idx_req,
1923  bool is_range_indirection = false);
1924  public:
1925  inline void add_grant(Grant g);
1926  inline void add_wait_barrier(PhaseBarrier bar);
1927  inline void add_arrival_barrier(PhaseBarrier bar);
1928  inline void add_wait_handshake(LegionHandshake handshake);
1929  inline void add_arrival_handshake(LegionHandshake handshake);
1930  public:
1931  std::vector<RegionRequirement> src_requirements;
1932  std::vector<RegionRequirement> dst_requirements;
1933  std::vector<RegionRequirement> src_indirect_requirements;
1934  std::vector<RegionRequirement> dst_indirect_requirements;
1935  std::vector<bool> src_indirect_is_range;
1936  std::vector<bool> dst_indirect_is_range;
1937  std::vector<Grant> grants;
1938  std::vector<PhaseBarrier> wait_barriers;
1939  std::vector<PhaseBarrier> arrive_barriers;
1940  Domain launch_domain;
1941  IndexSpace launch_space;
1942  // Will only be used in control replication context. If left
1943  // unset the runtime will use launch_domain/launch_space
1944  IndexSpace sharding_space;
1945  Predicate predicate;
1946  MapperID map_id;
1947  MappingTagID tag;
1948  UntypedBuffer map_arg;
1949  public:
1950  // Provenance string for the runtime and tools to use
1951  std::string provenance;
1952  public:
1953  // Inform the runtime about any static dependences
1954  // These will be ignored outside of static traces
1955  const std::vector<StaticDependence> *static_dependences;
1956  public:
1957  // Whether the source and destination indirections can lead
1958  // to out-of-range access into the instances to skip
1959  bool possible_src_indirect_out_of_range;
1960  bool possible_dst_indirect_out_of_range;
1961  // Whether the destination indirection can lead to aliasing
1962  // in the destination instances requiring synchronization
1963  bool possible_dst_indirect_aliasing;
1964  // Whether the individual point copies should operate collectively
1965  // together in the case of indirect copies (e.g. allow indirections
1966  // to refer to instances from other points). These settings have
1967  // no effect in the case of copies without indirections.
1968  bool collective_src_indirect_points;
1969  bool collective_dst_indirect_points;
1970  public:
1971  bool silence_warnings;
1972  };
1973 
1980  struct FillLauncher {
1981  public:
1982  FillLauncher(void);
1983  FillLauncher(LogicalRegion handle, LogicalRegion parent,
1984  UntypedBuffer arg, Predicate pred = Predicate::TRUE_PRED,
1985  MapperID id = 0, MappingTagID tag = 0,
1986  UntypedBuffer map_arg = UntypedBuffer(),
1987  const char *provenance = "");
1988  FillLauncher(LogicalRegion handle, LogicalRegion parent,
1989  Future f, Predicate pred = Predicate::TRUE_PRED,
1990  MapperID id = 0, MappingTagID tag = 0,
1991  UntypedBuffer map_arg = UntypedBuffer(),
1992  const char *provenance = "");
1993  public:
1994  inline void set_argument(UntypedBuffer arg);
1995  inline void set_future(Future f);
1996  inline void add_field(FieldID fid);
1997  inline void add_grant(Grant g);
1998  inline void add_wait_barrier(PhaseBarrier bar);
1999  inline void add_arrival_barrier(PhaseBarrier bar);
2000  inline void add_wait_handshake(LegionHandshake handshake);
2001  inline void add_arrival_handshake(LegionHandshake handshake);
2002  public:
2003  LogicalRegion handle;
2004  LogicalRegion parent;
2005  UntypedBuffer argument;
2006  Future future;
2007  Predicate predicate;
2008  std::set<FieldID> fields;
2009  std::vector<Grant> grants;
2010  std::vector<PhaseBarrier> wait_barriers;
2011  std::vector<PhaseBarrier> arrive_barriers;
2012  MapperID map_id;
2013  MappingTagID tag;
2014  UntypedBuffer map_arg;
2015  DomainPoint point;
2016  // Only used in control replication contexts for
2017  // doing sharding. If left unspecified the runtime
2018  // will use an index space of size 1 containing 'point'
2019  IndexSpace sharding_space;
2020  public:
2021  // Provenance string for the runtime and tools to use
2022  std::string provenance;
2023  public:
2024  // Inform the runtime about any static dependences
2025  // These will be ignored outside of static traces
2026  const std::vector<StaticDependence> *static_dependences;
2027  public:
2028  bool silence_warnings;
2029  };
2030 
2041  public:
2042  IndexFillLauncher(void);
2043  // Region projection
2044  IndexFillLauncher(Domain domain, LogicalRegion handle,
2045  LogicalRegion parent, UntypedBuffer arg,
2046  ProjectionID projection = 0,
2047  Predicate pred = Predicate::TRUE_PRED,
2048  MapperID id = 0, MappingTagID tag = 0,
2049  UntypedBuffer map_arg = UntypedBuffer(),
2050  const char *provenance = "");
2051  IndexFillLauncher(Domain domain, LogicalRegion handle,
2052  LogicalRegion parent, Future f,
2053  ProjectionID projection = 0,
2054  Predicate pred = Predicate::TRUE_PRED,
2055  MapperID id = 0, MappingTagID tag = 0,
2056  UntypedBuffer map_arg = UntypedBuffer(),
2057  const char *provenance = "");
2059  LogicalRegion parent, UntypedBuffer arg,
2060  ProjectionID projection = 0,
2061  Predicate pred = Predicate::TRUE_PRED,
2062  MapperID id = 0, MappingTagID tag = 0,
2063  UntypedBuffer map_arg = UntypedBuffer(),
2064  const char *provenance = "");
2066  LogicalRegion parent, Future f,
2067  ProjectionID projection = 0,
2068  Predicate pred = Predicate::TRUE_PRED,
2069  MapperID id = 0, MappingTagID tag = 0,
2070  UntypedBuffer map_arg = UntypedBuffer(),
2071  const char *provenance = "");
2072  // Partition projection
2073  IndexFillLauncher(Domain domain, LogicalPartition handle,
2074  LogicalRegion parent, UntypedBuffer arg,
2075  ProjectionID projection = 0,
2076  Predicate pred = Predicate::TRUE_PRED,
2077  MapperID id = 0, MappingTagID tag = 0,
2078  UntypedBuffer map_arg = UntypedBuffer(),
2079  const char *provenance = "");
2080  IndexFillLauncher(Domain domain, LogicalPartition handle,
2081  LogicalRegion parent, Future f,
2082  ProjectionID projection = 0,
2083  Predicate pred = Predicate::TRUE_PRED,
2084  MapperID id = 0, MappingTagID tag = 0,
2085  UntypedBuffer map_arg = UntypedBuffer(),
2086  const char *provenance = "");
2088  LogicalRegion parent, UntypedBuffer arg,
2089  ProjectionID projection = 0,
2090  Predicate pred = Predicate::TRUE_PRED,
2091  MapperID id = 0, MappingTagID tag = 0,
2092  UntypedBuffer map_arg = UntypedBuffer(),
2093  const char *provenance = "");
2095  LogicalRegion parent, Future f,
2096  ProjectionID projection = 0,
2097  Predicate pred = Predicate::TRUE_PRED,
2098  MapperID id = 0, MappingTagID tag = 0,
2099  UntypedBuffer map_arg = UntypedBuffer(),
2100  const char *provenance = "");
2101  public:
2102  inline void set_argument(UntypedBuffer arg);
2103  inline void set_future(Future f);
2104  inline void add_field(FieldID fid);
2105  inline void add_grant(Grant g);
2106  inline void add_wait_barrier(PhaseBarrier bar);
2107  inline void add_arrival_barrier(PhaseBarrier bar);
2108  inline void add_wait_handshake(LegionHandshake handshake);
2109  inline void add_arrival_handshake(LegionHandshake handshake);
2110  public:
2111  Domain launch_domain;
2112  IndexSpace launch_space;
2113  // Will only be used in control replication context. If left
2114  // unset the runtime will use launch_domain/launch_space
2115  IndexSpace sharding_space;
2116  LogicalRegion region;
2117  LogicalPartition partition;
2118  LogicalRegion parent;
2119  ProjectionID projection;
2120  UntypedBuffer argument;
2121  Future future;
2122  Predicate predicate;
2123  std::set<FieldID> fields;
2124  std::vector<Grant> grants;
2125  std::vector<PhaseBarrier> wait_barriers;
2126  std::vector<PhaseBarrier> arrive_barriers;
2127  MapperID map_id;
2128  MappingTagID tag;
2129  UntypedBuffer map_arg;
2130  public:
2131  // Provenance string for the runtime and tools to use
2132  std::string provenance;
2133  public:
2134  // Inform the runtime about any static dependences
2135  // These will be ignored outside of static traces
2136  const std::vector<StaticDependence> *static_dependences;
2137  public:
2138  bool silence_warnings;
2139  };
2140 
2148  public:
2150  public:
2151  inline void add_field(FieldID fid);
2152  public:
2153  LogicalRegion handle;
2154  LogicalRegion parent;
2155  std::set<FieldID> fields;
2156  public:
2157  // Provenance string for the runtime and tools to use
2158  std::string provenance;
2159  public:
2160  // Inform the runtime about any static dependences
2161  // These will be ignored outside of static traces
2162  const std::vector<StaticDependence> *static_dependences;
2163  public:
2164  bool silence_warnings;
2165  };
2166 
2189  public:
2190  AttachLauncher(ExternalResource resource,
2191  LogicalRegion handle, LogicalRegion parent,
2192  const bool restricted = true,
2193  const bool mapped = true);
2194  // Declared here to avoid superfluous compiler warnings
2195  // Can be remove after deprecated members are removed
2196  ~AttachLauncher(void);
2197  public:
2198  inline void initialize_constraints(bool column_major, bool soa,
2199  const std::vector<FieldID> &fields,
2200  const std::map<FieldID,size_t> *alignments = NULL);
2201  LEGION_DEPRECATED("Use Realm::ExternalFileResource instead")
2202  inline void attach_file(const char *file_name,
2203  const std::vector<FieldID> &fields,
2204  LegionFileMode mode);
2205  LEGION_DEPRECATED("Use Realm::ExternalHDF5Resource instead")
2206  inline void attach_hdf5(const char *file_name,
2207  const std::map<FieldID,const char*> &field_map,
2208  LegionFileMode mode);
2209  // Helper methods for AOS and SOA arrays, but it is totally
2210  // acceptable to fill in the layout constraint set manually
2211  LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2212  inline void attach_array_aos(void *base, bool column_major,
2213  const std::vector<FieldID> &fields,
2214  Memory memory = Memory::NO_MEMORY,
2215  const std::map<FieldID,size_t> *alignments = NULL);
2216  LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2217  inline void attach_array_soa(void *base, bool column_major,
2218  const std::vector<FieldID> &fields,
2219  Memory memory = Memory::NO_MEMORY,
2220  const std::map<FieldID,size_t> *alignments = NULL);
2221  public:
2222  ExternalResource resource;
2223  LogicalRegion parent;
2224  LogicalRegion handle;
2225  std::set<FieldID> privilege_fields;
2226  public:
2227  // This will be cloned each time you perform an attach with this launcher
2228  const Realm::ExternalInstanceResource* external_resource;
2229  public:
2230  LayoutConstraintSet constraints;
2231  public:
2232  // Whether this instance will be restricted when attached
2233  bool restricted /*= true*/;
2234  // Whether this region should be mapped by the calling task
2235  bool mapped; /*= true*/
2236  // Only matters for control replicated parent tasks
2237  // Indicate whether all the shards are providing the same data
2238  // or whether they are each providing different data
2239  // Collective means that each shard provides its own copy of the
2240  // data and non-collective means every shard provides the same data
2241  // Defaults to 'true' for external instances and 'false' for files
2242  bool collective;
2243  // For collective cases, indicate whether the runtime should
2244  // deduplicate data across shards in the same process
2245  // This is useful for cases where there is one file or external
2246  // instance per process but multiple shards per process
2247  bool deduplicate_across_shards;
2248  public:
2249  // Provenance string for the runtime and tools to use
2250  std::string provenance;
2251  public:
2252  // Data for files
2253  LEGION_DEPRECATED("file_name is deprecated, use external_resource")
2254  const char *file_name;
2255  LEGION_DEPRECATED("mode is deprecated, use external_resource")
2256  LegionFileMode mode;
2257  LEGION_DEPRECATED("file_fields is deprecated, use external_resource")
2258  std::vector<FieldID> file_fields; // normal files
2259  // This member must still be populated if you're attaching to an HDF5 file
2260  std::map<FieldID,/*file name*/const char*> field_files; // hdf5 files
2261  public:
2262  // Optional footprint of the instance in memory in bytes
2263  size_t footprint;
2264  public:
2265  // Inform the runtime about any static dependences
2266  // These will be ignored outside of static traces
2267  const std::vector<StaticDependence> *static_dependences;
2268  };
2269 
2281  public:
2282  IndexAttachLauncher(ExternalResource resource,
2283  LogicalRegion parent,
2284  const bool restricted = true);
2285  // Declared here to avoid superfluous compiler warnings
2286  // Can be remove after deprecated members are removed
2287  ~IndexAttachLauncher(void);
2288  public:
2289  inline void initialize_constraints(bool column_major, bool soa,
2290  const std::vector<FieldID> &fields,
2291  const std::map<FieldID,size_t> *alignments = NULL);
2292  inline void add_external_resource(LogicalRegion handle,
2293  const Realm::ExternalInstanceResource *resource);
2294  LEGION_DEPRECATED("Use Realm::ExternalFileResource instead")
2295  inline void attach_file(LogicalRegion handle,
2296  const char *file_name,
2297  const std::vector<FieldID> &fields,
2298  LegionFileMode mode);
2299  LEGION_DEPRECATED("Use Realm::ExternalHDF5Resource instead")
2300  inline void attach_hdf5(LogicalRegion handle,
2301  const char *file_name,
2302  const std::map<FieldID,const char*> &field_map,
2303  LegionFileMode mode);
2304  // Helper methods for AOS and SOA arrays, but it is totally
2305  // acceptable to fill in the layout constraint set manually
2306  LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2307  inline void attach_array_aos(LogicalRegion handle,
2308  void *base, bool column_major,
2309  const std::vector<FieldID> &fields,
2310  Memory memory = Memory::NO_MEMORY,
2311  const std::map<FieldID,size_t> *alignments = NULL);
2312  LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2313  inline void attach_array_soa(LogicalRegion handle,
2314  void *base, bool column_major,
2315  const std::vector<FieldID> &fields,
2316  Memory memory = Memory::NO_MEMORY,
2317  const std::map<FieldID,size_t> *alignments = NULL);
2318  public:
2319  ExternalResource resource;
2320  LogicalRegion parent;
2321  std::set<FieldID> privilege_fields;
2322  std::vector<LogicalRegion> handles;
2323  // This is the vector external resource objects that are going to
2324  // attached to the vector of logical region handles
2325  // These will be cloned each time you perform an attach with this launcher
2326  std::vector<const Realm::ExternalInstanceResource*> external_resources;
2327  public:
2328  LayoutConstraintSet constraints;
2329  public:
2330  // Whether these instances will be restricted when attached
2331  bool restricted /*= true*/;
2332  // Whether the runtime should check for duplicate resources across
2333  // the shards in a control replicated context, it is illegal to pass
2334  // in the same resource to different shards if this is set to false
2335  bool deduplicate_across_shards;
2336  public:
2337  // Provenance string for the runtime and tools to use
2338  std::string provenance;
2339  public:
2340  // Data for files
2341  LEGION_DEPRECATED("mode is deprecated, use external_resources")
2342  LegionFileMode mode;
2343  LEGION_DEPRECATED("file_names is deprecated, use external_resources")
2344  std::vector<const char*> file_names;
2345  LEGION_DEPRECATED("file_fields is deprecated, use external_resources")
2346  std::vector<FieldID> file_fields; // normal files
2347  // This data structure must still be filled in for using HDF5 files
2348  std::map<FieldID,
2349  std::vector</*file name*/const char*> > field_files; // hdf5 files
2350  public:
2351  // Data for external instances
2352  LEGION_DEPRECATED("pointers is deprecated, use external_resources")
2353  std::vector<PointerConstraint> pointers;
2354  public:
2355  // Optional footprint of the instance in memory in bytes
2356  // You only need to fill this in when using depcreated fields
2357  std::vector<size_t> footprint;
2358  public:
2359  // Inform the runtime about any static dependences
2360  // These will be ignored outside of static traces
2361  const std::vector<StaticDependence> *static_dependences;
2362  };
2363 
2371  public:
2372  explicit PredicateLauncher(bool and_op = true);
2373  public:
2374  inline void add_predicate(const Predicate &pred);
2375  public:
2376  bool and_op; // if not 'and' then 'or'
2377  std::vector<Predicate> predicates;
2378  std::string provenance;
2379  };
2380 
2387  public:
2388  TimingLauncher(TimingMeasurement measurement);
2389  public:
2390  inline void add_precondition(const Future &f);
2391  public:
2392  TimingMeasurement measurement;
2393  std::set<Future> preconditions;
2394  public:
2395  // Provenance string for the runtime and tools to use
2396  std::string provenance;
2397  };
2398 
2405  public:
2406  TunableLauncher(TunableID tid,
2407  MapperID mapper = 0,
2408  MappingTagID tag = 0,
2409  size_t return_type_size = SIZE_MAX);
2410  public:
2411  TunableID tunable;
2412  MapperID mapper;
2413  MappingTagID tag;
2414  UntypedBuffer arg;
2415  std::vector<Future> futures;
2416  size_t return_type_size;
2417  public:
2418  // Provenance string for the runtime and tools to use
2419  std::string provenance;
2420  };
2421 
2422  //==========================================================================
2423  // Task Variant Registrars
2424  //==========================================================================
2425 
2437  public:
2440  const char *layout_name = NULL);
2441  public:
2443  add_constraint(const SpecializedConstraint &constraint);
2445  add_constraint(const MemoryConstraint &constraint);
2447  add_constraint(const OrderingConstraint &constraint);
2449  add_constraint(const TilingConstraint &constraint);
2451  add_constraint(const FieldConstraint &constraint);
2453  add_constraint(const DimensionConstraint &constraint);
2455  add_constraint(const AlignmentConstraint &constraint);
2457  add_constraint(const OffsetConstraint &constraint);
2459  add_constraint(const PointerConstraint &constraint);
2461  add_constraint(const PaddingConstraint &constraint);
2462  public:
2463  FieldSpace handle;
2464  LayoutConstraintSet layout_constraints;
2465  const char* layout_name;
2466  };
2467 
2477  public:
2478  TaskVariantRegistrar(void);
2479  TaskVariantRegistrar(TaskID task_id, bool global = true,
2480  const char *variant_name = NULL);
2481  TaskVariantRegistrar(TaskID task_id, const char *variant_name,
2482  bool global = true);
2483  public: // Add execution constraints
2484  inline TaskVariantRegistrar&
2485  add_constraint(const ISAConstraint &constraint);
2486  inline TaskVariantRegistrar&
2487  add_constraint(const ProcessorConstraint &constraint);
2488  inline TaskVariantRegistrar&
2489  add_constraint(const ResourceConstraint &constraint);
2490  inline TaskVariantRegistrar&
2491  add_constraint(const LaunchConstraint &constraint);
2492  inline TaskVariantRegistrar&
2493  add_constraint(const ColocationConstraint &constraint);
2494  public: // Add layout constraint sets
2495  inline TaskVariantRegistrar&
2496  add_layout_constraint_set(unsigned index, LayoutConstraintID desc);
2497  public: // Set properties
2498  inline void set_leaf(bool is_leaf = true);
2499  inline void set_inner(bool is_inner = true);
2500  inline void set_idempotent(bool is_idempotent = true);
2501  inline void set_replicable(bool is_replicable = true);
2502  inline void set_concurrent(bool is_concurrent = true);
2503  inline void set_concurrent_barrier(bool needs_barrier = true);
2504  public: // Generator Task IDs
2505  inline void add_generator_task(TaskID tid);
2506  public:
2507  TaskID task_id;
2508  bool global_registration;
2509  const char* task_variant_name;
2510  public: // constraints
2511  ExecutionConstraintSet execution_constraints;
2512  TaskLayoutConstraintSet layout_constraints;
2513  public:
2514  // TaskIDs for which this variant can serve as a generator
2515  std::set<TaskID> generator_tasks;
2516  public: // properties
2517  bool leaf_variant;
2518  bool inner_variant;
2519  bool idempotent_variant;
2520  bool replicable_variant;
2521  bool concurrent_variant;
2522  bool concurrent_barrier;
2523  };
2524 
2525  //==========================================================================
2526  // Physical Data Classes
2527  //==========================================================================
2528 
2537  class PhysicalRegion : public Unserializable<PhysicalRegion> {
2538  public:
2539  PhysicalRegion(void);
2540  PhysicalRegion(const PhysicalRegion &rhs);
2541  PhysicalRegion(PhysicalRegion &&rhs) noexcept;
2542  ~PhysicalRegion(void);
2543  private:
2544  Internal::PhysicalRegionImpl *impl;
2545  protected:
2546  FRIEND_ALL_RUNTIME_CLASSES
2547  explicit PhysicalRegion(Internal::PhysicalRegionImpl *impl);
2548  public:
2549  PhysicalRegion& operator=(const PhysicalRegion &rhs);
2550  PhysicalRegion& operator=(PhysicalRegion &&rhs) noexcept;
2551  inline bool exists(void) const { return (impl != NULL); }
2552  inline bool operator==(const PhysicalRegion &reg) const
2553  { return (impl == reg.impl); }
2554  inline bool operator<(const PhysicalRegion &reg) const
2555  { return (impl < reg.impl); }
2556  public:
2560  bool is_mapped(void) const;
2568  void wait_until_valid(bool silence_warnings = false,
2569  const char *warning_string = NULL);
2576  bool is_valid(void) const;
2584  PrivilegeMode get_privilege(void) const;
2588  void get_memories(std::set<Memory>& memories,
2589  bool silence_warnings = false,
2590  const char *warning_string = NULL) const;
2594  void get_fields(std::vector<FieldID>& fields) const;
2595  public:
2596  template<int DIM, typename COORD_T>
2597  DomainT<DIM,COORD_T> get_bounds(void) const;
2598  // We'll also allow this to implicitly cast to a realm index space
2599  // so that users can easily iterate over the points
2600  template<int DIM, typename COORD_T>
2601  operator DomainT<DIM,COORD_T>(void) const;
2602  // They can implicitly cast to a rectangle if there is no
2603  // sparsity map, runtime will check for this
2604  template<int DIM, typename COORD_T>
2605  operator Rect<DIM,COORD_T>(void) const;
2606  protected:
2607  // These methods can only be accessed by accessor classes
2608  template<PrivilegeMode, typename, int, typename, typename, bool>
2609  friend class FieldAccessor;
2610  template<typename, bool, int, typename, typename, bool>
2611  friend class ReductionAccessor;
2612  template<typename, int, typename, typename, bool, bool, int>
2613  friend class MultiRegionAccessor;
2614  template<typename, int, typename, typename, bool>
2615  friend class PaddingAccessor;
2616  template<typename, int, typename, typename>
2617  friend class UnsafeFieldAccessor;
2618  template<typename, PrivilegeMode>
2619  friend class ArraySyntax::AccessorRefHelper;
2620  template<typename>
2621  friend class ArraySyntax::AffineRefHelper;
2622  friend class PieceIterator;
2623  template<PrivilegeMode, typename, int, typename>
2624  friend class SpanIterator;
2625  template<typename, int, typename>
2626  friend class UnsafeSpanIterator;
2627  Realm::RegionInstance get_instance_info(PrivilegeMode mode,
2628  FieldID fid, size_t field_size,
2629  void *realm_is, TypeTag type_tag,
2630  const char *warning_string,
2631  bool silence_warnings,
2632  bool generic_accessor,
2633  bool check_field_size,
2634  ReductionOpID redop = 0) const;
2635  Realm::RegionInstance get_instance_info(PrivilegeMode mode,
2636  const std::vector<PhysicalRegion> &other_regions,
2637  FieldID fid, size_t field_size,
2638  void *realm_is, TypeTag type_tag,
2639  const char *warning_string,
2640  bool silence_warnings,
2641  bool generic_accessor,
2642  bool check_field_size,
2643  bool need_bounds,
2644  ReductionOpID redop = 0) const;
2645  Realm::RegionInstance get_padding_info(FieldID fid, size_t field_size,
2646  Domain *inner, Domain &outer,
2647  const char *warning_string,
2648  bool silence_warnings,
2649  bool generic_accessor,
2650  bool check_field_size) const;
2651  void report_incompatible_accessor(const char *accessor_kind,
2652  Realm::RegionInstance instance, FieldID fid) const;
2653  void report_incompatible_multi_accessor(unsigned index, FieldID fid,
2654  Realm::RegionInstance inst1,
2655  Realm::RegionInstance inst2) const;
2656  void report_colocation_violation(const char *accessor_kind, FieldID fid,
2657  Realm::RegionInstance inst1,
2658  Realm::RegionInstance inst2,
2659  const PhysicalRegion &other,
2660  bool reduction = false) const;
2661  static void empty_colocation_regions(const char *accessor_kind,
2662  FieldID fid, bool reduction = false);
2663  static void fail_bounds_check(DomainPoint p, FieldID fid,
2664  PrivilegeMode mode, bool multi = false);
2665  static void fail_bounds_check(Domain d, FieldID fid,
2666  PrivilegeMode mode, bool multi = false);
2667  static void fail_privilege_check(DomainPoint p, FieldID fid,
2668  PrivilegeMode mode);
2669  static void fail_privilege_check(Domain d, FieldID fid,
2670  PrivilegeMode mode);
2671  static void fail_padding_check(DomainPoint p, FieldID fid);
2672  protected:
2673  void get_bounds(void *realm_is, TypeTag type_tag) const;
2674  };
2675 
2683  class ExternalResources : public Unserializable<ExternalResources> {
2684  public:
2685  ExternalResources(void);
2687  ExternalResources(ExternalResources &&rhs) noexcept;
2688  ~ExternalResources(void);
2689  private:
2690  Internal::ExternalResourcesImpl *impl;
2691  protected:
2692  FRIEND_ALL_RUNTIME_CLASSES
2693  explicit ExternalResources(Internal::ExternalResourcesImpl *impl);
2694  public:
2695  ExternalResources& operator=(const ExternalResources &rhs);
2696  ExternalResources& operator=(ExternalResources &&rhs) noexcept;
2697  inline bool exists(void) const { return (impl != NULL); }
2698  inline bool operator==(const ExternalResources &reg) const
2699  { return (impl == reg.impl); }
2700  inline bool operator<(const ExternalResources &reg) const
2701  { return (impl < reg.impl); }
2702  public:
2703  size_t size(void) const;
2704  PhysicalRegion operator[](unsigned index) const;
2705  };
2706 
2744  template<PrivilegeMode MODE, typename FT, int N, typename COORD_T = coord_t,
2745  typename A = Realm::GenericAccessor<FT,N,COORD_T>,
2746 #ifdef LEGION_BOUNDS_CHECKS
2747  bool CHECK_BOUNDS = true>
2748 #else
2749  bool CHECK_BOUNDS = false>
2750 #endif
2752  private:
2753  static_assert(N > 0, "N must be positive");
2754  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
2755  public:
2756  FieldAccessor(void) { }
2757  FieldAccessor(const PhysicalRegion &region, FieldID fid,
2758  // The actual field size in case it is different from the
2759  // one being used in FT and we still want to check it
2760  size_t actual_field_size = sizeof(FT),
2761 #ifdef DEBUG_LEGION
2762  bool check_field_size = true,
2763 #else
2764  bool check_field_size = false,
2765 #endif
2766  bool silence_warnings = false,
2767  const char *warning_string = NULL,
2768  size_t subfield_offset = 0) { }
2769  // For Realm::AffineAccessor specializations there are additional
2770  // methods for creating accessors with limited bounding boxes and
2771  // affine transformations for using alternative coordinates spaces
2772  // Specify a specific bounds rectangle to use for the accessor
2773  FieldAccessor(const PhysicalRegion &region, FieldID fid,
2774  const Rect<N,COORD_T> bounds,
2775  // The actual field size in case it is different from the
2776  // one being used in FT and we still want to check it
2777  size_t actual_field_size = sizeof(FT),
2778 #ifdef DEBUG_LEGION
2779  bool check_field_size = true,
2780 #else
2781  bool check_field_size = false,
2782 #endif
2783  bool silence_warnings = false,
2784  const char *warning_string = NULL,
2785  size_t subfield_offset = 0) { }
2786  // Specify a specific Affine transform to use for interpreting points
2787  // Not avalable for Realm::MultiAffineAccessor specializations
2788  template<int M>
2789  FieldAccessor(const PhysicalRegion &region, FieldID fid,
2790  const AffineTransform<M,N,COORD_T> transform,
2791  // The actual field size in case it is different from the
2792  // one being used in FT and we still want to check it
2793  size_t actual_field_size = sizeof(FT),
2794 #ifdef DEBUG_LEGION
2795  bool check_field_size = true,
2796 #else
2797  bool check_field_size = false,
2798 #endif
2799  bool silence_warnings = false,
2800  const char *warning_string = NULL,
2801  size_t subfield_offset = 0) { }
2802  // Specify both a transform and a bounds to use
2803  // Not avalable for Realm::MultiAffineAccessor specializations
2804  template<int M>
2805  FieldAccessor(const PhysicalRegion &region, FieldID fid,
2806  const AffineTransform<M,N,COORD_T> transform,
2807  const Rect<N,COORD_T> bounds,
2808  // The actual field size in case it is different from the
2809  // one being used in FT and we still want to check it
2810  size_t actual_field_size = sizeof(FT),
2811 #ifdef DEBUG_LEGION
2812  bool check_field_size = true,
2813 #else
2814  bool check_field_size = false,
2815 #endif
2816  bool silence_warnings = false,
2817  const char *warning_string = NULL,
2818  size_t subfield_offset = 0) { }
2819  // Create a field accessor for a Future
2820  // (only with READ-ONLY privileges and AffineAccessors)
2821  FieldAccessor(const Future &future,
2822  Memory::Kind kind = Memory::NO_MEMKIND,
2823  // The actual field size in case it is different from the
2824  // one being used in FT and we still want to check it
2825  size_t actual_field_size = sizeof(FT),
2826 #ifdef DEBUG_LEGION
2827  bool check_field_size = true,
2828 #else
2829  bool check_field_size = false,
2830 #endif
2831  bool silence_warnings = false,
2832  const char *warning_string = NULL,
2833  size_t subfield_offset = 0) { }
2834  // Create a field accessor for a Future
2835  // (only with READ-ONLY privileges and AffineAccessors)
2836  FieldAccessor(const Future &future,
2837  const Rect<N,COORD_T> bounds,
2838  Memory::Kind kind = Memory::NO_MEMKIND,
2839  // The actual field size in case it is different from the
2840  // one being used in FT and we still want to check it
2841  size_t actual_field_size = sizeof(FT),
2842 #ifdef DEBUG_LEGION
2843  bool check_field_size = true,
2844 #else
2845  bool check_field_size = false,
2846 #endif
2847  bool silence_warnings = false,
2848  const char *warning_string = NULL,
2849  size_t subfield_offset = 0) { }
2850  public:
2851  // Variations of the above four methods but with multiple physical
2852  // regions specified using input iterators for colocation regions
2853  // Colocation regions from [start, stop)
2854  template<typename InputIterator>
2855  FieldAccessor(InputIterator start_region,
2856  InputIterator stop_region, FieldID fid,
2857  // The actual field size in case it is different from the
2858  // one being used in FT and we still want to check it
2859  size_t actual_field_size = sizeof(FT),
2860 #ifdef DEBUG_LEGION
2861  bool check_field_size = true,
2862 #else
2863  bool check_field_size = false,
2864 #endif
2865  bool silence_warnings = false,
2866  const char *warning_string = NULL,
2867  size_t subfield_offset = 0) { }
2868  // For Realm::AffineAccessor specializations there are additional
2869  // methods for creating accessors with limited bounding boxes and
2870  // affine transformations for using alternative coordinates spaces
2871  // Specify a specific bounds rectangle to use for the accessor
2872  // Colocation regions from [start, stop)
2873  template<typename InputIterator>
2874  FieldAccessor(InputIterator start_region,
2875  InputIterator stop_region, FieldID fid,
2876  const Rect<N,COORD_T> bounds,
2877  // The actual field size in case it is different from the
2878  // one being used in FT and we still want to check it
2879  size_t actual_field_size = sizeof(FT),
2880 #ifdef DEBUG_LEGION
2881  bool check_field_size = true,
2882 #else
2883  bool check_field_size = false,
2884 #endif
2885  bool silence_warnings = false,
2886  const char *warning_string = NULL,
2887  size_t subfield_offset = 0) { }
2888  // Specify a specific Affine transform to use for interpreting points
2889  // Not avalable for Realm::MultiAffineAccessor specializations
2890  // Colocation regions from [start, stop)
2891  template<typename InputIterator, int M>
2892  FieldAccessor(InputIterator start_region,
2893  InputIterator stop_region, FieldID fid,
2894  const AffineTransform<M,N,COORD_T> transform,
2895  // The actual field size in case it is different from the
2896  // one being used in FT and we still want to check it
2897  size_t actual_field_size = sizeof(FT),
2898 #ifdef DEBUG_LEGION
2899  bool check_field_size = true,
2900 #else
2901  bool check_field_size = false,
2902 #endif
2903  bool silence_warnings = false,
2904  const char *warning_string = NULL,
2905  size_t subfield_offset = 0) { }
2906  // Specify both a transform and a bounds to use
2907  // Not avalable for Realm::MultiAffineAccessor specializations
2908  // Colocation regions from [start, stop)
2909  template<typename InputIterator, int M>
2910  FieldAccessor(InputIterator start_region,
2911  InputIterator stop_region, FieldID fid,
2912  const AffineTransform<M,N,COORD_T> transform,
2913  const Rect<N,COORD_T> bounds,
2914  // The actual field size in case it is different from the
2915  // one being used in FT and we still want to check it
2916  size_t actual_field_size = sizeof(FT),
2917 #ifdef DEBUG_LEGION
2918  bool check_field_size = true,
2919 #else
2920  bool check_field_size = false,
2921 #endif
2922  bool silence_warnings = false,
2923  const char *warning_string = NULL,
2924  size_t subfield_offset = 0) { }
2925  public:
2926  // Create a FieldAccessor for an UntypedDeferredValue
2927  // (only with AffineAccessors)
2928  FieldAccessor(const UntypedDeferredValue &value,
2929  // The actual field size in case it is different from the
2930  // one being used in FT and we still want to check it
2931  size_t actual_field_size = sizeof(FT),
2932 #ifdef DEBUG_LEGION
2933  bool check_field_size = true,
2934 #else
2935  bool check_field_size = false,
2936 #endif
2937  bool silence_warnings = false,
2938  const char *warning_string = NULL,
2939  size_t subfield_offset = 0) { }
2940  // Create a FieldAccessor for an UntypedDeferredValue
2941  // Specify a specific bounds rectangle to use for the accessor
2942  // (only with AffineAccessors)
2943  FieldAccessor(const UntypedDeferredValue &value,
2944  const Rect<N,COORD_T> &bounds,
2945  // The actual field size in case it is different from the
2946  // one being used in FT and we still want to check it
2947  size_t actual_field_size = sizeof(FT),
2948 #ifdef DEBUG_LEGION
2949  bool check_field_size = true,
2950 #else
2951  bool check_field_size = false,
2952 #endif
2953  bool silence_warnings = false,
2954  const char *warning_string = NULL,
2955  size_t subfield_offset = 0) { }
2956  public:
2957  // Create a FieldAccessor for UntypedDeferredBuffer
2958  // (only with AffineAccessors)
2960  // The actual field size in case it is different from the
2961  // one being used in FT and we still want to check it
2962  size_t actual_field_size = sizeof(FT),
2963 #ifdef DEBUG_LEGION
2964  bool check_field_size = true,
2965 #else
2966  bool check_field_size = false,
2967 #endif
2968  bool silence_warnings = false,
2969  const char *warning_string = NULL,
2970  size_t subfield_offset = 0) { }
2971  // Create a FieldAccessor for UntypedDeferredBuffer
2972  // Specify a specific bounds rectangle to use for the accessor
2973  // (only with AffineAccessors)
2975  const Rect<N,COORD_T> &bounds,
2976  // The actual field size in case it is different from the
2977  // one being used in FT and we still want to check it
2978  size_t actual_field_size = sizeof(FT),
2979 #ifdef DEBUG_LEGION
2980  bool check_field_size = true,
2981 #else
2982  bool check_field_size = false,
2983 #endif
2984  bool silence_warnings = false,
2985  const char *warning_string = NULL,
2986  size_t subfield_offset = 0) { }
2987  // Create a FieldAccessor for UntypedDeferredBuffer
2988  // Specify a specific Affine transform to use for interpreting points
2989  // (only with AffineAccessors)
2990  template<int M>
2992  const AffineTransform<M,N,COORD_T> &transform,
2993  // The actual field size in case it is different from the
2994  // one being used in FT and we still want to check it
2995  size_t actual_field_size = sizeof(FT),
2996 #ifdef DEBUG_LEGION
2997  bool check_field_size = true,
2998 #else
2999  bool check_field_size = false,
3000 #endif
3001  bool silence_warnings = false,
3002  const char *warning_string = NULL,
3003  size_t subfield_offset = 0) { }
3004  // Create a FieldAccessor for UntypedDeferredBuffer
3005  // Specify both a transform and a bounds to use
3006  // (only with AffineAccessors)
3007  template<int M>
3009  const AffineTransform<M,N,COORD_T> &transform,
3010  const Rect<N,COORD_T> &bounds,
3011  // The actual field size in case it is different from the
3012  // one being used in FT and we still want to check it
3013  size_t actual_field_size = sizeof(FT),
3014 #ifdef DEBUG_LEGION
3015  bool check_field_size = true,
3016 #else
3017  bool check_field_size = false,
3018 #endif
3019  bool silence_warnings = false,
3020  const char *warning_string = NULL,
3021  size_t subfield_offset = 0) { }
3022  public:
3023  typedef FT value_type;
3024  typedef FT& reference;
3025  typedef const FT& const_reference;
3026  static const int dim = N;
3027  };
3028 
3041  template<typename REDOP, bool EXCLUSIVE, int N, typename COORD_T = coord_t,
3042  typename A = Realm::GenericAccessor<typename REDOP::RHS,N,COORD_T>,
3043 #ifdef LEGION_BOUNDS_CHECKS
3044  bool CHECK_BOUNDS = true>
3045 #else
3046  bool CHECK_BOUNDS = false>
3047 #endif
3049  private:
3050  static_assert(N > 0, "N must be positive");
3051  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3052  public:
3053  ReductionAccessor(void) { }
3054  ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3055  ReductionOpID redop, bool silence_warnings = false,
3056  const char *warning_string = NULL,
3057  size_t subfield_offset = 0,
3058  size_t actual_field_size = sizeof(typename REDOP::RHS),
3059 #ifdef DEBUG_LEGION
3060  bool check_field_size = true
3061 #else
3062  bool check_field_size = false
3063 #endif
3064  ) { }
3065  // For Realm::AffineAccessor specializations there are additional
3066  // methods for creating accessors with limited bounding boxes and
3067  // affine transformations for using alternative coordinates spaces
3068  // Specify a specific bounds rectangle to use for the accessor
3069  ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3070  ReductionOpID redop,
3071  const Rect<N,COORD_T> bounds,
3072  bool silence_warnings = false,
3073  const char *warning_string = NULL,
3074  size_t subfield_offset = 0,
3075  size_t actual_field_size = sizeof(typename REDOP::RHS),
3076 #ifdef DEBUG_LEGION
3077  bool check_field_size = true
3078 #else
3079  bool check_field_size = false
3080 #endif
3081  ) { }
3082  // Specify a specific Affine transform to use for interpreting points
3083  // Not available for Realm::MultiAffineAccessor specializations
3084  template<int M>
3085  ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3086  ReductionOpID redop,
3087  const AffineTransform<M,N,COORD_T> transform,
3088  bool silence_warnings = false,
3089  const char *warning_string = NULL,
3090  size_t subfield_offset = 0,
3091  size_t actual_field_size = sizeof(typename REDOP::RHS),
3092 #ifdef DEBUG_LEGION
3093  bool check_field_size = true
3094 #else
3095  bool check_field_size = false
3096 #endif
3097  ) { }
3098  // Specify both a transform and a bounds to use
3099  // Not available for Realm::MultiAffineAccessor specializations
3100  template<int M>
3101  ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3102  ReductionOpID redop,
3103  const AffineTransform<M,N,COORD_T> transform,
3104  const Rect<N,COORD_T> bounds,
3105  bool silence_warnings = false,
3106  const char *warning_string = NULL,
3107  size_t subfield_offset = 0,
3108  size_t actual_field_size = sizeof(typename REDOP::RHS),
3109 #ifdef DEBUG_LEGION
3110  bool check_field_size = true
3111 #else
3112  bool check_field_size = false
3113 #endif
3114  ) { }
3115  public:
3116  // Variations of the same four methods above but with multiple
3117  // physical regions specified using input iterators for colocation regions
3118  // Colocation regions from [start, stop)
3119  template<typename InputIterator>
3120  ReductionAccessor(InputIterator start_region,
3121  InputIterator stop_region, FieldID fid,
3122  ReductionOpID redop, bool silence_warnings = false,
3123  const char *warning_string = NULL,
3124  size_t subfield_offset = 0,
3125  size_t actual_field_size = sizeof(typename REDOP::RHS),
3126 #ifdef DEBUG_LEGION
3127  bool check_field_size = true
3128 #else
3129  bool check_field_size = false
3130 #endif
3131  ) { }
3132  // For Realm::AffineAccessor specializations there are additional
3133  // methods for creating accessors with limited bounding boxes and
3134  // affine transformations for using alternative coordinates spaces
3135  // Specify a specific bounds rectangle to use for the accessor
3136  // Colocation regions from [start, stop)
3137  template<typename InputIterator>
3138  ReductionAccessor(InputIterator start_region,
3139  InputIterator stop_region, FieldID fid,
3140  ReductionOpID redop,
3141  const Rect<N,COORD_T> bounds,
3142  bool silence_warnings = false,
3143  const char *warning_string = NULL,
3144  size_t subfield_offset = 0,
3145  size_t actual_field_size = sizeof(typename REDOP::RHS),
3146 #ifdef DEBUG_LEGION
3147  bool check_field_size = true
3148 #else
3149  bool check_field_size = false
3150 #endif
3151  ) { }
3152  // Specify a specific Affine transform to use for interpreting points
3153  // Not available for Realm::MultiAffineAccessor specializations
3154  // Colocation regions from [start, stop)
3155  template<typename InputIterator, int M>
3156  ReductionAccessor(InputIterator start_region,
3157  InputIterator stop_region, FieldID fid,
3158  ReductionOpID redop,
3159  const AffineTransform<M,N,COORD_T> transform,
3160  bool silence_warnings = false,
3161  const char *warning_string = NULL,
3162  size_t subfield_offset = 0,
3163  size_t actual_field_size = sizeof(typename REDOP::RHS),
3164 #ifdef DEBUG_LEGION
3165  bool check_field_size = true
3166 #else
3167  bool check_field_size = false
3168 #endif
3169  ) { }
3170  // Specify both a transform and a bounds to use
3171  // Not available for Realm::MultiAffineAccessor specializations
3172  // Colocation regions from [start, stop)
3173  template<typename InputIterator, int M>
3174  ReductionAccessor(InputIterator start_region,
3175  InputIterator stop_region, FieldID fid,
3176  ReductionOpID redop,
3177  const AffineTransform<M,N,COORD_T> transform,
3178  const Rect<N,COORD_T> bounds,
3179  bool silence_warnings = false,
3180  const char *warning_string = NULL,
3181  size_t subfield_offset = 0,
3182  size_t actual_field_size = sizeof(typename REDOP::RHS),
3183 #ifdef DEBUG_LEGION
3184  bool check_field_size = true
3185 #else
3186  bool check_field_size = false
3187 #endif
3188  ) { }
3189  public:
3190  // Create a ReductionAccessor for an UntypedDeferredValue
3191  // (only with AffineAccessors)
3193  bool silence_warnings = false,
3194  const char *warning_string = NULL,
3195  size_t subfield_offset = 0,
3196  size_t actual_field_size = sizeof(typename REDOP::RHS),
3197 #ifdef DEBUG_LEGION
3198  bool check_field_size = true
3199 #else
3200  bool check_field_size = false
3201 #endif
3202  ) { }
3203  // Create a ReductionAccessor for an UntypedDeferredValue
3204  // Specify a specific bounds rectangle to use for the accessor
3205  // (only with AffineAccessors)
3207  const Rect<N,COORD_T> &bounds,
3208  bool silence_warnings = false,
3209  const char *warning_string = NULL,
3210  size_t subfield_offset = 0,
3211  size_t actual_field_size = sizeof(typename REDOP::RHS),
3212 #ifdef DEBUG_LEGION
3213  bool check_field_size = true
3214 #else
3215  bool check_field_size = false
3216 #endif
3217  ) { }
3218  public:
3219  // Create a ReductionAccessor for an UntypedDeferredBuffer
3220  // (only with AffineAccessors)
3222  bool silence_warnings = false,
3223  const char *warning_string = NULL,
3224  size_t subfield_offset = 0,
3225  size_t actual_field_size = sizeof(typename REDOP::RHS),
3226 #ifdef DEBUG_LEGION
3227  bool check_field_size = true
3228 #else
3229  bool check_field_size = false
3230 #endif
3231  ) { }
3232  // Create a ReductionAccessor for an UntypedDeferredBuffer
3233  // Specify a specific bounds rectangle to use for the accessor
3234  // (only with AffineAccessors)
3236  const Rect<N,COORD_T> &bounds,
3237  bool silence_warnings = false,
3238  const char *warning_string = NULL,
3239  size_t subfield_offset = 0,
3240  size_t actual_field_size = sizeof(typename REDOP::RHS),
3241 #ifdef DEBUG_LEGION
3242  bool check_field_size = true
3243 #else
3244  bool check_field_size = false
3245 #endif
3246  ) { }
3247  // Create a ReductionAccessor for an UntypedDeferredBuffer
3248  // Specify a specific Affine transform to use for interpreting points
3249  // (only with AffineAccessors)
3250  template<int M>
3252  const AffineTransform<M,N,COORD_T> &transform,
3253  bool silence_warnings = false,
3254  const char *warning_string = NULL,
3255  size_t subfield_offset = 0,
3256  size_t actual_field_size = sizeof(typename REDOP::RHS),
3257 #ifdef DEBUG_LEGION
3258  bool check_field_size = true
3259 #else
3260  bool check_field_size = false
3261 #endif
3262  ) { }
3263  // Create a ReductionAccessor for an UntypedDeferredBuffer
3264  // Specify both a transform and a bounds to use
3265  // (only with AffineAccessors)
3266  template<int M>
3268  const AffineTransform<M,N,COORD_T> &transform,
3269  const Rect<N,COORD_T> &bounds,
3270  bool silence_warnings = false,
3271  const char *warning_string = NULL,
3272  size_t subfield_offset = 0,
3273  size_t actual_field_size = sizeof(typename REDOP::RHS),
3274 #ifdef DEBUG_LEGION
3275  bool check_field_size = true
3276 #else
3277  bool check_field_size = false
3278 #endif
3279  ) { }
3280  public:
3281  typedef typename REDOP::RHS value_type;
3282  typedef typename REDOP::RHS& reference;
3283  typedef const typename REDOP::RHS& const_reference;
3284  static const int dim = N;
3285  };
3286 
3309  template<typename FT, int N, typename COORD_T = coord_t,
3310  typename A = Realm::GenericAccessor<FT,N,COORD_T>,
3311 #ifdef LEGION_BOUNDS_CHECKS
3312  bool CHECK_BOUNDS = true>
3313 #else
3314  bool CHECK_BOUNDS = false>
3315 #endif
3317  public:
3318  PaddingAccessor(void) { }
3319  PaddingAccessor(const PhysicalRegion &region, FieldID fid,
3320  // The actual field size in case it is different from the
3321  // one being used in FT and we still want to check it
3322  size_t actual_field_size = sizeof(FT),
3323 #ifdef DEBUG_LEGION
3324  bool check_field_size = true,
3325 #else
3326  bool check_field_size = false,
3327 #endif
3328  bool silence_warnings = false,
3329  const char *warning_string = NULL,
3330  size_t subfield_offset = 0) { }
3331  };
3332 
3333 #ifdef LEGION_MULTI_REGION_ACCESSOR
3334  // Multi-Region Accessors are a provisional feature now and are likely
3335  // to be deprecated and removed in the near future. Instead of multi-region
3336  // accessors you should be able to use the new colocation constructors
3337  // on the traditional Field Accessors.
3367  template<typename FT, int N, typename COORD_T = coord_t,
3368  typename A = Realm::GenericAccessor<FT,N,COORD_T>,
3369 #ifdef LEGION_BOUNDS_CHECKS
3370  bool CHECK_BOUNDS = true,
3371 #else
3372  bool CHECK_BOUNDS = false,
3373 #endif
3374 #ifdef LEGION_PRIVILEGE_CHECKS
3375  bool CHECK_PRIVILEGES = true,
3376 #else
3377  bool CHECK_PRIVILEGES = false,
3378 #endif
3379  // Only used if bounds/privilege checks enabled
3380  // Can safely over-approximate, but may cost space
3381  // Especially GPU parameter space
3382  int MAX_REGIONS = 4>
3383  class MultiRegionAccessor {
3384  private:
3385  static_assert(N > 0, "N must be positive");
3386  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3387  public:
3388  MultiRegionAccessor(void) { }
3389  public: // iterator based construction of the multi-region accessors
3390  template<typename InputIterator>
3391  MultiRegionAccessor(InputIterator start, InputIterator stop,
3392  // The actual field size in case it is different from
3393  // the one being used in FT and we still want to check
3394  FieldID fid, size_t actual_field_size = sizeof(FT),
3395 #ifdef DEBUG_LEGION
3396  bool check_field_size = true,
3397 #else
3398  bool check_field_size = false,
3399 #endif
3400  bool silence_warnings = false,
3401  const char *warning_string = NULL,
3402  size_t subfield_offset = 0) { }
3403  // Specify a specific bounds rectangle to use for the accessor
3404  template<typename InputIterator>
3405  MultiRegionAccessor(InputIterator start, InputIterator stop,
3406  const Rect<N,COORD_T> bounds, FieldID fid,
3407  // The actual field size in case it is different from
3408  // the one being used in FT and we still want to check
3409  size_t actual_field_size = sizeof(FT),
3410 #ifdef DEBUG_LEGION
3411  bool check_field_size = true,
3412 #else
3413  bool check_field_size = false,
3414 #endif
3415  bool silence_warnings = false,
3416  const char *warning_string = NULL,
3417  size_t subfield_offset = 0) { }
3418  // Specify a specific Affine transform to use for interpreting points
3419  template<int M, typename InputIterator>
3420  MultiRegionAccessor(InputIterator start, InputIterator stop,
3421  const AffineTransform<M,N,COORD_T> transform,
3422  // The actual field size in case it is different from
3423  // the one being used in FT and we still want to check
3424  FieldID fid, size_t actual_field_size = sizeof(FT),
3425 #ifdef DEBUG_LEGION
3426  bool check_field_size = true,
3427 #else
3428  bool check_field_size = false,
3429 #endif
3430  bool silence_warnings = false,
3431  const char *warning_string = NULL,
3432  size_t subfield_offset = 0) { }
3433  // Specify both a transform and a bounds to use
3434  template<int M, typename InputIterator>
3435  MultiRegionAccessor(InputIterator start, InputIterator stop,
3436  const AffineTransform<M,N,COORD_T> transform,
3437  const Rect<N,COORD_T> bounds, FieldID fid,
3438  // The actual field size in case it is different from the
3439  // one being used in FT and we still want to check it
3440  size_t actual_field_size = sizeof(FT),
3441 #ifdef DEBUG_LEGION
3442  bool check_field_size = true,
3443 #else
3444  bool check_field_size = false,
3445 #endif
3446  bool silence_warnings = false,
3447  const char *warning_string = NULL,
3448  size_t subfield_offset = 0) { }
3449  public: // explicit data structure versions of the implicit iterators above
3450  MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3451  // The actual field size in case it is different from
3452  // the one being used in FT and we still want to check
3453  FieldID fid, size_t actual_field_size = sizeof(FT),
3454 #ifdef DEBUG_LEGION
3455  bool check_field_size = true,
3456 #else
3457  bool check_field_size = false,
3458 #endif
3459  bool silence_warnings = false,
3460  const char *warning_string = NULL,
3461  size_t subfield_offset = 0) { }
3462  // Specify a specific bounds rectangle to use for the accessor
3463  MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3464  const Rect<N,COORD_T> bounds, FieldID fid,
3465  // The actual field size in case it is different from
3466  // the one being used in FT and we still want to check
3467  size_t actual_field_size = sizeof(FT),
3468 #ifdef DEBUG_LEGION
3469  bool check_field_size = true,
3470 #else
3471  bool check_field_size = false,
3472 #endif
3473  bool silence_warnings = false,
3474  const char *warning_string = NULL,
3475  size_t subfield_offset = 0) { }
3476  // Specify a specific Affine transform to use for interpreting points
3477  template<int M>
3478  MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3479  const AffineTransform<M,N,COORD_T> transform,
3480  // The actual field size in case it is different from
3481  // the one being used in FT and we still want to check
3482  FieldID fid, size_t actual_field_size = sizeof(FT),
3483 #ifdef DEBUG_LEGION
3484  bool check_field_size = true,
3485 #else
3486  bool check_field_size = false,
3487 #endif
3488  bool silence_warnings = false,
3489  const char *warning_string = NULL,
3490  size_t subfield_offset = 0) { }
3491  // Specify both a transform and a bounds to use
3492  template<int M>
3493  MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3494  const AffineTransform<M,N,COORD_T> transform,
3495  const Rect<N,COORD_T> bounds, FieldID fid,
3496  // The actual field size in case it is different from the
3497  // one being used in FT and we still want to check it
3498  size_t actual_field_size = sizeof(FT),
3499 #ifdef DEBUG_LEGION
3500  bool check_field_size = true,
3501 #else
3502  bool check_field_size = false,
3503 #endif
3504  bool silence_warnings = false,
3505  const char *warning_string = NULL,
3506  size_t subfield_offset = 0) { }
3507  public:
3508  typedef FT value_type;
3509  typedef FT& reference;
3510  typedef const FT& const_reference;
3511  static const int dim = N;
3512  };
3513 #endif // LEGION_MULTI_REGION_ACCESSOR
3514 
3539  public:
3540  PieceIterator(void);
3541  PieceIterator(const PieceIterator &rhs);
3542  PieceIterator(PieceIterator &&rhs) noexcept;
3543  PieceIterator(const PhysicalRegion &region, FieldID fid,
3544  bool privilege_only = true,
3545  bool silence_warnings = false,
3546  const char *warning_string = NULL);
3547  ~PieceIterator(void);
3548  public:
3549  PieceIterator& operator=(const PieceIterator &rhs);
3550  PieceIterator& operator=(PieceIterator &&rhs) noexcept;
3551  public:
3552  inline bool valid(void) const;
3553  bool step(void);
3554  public:
3555  inline operator bool(void) const;
3556  inline bool operator()(void) const;
3557  inline const Domain& operator*(void) const;
3558  inline const Domain* operator->(void) const;
3559  inline PieceIterator& operator++(void);
3560  inline PieceIterator operator++(int/*postfix*/);
3561  public:
3562  bool operator<(const PieceIterator &rhs) const;
3563  bool operator==(const PieceIterator &rhs) const;
3564  bool operator!=(const PieceIterator &rhs) const;
3565  private:
3566  Internal::PieceIteratorImpl *impl;
3567  int index;
3568  protected:
3569  Domain current_piece;
3570  };
3571 
3577  template<int DIM, typename COORD_T = coord_t>
3579  private:
3580  static_assert(DIM > 0, "DIM must be positive");
3581  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3582  public:
3583  PieceIteratorT(void);
3584  PieceIteratorT(const PieceIteratorT &rhs);
3585  PieceIteratorT(PieceIteratorT &&rhs) noexcept;
3586  PieceIteratorT(const PhysicalRegion &region, FieldID fid,
3587  bool privilege_only,
3588  bool silence_warnings = false,
3589  const char *warning_string = NULL);
3590  public:
3591  PieceIteratorT<DIM,COORD_T>& operator=(const PieceIteratorT &rhs);
3592  PieceIteratorT<DIM,COORD_T>& operator=(PieceIteratorT &&rhs) noexcept;
3593  public:
3594  inline bool step(void);
3595  inline const Rect<DIM,COORD_T>& operator*(void) const;
3596  inline const Rect<DIM,COORD_T>* operator->(void) const;
3597  inline PieceIteratorT<DIM,COORD_T>& operator++(void);
3598  inline PieceIteratorT<DIM,COORD_T> operator++(int/*postfix*/);
3599  protected:
3600  Rect<DIM,COORD_T> current_rect;
3601  };
3602 
3612  template<PrivilegeMode PM, typename FT, int DIM, typename COORD_T = coord_t>
3614  private:
3615  static_assert(DIM > 0, "DIM must be positive");
3616  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3617  public:
3618  SpanIterator(void) { }
3619  SpanIterator(const PhysicalRegion &region, FieldID fid,
3620  // The actual field size in case it is different from the
3621  // one being used in FT and we still want to check it
3622  size_t actual_field_size = sizeof(FT),
3623 #ifdef DEBUG_LEGION
3624  bool check_field_size = true,
3625 #else
3626  bool check_field_size = false,
3627 #endif
3628  // Iterate only the spans that we have privileges on
3629  bool privileges_only = true,
3630  bool silence_warnings = false,
3631  const char *warning_string = NULL);
3632  public:
3633  inline bool valid(void) const;
3634  inline bool step(void);
3635  public:
3636  inline operator bool(void) const;
3637  inline bool operator()(void) const;
3638  inline const Span<FT,PM>& operator*(void) const;
3639  inline const Span<FT,PM>* operator->(void) const;
3640  inline SpanIterator<PM,FT,DIM,COORD_T>& operator++(void);
3641  inline SpanIterator<PM,FT,DIM,COORD_T> operator++(int);
3642  private:
3643  PieceIteratorT<DIM,COORD_T> piece_iterator;
3644  Realm::MultiAffineAccessor<FT,DIM,COORD_T> accessor;
3645  Span<FT,PM> current;
3646  Point<DIM,COORD_T> partial_step_point;
3647  int dim_order[DIM];
3648  int partial_step_dim;
3649  bool partial_piece;
3650  };
3651 
3665  template<typename T>
3667  public:
3668  DeferredValue(T initial_value,
3669  size_t alignment = 16);
3670  public:
3671  __CUDA_HD__
3672  inline T read(void) const;
3673  __CUDA_HD__
3674  inline void write(T value) const;
3675  __CUDA_HD__
3676  inline T* ptr(void) const;
3677  __CUDA_HD__
3678  inline T& ref(void) const;
3679  __CUDA_HD__
3680  inline operator T(void) const;
3681  __CUDA_HD__
3682  inline DeferredValue<T>& operator=(T value);
3683  public:
3684  inline void finalize(Context ctx) const;
3685  protected:
3686  friend class UntypedDeferredValue;
3687  DeferredValue(void);
3688  Realm::RegionInstance instance;
3689  Realm::AffineAccessor<T,1,coord_t> accessor;
3690  };
3691 
3701  template<typename REDOP, bool EXCLUSIVE=false>
3702  class DeferredReduction: public DeferredValue<typename REDOP::RHS> {
3703  public:
3704  DeferredReduction(size_t alignment = 16);
3705  public:
3706  __CUDA_HD__
3707  inline void reduce(typename REDOP::RHS val) const;
3708  __CUDA_HD__
3709  inline void operator<<=(typename REDOP::RHS val) const;
3710  };
3711 
3717  public:
3718  UntypedDeferredValue(void);
3719  UntypedDeferredValue(size_t field_size, Memory target_memory,
3720  const void *initial_value = NULL,
3721  size_t alignment = 16);
3722  UntypedDeferredValue(size_t field_size,
3723  Memory::Kind memory_kind = Memory::Z_COPY_MEM,
3724  const void *initial_value = NULL,
3725  size_t alignment = 16);
3726  template<typename T>
3728  template<typename REDOP, bool EXCLUSIVE>
3730  public:
3731  template<typename T>
3732  inline operator DeferredValue<T>(void) const;
3733  template<typename REDOP, bool EXCLUSIVE>
3734  inline operator DeferredReduction<REDOP,EXCLUSIVE>(void) const;
3735  public:
3736  void finalize(Context ctx) const;
3737  Realm::RegionInstance get_instance() const;
3738  private:
3739  template<PrivilegeMode,typename,int,typename,typename,bool>
3740  friend class FieldAccessor;
3741  template<typename,bool,int,typename,typename,bool>
3742  friend class ReductionAccessor;
3743  Realm::RegionInstance instance;
3744  size_t field_size;
3745  };
3746 
3764  template<typename T, int DIM, typename COORD_T = coord_t,
3765 #ifdef LEGION_BOUNDS_CHECKS
3766  bool CHECK_BOUNDS = true>
3767 #else
3768  bool CHECK_BOUNDS = false>
3769 #endif
3771  private:
3772  static_assert(DIM > 0, "DIM must be positive");
3773  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3774  public:
3775  DeferredBuffer(void);
3776  public: // Constructors specifying a generic memory kind
3777  DeferredBuffer(Memory::Kind kind,
3778  const Domain &bounds,
3779  const T *initial_value = NULL,
3780  size_t alignment = 16,
3781  bool fortran_order_dims = false);
3782  DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3783  Memory::Kind kind,
3784  const T *initial_value = NULL,
3785  size_t alignment = 16,
3786  bool fortran_order_dims = false);
3787  public: // Constructors specifying a specific memory
3788  DeferredBuffer(Memory memory,
3789  const Domain &bounds,
3790  const T *initial_value = NULL,
3791  size_t alignment = 16,
3792  bool fortran_order_dims = false);
3793  DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3794  Memory memory,
3795  const T *initial_value = NULL,
3796  size_t alignment = 16,
3797  bool fortran_order_dims = false);
3798  public: // Constructors specifying a specific ordering
3799  DeferredBuffer(Memory::Kind kind,
3800  const Domain &bounds,
3801  std::array<DimensionKind,DIM> ordering,
3802  const T *initial_value = NULL,
3803  size_t alignment = 16);
3804  DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3805  Memory::Kind kind,
3806  std::array<DimensionKind,DIM> ordering,
3807  const T *initial_value = NULL,
3808  size_t alignment = 16);
3809  DeferredBuffer(Memory memory,
3810  const Domain &bounds,
3811  std::array<DimensionKind,DIM> ordering,
3812  const T *initial_value = NULL,
3813  size_t alignment = 16);
3814  DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3815  Memory memory,
3816  std::array<DimensionKind,DIM> ordering,
3817  const T *initial_value = NULL,
3818  size_t alignment = 16);
3819  protected:
3820  Memory get_memory_from_kind(Memory::Kind kind);
3821  void initialize_layout(size_t alignment, bool fortran_order_dims);
3822  void initialize(Memory memory,
3823  DomainT<DIM,COORD_T> bounds,
3824  const T *initial_value);
3825  public:
3826  __CUDA_HD__
3827  inline T read(const Point<DIM,COORD_T> &p) const;
3828  __CUDA_HD__
3829  inline void write(const Point<DIM,COORD_T> &p, T value) const;
3830  __CUDA_HD__
3831  inline T* ptr(const Point<DIM,COORD_T> &p) const;
3832  __CUDA_HD__
3833  inline T* ptr(const Rect<DIM,COORD_T> &r) const; // must be dense
3834  __CUDA_HD__
3835  inline T* ptr(const Rect<DIM,COORD_T> &r, size_t strides[DIM]) const;
3836  __CUDA_HD__
3837  inline T& operator[](const Point<DIM,COORD_T> &p) const;
3838  public:
3839  void destroy();
3840  Realm::RegionInstance get_instance() const;
3841  protected:
3842  friend class OutputRegion;
3843  friend class UntypedDeferredBuffer<COORD_T>;
3844  Realm::RegionInstance instance;
3845  Realm::AffineAccessor<T,DIM,COORD_T> accessor;
3846  std::array<DimensionKind,DIM> ordering;
3847  size_t alignment;
3848 #ifdef LEGION_BOUNDS_CHECKS
3849  DomainT<DIM,COORD_T> bounds;
3850 #endif
3851  };
3852 
3859  template<typename COORD_T = coord_t>
3861  private:
3862  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3863  public:
3864  UntypedDeferredBuffer(void);
3865  public: // Constructors specifying a generic memory kind
3866  UntypedDeferredBuffer(size_t field_size, int dims,
3867  Memory::Kind kind,
3868  const Domain &bounds,
3869  const void *initial_value = NULL,
3870  size_t alignment = 16,
3871  bool fortran_order_dims = false);
3872  UntypedDeferredBuffer(size_t field_size, int dims,
3873  Memory::Kind kind,
3874  IndexSpace bounds,
3875  const void *initial_value = NULL,
3876  size_t alignment = 16,
3877  bool fortran_order_dims = false);
3878  public: // Constructors specifying a specific memory
3879  UntypedDeferredBuffer(size_t field_size, int dims,
3880  Memory memory,
3881  const Domain &bounds,
3882  const void *initial_value = NULL,
3883  size_t alignment = 16,
3884  bool fortran_order_dims = false);
3885  UntypedDeferredBuffer(size_t field_size, int dims,
3886  Memory memory,
3887  IndexSpace bounds,
3888  const void *initial_value = NULL,
3889  size_t alignment = 16,
3890  bool fortran_order_dims = false);
3891  public:
3892  template<typename T, int DIM>
3894  public:
3895  template<typename T, int DIM, bool BC>
3896  inline operator DeferredBuffer<T,DIM,COORD_T,BC>(void) const;
3897  public:
3898  inline void destroy(void);
3899  inline Realm::RegionInstance get_instance(void) const { return instance; }
3900  private:
3901  template<PrivilegeMode,typename,int,typename,typename,bool>
3902  friend class FieldAccessor;
3903  template<typename,bool,int,typename,typename,bool>
3904  friend class ReductionAccessor;
3905  Realm::RegionInstance instance;
3906  size_t field_size;
3907  int dims;
3908  };
3909 
3916  class OutputRegion : public Unserializable<OutputRegion> {
3917  public:
3918  OutputRegion(void);
3919  OutputRegion(const OutputRegion &rhs);
3920  ~OutputRegion(void);
3921  private:
3922  Internal::OutputRegionImpl *impl;
3923  protected:
3924  FRIEND_ALL_RUNTIME_CLASSES
3925  explicit OutputRegion(Internal::OutputRegionImpl *impl);
3926  public:
3927  OutputRegion& operator=(const OutputRegion &rhs);
3928  public:
3929  Memory target_memory(void) const;
3930  // Returns the logical region of this output region.
3931  // The call is legal only when the output region is valid and
3932  // will raise an error otherwise.
3933  LogicalRegion get_logical_region(void) const;
3934  bool is_valid_output_region(void) const;
3935  public:
3936  // Returns a deferred buffer that satisfies the layout constraints of
3937  // this output region. The caller still needs to pass this buffer to
3938  // a return_data call if the buffer needs to be bound to this output
3939  // region. The caller can optionally choose to bind the returned buffer
3940  // to the output region; such a call cannot be made more than once.
3941  template<typename T,
3942  int DIM,
3943  typename COORD_T = coord_t,
3944 #ifdef LEGION_BOUNDS_CHECKS
3945  bool CHECK_BOUNDS = true>
3946 #else
3947  bool CHECK_BOUNDS = false>
3948 #endif
3950  create_buffer(const Point<DIM, COORD_T> &extents,
3951  FieldID field_id,
3952  const T *initial_value = NULL,
3953  bool return_buffer = false);
3954  private:
3955  void check_type_tag(TypeTag type_tag) const;
3956  void check_field_size(FieldID field_id, size_t field_size) const;
3957  void get_layout(FieldID field_id,
3958  std::vector<DimensionKind> &ordering,
3959  size_t &alignment) const;
3960  public:
3961  template<typename T,
3962  int DIM,
3963  typename COORD_T = coord_t,
3964 #ifdef LEGION_BOUNDS_CHECKS
3965  bool CHECK_BOUNDS = true>
3966 #else
3967  bool CHECK_BOUNDS = false>
3968 #endif
3969  void return_data(const Point<DIM,COORD_T> &extents,
3970  FieldID field_id,
3972  void return_data(const DomainPoint &extents,
3973  FieldID field_id,
3974  Realm::RegionInstance instance,
3975  bool check_constraints = true);
3976  private:
3977  void return_data(const DomainPoint &extents,
3978  FieldID field_id,
3979  Realm::RegionInstance instance,
3980  const LayoutConstraintSet *constraints,
3981  bool check_constraints);
3982  };
3983 
3984  //==========================================================================
3985  // Software Coherence Classes
3986  //==========================================================================
3987 
4000  public:
4001  AcquireLauncher(LogicalRegion logical_region,
4002  LogicalRegion parent_region,
4003  PhysicalRegion physical_region = PhysicalRegion(),
4004  Predicate pred = Predicate::TRUE_PRED,
4005  MapperID id = 0, MappingTagID tag = 0,
4006  UntypedBuffer map_arg = UntypedBuffer(),
4007  const char *provenance = "");
4008  public:
4009  inline void add_field(FieldID f);
4010  inline void add_grant(Grant g);
4011  inline void add_wait_barrier(PhaseBarrier pb);
4012  inline void add_arrival_barrier(PhaseBarrier pb);
4013  inline void add_wait_handshake(LegionHandshake handshake);
4014  inline void add_arrival_handshake(LegionHandshake handshake);
4015  public:
4016  LogicalRegion logical_region;
4017  LogicalRegion parent_region;
4018  std::set<FieldID> fields;
4019  public:
4020  // This field is now optional (but required with control replication)
4021  PhysicalRegion physical_region;
4022  public:
4023  std::vector<Grant> grants;
4024  std::vector<PhaseBarrier> wait_barriers;
4025  std::vector<PhaseBarrier> arrive_barriers;
4026  Predicate predicate;
4027  MapperID map_id;
4028  MappingTagID tag;
4029  UntypedBuffer map_arg;
4030  public:
4031  // Provenance string for the runtime and tools to use
4032  std::string provenance;
4033  public:
4034  // Inform the runtime about any static dependences
4035  // These will be ignored outside of static traces
4036  const std::vector<StaticDependence> *static_dependences;
4037  public:
4038  bool silence_warnings;
4039  };
4040 
4048  public:
4049  ReleaseLauncher(LogicalRegion logical_region,
4050  LogicalRegion parent_region,
4051  PhysicalRegion physical_region = PhysicalRegion(),
4052  Predicate pred = Predicate::TRUE_PRED,
4053  MapperID id = 0, MappingTagID tag = 0,
4054  UntypedBuffer map_arg = UntypedBuffer(),
4055  const char *provenance = "");
4056  public:
4057  inline void add_field(FieldID f);
4058  inline void add_grant(Grant g);
4059  inline void add_wait_barrier(PhaseBarrier pb);
4060  inline void add_arrival_barrier(PhaseBarrier pb);
4061  inline void add_wait_handshake(LegionHandshake handshake);
4062  inline void add_arrival_handshake(LegionHandshake handshake);
4063  public:
4064  LogicalRegion logical_region;
4065  LogicalRegion parent_region;
4066  std::set<FieldID> fields;
4067  public:
4068  // This field is now optional (but required with control replication)
4069  PhysicalRegion physical_region;
4070  public:
4071  std::vector<Grant> grants;
4072  std::vector<PhaseBarrier> wait_barriers;
4073  std::vector<PhaseBarrier> arrive_barriers;
4074  Predicate predicate;
4075  MapperID map_id;
4076  MappingTagID tag;
4077  UntypedBuffer map_arg;
4078  public:
4079  // Provenance string for the runtime and tools to use
4080  std::string provenance;
4081  public:
4082  // Inform the runtime about any static dependences
4083  // These will be ignored outside of static traces
4084  const std::vector<StaticDependence> *static_dependences;
4085  public:
4086  bool silence_warnings;
4087  };
4088 
4089  //==========================================================================
4090  // Must Parallelism Classes
4091  //==========================================================================
4092 
4107  public:
4108  MustEpochLauncher(MapperID id = 0, MappingTagID tag = 0);
4109  public:
4110  inline void add_single_task(const DomainPoint &point,
4111  const TaskLauncher &launcher);
4112  inline void add_index_task(const IndexTaskLauncher &launcher);
4113  public:
4114  MapperID map_id;
4115  MappingTagID mapping_tag;
4116  std::vector<TaskLauncher> single_tasks;
4117  std::vector<IndexTaskLauncher> index_tasks;
4118  public:
4119  Domain launch_domain;
4120  IndexSpace launch_space;
4121  // Will only be used in control replication context. If left
4122  // unset the runtime will use launch_space/launch_domain
4123  IndexSpace sharding_space;
4124  public:
4125  // Provenance string for the runtime and tools to use
4126  std::string provenance;
4127  public:
4128  bool silence_warnings;
4129  };
4130 
4131  //==========================================================================
4132  // Interoperability Classes
4133  //==========================================================================
4134 
4145  class LegionHandshake : public Unserializable<LegionHandshake> {
4146  public:
4147  LegionHandshake(void);
4148  LegionHandshake(const LegionHandshake &rhs);
4149  ~LegionHandshake(void);
4150  protected:
4151  Internal::LegionHandshakeImpl *impl;
4152  protected:
4153  // Only the runtime should be able to make these
4154  FRIEND_ALL_RUNTIME_CLASSES
4155  explicit LegionHandshake(Internal::LegionHandshakeImpl *impl);
4156  public:
4157  bool operator==(const LegionHandshake &h) const
4158  { return impl == h.impl; }
4159  bool operator<(const LegionHandshake &h) const
4160  { return impl < h.impl; }
4161  LegionHandshake& operator=(const LegionHandshake &rhs);
4162  public:
4167  void ext_handoff_to_legion(void) const;
4173  void ext_wait_on_legion(void) const;
4174  public:
4179  void legion_handoff_to_ext(void) const;
4184  void legion_wait_on_ext(void) const;
4185  public:
4186  /*
4187  * For asynchronous Legion execution, you can use these
4188  * methods to get a phase barrier associated with the
4189  * handshake object instead of blocking on the legion side
4190  */
4202  void advance_legion_handshake(void) const;
4203  };
4204 
4211  public:
4212  MPILegionHandshake(void);
4214  ~MPILegionHandshake(void);
4215  protected:
4216  // Only the runtime should be able to make these
4217  FRIEND_ALL_RUNTIME_CLASSES
4218  explicit MPILegionHandshake(Internal::LegionHandshakeImpl *impl);
4219  public:
4220  bool operator==(const MPILegionHandshake &h) const
4221  { return impl == h.impl; }
4222  bool operator<(const MPILegionHandshake &h) const
4223  { return impl < h.impl; }
4224  MPILegionHandshake& operator=(const MPILegionHandshake &rhs);
4225  public:
4230  inline void mpi_handoff_to_legion(void) const { ext_handoff_to_legion(); }
4235  inline void mpi_wait_on_legion(void) const { ext_wait_on_legion(); }
4236  public:
4241  inline void legion_handoff_to_mpi(void) const { legion_handoff_to_ext(); }
4246  inline void legion_wait_on_mpi(void) const { legion_wait_on_ext(); }
4247  };
4248 
4249  //==========================================================================
4250  // Operation Classes
4251  //==========================================================================
4252 
4259  class Mappable {
4260  public:
4261  Mappable(void);
4262  public:
4263  // Return a globally unique ID for this operation
4264  virtual UniqueID get_unique_id(void) const = 0;
4265  // Return the number of operations that came before
4266  // this operation in the same context (close operations
4267  // return number of previous close operations)
4268  virtual uint64_t get_context_index(void) const = 0;
4269  // Return the depth of this operation in the task tree
4270  virtual int get_depth(void) const = 0;
4271  // Get the parent task associated with this mappable
4272  virtual const Task* get_parent_task(void) const = 0;
4273  // Get the provenance string for this mappable
4274  // By default we return the human readable component but
4275  // you can also get the machine component as well
4276  virtual const std::string& get_provenance_string(
4277  bool human = true) const = 0;
4278  public:
4279  virtual MappableType get_mappable_type(void) const = 0;
4280  virtual const Task* as_task(void) const { return NULL; }
4281  virtual const Copy* as_copy(void) const { return NULL; }
4282  virtual const InlineMapping* as_inline(void) const { return NULL; }
4283  virtual const Acquire* as_acquire(void) const { return NULL; }
4284  virtual const Release* as_release(void) const { return NULL; }
4285  virtual const Close* as_close(void) const { return NULL; }
4286  virtual const Fill* as_fill(void) const { return NULL; }
4287  virtual const Partition* as_partition(void) const { return NULL; }
4288  virtual const MustEpoch* as_must_epoch(void) const { return NULL; }
4289  public:
4290  MapperID map_id;
4291  MappingTagID tag;
4292  public:
4293  // The 'parent_task' member is here for backwards compatibility
4294  // It's better to use the 'get_parent_task' method
4295  // as this may be NULL until that method is called
4296  mutable const Task* parent_task;
4297  public:
4298  // Mapper annotated data
4299  void* mapper_data;
4300  size_t mapper_data_size;
4301  public:
4302  // These are here for backwards compatibility from a time when
4303  // the MappableType enum was inside of this class
4304 #ifndef __GNUC__
4305  // GCC doesn't like this line even though it's just creating a
4306  // type alias, who knows what their problem is
4307  typedef Legion::MappableType MappableType;
4308 #endif
4309  static const MappableType TASK_MAPPABLE = ::LEGION_TASK_MAPPABLE;
4310  static const MappableType COPY_MAPPABLE = ::LEGION_COPY_MAPPABLE;
4311  static const MappableType INLINE_MAPPABLE = ::LEGION_INLINE_MAPPABLE;
4312  static const MappableType ACQUIRE_MAPPABLE = ::LEGION_ACQUIRE_MAPPABLE;
4313  static const MappableType RELEASE_MAPPABLE = ::LEGION_RELEASE_MAPPABLE;
4314  static const MappableType CLOSE_MAPPABLE = ::LEGION_CLOSE_MAPPABLE;
4315  static const MappableType FILL_MAPPABLE = ::LEGION_FILL_MAPPABLE;
4316  static const MappableType PARTITION_MAPPABLE =
4317  ::LEGION_PARTITION_MAPPABLE;
4318  static const MappableType MUST_EPOCH_MAPPABLE =
4319  ::LEGION_MUST_EPOCH_MAPPABLE;
4320  };
4321 
4330  class Task : public Mappable {
4331  public:
4332  Task(void);
4333  public:
4334  // Check whether this task has a parent task.
4335  virtual bool has_parent_task(void) const = 0;
4336  // Return the name of the task.
4337  virtual const char* get_task_name(void) const = 0;
4338  // Returns the current slice of the index domain that this
4339  // task is operating over. This method will only return a
4340  // valid domain if this is part of an index space task.
4341  virtual Domain get_slice_domain(void) const = 0;
4342  //------------------------------------------------------------------------
4343  // Control Replication methods
4344  // In general SPMD-style programming in Legion is wrong. If you find
4345  // yourself writing SPMD-style code for large fractions of your program
4346  // then you're probably doing something wrong. There are a few exceptions:
4347  // 1. index attach/detach operations are collective and may need
4348  // to do per-shard work
4349  // 2. I/O in general often needs to do per-shard work
4350  // 3. interaction with collective frameworks like MPI and NCCL
4351  // 4. others?
4352  // For these reasons we allow users to get access to sharding information
4353  // Please, please, please be careful with how you use it
4354  //------------------------------------------------------------------------
4355  virtual ShardID get_shard_id(void) const = 0;
4356  virtual size_t get_total_shards(void) const = 0;
4357  virtual DomainPoint get_shard_point(void) const = 0;
4358  virtual Domain get_shard_domain(void) const = 0;
4359  public:
4360  virtual MappableType get_mappable_type(void) const
4361  { return LEGION_TASK_MAPPABLE; }
4362  virtual const Task* as_task(void) const { return this; }
4363  public:
4364  // Task argument information
4365  TaskID task_id;
4366  std::vector<IndexSpaceRequirement> indexes;
4367  std::vector<RegionRequirement> regions;
4368  std::vector<OutputRequirement> output_regions;
4369  std::vector<Future> futures;
4370  std::vector<Grant> grants;
4371  std::vector<PhaseBarrier> wait_barriers;
4372  std::vector<PhaseBarrier> arrive_barriers;
4373  void* args;
4374  size_t arglen;
4375  public:
4376  // Index task argument information
4377  bool is_index_space;
4378  bool concurrent_task;
4379  bool must_epoch_task;
4380  Domain index_domain;
4381  DomainPoint index_point;
4382  IndexSpace sharding_space;
4383  void* local_args;
4384  size_t local_arglen;
4385  public:
4386  // Meta data information from the runtime
4387  Processor orig_proc;
4388  Processor current_proc;
4389  Processor target_proc;
4390  unsigned steal_count;
4391  bool stealable;
4392  bool speculated;
4393  bool local_function;
4394  };
4395 
4401  class Copy : public Mappable {
4402  public:
4403  Copy(void);
4404  public:
4405  virtual MappableType get_mappable_type(void) const
4406  { return LEGION_COPY_MAPPABLE; }
4407  virtual const Copy* as_copy(void) const { return this; }
4408  public:
4409  // Copy Launcher arguments
4410  std::vector<RegionRequirement> src_requirements;
4411  std::vector<RegionRequirement> dst_requirements;
4412  std::vector<RegionRequirement> src_indirect_requirements;
4413  std::vector<RegionRequirement> dst_indirect_requirements;
4414  std::vector<Grant> grants;
4415  std::vector<PhaseBarrier> wait_barriers;
4416  std::vector<PhaseBarrier> arrive_barriers;
4417  public:
4418  // Index copy argument information
4419  bool is_index_space;
4420  Domain index_domain;
4421  DomainPoint index_point;
4422  IndexSpace sharding_space;
4423  };
4424 
4430  class InlineMapping : public Mappable {
4431  public:
4432  InlineMapping(void);
4433  public:
4434  virtual MappableType get_mappable_type(void) const
4435  { return LEGION_INLINE_MAPPABLE; }
4436  virtual const InlineMapping* as_inline(void) const { return this; }
4437  virtual ShardID get_parent_shard(void) const { return 0; }
4438  public:
4439  // Inline Launcher arguments
4440  RegionRequirement requirement;
4441  std::vector<Grant> grants;
4442  std::vector<PhaseBarrier> wait_barriers;
4443  std::vector<PhaseBarrier> arrive_barriers;
4444  LayoutConstraintID layout_constraint_id;
4445  };
4446 
4452  class Acquire : public Mappable {
4453  public:
4454  Acquire(void);
4455  public:
4456  virtual MappableType get_mappable_type(void) const
4457  { return LEGION_ACQUIRE_MAPPABLE; }
4458  virtual const Acquire* as_acquire(void) const { return this; }
4459  public:
4460  // Acquire Launcher arguments
4461  LogicalRegion logical_region;
4462  LogicalRegion parent_region;
4463  std::set<FieldID> fields;
4464  std::vector<Grant> grants;
4465  std::vector<PhaseBarrier> wait_barriers;
4466  std::vector<PhaseBarrier> arrive_barriers;
4467  };
4468 
4474  class Release : public Mappable {
4475  public:
4476  Release(void);
4477  public:
4478  virtual MappableType get_mappable_type(void) const
4479  { return LEGION_RELEASE_MAPPABLE; }
4480  virtual const Release* as_release(void) const { return this; }
4481  public:
4482  // Release Launcher arguments
4483  LogicalRegion logical_region;
4484  LogicalRegion parent_region;
4485  std::set<FieldID> fields;
4486  std::vector<Grant> grants;
4487  std::vector<PhaseBarrier> wait_barriers;
4488  std::vector<PhaseBarrier> arrive_barriers;
4489  };
4490 
4500  class Close : public Mappable {
4501  public:
4502  Close(void);
4503  public:
4504  virtual MappableType get_mappable_type(void) const
4505  { return LEGION_CLOSE_MAPPABLE; }
4506  virtual const Close* as_close(void) const { return this; }
4507  public:
4508  // Synthesized region requirement
4509  RegionRequirement requirement;
4510  };
4511 
4518  class Fill : public Mappable {
4519  public:
4520  Fill(void);
4521  public:
4522  virtual MappableType get_mappable_type(void) const
4523  { return LEGION_FILL_MAPPABLE; }
4524  virtual const Fill* as_fill(void) const { return this; }
4525  public:
4526  // Synthesized region requirement
4527  RegionRequirement requirement;
4528  std::vector<Grant> grants;
4529  std::vector<PhaseBarrier> wait_barriers;
4530  std::vector<PhaseBarrier> arrive_barriers;
4531  public:
4532  // Index fill argument information
4533  bool is_index_space;
4534  Domain index_domain;
4535  DomainPoint index_point;
4536  IndexSpace sharding_space;
4537  };
4538 
4546  class Partition : public Mappable {
4547  public:
4548  Partition(void);
4549  public:
4550  virtual MappableType get_mappable_type(void) const
4551  { return LEGION_PARTITION_MAPPABLE; }
4552  virtual const Partition* as_partition(void) const { return this; }
4553  public:
4554  enum PartitionKind {
4555  BY_FIELD, // create partition by field
4556  BY_IMAGE, // create partition by image
4557  BY_IMAGE_RANGE, // create partition by image range
4558  BY_PREIMAGE, // create partition by preimage
4559  BY_PREIMAGE_RANGE, // create partition by preimage range
4560  BY_ASSOCIATION, // create partition by association
4561  };
4562  virtual PartitionKind get_partition_kind(void) const = 0;
4563  public:
4564  // Synthesized region requirement
4565  RegionRequirement requirement;
4566  public:
4567  // Index partition argument information
4568  bool is_index_space;
4569  Domain index_domain;
4570  DomainPoint index_point;
4571  };
4572 
4579  class MustEpoch : public Mappable {
4580  public:
4581  MustEpoch(void);
4582  public:
4583  virtual MappableType get_mappable_type(void) const
4584  { return LEGION_MUST_EPOCH_MAPPABLE; }
4585  virtual const MustEpoch* as_must_epoch(void) const { return this; }
4586  public:
4587  std::vector<const Task*> individual_tasks;
4588  std::vector<const Task*> index_space_tasks;
4589  public:
4590  // Index space of points for the must epoch operation
4591  Domain launch_domain;
4592  IndexSpace sharding_space;
4593  };
4594 
4595  //==========================================================================
4596  // Runtime Classes
4597  //==========================================================================
4598 
4604  struct InputArgs {
4605  public:
4606  char **argv;
4607  int argc;
4608  };
4609 
4615  Machine machine;
4616  Runtime *runtime;
4617  std::set<Processor> local_procs;
4618  UntypedBuffer buffer;
4619  };
4620 
4634  public:
4635  TaskConfigOptions(bool leaf = false,
4636  bool inner = false,
4637  bool idempotent = false);
4638  public:
4639  bool leaf;
4640  bool inner;
4641  bool idempotent;
4642  };
4643 
4662  public:
4663  ProjectionFunctor(void);
4665  virtual ~ProjectionFunctor(void);
4666  public:
4683  virtual LogicalRegion project(const Mappable *mappable, unsigned index,
4684  LogicalRegion upper_bound,
4685  const DomainPoint &point);
4694  virtual LogicalRegion project(const Mappable *mappable, unsigned index,
4695  LogicalPartition upper_bound,
4696  const DomainPoint &point);
4697 
4708  virtual LogicalRegion project(LogicalRegion upper_bound,
4709  const DomainPoint &point,
4710  const Domain &launch_domain);
4711 
4723  const DomainPoint &point,
4724  const Domain &launch_domain);
4725 
4738  virtual LogicalRegion project(LogicalRegion upper_bound,
4739  const DomainPoint &point,
4740  const Domain &launch_domain,
4741  const void *args, size_t size);
4742 
4756  const DomainPoint &point,
4757  const Domain &launch_domain,
4758  const void *args, size_t size);
4759 
4771  LEGION_DEPRECATED("The interface for projection functors has been "
4772  "updated. Please use the new 'project' methods.")
4773  virtual LogicalRegion project(Context ctx, Task *task,
4774  unsigned index,
4775  LogicalRegion upper_bound,
4776  const DomainPoint &point);
4788  LEGION_DEPRECATED("The interface for projection functors has been "
4789  "updated. Please use the new 'project' methods.")
4790  virtual LogicalRegion project(Context ctx, Task *task,
4791  unsigned index,
4792  LogicalPartition upper_bound,
4793  const DomainPoint &point);
4795 
4803  virtual void invert(LogicalRegion region, LogicalRegion upper_bound,
4804  const Domain &launch_domain,
4805  std::vector<DomainPoint> &ordered_points);
4806  virtual void invert(LogicalRegion region, LogicalPartition upper_bound,
4807  const Domain &launch_domain,
4808  std::vector<DomainPoint> &ordered_points);
4810 
4812 
4832  virtual bool is_complete(LogicalRegion upper_bound,
4833  const Domain &launch_domain);
4834  virtual bool is_complete(LogicalPartition upper_bound,
4835  const Domain &launch_domain);
4836  virtual bool is_complete(Mappable *mappable, unsigned index,
4837  LogicalRegion upper_bound, const Domain &launch_domain);
4838  virtual bool is_complete(Mappable *mappable, unsigned index,
4839  LogicalPartition upper_bound, const Domain &launch_domain);
4841 
4848  virtual bool is_exclusive(void) const { return false; }
4849 
4850  /*
4851  * Indicate whether this is a functional projection
4852  * functor or whether it depends on the operation being
4853  * launched. This will determine which project method
4854  * is invoked by the runtime.
4855  */
4856  virtual bool is_functional(void) const { return false; }
4857 
4863  virtual bool is_invertible(void) const { return false; }
4864 
4876  virtual unsigned get_depth(void) const = 0;
4877  private:
4878  friend class Internal::Runtime;
4879  // For pre-registered projection functors the runtime will
4880  // use this to initialize the runtime pointer
4881  inline void set_runtime(Runtime *rt) { runtime = rt; }
4882  protected:
4883  Runtime *runtime;
4884  };
4885 
4900  public:
4901  ShardingFunctor(void);
4902  virtual ~ShardingFunctor(void);
4903  public:
4904  // Indicate whether this functor wants to use the ShardID or
4905  // DomainPoint versions of these methods
4906  virtual bool use_points(void) const { return false; }
4907  public:
4908  // The ShardID version of this method
4909  virtual ShardID shard(const DomainPoint &index_point,
4910  const Domain &index_domain,
4911  const size_t total_shards);
4912  // The DomainPoint version of this method
4913  virtual DomainPoint shard_points(const DomainPoint &index_point,
4914  const Domain &index_domain,
4915  const std::vector<DomainPoint> &shard_points,
4916  const Domain &shard_domain);
4917  public:
4918  virtual bool is_invertible(void) const { return false; }
4919  // The ShardID version of this method
4920  virtual void invert(ShardID shard,
4921  const Domain &sharding_domain,
4922  const Domain &index_domain,
4923  const size_t total_shards,
4924  std::vector<DomainPoint> &points);
4925  // The DomainPoint version of this method
4926  virtual void invert_points(const DomainPoint &shard_point,
4927  const std::vector<DomainPoint> &shard_points,
4928  const Domain &shard_domain,
4929  const Domain &index_domain,
4930  const Domain &sharding_domain,
4931  std::vector<DomainPoint> &index_points);
4932  };
4933 
4950  public:
4951  virtual ~FutureFunctor(void) { }
4952  public:
4953  virtual const void* callback_get_future(size_t &size, bool &owned,
4954  const Realm::ExternalInstanceResource *&resource,
4955  void (*&freefunc)(const Realm::ExternalInstanceResource&),
4956  const void *&metadata, size_t &metasize) = 0;
4957  virtual void callback_release_future(void) = 0;
4958  };
4959 
4969  public:
4970  virtual ~PointTransformFunctor(void) { }
4971  public:
4972  virtual bool is_invertible(void) const { return false; }
4973  // Transform a point from the domain into a point in the range
4974  virtual DomainPoint transform_point(const DomainPoint &point,
4975  const Domain &domain,
4976  const Domain &range) = 0;
4977  // Invert a point from range and convert it into a point in the domain
4978  // This is only called if is_invertible returns true
4979  virtual DomainPoint invert_point(const DomainPoint &point,
4980  const Domain &domain,
4981  const Domain &range)
4982  { return DomainPoint(); }
4983  };
4984 
5008  class Runtime {
5009  protected:
5010  // The Runtime bootstraps itself and should
5011  // never need to be explicitly created.
5012  friend class Internal::Runtime;
5013  friend class Future;
5014  Runtime(Internal::Runtime *rt);
5015  public:
5016  //------------------------------------------------------------------------
5017  // Index Space Operations
5018  //------------------------------------------------------------------------
5020 
5031  IndexSpace create_index_space(Context ctx, const Domain &bounds,
5032  TypeTag type_tag = 0,
5033  const char *provenance = NULL);
5034  // Template version
5035  template<int DIM, typename COORD_T>
5036  IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5037  const Rect<DIM,COORD_T> &bounds,
5038  const char *provenance = NULL);
5039  template<int DIM, typename COORD_T>
5040  IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5041  const DomainT<DIM,COORD_T> &bounds,
5042  const char *provenance = NULL);
5045 
5058  IndexSpace create_index_space(Context ctx, size_t dimensions,
5059  const Future &f, TypeTag type_tag = 0,
5060  const char *provenance = NULL);
5061  template<int DIM, typename COORD_T>
5062  IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx, const Future &f,
5063  const char *provenance = NULL);
5066 
5075  const std::vector<DomainPoint> &points,
5076  const char *provenance = NULL);
5077  // Template version
5078  template<int DIM, typename COORD_T>
5079  IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5080  const std::vector<Point<DIM,COORD_T> > &points,
5081  const char *provenance = NULL);
5084 
5093  const std::vector<Domain> &rects,
5094  const char *provenance = NULL);
5095  // Template version
5096  template<int DIM, typename COORD_T>
5097  IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5098  const std::vector<Rect<DIM,COORD_T> > &rects,
5099  const char *provenance = NULL);
5102 
5112  const std::vector<IndexSpace> &spaces,
5113  const char *provenance = NULL);
5114  // Template version
5115  template<int DIM, typename COORD_T>
5116  IndexSpaceT<DIM,COORD_T> union_index_spaces(Context ctx,
5117  const std::vector<IndexSpaceT<DIM,COORD_T> > &spaces,
5118  const char *provenance = NULL);
5121 
5131  const std::vector<IndexSpace> &spaces,
5132  const char *provenance = NULL);
5133  // Template version
5134  template<int DIM, typename COORD_T>
5135  IndexSpaceT<DIM,COORD_T> intersect_index_spaces(Context ctx,
5136  const std::vector<IndexSpaceT<DIM,COORD_T> > &spaces,
5137  const char *provenance = NULL);
5140 
5147  IndexSpace left, IndexSpace right,
5148  const char *provenance = NULL);
5149  // Template version
5150  template<int DIM, typename COORD_T>
5151  IndexSpaceT<DIM,COORD_T> subtract_index_spaces(Context ctx,
5153  const char *provenance = NULL);
5155 
5162  LEGION_DEPRECATED("Use the new index space creation routines with a "
5163  "single domain or rectangle.")
5164  IndexSpace create_index_space(Context ctx, size_t max_num_elmts);
5172  LEGION_DEPRECATED("Use the new index space creation routines with a "
5173  "single domain or rectangle.")
5174  IndexSpace create_index_space(Context ctx,
5175  const std::set<Domain> &domains);
5186  void create_shared_ownership(Context ctx, IndexSpace handle);
5197  void destroy_index_space(Context ctx, IndexSpace handle,
5198  const bool unordered = false,
5199  const bool recurse = true,
5200  const char *provenance = NULL);
5201  public:
5212  void create_shared_ownership(Context ctx, IndexPartition handle);
5223  void destroy_index_partition(Context ctx, IndexPartition handle,
5224  const bool unordered = false,
5225  const bool recurse = true,
5226  const char *provenance = NULL);
5227  public:
5228  //------------------------------------------------------------------------
5229  // Dependent Partitioning Operations
5230  //------------------------------------------------------------------------
5232 
5252  IndexPartition create_equal_partition(Context ctx, IndexSpace parent,
5253  IndexSpace color_space,
5254  size_t granularity = 1,
5255  Color color =
5256  LEGION_AUTO_GENERATE_ID,
5257  const char *provenance = NULL);
5258  template<int DIM, typename COORD_T,
5259  int COLOR_DIM, typename COLOR_COORD_T>
5260  IndexPartitionT<DIM,COORD_T> create_equal_partition(Context ctx,
5261  IndexSpaceT<DIM,COORD_T> parent,
5262  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5263  size_t granularity = 1,
5264  Color color = LEGION_AUTO_GENERATE_ID,
5265  const char *provenance = NULL);
5268 
5285  IndexPartition create_partition_by_weights(Context ctx, IndexSpace parent,
5286  const std::map<DomainPoint,int> &weights,
5287  IndexSpace color_space,
5288  size_t granularity = 1,
5289  Color color = LEGION_AUTO_GENERATE_ID,
5290  const char *provenance = NULL);
5291  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5292  IndexPartitionT<DIM,COORD_T> create_partition_by_weights(Context ctx,
5293  IndexSpaceT<DIM,COORD_T> parent,
5294  const std::map<Point<COLOR_DIM,COLOR_COORD_T>,int> &weights,
5295  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5296  size_t granularity = 1,
5297  Color color = LEGION_AUTO_GENERATE_ID,
5298  const char *provenance = NULL);
5299  // 64-bit versions
5300  IndexPartition create_partition_by_weights(Context ctx, IndexSpace parent,
5301  const std::map<DomainPoint,size_t> &weights,
5302  IndexSpace color_space,
5303  size_t granularity = 1,
5304  Color color = LEGION_AUTO_GENERATE_ID,
5305  const char *provenance = NULL);
5306  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5307  IndexPartitionT<DIM,COORD_T> create_partition_by_weights(Context ctx,
5308  IndexSpaceT<DIM,COORD_T> parent,
5309  const std::map<Point<COLOR_DIM,COLOR_COORD_T>,size_t> &weights,
5310  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5311  size_t granularity = 1, Color color = LEGION_AUTO_GENERATE_ID,
5312  const char *provenance = NULL);
5313  // Alternate versions of the above method that take a future map where
5314  // the values in the future map will be interpretted as integer weights
5315  // You can use this method with both 32 and 64 bit weights
5316  IndexPartition create_partition_by_weights(Context ctx, IndexSpace parent,
5317  const FutureMap &weights,
5318  IndexSpace color_space,
5319  size_t granularity = 1,
5320  Color color =
5321  LEGION_AUTO_GENERATE_ID,
5322  const char *provenance = NULL);
5323  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5324  IndexPartitionT<DIM,COORD_T> create_partition_by_weights(Context ctx,
5325  IndexSpaceT<DIM,COORD_T> parent,
5326  const FutureMap &weights,
5327  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5328  size_t granularity = 1,
5329  Color color = LEGION_AUTO_GENERATE_ID,
5330  const char *provenance = NULL);
5333 
5357  IndexPartition create_partition_by_union(Context ctx,
5358  IndexSpace parent,
5359  IndexPartition handle1,
5360  IndexPartition handle2,
5361  IndexSpace color_space,
5362  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5363  Color color = LEGION_AUTO_GENERATE_ID,
5364  const char *provenance = NULL);
5365  template<int DIM, typename COORD_T,
5366  int COLOR_DIM, typename COLOR_COORD_T>
5367  IndexPartitionT<DIM,COORD_T> create_partition_by_union(Context ctx,
5368  IndexSpaceT<DIM,COORD_T> parent,
5369  IndexPartitionT<DIM,COORD_T> handle1,
5370  IndexPartitionT<DIM,COORD_T> handle2,
5371  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5372  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5373  Color color = LEGION_AUTO_GENERATE_ID,
5374  const char *provenance = NULL);
5377 
5402  IndexPartition create_partition_by_intersection(Context ctx,
5403  IndexSpace parent,
5404  IndexPartition handle1,
5405  IndexPartition handle2,
5406  IndexSpace color_space,
5407  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5408  Color color = LEGION_AUTO_GENERATE_ID,
5409  const char *provenance = NULL);
5410  template<int DIM, typename COORD_T,
5411  int COLOR_DIM, typename COLOR_COORD_T>
5412  IndexPartitionT<DIM,COORD_T> create_partition_by_intersection(
5413  Context ctx,
5414  IndexSpaceT<DIM,COORD_T> parent,
5415  IndexPartitionT<DIM,COORD_T> handle1,
5416  IndexPartitionT<DIM,COORD_T> handle2,
5417  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5418  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5419  Color color = LEGION_AUTO_GENERATE_ID,
5420  const char *provenance = NULL);
5423 
5443  IndexPartition create_partition_by_intersection(Context ctx,
5444  IndexSpace parent,
5445  IndexPartition partition,
5446  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5447  Color color = LEGION_AUTO_GENERATE_ID,
5448  bool dominates = false,
5449  const char *provenance = NULL);
5450  template<int DIM, typename COORD_T>
5451  IndexPartitionT<DIM,COORD_T> create_partition_by_intersection(Context ctx,
5452  IndexSpaceT<DIM,COORD_T> parent,
5453  IndexPartitionT<DIM,COORD_T> partition,
5454  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5455  Color color = LEGION_AUTO_GENERATE_ID,
5456  bool dominates = false,
5457  const char *provenance = NULL);
5460 
5485  IndexPartition create_partition_by_difference(Context ctx,
5486  IndexSpace parent,
5487  IndexPartition handle1,
5488  IndexPartition handle2,
5489  IndexSpace color_space,
5490  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5491  Color color = LEGION_AUTO_GENERATE_ID,
5492  const char *provenance = NULL);
5493  template<int DIM, typename COORD_T,
5494  int COLOR_DIM, typename COLOR_COORD_T>
5495  IndexPartitionT<DIM,COORD_T> create_partition_by_difference(Context ctx,
5496  IndexSpaceT<DIM,COORD_T> parent,
5497  IndexPartitionT<DIM,COORD_T> handle1,
5498  IndexPartitionT<DIM,COORD_T> handle2,
5499  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5500  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5501  Color color = LEGION_AUTO_GENERATE_ID,
5502  const char *provenance = NULL);
5505 
5530  Color create_cross_product_partitions(Context ctx,
5531  IndexPartition handle1,
5532  IndexPartition handle2,
5533  std::map<IndexSpace,IndexPartition> &handles,
5534  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5535  Color color = LEGION_AUTO_GENERATE_ID,
5536  const char *provenance = NULL);
5537  template<int DIM, typename COORD_T,
5538  int COLOR_DIM, typename COLOR_COORD_T>
5539  Color create_cross_product_partitions(Context ctx,
5540  IndexPartitionT<DIM,COORD_T> handle1,
5541  IndexPartitionT<DIM,COORD_T> handle2,
5542  typename std::map<
5543  IndexSpaceT<DIM,COORD_T>,
5544  IndexPartitionT<DIM,COORD_T> > &handles,
5545  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5546  Color color = LEGION_AUTO_GENERATE_ID,
5547  const char *provenance = NULL);
5550 
5574  void create_association(Context ctx,
5575  LogicalRegion domain,
5576  LogicalRegion domain_parent,
5577  FieldID domain_fid,
5578  IndexSpace range,
5579  MapperID id = 0,
5580  MappingTagID tag = 0,
5581  UntypedBuffer map_arg = UntypedBuffer(),
5582  const char *provenance = NULL);
5583  void create_bidirectional_association(Context ctx,
5584  LogicalRegion domain,
5585  LogicalRegion domain_parent,
5586  FieldID domain_fid,
5587  LogicalRegion range,
5588  LogicalRegion range_parent,
5589  FieldID range_fid,
5590  MapperID id = 0,
5591  MappingTagID tag = 0,
5592  UntypedBuffer map_arg =
5593  UntypedBuffer(),
5594  const char *provenance = NULL);
5595  // Template versions
5596  template<int DIM1, typename COORD_T1, int DIM2, typename COORD_T2>
5597  void create_association(Context ctx,
5598  LogicalRegionT<DIM1,COORD_T1> domain,
5599  LogicalRegionT<DIM1,COORD_T1> domain_parent,
5600  FieldID domain_fid, // type: Point<DIM2,COORD_T2>
5601  IndexSpaceT<DIM2,COORD_T2> range,
5602  MapperID id = 0,
5603  MappingTagID tag = 0,
5604  UntypedBuffer map_arg = UntypedBuffer(),
5605  const char *provenance = NULL);
5606  template<int DIM1, typename COORD_T1, int DIM2, typename COORD_T2>
5607  void create_bidirectional_association(Context ctx,
5608  LogicalRegionT<DIM1,COORD_T1> domain,
5609  LogicalRegionT<DIM1,COORD_T1> domain_parent,
5610  FieldID domain_fid, // type: Point<DIM2,COORD_T2>
5611  LogicalRegionT<DIM2,COORD_T2> range,
5612  LogicalRegionT<DIM2,COORD_T2> range_parent,
5613  FieldID range_fid, // type: Point<DIM1,COORD_T1>
5614  MapperID id = 0,
5615  MappingTagID tag = 0,
5616  UntypedBuffer map_arg = UntypedBuffer(),
5617  const char *provenance = NULL);
5620 
5645  IndexPartition create_partition_by_restriction(Context ctx,
5646  IndexSpace parent,
5647  IndexSpace color_space,
5648  DomainTransform transform,
5649  Domain extent,
5650  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5651  Color color = LEGION_AUTO_GENERATE_ID,
5652  const char *provenance = NULL);
5653  // Template version
5654  template<int DIM, int COLOR_DIM, typename COORD_T>
5655  IndexPartitionT<DIM,COORD_T> create_partition_by_restriction(Context ctx,
5656  IndexSpaceT<DIM,COORD_T> parent,
5657  IndexSpaceT<COLOR_DIM,COORD_T> color_space,
5658  Transform<DIM,COLOR_DIM,COORD_T> transform,
5659  Rect<DIM,COORD_T> extent,
5660  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5661  Color color = LEGION_AUTO_GENERATE_ID,
5662  const char *provenance = NULL);
5665 
5680  IndexPartition create_partition_by_blockify(Context ctx,
5681  IndexSpace parent,
5682  DomainPoint blocking_factor,
5683  Color color = LEGION_AUTO_GENERATE_ID,
5684  const char *provenance = NULL);
5685  // Template version
5686  template<int DIM, typename COORD_T>
5687  IndexPartitionT<DIM,COORD_T> create_partition_by_blockify(Context ctx,
5688  IndexSpaceT<DIM,COORD_T> parent,
5689  Point<DIM,COORD_T> blocking_factor,
5690  Color color = LEGION_AUTO_GENERATE_ID,
5691  const char *provenance = NULL);
5704  IndexPartition create_partition_by_blockify(Context ctx,
5705  IndexSpace parent,
5706  DomainPoint blockify_factor,
5707  DomainPoint origin,
5708  Color color = LEGION_AUTO_GENERATE_ID,
5709  const char *provenance = NULL);
5710  // Template version
5711  template<int DIM, typename COORD_T>
5712  IndexPartitionT<DIM,COORD_T> create_partition_by_blockify(Context ctx,
5713  IndexSpaceT<DIM,COORD_T> parent,
5714  Point<DIM,COORD_T> blocking_factor,
5715  Point<DIM,COORD_T> origin,
5716  Color color = LEGION_AUTO_GENERATE_ID,
5717  const char *provenance = NULL);
5720 
5740  IndexPartition create_partition_by_domain(Context ctx,
5741  IndexSpace parent,
5742  const std::map<DomainPoint,Domain> &domains,
5743  IndexSpace color_space,
5744  bool perform_intersections = true,
5745  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5746  Color color = LEGION_AUTO_GENERATE_ID,
5747  const char *provenance = NULL);
5748  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5749  IndexPartitionT<DIM,COORD_T> create_partition_by_domain(Context ctx,
5750  IndexSpaceT<DIM,COORD_T> parent,
5751  const std::map<
5752  Point<COLOR_DIM,COLOR_COORD_T>,
5753  DomainT<DIM,COORD_T> > &domains,
5754  IndexSpaceT<COLOR_DIM,
5755  COLOR_COORD_T> color_space,
5756  bool perform_intersections = true,
5757  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5758  Color color = LEGION_AUTO_GENERATE_ID,
5759  const char *provenance = NULL);
5777  IndexPartition create_partition_by_domain(Context ctx,
5778  IndexSpace parent,
5779  const FutureMap &domain_future_map,
5780  IndexSpace color_space,
5781  bool perform_intersections = true,
5782  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5783  Color color = LEGION_AUTO_GENERATE_ID,
5784  const char *provenance = NULL);
5785  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5786  IndexPartitionT<DIM,COORD_T> create_partition_by_domain(Context ctx,
5787  IndexSpaceT<DIM,COORD_T> parent,
5788  const FutureMap &domain_future_map,
5789  IndexSpaceT<COLOR_DIM,
5790  COLOR_COORD_T> color_space,
5791  bool perform_intersections = true,
5792  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5793  Color color = LEGION_AUTO_GENERATE_ID,
5794  const char *provenance = NULL);
5797 
5814  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5815  IndexPartitionT<DIM,COORD_T> create_partition_by_rectangles(Context ctx,
5816  IndexSpaceT<DIM,COORD_T> parent,
5817  const std::map<Point<COLOR_DIM,COLOR_COORD_T>,
5818  std::vector<Rect<DIM,COORD_T> > > &rectangles,
5819  IndexSpaceT<COLOR_DIM,
5820  COLOR_COORD_T> color_space,
5821  bool perform_intersections = true,
5822  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5823  Color color = LEGION_AUTO_GENERATE_ID,
5824  const char *provenance = NULL,
5825  bool collective = false);
5828 
5856  IndexPartition create_partition_by_field(Context ctx,
5857  LogicalRegion handle,
5858  LogicalRegion parent,
5859  FieldID fid,
5860  IndexSpace color_space,
5861  Color color =
5862  LEGION_AUTO_GENERATE_ID,
5863  MapperID id = 0,
5864  MappingTagID tag = 0,
5865  PartitionKind part_kind =
5866  LEGION_DISJOINT_KIND,
5867  UntypedBuffer map_arg =
5868  UntypedBuffer(),
5869  const char *provenance = NULL);
5870  template<int DIM, typename COORD_T,
5871  int COLOR_DIM, typename COLOR_COORD_T>
5872  IndexPartitionT<DIM,COORD_T> create_partition_by_field(Context ctx,
5873  LogicalRegionT<DIM,COORD_T> handle,
5874  LogicalRegionT<DIM,COORD_T> parent,
5875  FieldID fid, // type: Point<COLOR_DIM,COLOR_COORD_T>
5876  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5877  Color color = LEGION_AUTO_GENERATE_ID,
5878  MapperID id = 0, MappingTagID tag = 0,
5879  PartitionKind part_kind = LEGION_DISJOINT_KIND,
5880  UntypedBuffer map_arg = UntypedBuffer(),
5881  const char *provenance = NULL);
5884 
5917  IndexPartition create_partition_by_image(Context ctx,
5918  IndexSpace handle,
5919  LogicalPartition projection,
5920  LogicalRegion parent,
5921  FieldID fid,
5922  IndexSpace color_space,
5923  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5924  Color color = LEGION_AUTO_GENERATE_ID,
5925  MapperID id = 0, MappingTagID tag = 0,
5926  UntypedBuffer map_arg = UntypedBuffer(),
5927  const char *provenance = NULL);
5928  template<int DIM1, typename COORD_T1,
5929  int DIM2, typename COORD_T2,
5930  int COLOR_DIM, typename COLOR_COORD_T>
5931  IndexPartitionT<DIM2,COORD_T2> create_partition_by_image(Context ctx,
5932  IndexSpaceT<DIM2,COORD_T2> handle,
5933  LogicalPartitionT<DIM1,COORD_T1> projection,
5934  LogicalRegionT<DIM1,COORD_T1> parent,
5935  FieldID fid, // type: Point<DIM2,COORD_T2>
5936  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5937  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5938  Color color = LEGION_AUTO_GENERATE_ID,
5939  MapperID id = 0, MappingTagID tag = 0,
5940  UntypedBuffer map_arg = UntypedBuffer(),
5941  const char *provenance = NULL);
5942  // Range versions of image
5943  IndexPartition create_partition_by_image_range(Context ctx,
5944  IndexSpace handle,
5945  LogicalPartition projection,
5946  LogicalRegion parent,
5947  FieldID fid,
5948  IndexSpace color_space,
5949  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5950  Color color = LEGION_AUTO_GENERATE_ID,
5951  MapperID id = 0, MappingTagID tag = 0,
5952  UntypedBuffer map_arg = UntypedBuffer(),
5953  const char *provenance = NULL);
5954  template<int DIM1, typename COORD_T1,
5955  int DIM2, typename COORD_T2,
5956  int COLOR_DIM, typename COLOR_COORD_T>
5957  IndexPartitionT<DIM2,COORD_T2> create_partition_by_image_range(
5958  Context ctx,
5959  IndexSpaceT<DIM2,COORD_T2> handle,
5960  LogicalPartitionT<DIM1,COORD_T1> projection,
5961  LogicalRegionT<DIM1,COORD_T1> parent,
5962  FieldID fid, // type: Rect<DIM2,COORD_T2>
5963  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5964  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5965  Color color = LEGION_AUTO_GENERATE_ID,
5966  MapperID id = 0, MappingTagID tag = 0,
5967  UntypedBuffer map_arg = UntypedBuffer(),
5968  const char *provenance = NULL);
5971 
6001  IndexPartition create_partition_by_preimage(Context ctx,
6002  IndexPartition projection,
6003  LogicalRegion handle,
6004  LogicalRegion parent,
6005  FieldID fid,
6006  IndexSpace color_space,
6007  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6008  Color color = LEGION_AUTO_GENERATE_ID,
6009  MapperID id = 0, MappingTagID tag = 0,
6010  UntypedBuffer map_arg = UntypedBuffer(),
6011  const char *provenance = NULL);
6012  template<int DIM1, typename COORD_T1,
6013  int DIM2, typename COORD_T2,
6014  int COLOR_DIM, typename COLOR_COORD_T>
6015  IndexPartitionT<DIM1,COORD_T1> create_partition_by_preimage(Context ctx,
6016  IndexPartitionT<DIM2,COORD_T2> projection,
6017  LogicalRegionT<DIM1,COORD_T1> handle,
6018  LogicalRegionT<DIM1,COORD_T1> parent,
6019  FieldID fid, // type: Point<DIM2,COORD_T2>
6020  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6021  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6022  Color color = LEGION_AUTO_GENERATE_ID,
6023  MapperID id = 0, MappingTagID tag = 0,
6024  UntypedBuffer map_arg = UntypedBuffer(),
6025  const char *provenance = NULL);
6026  // Range versions of preimage
6027  IndexPartition create_partition_by_preimage_range(Context ctx,
6028  IndexPartition projection,
6029  LogicalRegion handle,
6030  LogicalRegion parent,
6031  FieldID fid,
6032  IndexSpace color_space,
6033  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6034  Color color = LEGION_AUTO_GENERATE_ID,
6035  MapperID id = 0, MappingTagID tag = 0,
6036  UntypedBuffer map_arg = UntypedBuffer(),
6037  const char *provenance = NULL);
6038  template<int DIM1, typename COORD_T1,
6039  int DIM2, typename COORD_T2,
6040  int COLOR_DIM, typename COLOR_COORD_T>
6041  IndexPartitionT<DIM1,COORD_T1> create_partition_by_preimage_range(
6042  Context ctx,
6043  IndexPartitionT<DIM2,COORD_T2> projection,
6044  LogicalRegionT<DIM1,COORD_T1> handle,
6045  LogicalRegionT<DIM1,COORD_T1> parent,
6046  FieldID fid, // type: Rect<DIM2,COORD_T2>
6047  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6048  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6049  Color color = LEGION_AUTO_GENERATE_ID,
6050  MapperID id = 0, MappingTagID tag = 0,
6051  UntypedBuffer map_arg = UntypedBuffer(),
6052  const char *provenance = NULL);
6054  public:
6055  //------------------------------------------------------------------------
6056  // Computed Index Spaces and Partitions
6057  //------------------------------------------------------------------------
6059 
6085  IndexPartition create_pending_partition(Context ctx,
6086  IndexSpace parent,
6087  IndexSpace color_space,
6088  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6089  Color color = LEGION_AUTO_GENERATE_ID,
6090  const char *provenance = NULL);
6091  template<int DIM, typename COORD_T,
6092  int COLOR_DIM, typename COLOR_COORD_T>
6093  IndexPartitionT<DIM,COORD_T> create_pending_partition(Context ctx,
6094  IndexSpaceT<DIM,COORD_T> parent,
6095  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6096  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6097  Color color = LEGION_AUTO_GENERATE_ID,
6098  const char *provenance = NULL);
6101 
6117  IndexSpace create_index_space_union(Context ctx, IndexPartition parent,
6118  const DomainPoint &color,
6119  const std::vector<IndexSpace> &handles,
6120  const char *provenance = NULL);
6121  template<int DIM, typename COORD_T,
6122  int COLOR_DIM, typename COLOR_COORD_T>
6123  IndexSpaceT<DIM,COORD_T> create_index_space_union(Context ctx,
6124  IndexPartitionT<DIM,COORD_T> parent,
6125  Point<COLOR_DIM,COLOR_COORD_T> color,
6126  const typename std::vector<
6127  IndexSpaceT<DIM,COORD_T> > &handles,
6128  const char *provenance = NULL);
6131 
6144  IndexSpace create_index_space_union(Context ctx, IndexPartition parent,
6145  const DomainPoint &color,
6146  IndexPartition handle,
6147  const char *provenance = NULL);
6148  template<int DIM, typename COORD_T,
6149  int COLOR_DIM, typename COLOR_COORD_T>
6150  IndexSpaceT<DIM,COORD_T> create_index_space_union(Context ctx,
6151  IndexPartitionT<DIM,COORD_T> parent,
6152  Point<COLOR_DIM,COLOR_COORD_T> color,
6153  IndexPartitionT<DIM,COORD_T> handle,
6154  const char *provenance = NULL);
6157 
6173  IndexSpace create_index_space_intersection(Context ctx,
6174  IndexPartition parent,
6175  const DomainPoint &color,
6176  const std::vector<IndexSpace> &handles,
6177  const char *provenance = NULL);
6178  template<int DIM, typename COORD_T,
6179  int COLOR_DIM, typename COLOR_COORD_T>
6180  IndexSpaceT<DIM,COORD_T> create_index_space_intersection(Context ctx,
6181  IndexPartitionT<DIM,COORD_T> parent,
6182  Point<COLOR_DIM,COLOR_COORD_T> color,
6183  const typename std::vector<
6184  IndexSpaceT<DIM,COORD_T> > &handles,
6185  const char *provenance = NULL);
6188 
6201  IndexSpace create_index_space_intersection(Context ctx,
6202  IndexPartition parent,
6203  const DomainPoint &color,
6204  IndexPartition handle,
6205  const char *provenannce=NULL);
6206  template<int DIM, typename COORD_T,
6207  int COLOR_DIM, typename COLOR_COORD_T>
6208  IndexSpaceT<DIM,COORD_T> create_index_space_intersection(Context ctx,
6209  IndexPartitionT<DIM,COORD_T> parent,
6210  Point<COLOR_DIM,COLOR_COORD_T> color,
6211  IndexPartitionT<DIM,COORD_T> handle,
6212  const char *provenance = NULL);
6215 
6236  IndexSpace create_index_space_difference(Context ctx,
6237  IndexPartition parent,
6238  const DomainPoint &color,
6239  IndexSpace initial,
6240  const std::vector<IndexSpace> &handles,
6241  const char *provenancne = NULL);
6242  template<int DIM, typename COORD_T,
6243  int COLOR_DIM, typename COLOR_COORD_T>
6244  IndexSpaceT<DIM,COORD_T> create_index_space_difference(Context ctx,
6245  IndexPartitionT<DIM,COORD_T> parent,
6246  Point<COLOR_DIM,COLOR_COORD_T> color,
6247  IndexSpaceT<DIM,COORD_T> initial,
6248  const typename std::vector<
6249  IndexSpaceT<DIM,COORD_T> > &handles,
6250  const char *provenance = NULL);
6252  public:
6253  //------------------------------------------------------------------------
6254  // Index Tree Traversal Operations
6255  //------------------------------------------------------------------------
6257 
6265  IndexPartition get_index_partition(Context ctx, IndexSpace parent,
6266  Color color);
6267  IndexPartition get_index_partition(Context ctx, IndexSpace parent,
6268  const DomainPoint &color);
6269  // Context free versions
6270  IndexPartition get_index_partition(IndexSpace parent, Color color);
6271  IndexPartition get_index_partition(IndexSpace parent,
6272  const DomainPoint &color);
6273  // Template version
6274  template<int DIM, typename COORD_T>
6275  IndexPartitionT<DIM,COORD_T> get_index_partition(
6276  IndexSpaceT<DIM,COORD_T> parent, Color color);
6277 
6279 
6281 
6289  bool has_index_partition(Context ctx, IndexSpace parent, Color color);
6290  bool has_index_partition(Context ctx, IndexSpace parent,
6291  const DomainPoint &color);
6292  // Context free
6293  bool has_index_partition(IndexSpace parent, Color color);
6294  bool has_index_partition(IndexSpace parent,
6295  const DomainPoint &color);
6296  // Template version
6297  template<int DIM, typename COORD_T>
6298  bool has_index_partition(IndexSpaceT<DIM,COORD_T> parent, Color color);
6300 
6302 
6310  IndexSpace get_index_subspace(Context ctx, IndexPartition p,
6311  Color color);
6312  IndexSpace get_index_subspace(Context ctx, IndexPartition p,
6313  const DomainPoint &color);
6314  // Context free versions
6315  IndexSpace get_index_subspace(IndexPartition p, Color color);
6316  IndexSpace get_index_subspace(IndexPartition p,
6317  const DomainPoint &color);
6318  // Template version
6319  template<int DIM, typename COORD_T,
6320  int COLOR_DIM, typename COLOR_COORD_T>
6321  IndexSpaceT<DIM,COORD_T> get_index_subspace(
6322  IndexPartitionT<DIM,COORD_T> p,
6323  Point<COLOR_DIM,COLOR_COORD_T> color);
6325 
6327 
6335  bool has_index_subspace(Context ctx, IndexPartition p,
6336  const DomainPoint &color);
6337  // Context free
6338  bool has_index_subspace(IndexPartition p,
6339  const DomainPoint &color);
6340  // Template version
6341  template<int DIM, typename COORD_T,
6342  int COLOR_DIM, typename COLOR_COORD_T>
6343  bool has_index_subspace(IndexPartitionT<DIM,COORD_T> p,
6344  Point<COLOR_DIM,COLOR_COORD_T> color);
6346 
6348 
6358  LEGION_DEPRECATED("Multiple domains are no longer supported.")
6359  bool has_multiple_domains(Context ctx, IndexSpace handle);
6360  // Context free
6361  LEGION_DEPRECATED("Multiple domains are no longer supported.")
6362  bool has_multiple_domains(IndexSpace handle);
6364 
6366 
6373  Domain get_index_space_domain(Context ctx, IndexSpace handle);
6374  // Context free
6375  Domain get_index_space_domain(IndexSpace handle);
6376  // Template version
6377  template<int DIM, typename COORD_T>
6378  DomainT<DIM,COORD_T> get_index_space_domain(
6379  IndexSpaceT<DIM,COORD_T> handle);
6381 
6383 
6393  LEGION_DEPRECATED("Multiple domains are no longer supported.")
6394  void get_index_space_domains(Context ctx, IndexSpace handle,
6395  std::vector<Domain> &domains);
6396  // Context free
6397  LEGION_DEPRECATED("Multiple domains are no longer supported.")
6398  void get_index_space_domains(IndexSpace handle,
6399  std::vector<Domain> &domains);
6401 
6403 
6410  Domain get_index_partition_color_space(Context ctx, IndexPartition p);
6411  // Context free
6412  Domain get_index_partition_color_space(IndexPartition p);
6413  // Template version
6414  template<int DIM, typename COORD_T,
6415  int COLOR_DIM, typename COLOR_COORD_T>
6416  DomainT<COLOR_DIM,COLOR_COORD_T>
6417  get_index_partition_color_space(IndexPartitionT<DIM,COORD_T> p);
6419 
6421 
6427  IndexSpace get_index_partition_color_space_name(Context ctx,
6428  IndexPartition p);
6429  // Context free
6430  IndexSpace get_index_partition_color_space_name(IndexPartition p);
6431  // Template version
6432  template<int DIM, typename COORD_T,
6433  int COLOR_DIM, typename COLOR_COORD_T>
6434  IndexSpaceT<COLOR_DIM,COLOR_COORD_T>
6435  get_index_partition_color_space_name(IndexPartitionT<DIM,COORD_T> p);
6437 
6439 
6448  void get_index_space_partition_colors(Context ctx, IndexSpace sp,
6449  std::set<Color> &colors);
6450  void get_index_space_partition_colors(Context ctx, IndexSpace sp,
6451  std::set<DomainPoint> &colors);
6452  // Context free versions
6453  void get_index_space_partition_colors(IndexSpace sp,
6454  std::set<Color> &colors);
6455  void get_index_space_partition_colors(IndexSpace sp,
6456  std::set<DomainPoint> &colors);
6458 
6460 
6466  bool is_index_partition_disjoint(Context ctx, IndexPartition p);
6467  // Context free
6468  bool is_index_partition_disjoint(IndexPartition p);
6470 
6472 
6478  bool is_index_partition_complete(Context ctx, IndexPartition p);
6479  // Context free
6480  bool is_index_partition_complete(IndexPartition p);
6482 
6484 
6492  Color get_index_space_color(Context ctx, IndexSpace handle);
6493  DomainPoint get_index_space_color_point(Context ctx, IndexSpace handle);
6494  // Context free
6495  Color get_index_space_color(IndexSpace handle);
6496  DomainPoint get_index_space_color_point(IndexSpace handle);
6497  // Template version
6498  template<int DIM, typename COORD_T,
6499  int COLOR_DIM, typename COLOR_COORD_T>
6500  Point<COLOR_DIM,COLOR_COORD_T>
6501  get_index_space_color(IndexSpaceT<DIM,COORD_T> handle);
6503 
6505 
6512  Color get_index_partition_color(Context ctx, IndexPartition handle);
6513  DomainPoint get_index_partition_color_point(Context ctx,
6514  IndexPartition handle);
6515  // Context free
6516  Color get_index_partition_color(IndexPartition handle);
6517  DomainPoint get_index_partition_color_point(IndexPartition handle);
6519 
6521 
6527  IndexSpace get_parent_index_space(Context ctx, IndexPartition handle);
6528  // Context free
6529  IndexSpace get_parent_index_space(IndexPartition handle);
6530  // Template version
6531  template<int DIM, typename COORD_T>
6532  IndexSpaceT<DIM,COORD_T> get_parent_index_space(
6533  IndexPartitionT<DIM,COORD_T> handle);
6535 
6537 
6543  bool has_parent_index_partition(Context ctx, IndexSpace handle);
6544  // Context free
6545  bool has_parent_index_partition(IndexSpace handle);
6547 
6549 
6556  IndexPartition get_parent_index_partition(Context ctx, IndexSpace handle);
6557  // Context free
6558  IndexPartition get_parent_index_partition(IndexSpace handle);
6559  // Template version
6560  template<int DIM, typename COORD_T>
6561  IndexPartitionT<DIM,COORD_T> get_parent_index_partition(
6562  IndexSpaceT<DIM,COORD_T> handle);
6564 
6566 
6572  unsigned get_index_space_depth(Context ctx, IndexSpace handle);
6573  // Context free
6574  unsigned get_index_space_depth(IndexSpace handle);
6576 
6578 
6584  unsigned get_index_partition_depth(Context ctx, IndexPartition handle);
6585  // Context free
6586  unsigned get_index_partition_depth(IndexPartition handle);
6588  public:
6589  //------------------------------------------------------------------------
6590  // Safe Cast Operations
6591  //------------------------------------------------------------------------
6601  DomainPoint safe_cast(Context ctx, DomainPoint point,
6602  LogicalRegion region);
6603 
6612  template<int DIM, typename COORD_T>
6613  bool safe_cast(Context ctx,
6614  Point<DIM,COORD_T> point,
6615  LogicalRegionT<DIM,COORD_T> region);
6616  public:
6617  //------------------------------------------------------------------------
6618  // Field Space Operations
6619  //------------------------------------------------------------------------
6627  FieldSpace create_field_space(Context ctx, const char *provenance = NULL);
6639  FieldSpace create_field_space(Context ctx,
6640  const std::vector<size_t> &field_sizes,
6641  std::vector<FieldID> &resulting_fields,
6642  CustomSerdezID serdez_id = 0,
6643  const char *provenance = NULL);
6655  FieldSpace create_field_space(Context ctx,
6656  const std::vector<Future> &field_sizes,
6657  std::vector<FieldID> &resulting_fields,
6658  CustomSerdezID serdez_id = 0,
6659  const char *provenance = NULL);
6670  void create_shared_ownership(Context ctx, FieldSpace handle);
6680  void destroy_field_space(Context ctx, FieldSpace handle,
6681  const bool unordered = false,
6682  const char *provenance = NULL);
6683 
6685 
6692  size_t get_field_size(Context ctx, FieldSpace handle, FieldID fid);
6693  // Context free
6694  size_t get_field_size(FieldSpace handle, FieldID fid);
6696 
6698 
6704  void get_field_space_fields(Context ctx, FieldSpace handle,
6705  std::vector<FieldID> &fields);
6706  // Context free
6707  void get_field_space_fields(FieldSpace handle,
6708  std::vector<FieldID> &fields);
6710 
6712 
6718  void get_field_space_fields(Context ctx, FieldSpace handle,
6719  std::set<FieldID> &fields);
6720  // Context free
6721  void get_field_space_fields(FieldSpace handle,
6722  std::set<FieldID> &fields);
6724  public:
6725  //------------------------------------------------------------------------
6726  // Logical Region Operations
6727  //------------------------------------------------------------------------
6741  LogicalRegion create_logical_region(Context ctx, IndexSpace index,
6742  FieldSpace fields,
6743  bool task_local = false,
6744  const char *provenance = NULL);
6745  // Template version
6746  template<int DIM, typename COORD_T>
6747  LogicalRegionT<DIM,COORD_T> create_logical_region(Context ctx,
6748  IndexSpaceT<DIM,COORD_T> index,
6749  FieldSpace fields,
6750  bool task_local = false,
6751  const char *provenance = NULL);
6762  void create_shared_ownership(Context ctx, LogicalRegion handle);
6772  void destroy_logical_region(Context ctx, LogicalRegion handle,
6773  const bool unordered = false,
6774  const char *provenance = NULL);
6775 
6783  LEGION_DEPRECATED("Destruction of logical partitions are no-ops now."
6784  "Logical partitions are automatically destroyed when their root "
6785  "logical region or their index spartition are destroyed.")
6786  void destroy_logical_partition(Context ctx, LogicalPartition handle,
6787  const bool unordered = false);
6788 
6807  void reset_equivalence_sets(Context ctx, LogicalRegion parent,
6808  LogicalRegion region,
6809  const std::set<FieldID> &fields);
6810  public:
6811  //------------------------------------------------------------------------
6812  // Logical Region Tree Traversal Operations
6813  //------------------------------------------------------------------------
6815 
6824  LogicalPartition get_logical_partition(Context ctx, LogicalRegion parent,
6825  IndexPartition handle);
6826  // Context free
6827  LogicalPartition get_logical_partition(LogicalRegion parent,
6828  IndexPartition handle);
6829  // Template version
6830  template<int DIM, typename COORD_T>
6831  LogicalPartitionT<DIM,COORD_T> get_logical_partition(
6832  LogicalRegionT<DIM,COORD_T> parent,
6833  IndexPartitionT<DIM,COORD_T> handle);
6835 
6837 
6845  LogicalPartition get_logical_partition_by_color(Context ctx,
6846  LogicalRegion parent,
6847  Color c);
6848  LogicalPartition get_logical_partition_by_color(Context ctx,
6849  LogicalRegion parent,
6850  const DomainPoint &c);
6851  // Context free
6852  LogicalPartition get_logical_partition_by_color(LogicalRegion parent,
6853  Color c);
6854  LogicalPartition get_logical_partition_by_color(LogicalRegion parent,
6855  const DomainPoint &c);
6856  // Template version
6857  template<int DIM, typename COORD_T>
6858  LogicalPartitionT<DIM,COORD_T> get_logical_partition_by_color(
6859  LogicalRegionT<DIM,COORD_T> parent,
6860  Color c);
6862 
6864 
6872  bool has_logical_partition_by_color(Context ctx,
6873  LogicalRegion parent,
6874  const DomainPoint &c);
6875  // Context free
6876  bool has_logical_partition_by_color(LogicalRegion parent,
6877  const DomainPoint &c);
6879 
6881 
6890  LogicalPartition get_logical_partition_by_tree(Context ctx,
6891  IndexPartition handle,
6892  FieldSpace fspace,
6893  RegionTreeID tid);
6894  // Context free
6895  LogicalPartition get_logical_partition_by_tree(IndexPartition handle,
6896  FieldSpace fspace,
6897  RegionTreeID tid);
6898  // Template version
6899  template<int DIM, typename COORD_T>
6900  LogicalPartitionT<DIM,COORD_T> get_logical_partition_by_tree(
6901  IndexPartitionT<DIM,COORD_T> handle,
6902  FieldSpace fspace, RegionTreeID tid);
6904 
6906 
6915  LogicalRegion get_logical_subregion(Context ctx, LogicalPartition parent,
6916  IndexSpace handle);
6917  // Context free
6918  LogicalRegion get_logical_subregion(LogicalPartition parent,
6919  IndexSpace handle);
6920  // Template version
6921  template<int DIM, typename COORD_T>
6922  LogicalRegionT<DIM,COORD_T> get_logical_subregion(
6923  LogicalPartitionT<DIM,COORD_T> parent,
6924  IndexSpaceT<DIM,COORD_T> handle);
6926 
6928 
6936  LogicalRegion get_logical_subregion_by_color(Context ctx,
6937  LogicalPartition parent,
6938  Color c);
6939  LogicalRegion get_logical_subregion_by_color(Context ctx,
6940  LogicalPartition parent,
6941  const DomainPoint &c);
6942  // Context free
6943  LogicalRegion get_logical_subregion_by_color(LogicalPartition parent,
6944  Color c);
6945  LogicalRegion get_logical_subregion_by_color(LogicalPartition parent,
6946  const DomainPoint &c);
6947  // Template version
6948  template<int DIM, typename COORD_T,
6949  int COLOR_DIM, typename COLOR_COORD_T>
6950  LogicalRegionT<DIM,COORD_T> get_logical_subregion_by_color(
6951  LogicalPartitionT<DIM,COORD_T> parent,
6952  Point<COLOR_DIM,COLOR_COORD_T> color);
6954 
6956 
6964  bool has_logical_subregion_by_color(Context ctx,
6965  LogicalPartition parent,
6966  const DomainPoint &c);
6967  // Context free
6968  bool has_logical_subregion_by_color(LogicalPartition parent,
6969  const DomainPoint &c);
6970  // Template version
6971  template<int DIM, typename COORD_T,
6972  int COLOR_DIM, typename COLOR_COORD_T>
6973  bool has_logical_subregion_by_color(LogicalPartitionT<DIM,COORD_T> parent,
6974  Point<COLOR_DIM,COLOR_COORD_T> color);
6976 
6978 
6987  LogicalRegion get_logical_subregion_by_tree(Context ctx,
6988  IndexSpace handle,
6989  FieldSpace fspace,
6990  RegionTreeID tid);
6991  // Context free
6992  LogicalRegion get_logical_subregion_by_tree(IndexSpace handle,
6993  FieldSpace fspace,
6994  RegionTreeID tid);
6995  // Template version
6996  template<int DIM, typename COORD_T>
6997  LogicalRegionT<DIM,COORD_T> get_logical_subregion_by_tree(
6998  IndexSpaceT<DIM,COORD_T> handle,
6999  FieldSpace space, RegionTreeID tid);
7001 
7003 
7011  Color get_logical_region_color(Context ctx, LogicalRegion handle);
7012  DomainPoint get_logical_region_color_point(Context ctx,
7013  LogicalRegion handle);
7014  // Context free versions
7015  Color get_logical_region_color(LogicalRegion handle);
7016  DomainPoint get_logical_region_color_point(LogicalRegion handle);
7017  // Template version
7018  template<int DIM, typename COORD_T,
7019  int COLOR_DIM, typename COLOR_COORD_T>
7020  Point<COLOR_DIM,COLOR_COORD_T>
7021  get_logical_region_color_point(LogicalRegionT<DIM,COORD_T> handle);
7023 
7025 
7032  Color get_logical_partition_color(Context ctx, LogicalPartition handle);
7033  DomainPoint get_logical_partition_color_point(Context ctx,
7034  LogicalPartition handle);
7035  // Context free versions
7036  Color get_logical_partition_color(LogicalPartition handle);
7037  DomainPoint get_logical_partition_color_point(LogicalPartition handle);
7039 
7041 
7047  LogicalRegion get_parent_logical_region(Context ctx,
7048  LogicalPartition handle);
7049  // Context free
7050  LogicalRegion get_parent_logical_region(LogicalPartition handle);
7051  // Template version
7052  template<int DIM, typename COORD_T>
7053  LogicalRegionT<DIM,COORD_T> get_parent_logical_region(
7054  LogicalPartitionT<DIM,COORD_T> handle);
7056 
7058 
7064  bool has_parent_logical_partition(Context ctx, LogicalRegion handle);
7065  // Context free
7066  bool has_parent_logical_partition(LogicalRegion handle);
7068 
7070 
7076  LogicalPartition get_parent_logical_partition(Context ctx,
7077  LogicalRegion handle);
7078  // Context free
7079  LogicalPartition get_parent_logical_partition(LogicalRegion handle);
7080  // Template version
7081  template<int DIM, typename COORD_T>
7082  LogicalPartitionT<DIM,COORD_T> get_parent_logical_partition(
7083  LogicalRegionT<DIM,COORD_T> handle);
7085  public:
7086  //------------------------------------------------------------------------
7087  // Allocator and Argument Map Operations
7088  //------------------------------------------------------------------------
7095  FieldAllocator create_field_allocator(Context ctx, FieldSpace handle);
7096 
7105  LEGION_DEPRECATED("ArgumentMap can be constructed directly.")
7106  ArgumentMap create_argument_map(Context ctx);
7107  public:
7108  //------------------------------------------------------------------------
7109  // Task Launch Operations
7110  //------------------------------------------------------------------------
7120  Future execute_task(Context ctx,
7121  const TaskLauncher &launcher,
7122  std::vector<OutputRequirement> *outputs = NULL);
7123 
7134  FutureMap execute_index_space(
7135  Context ctx, const IndexTaskLauncher &launcher,
7136  std::vector<OutputRequirement> *outputs = NULL);
7137 
7160  Future execute_index_space(
7161  Context ctx, const IndexTaskLauncher &launcher,
7162  ReductionOpID redop, bool ordered = true,
7163  std::vector<OutputRequirement> *outputs = NULL);
7164 
7188  Future reduce_future_map(Context ctx, const FutureMap &future_map,
7189  ReductionOpID redop, bool ordered = true,
7190  MapperID map_id = 0, MappingTagID tag = 0,
7191  const char *provenance = NULL,
7192  Future initial_value = Future());
7193 
7221  FutureMap construct_future_map(Context ctx, IndexSpace domain,
7222  const std::map<DomainPoint,UntypedBuffer> &data,
7223  bool collective = false, ShardingID sid = 0,
7224  bool implicit_sharding = false,
7225  const char *provenance = NULL);
7226  LEGION_DEPRECATED("Use the version that takes an IndexSpace instead")
7227  FutureMap construct_future_map(Context ctx, const Domain &domain,
7228  const std::map<DomainPoint,UntypedBuffer> &data,
7229  bool collective = false, ShardingID sid = 0,
7230  bool implicit_sharding = false);
7231 
7255  FutureMap construct_future_map(Context ctx, IndexSpace domain,
7256  const std::map<DomainPoint,Future> &futures,
7257  bool collective = false, ShardingID sid = 0,
7258  bool implicit_sharding = false,
7259  const char *provenance = NULL);
7260  LEGION_DEPRECATED("Use the version that takes an IndexSpace instead")
7261  FutureMap construct_future_map(Context ctx, const Domain &domain,
7262  const std::map<DomainPoint,Future> &futures,
7263  bool collective = false, ShardingID sid = 0,
7264  bool implicit_sharding = false);
7265 
7283  typedef DomainPoint (*PointTransformFnptr)(const DomainPoint &point,
7284  const Domain &domain,
7285  const Domain &range);
7286  FutureMap transform_future_map(Context ctx, const FutureMap &fm,
7287  IndexSpace new_domain,
7288  PointTransformFnptr fnptr,
7289  const char *provenance = NULL);
7307  FutureMap transform_future_map(Context ctx, const FutureMap &fm,
7308  IndexSpace new_domain,
7309  PointTransformFunctor *functor,
7310  bool take_ownership = false,
7311  const char *provenance = NULL);
7312 
7328  LEGION_DEPRECATED("Launching tasks should be done with the new task "
7329  "launcher interface.")
7330  Future execute_task(Context ctx, TaskID task_id,
7331  const std::vector<IndexSpaceRequirement> &indexes,
7332  const std::vector<FieldSpaceRequirement> &fields,
7333  const std::vector<RegionRequirement> &regions,
7334  const UntypedBuffer &arg,
7335  const Predicate &predicate = Predicate::TRUE_PRED,
7336  MapperID id = 0,
7337  MappingTagID tag = 0);
7338 
7357  LEGION_DEPRECATED("Launching tasks should be done with the new task "
7358  "launcher interface.")
7359  FutureMap execute_index_space(Context ctx, TaskID task_id,
7360  const Domain domain,
7361  const std::vector<IndexSpaceRequirement> &indexes,
7362  const std::vector<FieldSpaceRequirement> &fields,
7363  const std::vector<RegionRequirement> &regions,
7364  const UntypedBuffer &global_arg,
7365  const ArgumentMap &arg_map,
7366  const Predicate &predicate = Predicate::TRUE_PRED,
7367  bool must_paralleism = false,
7368  MapperID id = 0,
7369  MappingTagID tag = 0);
7370 
7392  LEGION_DEPRECATED("Launching tasks should be done with the new task "
7393  "launcher interface.")
7394  Future execute_index_space(Context ctx, TaskID task_id,
7395  const Domain domain,
7396  const std::vector<IndexSpaceRequirement> &indexes,
7397  const std::vector<FieldSpaceRequirement> &fields,
7398  const std::vector<RegionRequirement> &regions,
7399  const UntypedBuffer &global_arg,
7400  const ArgumentMap &arg_map,
7401  ReductionOpID reduction,
7402  const UntypedBuffer &initial_value,
7403  const Predicate &predicate = Predicate::TRUE_PRED,
7404  bool must_parallelism = false,
7405  MapperID id = 0,
7406  MappingTagID tag = 0);
7407  public:
7408  //------------------------------------------------------------------------
7409  // Inline Mapping Operations
7410  //------------------------------------------------------------------------
7420  PhysicalRegion map_region(Context ctx, const InlineLauncher &launcher);
7421 
7435  PhysicalRegion map_region(Context ctx, const RegionRequirement &req,
7436  MapperID id = 0, MappingTagID tag = 0,
7437  const char *provenance = NULL);
7438 
7450  PhysicalRegion map_region(Context ctx, unsigned idx,
7451  MapperID id = 0, MappingTagID tag = 0,
7452  const char *provenance = NULL);
7453 
7463  void remap_region(Context ctx, PhysicalRegion region,
7464  const char *provenance = NULL);
7465 
7473  void unmap_region(Context ctx, PhysicalRegion region);
7474 
7482  void unmap_all_regions(Context ctx);
7483  public:
7484  //------------------------------------------------------------------------
7485  // Output Region Operations
7486  //------------------------------------------------------------------------
7492  OutputRegion get_output_region(Context ctx, unsigned index);
7493 
7499  void get_output_regions(Context ctx, std::vector<OutputRegion> &regions);
7500  public:
7501  //------------------------------------------------------------------------
7502  // Fill Field Operations
7503  //------------------------------------------------------------------------
7518  template<typename T>
7519  void fill_field(Context ctx, LogicalRegion handle, LogicalRegion parent,
7520  FieldID fid, const T &value,
7521  Predicate pred = Predicate::TRUE_PRED);
7522 
7536  void fill_field(Context ctx, LogicalRegion handle, LogicalRegion parent,
7537  FieldID fid, const void *value, size_t value_size,
7538  Predicate pred = Predicate::TRUE_PRED);
7539 
7552  void fill_field(Context ctx, LogicalRegion handle, LogicalRegion parent,
7553  FieldID fid, Future f,
7554  Predicate pred = Predicate::TRUE_PRED);
7555 
7566  template<typename T>
7567  void fill_fields(Context ctx, LogicalRegion handle, LogicalRegion parent,
7568  const std::set<FieldID> &fields, const T &value,
7569  Predicate pred = Predicate::TRUE_PRED);
7570 
7583  void fill_fields(Context ctx, LogicalRegion handle, LogicalRegion parent,
7584  const std::set<FieldID> &fields,
7585  const void *value, size_t value_size,
7586  Predicate pred = Predicate::TRUE_PRED);
7587 
7598  void fill_fields(Context ctx, LogicalRegion handle, LogicalRegion parent,
7599  const std::set<FieldID> &fields,
7600  Future f, Predicate pred = Predicate::TRUE_PRED);
7601 
7608  void fill_fields(Context ctx, const FillLauncher &launcher);
7609 
7616  void fill_fields(Context ctx, const IndexFillLauncher &launcher);
7617 
7623  void discard_fields(Context ctx, const DiscardLauncher &launcher);
7624  public:
7625  //------------------------------------------------------------------------
7626  // Attach Operations
7627  //------------------------------------------------------------------------
7628 
7635  PhysicalRegion attach_external_resource(Context ctx,
7636  const AttachLauncher &launcher);
7637 
7649  Future detach_external_resource(Context ctx, PhysicalRegion region,
7650  const bool flush = true,
7651  const bool unordered = false,
7652  const char *provenance = NULL);
7653 
7671  ExternalResources attach_external_resources(Context ctx,
7672  const IndexAttachLauncher &launcher);
7673 
7686  Future detach_external_resources(Context ctx, ExternalResources external,
7687  const bool flush = true,
7688  const bool unordered = false,
7689  const char *provenance = NULL);
7690 
7697  void progress_unordered_operations(Context ctx);
7698 
7729  LEGION_DEPRECATED("Attaching specific HDF5 file type is deprecated "
7730  "in favor of generic attach launcher interface.")
7731  PhysicalRegion attach_hdf5(Context ctx, const char *file_name,
7732  LogicalRegion handle, LogicalRegion parent,
7733  const std::map<FieldID,const char*> &field_map,
7734  LegionFileMode mode);
7735 
7752  LEGION_DEPRECATED("Detaching specific HDF5 file type is deprecated "
7753  "in favor of generic detach interface.")
7754  void detach_hdf5(Context ctx, PhysicalRegion region);
7755 
7762  LEGION_DEPRECATED("Attaching generic file type is deprecated "
7763  "in favor of generic attach launcher interface.")
7764  PhysicalRegion attach_file(Context ctx, const char *file_name,
7765  LogicalRegion handle, LogicalRegion parent,
7766  const std::vector<FieldID> &field_vec,
7767  LegionFileMode mode);
7768 
7774  LEGION_DEPRECATED("Detaching generic file type is deprecated "
7775  "in favor of generic detach interface.")
7776  void detach_file(Context ctx, PhysicalRegion region);
7777  public:
7778  //------------------------------------------------------------------------
7779  // Copy Operations
7780  //------------------------------------------------------------------------
7788  void issue_copy_operation(Context ctx, const CopyLauncher &launcher);
7789 
7797  void issue_copy_operation(Context ctx, const IndexCopyLauncher &launcher);
7798  public:
7799  //------------------------------------------------------------------------
7800  // Predicate Operations
7801  //------------------------------------------------------------------------
7811  Predicate create_predicate(Context ctx, const Future &f,
7812  const char *provenance = NULL);
7813 
7823  Predicate predicate_not(Context ctx, const Predicate &p,
7824  const char *provenance = NULL);
7825 
7836  Predicate predicate_and(Context ctx,
7837  const Predicate &p1, const Predicate &p2,
7838  const char *provenance = NULL);
7839 
7850  Predicate predicate_or(Context ctx,
7851  const Predicate &p1, const Predicate &p2,
7852  const char *provenance = NULL);
7853 
7860  Predicate create_predicate(Context ctx,const PredicateLauncher &launcher);
7861 
7870  Future get_predicate_future(Context ctx, const Predicate &p,
7871  const char *provenance = NULL);
7872  public:
7873  //------------------------------------------------------------------------
7874  // Lock Operations
7875  //------------------------------------------------------------------------
7881  Lock create_lock(Context ctx);
7882 
7893  void destroy_lock(Context ctx, Lock l);
7894 
7907  Grant acquire_grant(Context ctx,
7908  const std::vector<LockRequest> &requests);
7909 
7919  void release_grant(Context ctx, Grant grant);
7920  public:
7921  //------------------------------------------------------------------------
7922  // Phase Barrier operations
7923  //------------------------------------------------------------------------
7933  PhaseBarrier create_phase_barrier(Context ctx, unsigned arrivals);
7934 
7945  void destroy_phase_barrier(Context ctx, PhaseBarrier pb);
7946 
7962  PhaseBarrier advance_phase_barrier(Context ctx, PhaseBarrier pb);
7963  public:
7964  //------------------------------------------------------------------------
7965  // Dynamic Collective operations
7966  //------------------------------------------------------------------------
7981  DynamicCollective create_dynamic_collective(Context ctx,
7982  unsigned arrivals,
7983  ReductionOpID redop,
7984  const void *init_value,
7985  size_t init_size);
7986 
7993  void destroy_dynamic_collective(Context ctx, DynamicCollective dc);
7994 
8004  void arrive_dynamic_collective(Context ctx,
8005  DynamicCollective dc,
8006  const void *buffer,
8007  size_t size, unsigned count = 1);
8008 
8018  void defer_dynamic_collective_arrival(Context ctx,
8019  DynamicCollective dc,
8020  const Future &f,
8021  unsigned count = 1);
8022 
8033  Future get_dynamic_collective_result(Context ctx, DynamicCollective dc,
8034  const char *provenance = NULL);
8035 
8044  DynamicCollective advance_dynamic_collective(Context ctx,
8045  DynamicCollective dc);
8046  public:
8047  //------------------------------------------------------------------------
8048  // User-Managed Software Coherence
8049  //------------------------------------------------------------------------
8056  void issue_acquire(Context ctx, const AcquireLauncher &launcher);
8057 
8064  void issue_release(Context ctx, const ReleaseLauncher &launcher);
8065  public:
8066  //------------------------------------------------------------------------
8067  // Fence Operations
8068  //------------------------------------------------------------------------
8077  Future issue_mapping_fence(Context ctx, const char *provenance = NULL);
8078 
8088  Future issue_execution_fence(Context ctx, const char *provenance = NULL);
8089  public:
8090  //------------------------------------------------------------------------
8091  // Tracing Operations
8092  //------------------------------------------------------------------------
8122  void begin_trace(Context ctx, TraceID tid, bool logical_only = false,
8123  bool static_trace = false, const std::set<RegionTreeID> *managed = NULL,
8124  const char *provenance = NULL);
8128  void end_trace(Context ctx, TraceID tid, const char *provenance = NULL);
8143  LEGION_DEPRECATED("Use begin_trace with static_trace=true")
8144  void begin_static_trace(Context ctx,
8145  const std::set<RegionTreeID> *managed = NULL);
8150  LEGION_DEPRECATED("Use end_trace")
8151  void end_static_trace(Context ctx);
8152 
8157  TraceID generate_dynamic_trace_id(void);
8158 
8169  TraceID generate_library_trace_ids(const char *name, size_t count);
8170 
8178  static TraceID generate_static_trace_id(void);
8179  public:
8180  //------------------------------------------------------------------------
8181  // Frame Operations
8182  //------------------------------------------------------------------------
8196  void complete_frame(Context ctx, const char *provenance = NULL);
8197  public:
8198  //------------------------------------------------------------------------
8199  // Must Parallelism
8200  //------------------------------------------------------------------------
8208  FutureMap execute_must_epoch(Context ctx,
8209  const MustEpochLauncher &launcher);
8210  public:
8211  //------------------------------------------------------------------------
8212  // Tunable Variables
8213  //------------------------------------------------------------------------
8214 
8228  Future select_tunable_value(Context ctx, TunableID tid,
8229  MapperID mapper = 0, MappingTagID tag = 0,
8230  const void *args = NULL, size_t argsize = 0);
8231  Future select_tunable_value(Context ctx, const TunableLauncher &launcher);
8232 
8239  LEGION_DEPRECATED("Tunable values should now be obtained via the "
8240  "generic interface that returns a future result.")
8241  int get_tunable_value(Context ctx, TunableID tid,
8242  MapperID mapper = 0, MappingTagID tag = 0);
8243  public:
8244  //------------------------------------------------------------------------
8245  // Task Local Interface
8246  //------------------------------------------------------------------------
8252  const Task* get_local_task(Context ctx);
8253 
8261  void* get_local_task_variable_untyped(Context ctx, LocalVariableID id);
8262  template<typename T>
8263  T* get_local_task_variable(Context ctx, LocalVariableID id);
8264 
8275  void set_local_task_variable_untyped(Context ctx, LocalVariableID id,
8276  const void *value, void (*destructor)(void*) = NULL);
8277  template<typename T>
8278  void set_local_task_variable(Context ctx, LocalVariableID id,
8279  const T* value, void (*destructor)(void*) = NULL);
8280  public:
8281  //------------------------------------------------------------------------
8282  // Timing Operations
8283  //------------------------------------------------------------------------
8292  Future get_current_time(Context ctx, Future precondition = Future());
8293 
8302  Future get_current_time_in_microseconds(Context ctx,
8303  Future precondition = Future());
8304 
8313  Future get_current_time_in_nanoseconds(Context ctx,
8314  Future precondition = Future());
8315 
8322  Future issue_timing_measurement(Context ctx,
8323  const TimingLauncher &launcher);
8324 
8331  static long long get_zero_time(void);
8332  public:
8333  //------------------------------------------------------------------------
8334  // Miscellaneous Operations
8335  //------------------------------------------------------------------------
8350  Mapping::Mapper* get_mapper(Context ctx, MapperID id,
8351  Processor target = Processor::NO_PROC);
8352 
8366  Mapping::MapperContext begin_mapper_call(Context ctx, MapperID id,
8367  Processor target = Processor::NO_PROC);
8368 
8374  void end_mapper_call(Mapping::MapperContext ctx);
8375 
8382  Processor get_executing_processor(Context ctx);
8383 
8390  const Task* get_current_task(Context ctx);
8391 
8403  size_t query_available_memory(Context ctx, Memory target);
8404 
8421  void raise_region_exception(Context ctx, PhysicalRegion region,
8422  bool nuclear);
8423 
8434  void yield(Context ctx);
8435 
8473  void concurrent_task_barrier(Context ctx);
8474  public:
8475  //------------------------------------------------------------------------
8476  // MPI Interoperability
8477  //------------------------------------------------------------------------
8481  bool is_MPI_interop_configured(void);
8482 
8490  const std::map<int/*rank*/,AddressSpace>& find_forward_MPI_mapping(void);
8491 
8499  const std::map<AddressSpace,int/*rank*/>& find_reverse_MPI_mapping(void);
8500 
8504  int find_local_MPI_rank(void);
8505  public:
8506  //------------------------------------------------------------------------
8507  // Semantic Information
8508  //------------------------------------------------------------------------
8518  void attach_semantic_information(TaskID task_id, SemanticTag tag,
8519  const void *buffer, size_t size,
8520  bool is_mutable = false, bool local_only = false);
8521 
8530  void attach_semantic_information(IndexSpace handle, SemanticTag tag,
8531  const void *buffer, size_t size, bool is_mutable = false);
8532 
8541  void attach_semantic_information(IndexPartition handle, SemanticTag tag,
8542  const void *buffer, size_t size, bool is_mutable = false);
8543 
8552  void attach_semantic_information(FieldSpace handle, SemanticTag tag,
8553  const void *buffer, size_t size, bool is_mutable = false);
8554 
8564  void attach_semantic_information(FieldSpace handle, FieldID fid,
8565  SemanticTag tag, const void *buffer,
8566  size_t size, bool is_mutable = false);
8567 
8576  void attach_semantic_information(LogicalRegion handle, SemanticTag tag,
8577  const void *buffer, size_t size, bool is_mutable = false);
8578 
8587  void attach_semantic_information(LogicalPartition handle,
8588  SemanticTag tag, const void *buffer,
8589  size_t size, bool is_mutable = false);
8590 
8598  void attach_name(TaskID task_id, const char *name,
8599  bool is_mutable = false,
8600  bool local_only = false);
8601 
8608  void attach_name(IndexSpace handle, const char *name,
8609  bool is_mutable = false);
8610 
8617  void attach_name(IndexPartition handle, const char *name,
8618  bool is_mutable = false);
8619 
8626  void attach_name(FieldSpace handle, const char *name,
8627  bool is_mutable = false);
8628 
8636  void attach_name(FieldSpace handle, FieldID fid,
8637  const char *name, bool is_mutable = false);
8638 
8645  void attach_name(LogicalRegion handle, const char *name,
8646  bool is_mutable = false);
8647 
8654  void attach_name(LogicalPartition handle, const char *name,
8655  bool is_mutable = false);
8656 
8667  bool retrieve_semantic_information(TaskID task_id, SemanticTag tag,
8668  const void *&result, size_t &size,
8669  bool can_fail = false,
8670  bool wait_until_ready = false);
8671 
8682  bool retrieve_semantic_information(IndexSpace handle, SemanticTag tag,
8683  const void *&result, size_t &size,
8684  bool can_fail = false,
8685  bool wait_until_ready = false);
8686 
8697  bool retrieve_semantic_information(IndexPartition handle, SemanticTag tag,
8698  const void *&result, size_t &size,
8699  bool can_fail = false,
8700  bool wait_until_ready = false);
8701 
8712  bool retrieve_semantic_information(FieldSpace handle, SemanticTag tag,
8713  const void *&result, size_t &size,
8714  bool can_fail = false,
8715  bool wait_until_ready = false);
8716 
8728  bool retrieve_semantic_information(FieldSpace handle, FieldID fid,
8729  SemanticTag tag,
8730  const void *&result, size_t &size,
8731  bool can_fail = false,
8732  bool wait_until_ready = false);
8733 
8744  bool retrieve_semantic_information(LogicalRegion handle, SemanticTag tag,
8745  const void *&result, size_t &size,
8746  bool can_fail = false,
8747  bool wait_until_ready = false);
8748 
8759  bool retrieve_semantic_information(LogicalPartition handle,
8760  SemanticTag tag,
8761  const void *&result, size_t &size,
8762  bool can_fail = false,
8763  bool wait_until_ready = false);
8764 
8770  void retrieve_name(TaskID task_id, const char *&result);
8771 
8777  void retrieve_name(IndexSpace handle, const char *&result);
8778 
8784  void retrieve_name(IndexPartition handle, const char *&result);
8785 
8791  void retrieve_name(FieldSpace handle, const char *&result);
8792 
8799  void retrieve_name(FieldSpace handle, FieldID fid, const char *&result);
8800 
8806  void retrieve_name(LogicalRegion handle, const char *&result);
8807 
8813  void retrieve_name(LogicalPartition handle, const char *&result);
8814 
8815  public:
8816  //------------------------------------------------------------------------
8817  // Printing operations, these are useful for only generating output
8818  // from a single task if the task has been replicated (either directly
8819  // or as part of control replication).
8820  //------------------------------------------------------------------------
8828  void print_once(Context ctx, FILE *f, const char *message);
8829 
8836  void log_once(Context ctx, Realm::LoggerMessage &message);
8837  public:
8838  //------------------------------------------------------------------------
8839  // Registration Callback Operations
8840  // All of these calls must be made while in the registration
8841  // function called before start-up. This function is specified
8842  // by calling the 'set_registration_callback' static method.
8843  //------------------------------------------------------------------------
8844 
8849  Mapping::MapperRuntime* get_mapper_runtime(void);
8850 
8855  MapperID generate_dynamic_mapper_id(void);
8856 
8867  MapperID generate_library_mapper_ids(const char *name, size_t count);
8868 
8876  static MapperID generate_static_mapper_id(void);
8877 
8889  void add_mapper(MapperID map_id, Mapping::Mapper *mapper,
8890  Processor proc = Processor::NO_PROC);
8891 
8903  void replace_default_mapper(Mapping::Mapper *mapper,
8904  Processor proc = Processor::NO_PROC);
8905 
8906  public:
8911  ProjectionID generate_dynamic_projection_id(void);
8912 
8923  ProjectionID generate_library_projection_ids(const char *name,
8924  size_t count);
8925 
8933  static ProjectionID generate_static_projection_id(void);
8934 
8948  void register_projection_functor(ProjectionID pid,
8949  ProjectionFunctor *functor,
8950  bool silence_warnings = false,
8951  const char *warning_string = NULL);
8952 
8962  static void preregister_projection_functor(ProjectionID pid,
8963  ProjectionFunctor *functor);
8964 
8971  static ProjectionFunctor* get_projection_functor(ProjectionID pid);
8972 
8977  ShardingID generate_dynamic_sharding_id(void);
8978 
8989  ShardingID generate_library_sharding_ids(const char *name, size_t count);
8990 
8998  static ShardingID generate_static_sharding_id(void);
8999 
9012  void register_sharding_functor(ShardingID sid,
9013  ShardingFunctor *functor,
9014  bool silence_warnings = false,
9015  const char *warning_string = NULL);
9016 
9027  static void preregister_sharding_functor(ShardingID sid,
9028  ShardingFunctor *functor);
9029 
9036  static ShardingFunctor* get_sharding_functor(ShardingID sid);
9037  public:
9042  ReductionOpID generate_dynamic_reduction_id(void);
9043 
9054  ReductionOpID generate_library_reduction_ids(const char *name,
9055  size_t count);
9056 
9064  static ReductionOpID generate_static_reduction_id(void);
9065 
9080  template<typename REDOP>
9081  static void register_reduction_op(ReductionOpID redop_id,
9082  bool permit_duplicates = false);
9083 
9104  static void register_reduction_op(ReductionOpID redop_id,
9105  ReductionOp *op,
9106  SerdezInitFnptr init_fnptr = NULL,
9107  SerdezFoldFnptr fold_fnptr = NULL,
9108  bool permit_duplicates = false);
9109 
9115  static const ReductionOp* get_reduction_op(ReductionOpID redop_id);
9116 
9117 #ifdef LEGION_GPU_REDUCTIONS
9118  template<typename REDOP>
9119  LEGION_DEPRECATED("Use register_reduction_op instead")
9120  static void preregister_gpu_reduction_op(ReductionOpID redop_id);
9121 #endif
9122  public:
9127  CustomSerdezID generate_dynamic_serdez_id(void);
9128 
9139  CustomSerdezID generate_library_serdez_ids(const char *name,
9140  size_t count);
9141 
9149  static CustomSerdezID generate_static_serdez_id(void);
9150 
9164  template<typename SERDEZ>
9165  static void register_custom_serdez_op(CustomSerdezID serdez_id,
9166  bool permit_duplicates = false);
9167 
9180  static void register_custom_serdez_op(CustomSerdezID serdez_id,
9181  SerdezOp *serdez_op,
9182  bool permit_duplicates = false);
9183 
9189  static const SerdezOp* get_serdez_op(CustomSerdezID serdez_id);
9190  public:
9191  //------------------------------------------------------------------------
9192  // Start-up Operations
9193  // Everything below here is a static function that is used to configure
9194  // the runtime prior to calling the start method to begin execution.
9195  //------------------------------------------------------------------------
9196  public:
9202  static const char* get_legion_version(void);
9203 
9381  static int start(int argc, char **argv, bool background = false,
9382  bool supply_default_mapper = true, bool filter = false);
9383 
9399  static void initialize(int *argc, char ***argv,
9400  bool filter = false, bool parse = true);
9401 
9407  static int wait_for_shutdown(void);
9408 
9416  static void set_return_code(int return_code);
9417 
9425  static void set_top_level_task_id(TaskID top_id);
9426 
9433  static void set_top_level_task_mapper_id(MapperID mapper_id);
9434 
9442 
9461  Context begin_implicit_task(TaskID top_task_id,
9462  MapperID mapper_id,
9463  Processor::Kind proc_kind,
9464  const char *task_name = NULL,
9465  bool control_replicable = false,
9466  unsigned shard_per_address_space = 1,
9467  int shard_id = -1,
9468  DomainPoint shard_point = DomainPoint());
9469 
9478 
9486 
9497  void finish_implicit_task(Context ctx,
9498  Realm::Event effects = Realm::Event::NO_EVENT);
9499 
9505  static size_t get_maximum_dimension(void);
9506 
9516  static void configure_MPI_interoperability(int rank);
9517 
9531  static LegionHandshake create_external_handshake(bool init_in_ext = true,
9532  int ext_participants = 1,
9533  int legion_participants = 1);
9534 
9546  static MPILegionHandshake create_handshake(bool init_in_MPI = true,
9547  int mpi_participants = 1,
9548  int legion_participants = 1);
9549 
9560  template<LogicalRegion (*PROJ_PTR)(LogicalRegion, const DomainPoint&,
9561  Runtime*)>
9562  LEGION_DEPRECATED("Projection functions should now be specified "
9563  "using projection functor objects")
9564  static ProjectionID register_region_function(ProjectionID handle);
9565 
9575  template<LogicalRegion (*PROJ_PTR)(LogicalPartition, const DomainPoint&,
9576  Runtime*)>
9577  LEGION_DEPRECATED("Projection functions should now be specified "
9578  "using projection functor objects")
9579  static ProjectionID register_partition_function(ProjectionID handle);
9580  public:
9597  static void add_registration_callback(RegistrationCallbackFnptr callback,
9598  bool dedup = true, size_t dedup_tag = 0);
9599  static void add_registration_callback(
9600  RegistrationWithArgsCallbackFnptr callback, const UntypedBuffer &buffer,
9601  bool dedup = true, size_t dedup_tag = 0);
9602 
9628  RegistrationCallbackFnptr callback, bool global,
9629  bool deduplicate = true, size_t dedup_tag = 0);
9630  static void perform_registration_callback(
9631  RegistrationWithArgsCallbackFnptr callback,
9632  const UntypedBuffer &buffer, bool global,
9633  bool deduplicate = true , size_t dedup_tag = 0);
9634 
9646  LEGION_DEPRECATED("Legion now supports multiple registration callbacks "
9647  "added via the add_registration_callback method.")
9648  static void set_registration_callback(RegistrationCallbackFnptr callback);
9649 
9655  static const InputArgs& get_input_args(void);
9656  public:
9660  static void enable_profiling(void);
9664  static void disable_profiling(void);
9668  static void dump_profiling(void);
9669  public:
9670  //------------------------------------------------------------------------
9671  // Layout Registration Operations
9672  //------------------------------------------------------------------------
9681  LayoutConstraintID register_layout(
9682  const LayoutConstraintRegistrar &registrar);
9683 
9689  void release_layout(LayoutConstraintID layout_id);
9690 
9702  static LayoutConstraintID preregister_layout(
9703  const LayoutConstraintRegistrar &registrar,
9704  LayoutConstraintID layout_id =
9705  LEGION_AUTO_GENERATE_ID);
9706 
9712  FieldSpace get_layout_constraint_field_space(
9713  LayoutConstraintID layout_id);
9714 
9720  void get_layout_constraints(LayoutConstraintID layout_id,
9721  LayoutConstraintSet &layout_constraints);
9722 
9728  const char* get_layout_constraints_name(LayoutConstraintID layout_id);
9729  public:
9730  //------------------------------------------------------------------------
9731  // Task Registration Operations
9732  //------------------------------------------------------------------------
9733 
9738  TaskID generate_dynamic_task_id(void);
9739 
9750  TaskID generate_library_task_ids(const char *name, size_t count);
9751 
9759  static TaskID generate_static_task_id(void);
9760 
9768  template<typename T,
9769  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9770  Context, Runtime*)>
9771  VariantID register_task_variant(const TaskVariantRegistrar &registrar,
9772  VariantID vid = LEGION_AUTO_GENERATE_ID);
9773 
9782  template<typename T, typename UDT,
9783  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9784  Context, Runtime*, const UDT&)>
9785  VariantID register_task_variant(const TaskVariantRegistrar &registrar,
9786  const UDT &user_data,
9787  VariantID vid = LEGION_AUTO_GENERATE_ID);
9788 
9796  template<
9797  void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9798  Context, Runtime*)>
9799  VariantID register_task_variant(const TaskVariantRegistrar &registrar,
9800  VariantID vid = LEGION_AUTO_GENERATE_ID);
9801 
9810  template<typename UDT,
9811  void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9812  Context, Runtime*, const UDT&)>
9813  VariantID register_task_variant(const TaskVariantRegistrar &registrar,
9814  const UDT &user_data,
9815  VariantID vid = LEGION_AUTO_GENERATE_ID);
9816 
9836  VariantID register_task_variant(const TaskVariantRegistrar &registrar,
9837  const CodeDescriptor &codedesc,
9838  const void *user_data = NULL,
9839  size_t user_len = 0,
9840  size_t return_type_size =
9841  LEGION_MAX_RETURN_SIZE,
9842  VariantID vid = LEGION_AUTO_GENERATE_ID,
9843  bool has_return_type_size = true);
9844 
9855  template<typename T,
9856  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9857  Context, Runtime*)>
9858  static VariantID preregister_task_variant(
9859  const TaskVariantRegistrar &registrar,
9860  const char *task_name = NULL,
9861  VariantID vid = LEGION_AUTO_GENERATE_ID);
9862 
9874  template<typename T, typename UDT,
9875  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9876  Context, Runtime*, const UDT&)>
9877  static VariantID preregister_task_variant(
9878  const TaskVariantRegistrar &registrar,
9879  const UDT &user_data,
9880  const char *task_name = NULL,
9881  VariantID vid = LEGION_AUTO_GENERATE_ID);
9882 
9893  template<
9894  void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9895  Context, Runtime*)>
9896  static VariantID preregister_task_variant(
9897  const TaskVariantRegistrar &registrar,
9898  const char *task_name = NULL,
9899  VariantID vid = LEGION_AUTO_GENERATE_ID);
9900 
9912  template<typename UDT,
9913  void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9914  Context, Runtime*, const UDT&)>
9915  static VariantID preregister_task_variant(
9916  const TaskVariantRegistrar &registrar, const UDT &user_data,
9917  const char *task_name = NULL,
9918  VariantID vid = LEGION_AUTO_GENERATE_ID);
9919 
9941  static VariantID preregister_task_variant(
9942  const TaskVariantRegistrar &registrar,
9943  const CodeDescriptor &codedesc,
9944  const void *user_data = NULL,
9945  size_t user_len = 0,
9946  const char *task_name = NULL,
9947  VariantID vid = LEGION_AUTO_GENERATE_ID,
9948  size_t return_type_size = LEGION_MAX_RETURN_SIZE,
9949  bool has_return_type_size = true,
9950  bool check_task_id = true);
9951 
9965  static void legion_task_preamble(const void *data, size_t datalen,
9966  Processor p, const Task *& task,
9967  const std::vector<PhysicalRegion> *& reg,
9968  Context& ctx, Runtime *& runtime);
9969 
9987  static void legion_task_postamble(Context ctx,
9988  const void *retvalptr = NULL,
9989  size_t retvalsize = 0,
9990  bool owned = false,
9991  Realm::RegionInstance inst =
9992  Realm::RegionInstance::NO_INST,
9993  const void *metadataptr = NULL,
9994  size_t metadatasize = 0);
9995 
10014  static void legion_task_postamble(Context ctx,
10015  const void *retvalptr, size_t retvalsize, bool owned,
10016  const Realm::ExternalInstanceResource &allocation,
10017  void (*freefunc)(const Realm::ExternalInstanceResource&) = NULL,
10018  const void *metadataptr = NULL, size_t metadatasize = 0);
10019 
10029  static void legion_task_postamble(Context ctx,
10030  FutureFunctor *callback_functor,
10031  bool owned = false);
10032  public:
10033  // ------------------ Deprecated task registration -----------------------
10047  template<typename T,
10048  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10049  Context, Runtime*)>
10050  LEGION_DEPRECATED("Task registration should be done with "
10051  "a TaskVariantRegistrar")
10052  static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10053  bool single, bool index,
10054  VariantID vid =LEGION_AUTO_GENERATE_ID,
10056  const char *task_name = NULL);
10070  template<
10071  void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10072  Context, Runtime*)>
10073  LEGION_DEPRECATED("Task registration should be done with "
10075  static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10076  bool single, bool index,
10077  VariantID vid =LEGION_AUTO_GENERATE_ID,
10079  const char *task_name = NULL);
10095  template<typename T, typename UDT,
10096  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10097  Context, Runtime*, const UDT&)>
10098  LEGION_DEPRECATED("Task registration should be done with "
10100  static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10101  bool single, bool index,
10102  const UDT &user_data,
10103  VariantID vid =LEGION_AUTO_GENERATE_ID,
10105  const char *task_name = NULL);
10121  template<typename UDT,
10122  void (*TASK_PTR)(const Task*,const std::vector<PhysicalRegion>&,
10123  Context, Runtime*, const UDT&)>
10124  LEGION_DEPRECATED("Task registration should be done with "
10126  static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10127  bool single, bool index,
10128  const UDT &user_data,
10129  VariantID vid =LEGION_AUTO_GENERATE_ID,
10131  const char *task_name = NULL);
10132  public:
10139  static bool has_runtime(void);
10140 
10148  static Runtime* get_runtime(Processor p = Processor::NO_PROC);
10149 
10156  static bool has_context(void);
10157 
10164  static Context get_context(void);
10165 
10171  static const Task* get_context_task(Context ctx);
10172  private:
10173  IndexPartition create_restricted_partition(Context ctx,
10174  IndexSpace parent,
10175  IndexSpace color_space,
10176  const void *transform,
10177  size_t transform_size,
10178  const void *extent,
10179  size_t extent_size,
10180  PartitionKind part_kind, Color color,
10181  const char *provenance);
10182  IndexSpace create_index_space_union_internal(Context ctx,
10183  IndexPartition parent,
10184  const void *realm_color,size_t color_size,
10185  TypeTag type_tag, const char *provenance,
10186  const std::vector<IndexSpace> &handles);
10187  IndexSpace create_index_space_union_internal(Context ctx,
10188  IndexPartition parent,
10189  const void *realm_color,size_t color_size,
10190  TypeTag type_tag, const char *provenance,
10191  IndexPartition handle);
10192  IndexSpace create_index_space_intersection_internal(Context ctx,
10193  IndexPartition parent,
10194  const void *realm_color,size_t color_size,
10195  TypeTag type_tag, const char *provenance,
10196  const std::vector<IndexSpace> &handles);
10197  IndexSpace create_index_space_intersection_internal(Context ctx,
10198  IndexPartition parent,
10199  const void *realm_color,size_t color_size,
10200  TypeTag type_tag, const char *provenance,
10201  IndexPartition handle);
10202  IndexSpace create_index_space_difference_internal(Context ctx,
10203  IndexPartition paretn,
10204  const void *realm_color, size_t color_size,
10205  TypeTag type_tag, const char *provenance,
10206  IndexSpace initial,
10207  const std::vector<IndexSpace> &handles);
10208  IndexSpace get_index_subspace_internal(IndexPartition handle,
10209  const void *realm_color,TypeTag type_tag);
10210  bool has_index_subspace_internal(IndexPartition handle,
10211  const void *realm_color,TypeTag type_tag);
10212  void get_index_partition_color_space_internal(IndexPartition handle,
10213  void *realm_is, TypeTag type_tag);
10214  void get_index_space_domain_internal(IndexSpace handle,
10215  void *realm_is, TypeTag type_tag);
10216  void get_index_space_color_internal(IndexSpace handle,
10217  void *realm_color, TypeTag type_tag);
10218  bool safe_cast_internal(Context ctx, LogicalRegion region,
10219  const void *realm_point,TypeTag type_tag);
10220  LogicalRegion get_logical_subregion_by_color_internal(
10221  LogicalPartition parent,
10222  const void *realm_color,TypeTag type_tag);
10223  bool has_logical_subregion_by_color_internal(
10224  LogicalPartition parent,
10225  const void *realm_color,TypeTag type_tag);
10226  private:
10227  // Methods for the wrapper functions to get information from the runtime
10228  friend class LegionTaskWrapper;
10229  friend class LegionSerialization;
10230  private:
10231  template<typename T>
10232  friend class DeferredValue;
10233  template<typename T, int DIM, typename COORD_T, bool CHECK_BOUNDS>
10234  friend class DeferredBuffer;
10235  friend class UntypedDeferredValue;
10236  template<typename>
10237  friend class UntypedDeferredBuffer;
10238  Realm::RegionInstance create_task_local_instance(Memory memory,
10239  Realm::InstanceLayoutGeneric *layout);
10240  void destroy_task_local_instance(Realm::RegionInstance instance);
10241  public:
10242  // This method is hidden down here and not publicly documented because
10243  // users shouldn't really need it for anything, however there are some
10244  // reasonable cases where it might be utilitized for things like doing
10245  // file I/O or printf that people might want it for so we've got it
10246  ShardID get_shard_id(Context ctx, bool I_know_what_I_am_doing = false);
10247  // We'll also allow users to get the total number of shards in the context
10248  // if they also ar willing to attest they know what they are doing
10249  size_t get_num_shards(Context ctx, bool I_know_what_I_am_doing = false);
10250  // This is another hidden method for control replication because it's
10251  // still somewhat experimental. In some cases there are unavoidable
10252  // sources of randomness that can mess with the needed invariants for
10253  // control replication (e.g. garbage collectors). This method will
10254  // allow the application to pass in an array of elements from each shard
10255  // and the runtime will fill in an output buffer with an ordered array of
10256  // elements that were passed in by every shard. Each shard will get the
10257  // same elements that were present in all the other shards in the same
10258  // order in the output array. The number of elements in the output buffer
10259  // is returned as a future (of type size_t) as the runtime will return
10260  // immediately and the application can continue running ahead. The
10261  // application must keep the input and output buffers allocated until
10262  // the future resolves. By definition the output buffer need be no bigger
10263  // than the input buffer since only elements that are in the input buffer
10264  // on any shard can appear in the output buffer. Note you can use this
10265  // method safely in contexts that are not control replicated as well:
10266  // the input will just be mem-copied to the output and num_elements
10267  // returned as the future result.
10268  Future consensus_match(Context ctx, const void *input, void *output,
10269  size_t num_elements, size_t element_size, const char *provenance = NULL);
10270  private:
10271  friend class Mapper;
10272  Internal::Runtime *runtime;
10273  };
10274 
10275 }; // namespace Legion
10276 
10277 #include "legion/legion.inl"
10278 // Include this here so we get the mapper interface in the header file
10279 // We have to put it here though since the mapper interface depends
10280 // on the rest of the legion interface
10281 #include "legion/legion_mapping.h"
10282 
10283 #endif // __LEGION_RUNTIME_H__
10284 #endif // defined LEGION_ENABLE_CXX_BINDINGS
10285 
10286 // EOF
Definition: legion.h:4452
Definition: legion.h:552
void set_point(const DomainPoint &point, const UntypedBuffer &arg, bool replace=true)
bool remove_point(const DomainPoint &point)
bool remove_point(const PT point[DIM])
bool has_point(const DomainPoint &point)
void set_point_arg(const PT point[DIM], const UntypedBuffer &arg, bool replace=false)
void set_point(const DomainPoint &point, const Future &f, bool replace=true)
UntypedBuffer get_point(const DomainPoint &point) const
Definition: legion_types.h:204
Definition: legion_types.h:205
Definition: legion.h:4500
Definition: legion.h:4401
Definition: legion.h:3770
Definition: legion.h:3702
Definition: legion.h:3666
Definition: legion_domain.h:253
Definition: legion_domain.h:132
Definition: legion_domain.h:614
Definition: legion.h:832
Definition: legion.h:2683
Definition: legion.h:2751
Definition: legion.h:373
FieldID allocate_field(size_t field_size, FieldID desired_fieldid=LEGION_AUTO_GENERATE_ID, CustomSerdezID serdez_id=0, bool local_field=false, const char *provenance=NULL)
void allocate_local_fields(const std::vector< size_t > &field_sizes, std::vector< FieldID > &resulting_fields, CustomSerdezID serdez_id=0, const char *provenance=NULL)
FieldID allocate_local_field(size_t field_size, FieldID desired_fieldid=LEGION_AUTO_GENERATE_ID, CustomSerdezID serdez_id=0, const char *provenance=NULL)
void allocate_fields(const std::vector< size_t > &field_sizes, std::vector< FieldID > &resulting_fields, CustomSerdezID serdez_id=0, bool local_fields=false, const char *provenance=NULL)
FieldSpace get_field_space(void) const
void free_fields(const std::set< FieldID > &to_free, const bool unordered=false, const char *provenance=NULL)
void free_field(FieldID fid, const bool unordered=false, const char *provenance=NULL)
Definition: legion.h:198
static const FieldSpace NO_SPACE
Definition: legion.h:200
Definition: legion.h:4518
Definition: legion.h:4949
Definition: legion.h:1172
static Future from_untyped_pointer(Runtime *rt, const void *buffer, size_t bytes, bool take_ownership=false)
size_t get_untyped_size(void) const
void get_void_result(bool silence_warnings=false, const char *warning_string=NULL) const
static Future from_value(Runtime *rt, const T &value)
T get_result(bool silence_warnings=false, const char *warning_string=NULL) const
const T & get_reference(bool silence_warnings=false, const char *warning_string=NULL) const
Span< T, PM > get_span(Memory::Kind memory, bool silence_warnings=false, const char *warning_string=NULL) const
const void * get_untyped_pointer(bool silence_warnings=false, const char *warning_string=NULL) const
bool is_empty(bool block=false, bool silence_warnings=false, const char *warning_string=NULL) const
const void * get_buffer(Memory::Kind memory, size_t *extent_in_bytes=NULL, bool check_extent=false, bool silence_warnings=false, const char *warning_string=NULL) const
const void * get_metadata(size_t *size=NULL) const
bool is_ready(bool subscribe=false) const
Definition: legion.h:1374
Domain get_future_map_domain(void) const
void get_void_result(const PT point[DIM]) const
T get_result(const DomainPoint &point, bool silence_warnings=false, const char *warning_string=NULL) const
void wait_all_results(bool silence_warnings=false, const char *warning_string=NULL) const
void get_void_result(const DomainPoint &point, bool silence_warnings=false, const char *warning_string=NULL) const
Future get_future(const PT point[DIM]) const
Future get_future(const DomainPoint &point) const
RT get_result(const PT point[DIM]) const
Definition: legion.h:749
Definition: legion.h:140
Definition: legion.h:174
Definition: legion.h:85
static const IndexSpace NO_SPACE
Definition: legion.h:87
Definition: legion.h:119
Definition: legion.h:4430
Definition: legion_types.h:2961
Definition: legion.h:4145
void legion_handoff_to_ext(void) const
PhaseBarrier get_legion_wait_phase_barrier(void) const
PhaseBarrier get_legion_arrive_phase_barrier(void) const
void ext_handoff_to_legion(void) const
void legion_wait_on_ext(void) const
void ext_wait_on_legion(void) const
void advance_legion_handshake(void) const
Definition: legion.h:704
Definition: legion.h:300
static const LogicalPartition NO_PART
Definition: legion.h:302
Definition: legion.h:338
Definition: legion.h:233
static const LogicalRegion NO_REGION
Definition: legion.h:235
Definition: legion.h:270
Definition: legion.h:4210
void legion_handoff_to_mpi(void) const
Definition: legion.h:4241
void mpi_handoff_to_legion(void) const
Definition: legion.h:4230
void legion_wait_on_mpi(void) const
Definition: legion.h:4246
void mpi_wait_on_legion(void) const
Definition: legion.h:4235
Definition: legion.h:4259
Definition: legion.h:4579
Definition: legion.h:3916
Definition: legion.h:3316
Definition: legion.h:4546
Definition: legion.h:796
Definition: legion.h:2537
LogicalRegion get_logical_region(void) const
void get_memories(std::set< Memory > &memories, bool silence_warnings=false, const char *warning_string=NULL) const
void wait_until_valid(bool silence_warnings=false, const char *warning_string=NULL)
PrivilegeMode get_privilege(void) const
bool is_valid(void) const
bool is_mapped(void) const
void get_fields(std::vector< FieldID > &fields) const
Definition: legion.h:3538
Definition: legion.h:3578
Definition: legion.h:4968
Definition: legion.h:645
Definition: legion.h:4661
virtual unsigned get_depth(void) const =0
virtual LogicalRegion project(const Mappable *mappable, unsigned index, LogicalPartition upper_bound, const DomainPoint &point)
virtual LogicalRegion project(LogicalPartition upper_bound, const DomainPoint &point, const Domain &launch_domain, const void *args, size_t size)
virtual LogicalRegion project(const Mappable *mappable, unsigned index, LogicalRegion upper_bound, const DomainPoint &point)
virtual LogicalRegion project(LogicalRegion upper_bound, const DomainPoint &point, const Domain &launch_domain)
virtual bool is_invertible(void) const
Definition: legion.h:4863
virtual LogicalRegion project(LogicalPartition upper_bound, const DomainPoint &point, const Domain &launch_domain)
virtual LogicalRegion project(LogicalRegion upper_bound, const DomainPoint &point, const Domain &launch_domain, const void *args, size_t size)
Definition: legion.h:3048
Definition: legion.h:4474
Definition: legion.h:5008
static void register_custom_serdez_op(CustomSerdezID serdez_id, bool permit_duplicates=false)
Context begin_implicit_task(TaskID top_task_id, MapperID mapper_id, Processor::Kind proc_kind, const char *task_name=NULL, bool control_replicable=false, unsigned shard_per_address_space=1, int shard_id=-1, DomainPoint shard_point=DomainPoint())
static int wait_for_shutdown(void)
void unbind_implicit_task_from_external_thread(Context ctx)
IndexSpace create_index_space(Context ctx, const std::vector< DomainPoint > &points, const char *provenance=NULL)
CustomSerdezID generate_dynamic_serdez_id(void)
static void set_return_code(int return_code)
static LegionHandshake create_external_handshake(bool init_in_ext=true, int ext_participants=1, int legion_participants=1)
IndexSpace create_index_space(Context ctx, size_t dimensions, const Future &f, TypeTag type_tag=0, const char *provenance=NULL)
static const SerdezOp * get_serdez_op(CustomSerdezID serdez_id)
static void configure_MPI_interoperability(int rank)
static void set_top_level_task_id(TaskID top_id)
IndexSpace union_index_spaces(Context ctx, const std::vector< IndexSpace > &spaces, const char *provenance=NULL)
CustomSerdezID generate_library_serdez_ids(const char *name, size_t count)
void finish_implicit_task(Context ctx, Realm::Event effects=Realm::Event::NO_EVENT)
static CustomSerdezID generate_static_serdez_id(void)
static int start(int argc, char **argv, bool background=false, bool supply_default_mapper=true, bool filter=false)
Future launch_top_level_task(const TaskLauncher &launcher)
static ProjectionID register_region_function(ProjectionID handle)
static ProjectionID register_partition_function(ProjectionID handle)
IndexSpace create_index_space(Context ctx, const std::vector< Domain > &rects, const char *provenance=NULL)
static void register_custom_serdez_op(CustomSerdezID serdez_id, SerdezOp *serdez_op, bool permit_duplicates=false)
IndexSpace intersect_index_spaces(Context ctx, const std::vector< IndexSpace > &spaces, const char *provenance=NULL)
static void set_top_level_task_mapper_id(MapperID mapper_id)
void bind_implicit_task_to_external_thread(Context ctx)
IndexSpace subtract_index_spaces(Context ctx, IndexSpace left, IndexSpace right, const char *provenance=NULL)
IndexSpace create_index_space(Context ctx, const Domain &bounds, TypeTag type_tag=0, const char *provenance=NULL)
static MPILegionHandshake create_handshake(bool init_in_MPI=true, int mpi_participants=1, int legion_participants=1)
static void perform_registration_callback(RegistrationCallbackFnptr callback, bool global, bool deduplicate=true, size_t dedup_tag=0)
static const char * get_legion_version(void)
static void initialize(int *argc, char ***argv, bool filter=false, bool parse=true)
static size_t get_maximum_dimension(void)
static void add_registration_callback(RegistrationCallbackFnptr callback, bool dedup=true, size_t dedup_tag=0)
Definition: legion.h:4899
Definition: legion_domain.h:738
Definition: legion.h:3613
Definition: legion.h:4330
Definition: legion_types.h:202
Definition: legion_types.h:3407
Definition: legion.h:513
Definition: legion.h:3860
Definition: legion.h:3716
void legion_task_preamble(const void *data, size_t datalen, realm_id_t proc_id, legion_task_t *taskptr, const legion_physical_region_t **regionptr, unsigned *num_regions_ptr, legion_context_t *ctxptr, legion_runtime_t *runtimeptr)
void legion_task_postamble(legion_runtime_t runtime, legion_context_t ctx, const void *retval, size_t retsize)
Definition: legion.h:3999
Definition: legion_domain.h:46
Definition: legion.h:2188
Definition: legion.h:1811
Definition: legion.h:2147
Definition: legion.h:1135
Definition: legion.h:1980
Definition: legion.h:2280
Definition: legion.h:1892
Definition: legion.h:2040
Definition: legion.h:1107
Definition: legion.h:1626
Definition: legion.h:1751
Definition: legion.h:4604
Definition: legion.h:2436
Definition: legion.h:728
Definition: legion.h:4106
Definition: legion.h:1067
IndexSpace color_space
Definition: legion.h:1097
FieldSpace field_space
Definition: legion.h:1094
bool global_indexing
Definition: legion.h:1095
bool valid_requirement
Definition: legion.h:1096
Definition: legion.h:2370
Definition: legion.h:864
ProjectionType handle_type
Definition: legion.h:992
std::set< FieldID > privilege_fields
Definition: legion.h:983
RegionRequirement & add_field(FieldID fid, bool instance=true)
RegionRequirement(LogicalPartition pid, ProjectionID _proj, const std::set< FieldID > &privilege_fields, const std::vector< FieldID > &instance_fields, PrivilegeMode _priv, CoherenceProperty _prop, LogicalRegion _parent, MappingTagID _tag=0, bool _verified=false)
RegionRequirement(LogicalRegion _handle, ProjectionID _proj, const std::set< FieldID > &privilege_fields, const std::vector< FieldID > &instance_fields, PrivilegeMode _priv, CoherenceProperty _prop, LogicalRegion _parent, MappingTagID _tag=0, bool _verified=false)
ProjectionID projection
Definition: legion.h:993
LogicalRegion parent
Definition: legion.h:987
void * projection_args
Definition: legion.h:995
std::vector< FieldID > instance_fields
Definition: legion.h:984
LogicalPartition partition
Definition: legion.h:982
MappingTagID tag
Definition: legion.h:989
CoherenceProperty prop
Definition: legion.h:986
ReductionOpID redop
Definition: legion.h:988
RegionRequirement(LogicalRegion _handle, const std::set< FieldID > &privilege_fields, const std::vector< FieldID > &instance_fields, ReductionOpID op, CoherenceProperty _prop, LogicalRegion _parent, MappingTagID _tag=0, bool _verified=false)
RegionRequirement(LogicalPartition pid, ProjectionID _proj, const std::set< FieldID > &privilege_fields, const std::vector< FieldID > &instance_fields, ReductionOpID op, CoherenceProperty _prop, LogicalRegion _parent, MappingTagID _tag=0, bool _verified=false)
PrivilegeMode privilege
Definition: legion.h:985
RegionRequirement(LogicalRegion _handle, ProjectionID _proj, const std::set< FieldID > &privilege_fields, const std::vector< FieldID > &instance_fields, ReductionOpID op, CoherenceProperty _prop, LogicalRegion _parent, MappingTagID _tag=0, bool _verified=false)
size_t projection_args_size
Definition: legion.h:996
RegionFlags flags
Definition: legion.h:990
RegionRequirement(LogicalRegion _handle, const std::set< FieldID > &privilege_fields, const std::vector< FieldID > &instance_fields, PrivilegeMode _priv, CoherenceProperty _prop, LogicalRegion _parent, MappingTagID _tag=0, bool _verified=false)
LogicalRegion region
Definition: legion.h:981
Definition: legion.h:4614
Definition: legion.h:4047
Definition: legion.h:1485
Definition: legion.h:4633
Definition: legion.h:1523
Definition: legion.h:2476
Definition: legion.h:2386
Definition: legion.h:2404