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 std::size_t hash(void) const;
100  inline IndexSpaceID get_id(void) const { return id; }
101  inline IndexTreeID get_tree_id(void) const { return tid; }
102  inline bool exists(void) const { return (id != 0); }
103  inline TypeTag get_type_tag(void) const { return type_tag; }
104  inline int get_dim(void) const;
105  protected:
106  friend std::ostream& operator<<(std::ostream& os,
107  const IndexSpace& is);
108  IndexSpaceID id;
109  IndexTreeID tid;
110  TypeTag type_tag;
111  };
112 
119  template<int DIM, typename COORD_T = coord_t>
120  class IndexSpaceT : public IndexSpace {
121  private:
122  static_assert(DIM > 0, "DIM must be positive");
123  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
124  protected:
125  // Only the runtime should be allowed to make these
126  FRIEND_ALL_RUNTIME_CLASSES
127  IndexSpaceT(IndexSpaceID id, IndexTreeID tid);
128  public:
129  IndexSpaceT(void);
130  explicit IndexSpaceT(const IndexSpace &rhs);
131  public:
132  inline IndexSpaceT& operator=(const IndexSpace &rhs);
133  };
134 
142  public:
143  static const IndexPartition NO_PART;
144  protected:
145  // Only the runtime should be allowed to make these
146  FRIEND_ALL_RUNTIME_CLASSES
147  IndexPartition(IndexPartitionID id, IndexTreeID tid, TypeTag tag);
148  public:
149  IndexPartition(void);
150  public:
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 bool operator>(const IndexPartition &rhs) const;
155  inline std::size_t hash(void) const;
156  inline IndexPartitionID get_id(void) const { return id; }
157  inline IndexTreeID get_tree_id(void) const { return tid; }
158  inline bool exists(void) const { return (id != 0); }
159  inline TypeTag get_type_tag(void) const { return type_tag; }
160  inline int get_dim(void) const;
161  protected:
162  friend std::ostream& operator<<(std::ostream& os,
163  const IndexPartition& ip);
164  IndexPartitionID id;
165  IndexTreeID tid;
166  TypeTag type_tag;
167  };
168 
175  template<int DIM, typename COORD_T = coord_t>
177  private:
178  static_assert(DIM > 0, "DIM must be positive");
179  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
180  protected:
181  // Only the runtime should be allowed to make these
182  FRIEND_ALL_RUNTIME_CLASSES
183  IndexPartitionT(IndexPartitionID id, IndexTreeID tid);
184  public:
185  IndexPartitionT(void);
186  explicit IndexPartitionT(const IndexPartition &rhs);
187  public:
188  inline IndexPartitionT& operator=(const IndexPartition &rhs);
189  };
190 
200  class FieldSpace {
201  public:
202  static const FieldSpace NO_SPACE;
203  protected:
204  // Only the runtime should be allowed to make these
205  FRIEND_ALL_RUNTIME_CLASSES
206  FieldSpace(FieldSpaceID id);
207  public:
208  FieldSpace(void);
209  public:
210  inline bool operator==(const FieldSpace &rhs) const;
211  inline bool operator!=(const FieldSpace &rhs) const;
212  inline bool operator<(const FieldSpace &rhs) const;
213  inline bool operator>(const FieldSpace &rhs) const;
214  inline std::size_t hash(void) const;
215  inline FieldSpaceID get_id(void) const { return id; }
216  inline bool exists(void) const { return (id != 0); }
217  private:
218  friend std::ostream& operator<<(std::ostream& os, const FieldSpace& fs);
219  FieldSpaceID id;
220  };
221 
237  public:
238  static const LogicalRegion NO_REGION;
239  protected:
240  // Only the runtime should be allowed to make these
241  FRIEND_ALL_RUNTIME_CLASSES
242  LogicalRegion(RegionTreeID tid, IndexSpace index, FieldSpace field);
243  public:
244  LogicalRegion(void);
245  public:
246  inline bool operator==(const LogicalRegion &rhs) const;
247  inline bool operator!=(const LogicalRegion &rhs) const;
248  inline bool operator<(const LogicalRegion &rhs) const;
249  std::size_t hash(void) const;
250  public:
251  inline IndexSpace get_index_space(void) const { return index_space; }
252  inline FieldSpace get_field_space(void) const { return field_space; }
253  inline RegionTreeID get_tree_id(void) const { return tree_id; }
254  inline bool exists(void) const { return (tree_id != 0); }
255  inline TypeTag get_type_tag(void) const
256  { return index_space.get_type_tag(); }
257  inline int get_dim(void) const { return index_space.get_dim(); }
258  protected:
259  friend std::ostream& operator<<(std::ostream& os,
260  const LogicalRegion& lr);
261  // These are private so the user can't just arbitrarily change them
262  RegionTreeID tree_id;
263  IndexSpace index_space;
264  FieldSpace field_space;
265  };
266 
273  template<int DIM, typename COORD_T = coord_t>
274  class LogicalRegionT : public LogicalRegion {
275  private:
276  static_assert(DIM > 0, "DIM must be positive");
277  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
278  protected:
279  // Only the runtime should be allowed to make these
280  FRIEND_ALL_RUNTIME_CLASSES
281  LogicalRegionT(RegionTreeID tid, IndexSpace index, FieldSpace field);
282  public:
283  LogicalRegionT(void);
284  explicit LogicalRegionT(const LogicalRegion &rhs);
285  public:
286  inline LogicalRegionT& operator=(const LogicalRegion &rhs);
287  };
288 
305  public:
306  static const LogicalPartition NO_PART;
307  protected:
308  // Only the runtime should be allowed to make these
309  FRIEND_ALL_RUNTIME_CLASSES
310  LogicalPartition(RegionTreeID tid, IndexPartition pid, FieldSpace field);
311  public:
312  LogicalPartition(void);
313  public:
314  inline bool operator==(const LogicalPartition &rhs) const;
315  inline bool operator!=(const LogicalPartition &rhs) const;
316  inline bool operator<(const LogicalPartition &rhs) const;
317  std::size_t hash(void) const;
318  public:
319  inline IndexPartition get_index_partition(void) const
320  { return index_partition; }
321  inline FieldSpace get_field_space(void) const { return field_space; }
322  inline RegionTreeID get_tree_id(void) const { return tree_id; }
323  inline bool exists(void) const { return (tree_id != 0); }
324  inline TypeTag get_type_tag(void) const
325  { return index_partition.get_type_tag(); }
326  inline int get_dim(void) const { return index_partition.get_dim(); }
327  protected:
328  friend std::ostream& operator<<(std::ostream& os,
329  const LogicalPartition& lp);
330  // These are private so the user can't just arbitrary change them
331  RegionTreeID tree_id;
332  IndexPartition index_partition;
333  FieldSpace field_space;
334  };
335 
342  template<int DIM, typename COORD_T = coord_t>
344  private:
345  static_assert(DIM > 0, "DIM must be positive");
346  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
347  protected:
348  // Only the runtime should be allowed to make these
349  FRIEND_ALL_RUNTIME_CLASSES
350  LogicalPartitionT(RegionTreeID tid, IndexPartition pid, FieldSpace field);
351  public:
352  LogicalPartitionT(void);
353  explicit LogicalPartitionT(const LogicalPartition &rhs);
354  public:
355  inline LogicalPartitionT& operator=(const LogicalPartition &rhs);
356  };
357 
358  //==========================================================================
359  // Data Allocation Classes
360  //==========================================================================
361 
378  class FieldAllocator : public Unserializable<FieldAllocator> {
379  public:
380  FieldAllocator(void);
381  FieldAllocator(const FieldAllocator &allocator);
382  FieldAllocator(FieldAllocator &&allocator) noexcept;
383  ~FieldAllocator(void);
384  protected:
385  FRIEND_ALL_RUNTIME_CLASSES
386  // Only the Runtime should be able to make these
387  FieldAllocator(Internal::FieldAllocatorImpl *impl);
388  public:
389  FieldAllocator& operator=(const FieldAllocator &allocator);
390  FieldAllocator& operator=(FieldAllocator &&allocator) noexcept;
391  inline bool operator<(const FieldAllocator &rhs) const;
392  inline bool operator==(const FieldAllocator &rhs) const;
393  inline bool exists(void) const { return (impl != NULL); }
394  public:
396 
415  FieldID allocate_field(size_t 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);
420  FieldID allocate_field(const Future &field_size,
421  FieldID desired_fieldid = LEGION_AUTO_GENERATE_ID,
422  CustomSerdezID serdez_id = 0,
423  bool local_field = false,
424  const char *provenance = NULL);
426 
434  LEGION_DEPRECATED("We are considering removing support for freeing fields"
435  "in a future Legion release. Please contact the Legion developer's "
436  "list if field deletion is important for your application.")
437  void free_field(FieldID fid, const bool unordered = false,
438  const char *provenance = NULL);
439 
447  FieldID allocate_local_field(size_t field_size,
448  FieldID desired_fieldid = LEGION_AUTO_GENERATE_ID,
449  CustomSerdezID serdez_id = 0, const char *provenance = NULL);
451 
468  void allocate_fields(const std::vector<size_t> &field_sizes,
469  std::vector<FieldID> &resulting_fields,
470  CustomSerdezID serdez_id = 0,
471  bool local_fields = false,
472  const char *provenance = NULL);
473  void allocate_fields(const std::vector<Future> &field_sizes,
474  std::vector<FieldID> &resulting_fields,
475  CustomSerdezID serdez_id = 0,
476  bool local_fields = false,
477  const char *provenance = NULL);
479 
487  LEGION_DEPRECATED("We are considering removing support for freeing fields"
488  "in a future Legion release. Please contact the Legion developer's "
489  "list if field deletion is important for your application.")
490  void free_fields(const std::set<FieldID> &to_free,
491  const bool unordered = false,
492  const char *provenance = NULL);
500  void allocate_local_fields(const std::vector<size_t> &field_sizes,
501  std::vector<FieldID> &resulting_fields,
502  CustomSerdezID serdez_id = 0,
503  const char *provenance = NULL);
508  private:
509  Internal::FieldAllocatorImpl *impl;
510  };
511 
512  //==========================================================================
513  // Pass-By-Value Argument Classes
514  //==========================================================================
515 
525  public:
526  UntypedBuffer(void) : args(NULL), arglen(0) { }
527  UntypedBuffer(const void *arg, size_t argsize)
528  : args(const_cast<void*>(arg)), arglen(argsize) { }
529  UntypedBuffer(const UntypedBuffer &rhs)
530  : args(rhs.args), arglen(rhs.arglen) { }
531  UntypedBuffer(UntypedBuffer &&rhs) noexcept
532  : args(rhs.args), arglen(rhs.arglen) { }
533  public:
534  inline size_t get_size(void) const { return arglen; }
535  inline void* get_ptr(void) const { return args; }
536  public:
537  inline bool operator==(const UntypedBuffer &arg) const
538  { return (args == arg.args) && (arglen == arg.arglen); }
539  inline bool operator<(const UntypedBuffer &arg) const
540  { return (args < arg.args) && (arglen < arg.arglen); }
541  inline UntypedBuffer& operator=(const UntypedBuffer &rhs)
542  { args = rhs.args; arglen = rhs.arglen; return *this; }
543  inline UntypedBuffer& operator=(UntypedBuffer &&rhs) noexcept
544  { args = rhs.args; arglen = rhs.arglen; return *this; }
545  private:
546  void *args;
547  size_t arglen;
548  };
549  // This typedef is here for backwards compatibility since we
550  // used to call an UntypedBuffer a TaskArgument
551  typedef UntypedBuffer TaskArgument;
552 
563  class ArgumentMap : public Unserializable<ArgumentMap> {
564  public:
565  ArgumentMap(void);
566  ArgumentMap(const FutureMap &rhs);
567  ArgumentMap(const ArgumentMap &rhs);
568  ArgumentMap(ArgumentMap &&rhs) noexcept;
569  ~ArgumentMap(void);
570  public:
571  ArgumentMap& operator=(const FutureMap &rhs);
572  ArgumentMap& operator=(const ArgumentMap &rhs);
573  ArgumentMap& operator=(ArgumentMap &&rhs) noexcept;
574  inline bool operator==(const ArgumentMap &rhs) const
575  { return (impl == rhs.impl); }
576  inline bool operator<(const ArgumentMap &rhs) const
577  { return (impl < rhs.impl); }
578  inline bool exists(void) const { return (impl != NULL); }
579  public:
585  bool has_point(const DomainPoint &point);
592  void set_point(const DomainPoint &point, const UntypedBuffer &arg,
593  bool replace = true);
600  void set_point(const DomainPoint &point, const Future &f,
601  bool replace = true);
607  bool remove_point(const DomainPoint &point);
615  UntypedBuffer get_point(const DomainPoint &point) const;
616  public:
625  template<typename PT, unsigned DIM>
626  inline void set_point_arg(const PT point[DIM], const UntypedBuffer &arg,
627  bool replace = false);
633  template<typename PT, unsigned DIM>
634  inline bool remove_point(const PT point[DIM]);
635  private:
636  FRIEND_ALL_RUNTIME_CLASSES
637  Internal::ArgumentMapImpl *impl;
638  private:
639  explicit ArgumentMap(Internal::ArgumentMapImpl *i);
640  };
641 
642  //==========================================================================
643  // Predicate Classes
644  //==========================================================================
645 
656  class Predicate : public Unserializable<Predicate> {
657  public:
658  static const Predicate TRUE_PRED;
659  static const Predicate FALSE_PRED;
660  public:
661  Predicate(void);
662  Predicate(const Predicate &p);
663  Predicate(Predicate &&p) noexcept;
664  explicit Predicate(bool value);
665  ~Predicate(void);
666  protected:
667  FRIEND_ALL_RUNTIME_CLASSES
668  Internal::PredicateImpl *impl;
669  // Only the runtime should be allowed to make these
670  explicit Predicate(Internal::PredicateImpl *impl);
671  public:
672  Predicate& operator=(const Predicate &p);
673  Predicate& operator=(Predicate &&p) noexcept;
674  inline bool operator==(const Predicate &p) const;
675  inline bool operator<(const Predicate &p) const;
676  inline bool operator!=(const Predicate &p) const;
677  inline bool exists(void) const { return (impl != NULL); }
678  private:
679  bool const_value;
680  };
681 
682  //==========================================================================
683  // Simultaneous Coherence Synchronization Classes
684  //==========================================================================
685 
715  class Lock {
716  public:
717  Lock(void);
718  protected:
719  // Only the runtime is allowed to make non-empty locks
720  FRIEND_ALL_RUNTIME_CLASSES
721  Lock(Reservation r);
722  public:
723  bool operator<(const Lock &rhs) const;
724  bool operator==(const Lock &rhs) const;
725  public:
726  void acquire(unsigned mode = 0, bool exclusive = true);
727  void release(void);
728  private:
729  Reservation reservation_lock;
730  };
731 
739  struct LockRequest {
740  public:
741  LockRequest(Lock l, unsigned mode = 0, bool exclusive = true);
742  public:
743  Lock lock;
744  unsigned mode;
745  bool exclusive;
746  };
747 
760  class Grant {
761  public:
762  Grant(void);
763  Grant(const Grant &g);
764  ~Grant(void);
765  protected:
766  // Only the runtime is allowed to make non-empty grants
767  FRIEND_ALL_RUNTIME_CLASSES
768  explicit Grant(Internal::GrantImpl *impl);
769  public:
770  bool operator==(const Grant &g) const
771  { return impl == g.impl; }
772  bool operator<(const Grant &g) const
773  { return impl < g.impl; }
774  Grant& operator=(const Grant &g);
775  protected:
776  Internal::GrantImpl *impl;
777  };
778 
807  class PhaseBarrier {
808  public:
809  PhaseBarrier(void);
810  protected:
811  // Only the runtime is allowed to make non-empty phase barriers
812  FRIEND_ALL_RUNTIME_CLASSES
814  public:
815  bool operator<(const PhaseBarrier &rhs) const;
816  bool operator==(const PhaseBarrier &rhs) const;
817  bool operator!=(const PhaseBarrier &rhs) const;
818  public:
819  void arrive(unsigned count = 1);
820  void wait(void);
821  void alter_arrival_count(int delta);
822  Realm::Barrier get_barrier(void) const { return phase_barrier; }
823  bool exists(void) const;
824  protected:
825  Internal::ApBarrier phase_barrier;
826  friend std::ostream& operator<<(std::ostream& os, const PhaseBarrier& pb);
827  };
828 
844  public:
845  DynamicCollective(void);
846  protected:
847  // Only the runtime is allowed to make non-empty dynamic collectives
848  FRIEND_ALL_RUNTIME_CLASSES
849  DynamicCollective(Internal::ApBarrier b, ReductionOpID redop);
850  public:
851  // All the same operations as a phase barrier
852  void arrive(const void *value, size_t size, unsigned count = 1);
853  protected:
854  ReductionOpID redop;
855  };
856 
857  //==========================================================================
858  // Operation Requirement Classes
859  //==========================================================================
860 
876  public:
877  RegionRequirement(void);
882  const std::set<FieldID> &privilege_fields,
883  const std::vector<FieldID> &instance_fields,
884  PrivilegeMode _priv, CoherenceProperty _prop,
885  LogicalRegion _parent, MappingTagID _tag = 0,
886  bool _verified = false);
890  RegionRequirement(LogicalPartition pid, ProjectionID _proj,
891  const std::set<FieldID> &privilege_fields,
892  const std::vector<FieldID> &instance_fields,
893  PrivilegeMode _priv, CoherenceProperty _prop,
894  LogicalRegion _parent, MappingTagID _tag = 0,
895  bool _verified = false);
899  RegionRequirement(LogicalRegion _handle, ProjectionID _proj,
900  const std::set<FieldID> &privilege_fields,
901  const std::vector<FieldID> &instance_fields,
902  PrivilegeMode _priv, CoherenceProperty _prop,
903  LogicalRegion _parent, MappingTagID _tag = 0,
904  bool _verified = false);
910  const std::set<FieldID> &privilege_fields,
911  const std::vector<FieldID> &instance_fields,
912  ReductionOpID op, CoherenceProperty _prop,
913  LogicalRegion _parent, MappingTagID _tag = 0,
914  bool _verified = false);
918  RegionRequirement(LogicalPartition pid, ProjectionID _proj,
919  const std::set<FieldID> &privilege_fields,
920  const std::vector<FieldID> &instance_fields,
921  ReductionOpID op, CoherenceProperty _prop,
922  LogicalRegion _parent, MappingTagID _tag = 0,
923  bool _verified = false);
927  RegionRequirement(LogicalRegion _handle, ProjectionID _proj,
928  const std::set<FieldID> &privilege_fields,
929  const std::vector<FieldID> &instance_fields,
930  ReductionOpID op, CoherenceProperty _prop,
931  LogicalRegion _parent, MappingTagID _tag = 0,
932  bool _verified = false);
933  public:
934  // Analogous constructors without the privilege and instance fields
935  RegionRequirement(LogicalRegion _handle, PrivilegeMode _priv,
936  CoherenceProperty _prop, LogicalRegion _parent,
937  MappingTagID _tag = 0, bool _verified = false);
938  RegionRequirement(LogicalPartition pid, ProjectionID _proj,
939  PrivilegeMode _priv, CoherenceProperty _prop,
940  LogicalRegion _parent, MappingTagID _tag = 0,
941  bool _verified = false);
942  RegionRequirement(LogicalRegion _handle, ProjectionID _proj,
943  PrivilegeMode _priv, CoherenceProperty _prop,
944  LogicalRegion _parent, MappingTagID _tag = 0,
945  bool _verified = false);
946  RegionRequirement(LogicalRegion _handle, ReductionOpID op,
947  CoherenceProperty _prop, LogicalRegion _parent,
948  MappingTagID _tag = 0, bool _verified = false);
949  RegionRequirement(LogicalPartition pid, ProjectionID _proj,
950  ReductionOpID op, CoherenceProperty _prop,
951  LogicalRegion _parent, MappingTagID _tag = 0,
952  bool _verified = false);
953  RegionRequirement(LogicalRegion _handle, ProjectionID _proj,
954  ReductionOpID op, CoherenceProperty _prop,
955  LogicalRegion _parent, MappingTagID _tag = 0,
956  bool _verified = false);
957  public:
959  ~RegionRequirement(void);
960  RegionRequirement& operator=(const RegionRequirement &req);
961  public:
962  bool operator==(const RegionRequirement &req) const;
963  bool operator<(const RegionRequirement &req) const;
964  public:
970  inline RegionRequirement& add_field(FieldID fid, bool instance = true);
971  inline RegionRequirement& add_fields(const std::vector<FieldID>& fids,
972  bool instance = true);
973 
974  inline RegionRequirement& add_flags(RegionFlags new_flags);
975  public:
976  inline bool is_verified(void) const
977  { return (flags & LEGION_VERIFIED_FLAG); }
978  inline bool is_no_access(void) const
979  { return (flags & LEGION_NO_ACCESS_FLAG); }
980  inline bool is_restricted(void) const
981  { return (flags & LEGION_RESTRICTED_FLAG); }
982  LEGION_DEPRECATED("Premapping regions is no longer supported.")
983  inline bool must_premap(void) const
984  { return false; }
985  public:
986  const void* get_projection_args(size_t *size) const;
987  void set_projection_args(const void *args, size_t size, bool own = false);
988  public:
989  bool has_field_privilege(FieldID fid) const;
990  public:
991  // Fields used for controlling task launches
994  std::set<FieldID> privilege_fields;
995  std::vector<FieldID> instance_fields;
996  PrivilegeMode privilege;
997  CoherenceProperty prop;
999  ReductionOpID redop;
1000  MappingTagID tag;
1001  RegionFlags flags;
1002  public:
1003  ProjectionType handle_type;
1004  ProjectionID projection;
1005  public:
1008  };
1009 
1079  public:
1080  OutputRequirement(bool valid_requirement = false);
1082  OutputRequirement(FieldSpace field_space,
1083  const std::set<FieldID> &fields,
1084  int dim = 1,
1085  bool global_indexing = false);
1086  public:
1088  ~OutputRequirement(void);
1089  OutputRequirement& operator=(const RegionRequirement &req);
1090  OutputRequirement& operator=(const OutputRequirement &req);
1091  public:
1092  bool operator==(const OutputRequirement &req) const;
1093  bool operator<(const OutputRequirement &req) const;
1094  public:
1095  template <int DIM, typename COORD_T>
1096  void set_type_tag();
1097  // Specifies a projection functor id for this requirement.
1098  // For a projection output requirement, a color space must be specified.
1099  // The projection functor must be a bijective mapping from the launch
1100  // domain to the color space. This implies that the launch domain's
1101  // volume must be the same as the color space's.
1102  void set_projection(ProjectionID projection, IndexSpace color_space);
1103  public:
1104  TypeTag type_tag;
1109  };
1110 
1119  public:
1120  IndexSpace handle;
1121  AllocateMode privilege;
1122  IndexSpace parent;
1123  bool verified;
1124  public:
1125  IndexSpaceRequirement(void);
1127  AllocateMode _priv,
1128  IndexSpace _parent,
1129  bool _verified = false);
1130  public:
1131  bool operator<(const IndexSpaceRequirement &req) const;
1132  bool operator==(const IndexSpaceRequirement &req) const;
1133  };
1134 
1147  public:
1148  FieldSpace handle;
1149  AllocateMode privilege;
1150  bool verified;
1151  public:
1152  FieldSpaceRequirement(void);
1154  AllocateMode _priv,
1155  bool _verified = false);
1156  public:
1157  bool operator<(const FieldSpaceRequirement &req) const;
1158  bool operator==(const FieldSpaceRequirement &req) const;
1159  };
1160 
1161  //==========================================================================
1162  // Future Value Classes
1163  //==========================================================================
1164 
1183  class Future : public Unserializable<Future> {
1184  public:
1185  Future(void);
1186  Future(const Future &f);
1187  Future(Future &&f) noexcept;
1188  ~Future(void);
1189  private:
1190  Internal::FutureImpl *impl;
1191  protected:
1192  // Only the runtime should be allowed to make these
1193  FRIEND_ALL_RUNTIME_CLASSES
1194  explicit Future(Internal::FutureImpl *impl);
1195  public:
1196  inline bool exists(void) const { return (impl != NULL); }
1197  inline bool operator==(const Future &f) const
1198  { return impl == f.impl; }
1199  inline bool operator<(const Future &f) const
1200  { return impl < f.impl; }
1201  Future& operator=(const Future &f);
1202  Future& operator=(Future &&f) noexcept;
1203  std::size_t hash(void) const;
1204  public:
1213  template<typename T>
1214  inline T get_result(bool silence_warnings = false,
1215  const char *warning_string = NULL) const;
1221  void get_void_result(bool silence_warnings = false,
1222  const char *warning_string = NULL) const;
1234  bool is_empty(bool block = false, bool silence_warnings = false,
1235  const char *warning_string = NULL) const;
1243  bool is_ready(bool subscribe = false) const;
1244  public:
1259  template<typename T, PrivilegeMode PM = LEGION_READ_ONLY>
1260  Span<T,PM> get_span(Memory::Kind memory,
1261  bool silence_warnings = false,
1262  const char *warning_string = NULL) const;
1263 
1277  const void* get_buffer(Memory::Kind memory,
1278  size_t *extent_in_bytes = NULL,
1279  bool check_extent = false,
1280  bool silence_warnings = false,
1281  const char *warning_string = NULL) const;
1282 
1290  void get_memories(std::set<Memory> &memories,
1291  bool silence_warnings = false,
1292  const char *warning_string = NULL) const;
1293 
1307  template<typename T>
1308  LEGION_DEPRECATED("Use 'Future::get_span' instead")
1309  inline const T& get_reference(bool silence_warnings = false,
1310  const char *warning_string = NULL) const;
1321  LEGION_DEPRECATED("Use 'Future::get_buffer' instead")
1322  inline const void* get_untyped_pointer(bool silence_warnings = false,
1323  const char *warning_string = NULL) const;
1324 
1328  size_t get_untyped_size(void) const;
1329 
1338  const void* get_metadata(size_t *size = NULL) const;
1339  public:
1340  // These methods provide partial support the C++ future interface
1341  template<typename T>
1342  inline T get(void);
1343 
1344  inline bool valid(void) const;
1345 
1346  inline void wait(void) const;
1347  public:
1353  template<typename T>
1354  LEGION_DEPRECATED("Use the version without a runtime pointer argument")
1355  static inline Future from_value(Runtime *rt, const T &value);
1356  template<typename T>
1357  static inline Future from_value(const T &value);
1358 
1363  LEGION_DEPRECATED("Use the version without a runtime pointer argument")
1364  static Future from_untyped_pointer(Runtime *rt,
1365  const void *buffer, size_t bytes, bool take_ownership = false);
1366  static Future from_untyped_pointer(
1367  const void *buffer, size_t bytes, bool take_ownership = false,
1368  const char *provenance = NULL, bool shard_local = false);
1369  static Future from_value(const void *buffer, size_t bytes, bool owned,
1370  const Realm::ExternalInstanceResource &resource,
1371  void (*freefunc)(const Realm::ExternalInstanceResource&) = NULL,
1372  const char *provenance = NULL, bool shard_local = false);
1373  private:
1374  // This should only be available for accessor classes
1375  template<PrivilegeMode, typename, int, typename, typename, bool>
1376  friend class FieldAccessor;
1377  Realm::RegionInstance get_instance(Memory::Kind kind,
1378  size_t field_size, bool check_field_size,
1379  const char *warning_string, bool silence_warnings) const;
1380  void report_incompatible_accessor(const char *accessor_kind,
1381  Realm::RegionInstance instance) const;
1382  };
1383 
1398  public:
1399  FutureMap(void);
1400  FutureMap(const FutureMap &map);
1401  FutureMap(FutureMap &&map) noexcept;
1402  ~FutureMap(void);
1403  private:
1404  Internal::FutureMapImpl *impl;
1405  protected:
1406  // Only the runtime should be allowed to make these
1407  FRIEND_ALL_RUNTIME_CLASSES
1408  explicit FutureMap(Internal::FutureMapImpl *impl);
1409  public:
1410  inline bool exists(void) const { return (impl != NULL); }
1411  inline bool operator==(const FutureMap &f) const
1412  { return impl == f.impl; }
1413  inline bool operator<(const FutureMap &f) const
1414  { return impl < f.impl; }
1415  inline Future operator[](const DomainPoint &point) const
1416  { return get_future(point); }
1417  FutureMap& operator=(const FutureMap &f);
1418  FutureMap& operator=(FutureMap &&f) noexcept;
1419  std::size_t hash(void) const;
1420  public:
1429  template<typename T>
1430  inline T get_result(const DomainPoint &point,
1431  bool silence_warnings = false,
1432  const char *warning_string = NULL) const;
1440  Future get_future(const DomainPoint &point) const;
1448  void get_void_result(const DomainPoint &point,
1449  bool silence_warnings = false,
1450  const char *warning_string = NULL) const;
1451  public:
1459  template<typename RT, typename PT, unsigned DIM>
1460  inline RT get_result(const PT point[DIM]) const;
1469  template<typename PT, unsigned DIM>
1470  inline Future get_future(const PT point[DIM]) const;
1476  template<typename PT, unsigned DIM>
1477  inline void get_void_result(const PT point[DIM]) const;
1478  public:
1485  void wait_all_results(bool silence_warnings = false,
1486  const char *warning_string = NULL) const;
1487  public:
1494  };
1495 
1496 
1497  //==========================================================================
1498  // Operation Launcher Classes
1499  //==========================================================================
1500 
1509  struct StaticDependence : public Unserializable<StaticDependence> {
1510  public:
1511  StaticDependence(void);
1512  StaticDependence(unsigned previous_offset,
1513  unsigned previous_req_index,
1514  unsigned current_req_index,
1515  DependenceType dtype,
1516  bool validates = false,
1517  bool shard_only = false);
1518  public:
1519  inline void add_field(FieldID fid);
1520  public:
1521  // The relative offset from this operation to
1522  // previous operation in the stream of operations
1523  // (e.g. 1 is the operation launched immediately before)
1524  unsigned previous_offset;
1525  // Region requirement of the previous operation for the dependence
1526  unsigned previous_req_index;
1527  // Region requirement of the current operation for the dependence
1528  unsigned current_req_index;
1529  // The type of the dependence
1530  DependenceType dependence_type;
1531  // Whether this requirement validates the previous writer
1532  bool validates;
1533  // Whether this dependence is a shard-only dependence for
1534  // control replication or it depends on all other copies
1535  bool shard_only;
1536  // Fields that have the dependence
1537  std::set<FieldID> dependent_fields;
1538  };
1539 
1547  struct TaskLauncher {
1548  public:
1549  TaskLauncher(void);
1550  TaskLauncher(TaskID tid,
1551  UntypedBuffer arg,
1552  Predicate pred = Predicate::TRUE_PRED,
1553  MapperID id = 0,
1554  MappingTagID tag = 0,
1555  UntypedBuffer map_arg = UntypedBuffer(),
1556  const char *provenance = "");
1557  public:
1558  inline IndexSpaceRequirement&
1559  add_index_requirement(const IndexSpaceRequirement &req);
1560  inline RegionRequirement&
1561  add_region_requirement(const RegionRequirement &req);
1562  inline void add_field(unsigned idx, FieldID fid, bool inst = true);
1563  public:
1564  inline void add_future(Future f);
1565  inline void add_grant(Grant g);
1566  inline void add_wait_barrier(PhaseBarrier bar);
1567  inline void add_arrival_barrier(PhaseBarrier bar);
1568  inline void add_wait_handshake(LegionHandshake handshake);
1569  inline void add_arrival_handshake(LegionHandshake handshake);
1570  public:
1571  inline void set_predicate_false_future(Future f);
1572  inline void set_predicate_false_result(UntypedBuffer arg);
1573  public:
1574  inline void set_independent_requirements(bool independent);
1575  public:
1576  TaskID task_id;
1577  std::vector<IndexSpaceRequirement> index_requirements;
1578  std::vector<RegionRequirement> region_requirements;
1579  std::vector<Future> futures;
1580  std::vector<Grant> grants;
1581  std::vector<PhaseBarrier> wait_barriers;
1582  std::vector<PhaseBarrier> arrive_barriers;
1583  UntypedBuffer argument;
1584  Predicate predicate;
1585  MapperID map_id;
1586  MappingTagID tag;
1587  UntypedBuffer map_arg;
1588  DomainPoint point;
1589  // Only used in control replication contexts for
1590  // doing sharding. If left unspecified the runtime
1591  // will use an index space of size 1 containing 'point'
1592  IndexSpace sharding_space;
1593  public:
1594  // If the predicate is set to anything other than
1595  // Predicate::TRUE_PRED, then the application must
1596  // specify a value for the future in the case that
1597  // the predicate resolves to false. UntypedBuffer(NULL,0)
1598  // can be used if the task's return type is void.
1599  Future predicate_false_future;
1600  UntypedBuffer predicate_false_result;
1601  public:
1602  // Provenance string for the runtime and tools to use
1603  std::string provenance;
1604  public:
1605  // Inform the runtime about any static dependences
1606  // These will be ignored outside of static traces
1607  const std::vector<StaticDependence> *static_dependences;
1608  public:
1609  // Users can tell the runtime this task is eligible
1610  // for inlining by the mapper. This will invoke the
1611  // select_task_options call inline as part of the launch
1612  // logic for this task to allow the mapper to decide
1613  // whether to inline the task or not. Note that if the
1614  // mapper pre-empts during execution then resuming it
1615  // may take a long time if another long running task
1616  // gets scheduled on the processor that launched this task.
1617  bool enable_inlining;
1618  public:
1619  // In some cases users (most likely compilers) will want
1620  // to run a light-weight function (e.g. a continuation)
1621  // as a task that just depends on futures once those futures
1622  // are ready on a local processor where the parent task
1623  // is executing. We call this a local function task and it
1624  // must not have any region requirements. It must als be a
1625  // pure function with no side effects. This task will
1626  // not have the option of being distributed to remote nodes.
1627  bool local_function_task;
1628  public:
1629  // Users can inform the runtime that all region requirements
1630  // are independent of each other in this task. Independent
1631  // means that either field sets are independent or region
1632  // requirements are disjoint based on the region tree.
1633  bool independent_requirements;
1634  public:
1635  // Instruct the runtime that it does not need to produce
1636  // a future or future map result for this index task
1637  bool elide_future_return;
1638  public:
1639  bool silence_warnings;
1640  };
1641 
1651  public:
1652  IndexTaskLauncher(void);
1653  IndexTaskLauncher(TaskID tid,
1654  Domain domain,
1655  UntypedBuffer global_arg,
1656  ArgumentMap map,
1657  Predicate pred = Predicate::TRUE_PRED,
1658  bool must = false,
1659  MapperID id = 0,
1660  MappingTagID tag = 0,
1661  UntypedBuffer map_arg = UntypedBuffer(),
1662  const char *provenance = "");
1663  IndexTaskLauncher(TaskID tid,
1664  IndexSpace launch_space,
1665  UntypedBuffer global_arg,
1666  ArgumentMap map,
1667  Predicate pred = Predicate::TRUE_PRED,
1668  bool must = false,
1669  MapperID id = 0,
1670  MappingTagID tag = 0,
1671  UntypedBuffer map_arg = UntypedBuffer(),
1672  const char *provenance = "");
1673  public:
1674  inline IndexSpaceRequirement&
1675  add_index_requirement(const IndexSpaceRequirement &req);
1676  inline RegionRequirement&
1677  add_region_requirement(const RegionRequirement &req);
1678  inline void add_field(unsigned idx, FieldID fid, bool inst = true);
1679  public:
1680  inline void add_future(Future f);
1681  inline void add_grant(Grant g);
1682  inline void add_wait_barrier(PhaseBarrier bar);
1683  inline void add_arrival_barrier(PhaseBarrier bar);
1684  inline void add_wait_handshake(LegionHandshake handshake);
1685  inline void add_arrival_handshake(LegionHandshake handshake);
1686  public:
1687  inline void set_predicate_false_future(Future f);
1688  inline void set_predicate_false_result(UntypedBuffer arg);
1689  public:
1690  inline void set_independent_requirements(bool independent);
1691  public:
1692  TaskID task_id;
1693  Domain launch_domain;
1694  IndexSpace launch_space;
1695  // Will only be used in control replication context. If left
1696  // unset the runtime will use launch_domain/launch_space
1697  IndexSpace sharding_space;
1698  std::vector<IndexSpaceRequirement> index_requirements;
1699  std::vector<RegionRequirement> region_requirements;
1700  std::vector<Future> futures;
1701  // These are appended to the futures for the point
1702  // task after the futures sent to all points above
1703  std::vector<ArgumentMap> point_futures;
1704  std::vector<Grant> grants;
1705  std::vector<PhaseBarrier> wait_barriers;
1706  std::vector<PhaseBarrier> arrive_barriers;
1707  UntypedBuffer global_arg;
1708  ArgumentMap argument_map;
1709  Predicate predicate;
1710  // Specify that all the point tasks in this index launch be
1711  // able to run concurrently, meaning they all must map to
1712  // different processors and they cannot have interfering region
1713  // requirements that might lead to dependences. Note that the
1714  // runtime guarantees that concurrent index launches will not
1715  // deadlock with other concurrent index launches which requires
1716  // additional analysis. Currently concurrent index space launches
1717  // will only be allowed to map to leaf task variants currently.
1718  bool concurrent;
1719  // This will convert this index space launch into a must
1720  // epoch launch which supports interfering region requirements
1721  bool must_parallelism;
1722  MapperID map_id;
1723  MappingTagID tag;
1724  UntypedBuffer map_arg;
1725  public:
1726  // If the predicate is set to anything other than
1727  // Predicate::TRUE_PRED, then the application must
1728  // specify a value for the future in the case that
1729  // the predicate resolves to false. UntypedBuffer(NULL,0)
1730  // can be used if the task's return type is void.
1731  Future predicate_false_future;
1732  UntypedBuffer predicate_false_result;
1733  public:
1734  // Provenance string for the runtime and tools to use
1735  std::string provenance;
1736  public:
1737  // Inform the runtime about any static dependences
1738  // These will be ignored outside of static traces
1739  const std::vector<StaticDependence> *static_dependences;
1740  public:
1741  // Users can tell the runtime this task is eligible
1742  // for inlining by the mapper. This will invoke the
1743  // select_task_options call inline as part of the launch
1744  // logic for this task to allow the mapper to decide
1745  // whether to inline the task or not. Note that if the
1746  // mapper pre-empts during execution then resuming it
1747  // may take a long time if another long running task
1748  // gets scheduled on the processor that launched this task.
1749  bool enable_inlining;
1750  public:
1751  // Users can inform the runtime that all region requirements
1752  // are independent of each other in this task. Independent
1753  // means that either field sets are independent or region
1754  // requirements are disjoint based on the region tree.
1755  bool independent_requirements;
1756  public:
1757  // Instruct the runtime that it does not need to produce
1758  // a future or future map result for this index task
1759  bool elide_future_return;
1760  public:
1761  bool silence_warnings;
1762  public:
1763  // Initial value for reduction
1764  Future initial_value;
1765  };
1766 
1776  public:
1777  InlineLauncher(void);
1778  InlineLauncher(const RegionRequirement &req,
1779  MapperID id = 0,
1780  MappingTagID tag = 0,
1781  LayoutConstraintID layout_id = 0,
1782  UntypedBuffer map_arg = UntypedBuffer(),
1783  const char *provenance = "");
1784  public:
1785  inline void add_field(FieldID fid, bool inst = true);
1786  public:
1787  inline void add_grant(Grant g);
1788  inline void add_wait_barrier(PhaseBarrier bar);
1789  inline void add_arrival_barrier(PhaseBarrier bar);
1790  inline void add_wait_handshake(LegionHandshake handshake);
1791  inline void add_arrival_handshake(LegionHandshake handshake);
1792  public:
1793  RegionRequirement requirement;
1794  std::vector<Grant> grants;
1795  std::vector<PhaseBarrier> wait_barriers;
1796  std::vector<PhaseBarrier> arrive_barriers;
1797  MapperID map_id;
1798  MappingTagID tag;
1799  UntypedBuffer map_arg;
1800  public:
1801  LayoutConstraintID layout_constraint_id;
1802  public:
1803  // Provenance string for the runtime and tools to use
1804  std::string provenance;
1805  public:
1806  // Inform the runtime about any static dependences
1807  // These will be ignored outside of static traces
1808  const std::vector<StaticDependence> *static_dependences;
1809  };
1810 
1835  struct CopyLauncher {
1836  public:
1837  CopyLauncher(Predicate pred = Predicate::TRUE_PRED,
1838  MapperID id = 0, MappingTagID tag = 0,
1839  UntypedBuffer map_arg = UntypedBuffer(),
1840  const char *provenance = "");
1841  public:
1842  inline unsigned add_copy_requirements(const RegionRequirement &src,
1843  const RegionRequirement &dst);
1844  inline void add_src_field(unsigned idx, FieldID fid, bool inst = true);
1845  inline void add_dst_field(unsigned idx, FieldID fid, bool inst = true);
1846  public:
1847  // Specify src/dst indirect requirements (must have exactly 1 field)
1848  inline void add_src_indirect_field(FieldID src_idx_fid,
1849  const RegionRequirement &src_idx_req,
1850  bool is_range_indirection = false,
1851  bool inst = true);
1852  inline void add_dst_indirect_field(FieldID dst_idx_fid,
1853  const RegionRequirement &dst_idx_req,
1854  bool is_range_indirection = false,
1855  bool inst = true);
1856  inline RegionRequirement& add_src_indirect_field(
1857  const RegionRequirement &src_idx_req,
1858  bool is_range_indirection = false);
1859  inline RegionRequirement& add_dst_indirect_field(
1860  const RegionRequirement &dst_idx_req,
1861  bool is_range_indirection = false);
1862  public:
1863  inline void add_grant(Grant g);
1864  inline void add_wait_barrier(PhaseBarrier bar);
1865  inline void add_arrival_barrier(PhaseBarrier bar);
1866  inline void add_wait_handshake(LegionHandshake handshake);
1867  inline void add_arrival_handshake(LegionHandshake handshake);
1868  public:
1869  std::vector<RegionRequirement> src_requirements;
1870  std::vector<RegionRequirement> dst_requirements;
1871  std::vector<RegionRequirement> src_indirect_requirements;
1872  std::vector<RegionRequirement> dst_indirect_requirements;
1873  std::vector<bool> src_indirect_is_range;
1874  std::vector<bool> dst_indirect_is_range;
1875  std::vector<Grant> grants;
1876  std::vector<PhaseBarrier> wait_barriers;
1877  std::vector<PhaseBarrier> arrive_barriers;
1878  Predicate predicate;
1879  MapperID map_id;
1880  MappingTagID tag;
1881  UntypedBuffer map_arg;
1882  DomainPoint point;
1883  // Only used in control replication contexts for
1884  // doing sharding. If left unspecified the runtime
1885  // will use an index space of size 1 containing 'point'
1886  IndexSpace sharding_space;
1887  public:
1888  // Provenance string for the runtime and tools to use
1889  std::string provenance;
1890  public:
1891  // Inform the runtime about any static dependences
1892  // These will be ignored outside of static traces
1893  const std::vector<StaticDependence> *static_dependences;
1894  public:
1895  // Whether the source and destination indirections can lead
1896  // to out-of-range access into the instances to skip
1897  bool possible_src_indirect_out_of_range;
1898  bool possible_dst_indirect_out_of_range;
1899  // Whether the destination indirection can lead to aliasing
1900  // in the destination instances requiring synchronization
1901  bool possible_dst_indirect_aliasing;
1902  public:
1903  bool silence_warnings;
1904  };
1905 
1917  public:
1918  IndexCopyLauncher(void);
1919  IndexCopyLauncher(Domain domain, Predicate pred = Predicate::TRUE_PRED,
1920  MapperID id = 0, MappingTagID tag = 0,
1921  UntypedBuffer map_arg = UntypedBuffer(),
1922  const char *provenance = "");
1923  IndexCopyLauncher(IndexSpace space, Predicate pred = Predicate::TRUE_PRED,
1924  MapperID id = 0, MappingTagID tag = 0,
1925  UntypedBuffer map_arg = UntypedBuffer(),
1926  const char *provenance = "");
1927  public:
1928  inline unsigned add_copy_requirements(const RegionRequirement &src,
1929  const RegionRequirement &dst);
1930  inline void add_src_field(unsigned idx, FieldID fid, bool inst = true);
1931  inline void add_dst_field(unsigned idx, FieldID fid, bool inst = true);
1932  public:
1933  // Specify src/dst indirect requirements (must have exactly 1 field)
1934  inline void add_src_indirect_field(FieldID src_idx_fid,
1935  const RegionRequirement &src_idx_req,
1936  bool is_range_indirection = false,
1937  bool inst = true);
1938  inline void add_dst_indirect_field(FieldID dst_idx_fid,
1939  const RegionRequirement &dst_idx_req,
1940  bool is_range_indirection = false,
1941  bool inst = true);
1942  inline RegionRequirement& add_src_indirect_field(
1943  const RegionRequirement &src_idx_req,
1944  bool is_range_indirection = false);
1945  inline RegionRequirement& add_dst_indirect_field(
1946  const RegionRequirement &dst_idx_req,
1947  bool is_range_indirection = false);
1948  public:
1949  inline void add_grant(Grant g);
1950  inline void add_wait_barrier(PhaseBarrier bar);
1951  inline void add_arrival_barrier(PhaseBarrier bar);
1952  inline void add_wait_handshake(LegionHandshake handshake);
1953  inline void add_arrival_handshake(LegionHandshake handshake);
1954  public:
1955  std::vector<RegionRequirement> src_requirements;
1956  std::vector<RegionRequirement> dst_requirements;
1957  std::vector<RegionRequirement> src_indirect_requirements;
1958  std::vector<RegionRequirement> dst_indirect_requirements;
1959  std::vector<bool> src_indirect_is_range;
1960  std::vector<bool> dst_indirect_is_range;
1961  std::vector<Grant> grants;
1962  std::vector<PhaseBarrier> wait_barriers;
1963  std::vector<PhaseBarrier> arrive_barriers;
1964  Domain launch_domain;
1965  IndexSpace launch_space;
1966  // Will only be used in control replication context. If left
1967  // unset the runtime will use launch_domain/launch_space
1968  IndexSpace sharding_space;
1969  Predicate predicate;
1970  MapperID map_id;
1971  MappingTagID tag;
1972  UntypedBuffer map_arg;
1973  public:
1974  // Provenance string for the runtime and tools to use
1975  std::string provenance;
1976  public:
1977  // Inform the runtime about any static dependences
1978  // These will be ignored outside of static traces
1979  const std::vector<StaticDependence> *static_dependences;
1980  public:
1981  // Whether the source and destination indirections can lead
1982  // to out-of-range access into the instances to skip
1983  bool possible_src_indirect_out_of_range;
1984  bool possible_dst_indirect_out_of_range;
1985  // Whether the destination indirection can lead to aliasing
1986  // in the destination instances requiring synchronization
1987  bool possible_dst_indirect_aliasing;
1988  // Whether the individual point copies should operate collectively
1989  // together in the case of indirect copies (e.g. allow indirections
1990  // to refer to instances from other points). These settings have
1991  // no effect in the case of copies without indirections.
1992  bool collective_src_indirect_points;
1993  bool collective_dst_indirect_points;
1994  public:
1995  bool silence_warnings;
1996  };
1997 
2004  struct FillLauncher {
2005  public:
2006  FillLauncher(void);
2007  FillLauncher(LogicalRegion handle, LogicalRegion parent,
2008  UntypedBuffer arg, Predicate pred = Predicate::TRUE_PRED,
2009  MapperID id = 0, MappingTagID tag = 0,
2010  UntypedBuffer map_arg = UntypedBuffer(),
2011  const char *provenance = "");
2012  FillLauncher(LogicalRegion handle, LogicalRegion parent,
2013  Future f, Predicate pred = Predicate::TRUE_PRED,
2014  MapperID id = 0, MappingTagID tag = 0,
2015  UntypedBuffer map_arg = UntypedBuffer(),
2016  const char *provenance = "");
2017  public:
2018  inline void set_argument(UntypedBuffer arg);
2019  inline void set_future(Future f);
2020  inline void add_field(FieldID fid);
2021  inline void add_grant(Grant g);
2022  inline void add_wait_barrier(PhaseBarrier bar);
2023  inline void add_arrival_barrier(PhaseBarrier bar);
2024  inline void add_wait_handshake(LegionHandshake handshake);
2025  inline void add_arrival_handshake(LegionHandshake handshake);
2026  public:
2027  LogicalRegion handle;
2028  LogicalRegion parent;
2029  UntypedBuffer argument;
2030  Future future;
2031  Predicate predicate;
2032  std::set<FieldID> fields;
2033  std::vector<Grant> grants;
2034  std::vector<PhaseBarrier> wait_barriers;
2035  std::vector<PhaseBarrier> arrive_barriers;
2036  MapperID map_id;
2037  MappingTagID tag;
2038  UntypedBuffer map_arg;
2039  DomainPoint point;
2040  // Only used in control replication contexts for
2041  // doing sharding. If left unspecified the runtime
2042  // will use an index space of size 1 containing 'point'
2043  IndexSpace sharding_space;
2044  public:
2045  // Provenance string for the runtime and tools to use
2046  std::string provenance;
2047  public:
2048  // Inform the runtime about any static dependences
2049  // These will be ignored outside of static traces
2050  const std::vector<StaticDependence> *static_dependences;
2051  public:
2052  bool silence_warnings;
2053  };
2054 
2065  public:
2066  IndexFillLauncher(void);
2067  // Region projection
2068  IndexFillLauncher(Domain domain, LogicalRegion handle,
2069  LogicalRegion parent, UntypedBuffer arg,
2070  ProjectionID projection = 0,
2071  Predicate pred = Predicate::TRUE_PRED,
2072  MapperID id = 0, MappingTagID tag = 0,
2073  UntypedBuffer map_arg = UntypedBuffer(),
2074  const char *provenance = "");
2075  IndexFillLauncher(Domain domain, LogicalRegion handle,
2076  LogicalRegion parent, Future f,
2077  ProjectionID projection = 0,
2078  Predicate pred = Predicate::TRUE_PRED,
2079  MapperID id = 0, MappingTagID tag = 0,
2080  UntypedBuffer map_arg = UntypedBuffer(),
2081  const char *provenance = "");
2083  LogicalRegion parent, UntypedBuffer arg,
2084  ProjectionID projection = 0,
2085  Predicate pred = Predicate::TRUE_PRED,
2086  MapperID id = 0, MappingTagID tag = 0,
2087  UntypedBuffer map_arg = UntypedBuffer(),
2088  const char *provenance = "");
2090  LogicalRegion parent, Future f,
2091  ProjectionID projection = 0,
2092  Predicate pred = Predicate::TRUE_PRED,
2093  MapperID id = 0, MappingTagID tag = 0,
2094  UntypedBuffer map_arg = UntypedBuffer(),
2095  const char *provenance = "");
2096  // Partition projection
2097  IndexFillLauncher(Domain domain, LogicalPartition handle,
2098  LogicalRegion parent, UntypedBuffer arg,
2099  ProjectionID projection = 0,
2100  Predicate pred = Predicate::TRUE_PRED,
2101  MapperID id = 0, MappingTagID tag = 0,
2102  UntypedBuffer map_arg = UntypedBuffer(),
2103  const char *provenance = "");
2104  IndexFillLauncher(Domain domain, LogicalPartition handle,
2105  LogicalRegion parent, Future f,
2106  ProjectionID projection = 0,
2107  Predicate pred = Predicate::TRUE_PRED,
2108  MapperID id = 0, MappingTagID tag = 0,
2109  UntypedBuffer map_arg = UntypedBuffer(),
2110  const char *provenance = "");
2112  LogicalRegion parent, UntypedBuffer arg,
2113  ProjectionID projection = 0,
2114  Predicate pred = Predicate::TRUE_PRED,
2115  MapperID id = 0, MappingTagID tag = 0,
2116  UntypedBuffer map_arg = UntypedBuffer(),
2117  const char *provenance = "");
2119  LogicalRegion parent, Future f,
2120  ProjectionID projection = 0,
2121  Predicate pred = Predicate::TRUE_PRED,
2122  MapperID id = 0, MappingTagID tag = 0,
2123  UntypedBuffer map_arg = UntypedBuffer(),
2124  const char *provenance = "");
2125  public:
2126  inline void set_argument(UntypedBuffer arg);
2127  inline void set_future(Future f);
2128  inline void add_field(FieldID fid);
2129  inline void add_grant(Grant g);
2130  inline void add_wait_barrier(PhaseBarrier bar);
2131  inline void add_arrival_barrier(PhaseBarrier bar);
2132  inline void add_wait_handshake(LegionHandshake handshake);
2133  inline void add_arrival_handshake(LegionHandshake handshake);
2134  public:
2135  Domain launch_domain;
2136  IndexSpace launch_space;
2137  // Will only be used in control replication context. If left
2138  // unset the runtime will use launch_domain/launch_space
2139  IndexSpace sharding_space;
2140  LogicalRegion region;
2141  LogicalPartition partition;
2142  LogicalRegion parent;
2143  ProjectionID projection;
2144  UntypedBuffer argument;
2145  Future future;
2146  Predicate predicate;
2147  std::set<FieldID> fields;
2148  std::vector<Grant> grants;
2149  std::vector<PhaseBarrier> wait_barriers;
2150  std::vector<PhaseBarrier> arrive_barriers;
2151  MapperID map_id;
2152  MappingTagID tag;
2153  UntypedBuffer map_arg;
2154  public:
2155  // Provenance string for the runtime and tools to use
2156  std::string provenance;
2157  public:
2158  // Inform the runtime about any static dependences
2159  // These will be ignored outside of static traces
2160  const std::vector<StaticDependence> *static_dependences;
2161  public:
2162  bool silence_warnings;
2163  };
2164 
2172  public:
2174  public:
2175  inline void add_field(FieldID fid);
2176  public:
2177  LogicalRegion handle;
2178  LogicalRegion parent;
2179  std::set<FieldID> fields;
2180  public:
2181  // Provenance string for the runtime and tools to use
2182  std::string provenance;
2183  public:
2184  // Inform the runtime about any static dependences
2185  // These will be ignored outside of static traces
2186  const std::vector<StaticDependence> *static_dependences;
2187  public:
2188  bool silence_warnings;
2189  };
2190 
2213  public:
2214  AttachLauncher(ExternalResource resource,
2215  LogicalRegion handle, LogicalRegion parent,
2216  const bool restricted = true,
2217  const bool mapped = true);
2218  // Declared here to avoid superfluous compiler warnings
2219  // Can be remove after deprecated members are removed
2220  ~AttachLauncher(void);
2221  public:
2222  inline void initialize_constraints(bool column_major, bool soa,
2223  const std::vector<FieldID> &fields,
2224  const std::map<FieldID,size_t> *alignments = NULL);
2225  LEGION_DEPRECATED("Use Realm::ExternalFileResource instead")
2226  inline void attach_file(const char *file_name,
2227  const std::vector<FieldID> &fields,
2228  LegionFileMode mode);
2229  LEGION_DEPRECATED("Use Realm::ExternalHDF5Resource instead")
2230  inline void attach_hdf5(const char *file_name,
2231  const std::map<FieldID,const char*> &field_map,
2232  LegionFileMode mode);
2233  // Helper methods for AOS and SOA arrays, but it is totally
2234  // acceptable to fill in the layout constraint set manually
2235  LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2236  inline void attach_array_aos(void *base, bool column_major,
2237  const std::vector<FieldID> &fields,
2238  Memory memory = Memory::NO_MEMORY,
2239  const std::map<FieldID,size_t> *alignments = NULL);
2240  LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2241  inline void attach_array_soa(void *base, bool column_major,
2242  const std::vector<FieldID> &fields,
2243  Memory memory = Memory::NO_MEMORY,
2244  const std::map<FieldID,size_t> *alignments = NULL);
2245  public:
2246  ExternalResource resource;
2247  LogicalRegion parent;
2248  LogicalRegion handle;
2249  std::set<FieldID> privilege_fields;
2250  public:
2251  // This will be cloned each time you perform an attach with this launcher
2252  const Realm::ExternalInstanceResource* external_resource;
2253  public:
2254  LayoutConstraintSet constraints;
2255  public:
2256  // Whether this instance will be restricted when attached
2257  bool restricted /*= true*/;
2258  // Whether this region should be mapped by the calling task
2259  bool mapped; /*= true*/
2260  // Only matters for control replicated parent tasks
2261  // Indicate whether all the shards are providing the same data
2262  // or whether they are each providing different data
2263  // Collective means that each shard provides its own copy of the
2264  // data and non-collective means every shard provides the same data
2265  // Defaults to 'true' for external instances and 'false' for files
2266  bool collective;
2267  // For collective cases, indicate whether the runtime should
2268  // deduplicate data across shards in the same process
2269  // This is useful for cases where there is one file or external
2270  // instance per process but multiple shards per process
2271  bool deduplicate_across_shards;
2272  public:
2273  // Provenance string for the runtime and tools to use
2274  std::string provenance;
2275  public:
2276  // Data for files
2277  LEGION_DEPRECATED("file_name is deprecated, use external_resource")
2278  const char *file_name;
2279  LEGION_DEPRECATED("mode is deprecated, use external_resource")
2280  LegionFileMode mode;
2281  LEGION_DEPRECATED("file_fields is deprecated, use external_resource")
2282  std::vector<FieldID> file_fields; // normal files
2283  // This member must still be populated if you're attaching to an HDF5 file
2284  std::map<FieldID,/*file name*/const char*> field_files; // hdf5 files
2285  public:
2286  // Optional footprint of the instance in memory in bytes
2287  size_t footprint;
2288  public:
2289  // Inform the runtime about any static dependences
2290  // These will be ignored outside of static traces
2291  const std::vector<StaticDependence> *static_dependences;
2292  };
2293 
2305  public:
2306  IndexAttachLauncher(ExternalResource resource,
2307  LogicalRegion parent,
2308  const bool restricted = true);
2309  // Declared here to avoid superfluous compiler warnings
2310  // Can be remove after deprecated members are removed
2311  ~IndexAttachLauncher(void);
2312  public:
2313  inline void initialize_constraints(bool column_major, bool soa,
2314  const std::vector<FieldID> &fields,
2315  const std::map<FieldID,size_t> *alignments = NULL);
2316  inline void add_external_resource(LogicalRegion handle,
2317  const Realm::ExternalInstanceResource *resource);
2318  LEGION_DEPRECATED("Use Realm::ExternalFileResource instead")
2319  inline void attach_file(LogicalRegion handle,
2320  const char *file_name,
2321  const std::vector<FieldID> &fields,
2322  LegionFileMode mode);
2323  LEGION_DEPRECATED("Use Realm::ExternalHDF5Resource instead")
2324  inline void attach_hdf5(LogicalRegion handle,
2325  const char *file_name,
2326  const std::map<FieldID,const char*> &field_map,
2327  LegionFileMode mode);
2328  // Helper methods for AOS and SOA arrays, but it is totally
2329  // acceptable to fill in the layout constraint set manually
2330  LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2331  inline void attach_array_aos(LogicalRegion handle,
2332  void *base, bool column_major,
2333  const std::vector<FieldID> &fields,
2334  Memory memory = Memory::NO_MEMORY,
2335  const std::map<FieldID,size_t> *alignments = NULL);
2336  LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2337  inline void attach_array_soa(LogicalRegion handle,
2338  void *base, bool column_major,
2339  const std::vector<FieldID> &fields,
2340  Memory memory = Memory::NO_MEMORY,
2341  const std::map<FieldID,size_t> *alignments = NULL);
2342  public:
2343  ExternalResource resource;
2344  LogicalRegion parent;
2345  std::set<FieldID> privilege_fields;
2346  std::vector<LogicalRegion> handles;
2347  // This is the vector external resource objects that are going to
2348  // attached to the vector of logical region handles
2349  // These will be cloned each time you perform an attach with this launcher
2350  std::vector<const Realm::ExternalInstanceResource*> external_resources;
2351  public:
2352  LayoutConstraintSet constraints;
2353  public:
2354  // Whether these instances will be restricted when attached
2355  bool restricted /*= true*/;
2356  // Whether the runtime should check for duplicate resources across
2357  // the shards in a control replicated context, it is illegal to pass
2358  // in the same resource to different shards if this is set to false
2359  bool deduplicate_across_shards;
2360  public:
2361  // Provenance string for the runtime and tools to use
2362  std::string provenance;
2363  public:
2364  // Data for files
2365  LEGION_DEPRECATED("mode is deprecated, use external_resources")
2366  LegionFileMode mode;
2367  LEGION_DEPRECATED("file_names is deprecated, use external_resources")
2368  std::vector<const char*> file_names;
2369  LEGION_DEPRECATED("file_fields is deprecated, use external_resources")
2370  std::vector<FieldID> file_fields; // normal files
2371  // This data structure must still be filled in for using HDF5 files
2372  std::map<FieldID,
2373  std::vector</*file name*/const char*> > field_files; // hdf5 files
2374  public:
2375  // Data for external instances
2376  LEGION_DEPRECATED("pointers is deprecated, use external_resources")
2377  std::vector<PointerConstraint> pointers;
2378  public:
2379  // Optional footprint of the instance in memory in bytes
2380  // You only need to fill this in when using depcreated fields
2381  std::vector<size_t> footprint;
2382  public:
2383  // Inform the runtime about any static dependences
2384  // These will be ignored outside of static traces
2385  const std::vector<StaticDependence> *static_dependences;
2386  };
2387 
2395  public:
2396  explicit PredicateLauncher(bool and_op = true);
2397  public:
2398  inline void add_predicate(const Predicate &pred);
2399  public:
2400  bool and_op; // if not 'and' then 'or'
2401  std::vector<Predicate> predicates;
2402  std::string provenance;
2403  };
2404 
2411  public:
2412  TimingLauncher(TimingMeasurement measurement);
2413  public:
2414  inline void add_precondition(const Future &f);
2415  public:
2416  TimingMeasurement measurement;
2417  std::set<Future> preconditions;
2418  public:
2419  // Provenance string for the runtime and tools to use
2420  std::string provenance;
2421  };
2422 
2429  public:
2430  TunableLauncher(TunableID tid,
2431  MapperID mapper = 0,
2432  MappingTagID tag = 0,
2433  size_t return_type_size = SIZE_MAX);
2434  public:
2435  TunableID tunable;
2436  MapperID mapper;
2437  MappingTagID tag;
2438  UntypedBuffer arg;
2439  std::vector<Future> futures;
2440  size_t return_type_size;
2441  public:
2442  // Provenance string for the runtime and tools to use
2443  std::string provenance;
2444  };
2445 
2446  //==========================================================================
2447  // Task Variant Registrars
2448  //==========================================================================
2449 
2461  public:
2464  const char *layout_name = NULL);
2465  public:
2467  add_constraint(const SpecializedConstraint &constraint);
2469  add_constraint(const MemoryConstraint &constraint);
2471  add_constraint(const OrderingConstraint &constraint);
2473  add_constraint(const TilingConstraint &constraint);
2475  add_constraint(const FieldConstraint &constraint);
2477  add_constraint(const DimensionConstraint &constraint);
2479  add_constraint(const AlignmentConstraint &constraint);
2481  add_constraint(const OffsetConstraint &constraint);
2483  add_constraint(const PointerConstraint &constraint);
2485  add_constraint(const PaddingConstraint &constraint);
2486  public:
2487  FieldSpace handle;
2488  LayoutConstraintSet layout_constraints;
2489  const char* layout_name;
2490  };
2491 
2497  struct PoolBounds {
2498  public:
2499  PoolBounds(UnboundPoolScope s)
2500  : size(0), alignment(0), scope(s) { }
2501  PoolBounds(size_t s = 0, uint32_t a = 16)
2502  : size(s), alignment(a), scope(LEGION_BOUNDED_POOL) { }
2503  PoolBounds(const PoolBounds&) = default;
2504  PoolBounds(PoolBounds&&) = default;
2505  PoolBounds& operator=(const PoolBounds&) = default;
2506  PoolBounds& operator=(PoolBounds&&) = default;
2507  public:
2508  size_t size; // upper bound of the pool in bytes
2509  uint32_t alignment; // maximum alignment supported
2510  UnboundPoolScope scope; // scope for unbound pools
2511  };
2512 
2522  public:
2523  TaskVariantRegistrar(void);
2524  TaskVariantRegistrar(TaskID task_id, bool global = true,
2525  const char *variant_name = NULL);
2526  TaskVariantRegistrar(TaskID task_id, const char *variant_name,
2527  bool global = true);
2528  public: // Add execution constraints
2529  inline TaskVariantRegistrar&
2530  add_constraint(const ISAConstraint &constraint);
2531  inline TaskVariantRegistrar&
2532  add_constraint(const ProcessorConstraint &constraint);
2533  inline TaskVariantRegistrar&
2534  add_constraint(const ResourceConstraint &constraint);
2535  inline TaskVariantRegistrar&
2536  add_constraint(const LaunchConstraint &constraint);
2537  inline TaskVariantRegistrar&
2538  add_constraint(const ColocationConstraint &constraint);
2539  public: // Add layout constraint sets
2540  inline TaskVariantRegistrar&
2541  add_layout_constraint_set(unsigned index, LayoutConstraintID desc);
2542  public: // Set properties
2543  inline void set_leaf(bool is_leaf = true);
2544  inline void set_inner(bool is_inner = true);
2545  inline void set_idempotent(bool is_idempotent = true);
2546  inline void set_replicable(bool is_replicable = true);
2547  inline void set_concurrent(bool is_concurrent = true);
2548  inline void set_concurrent_barrier(bool needs_barrier = true);
2549  public: // Generator Task IDs
2550  inline void add_generator_task(TaskID tid);
2551  public:
2552  TaskID task_id;
2553  bool global_registration;
2554  const char* task_variant_name;
2555  public: // constraints
2556  ExecutionConstraintSet execution_constraints;
2557  TaskLayoutConstraintSet layout_constraints;
2558  public:
2559  // If this is a leaf task variant then the application can
2560  // request that the runtime preserve a pool in the memory of
2561  // the corresponding kind with the closest affinity to the target
2562  // processor for handling dynamic memory allocations during the
2563  // execution of the task. Pool bounds can also be set to request
2564  // an unbounded pool allocation. Note that requesting an unbound
2565  // memory allocation will likely result in severe performance degradation.
2566  std::map<Memory::Kind,PoolBounds> leaf_pool_bounds;
2567  public:
2568  // TaskIDs for which this variant can serve as a generator
2569  std::set<TaskID> generator_tasks;
2570  public: // properties
2571  bool leaf_variant;
2572  bool inner_variant;
2573  bool idempotent_variant;
2574  bool replicable_variant;
2575  bool concurrent_variant;
2576  bool concurrent_barrier;
2577  };
2578 
2579  //==========================================================================
2580  // Physical Data Classes
2581  //==========================================================================
2582 
2591  class PhysicalRegion : public Unserializable<PhysicalRegion> {
2592  public:
2593  PhysicalRegion(void);
2594  PhysicalRegion(const PhysicalRegion &rhs);
2595  PhysicalRegion(PhysicalRegion &&rhs) noexcept;
2596  ~PhysicalRegion(void);
2597  private:
2598  Internal::PhysicalRegionImpl *impl;
2599  protected:
2600  FRIEND_ALL_RUNTIME_CLASSES
2601  explicit PhysicalRegion(Internal::PhysicalRegionImpl *impl);
2602  public:
2603  PhysicalRegion& operator=(const PhysicalRegion &rhs);
2604  PhysicalRegion& operator=(PhysicalRegion &&rhs) noexcept;
2605  inline bool exists(void) const { return (impl != NULL); }
2606  inline bool operator==(const PhysicalRegion &reg) const
2607  { return (impl == reg.impl); }
2608  inline bool operator<(const PhysicalRegion &reg) const
2609  { return (impl < reg.impl); }
2610  std::size_t hash(void) const;
2611  public:
2615  bool is_mapped(void) const;
2623  void wait_until_valid(bool silence_warnings = false,
2624  const char *warning_string = NULL);
2631  bool is_valid(void) const;
2639  PrivilegeMode get_privilege(void) const;
2643  void get_memories(std::set<Memory>& memories,
2644  bool silence_warnings = false,
2645  const char *warning_string = NULL) const;
2649  void get_fields(std::vector<FieldID>& fields) const;
2650  public:
2651  template<int DIM, typename COORD_T>
2652  DomainT<DIM,COORD_T> get_bounds(void) const;
2653  // We'll also allow this to implicitly cast to a realm index space
2654  // so that users can easily iterate over the points
2655  template<int DIM, typename COORD_T>
2656  operator DomainT<DIM,COORD_T>(void) const;
2657  // They can implicitly cast to a rectangle if there is no
2658  // sparsity map, runtime will check for this
2659  template<int DIM, typename COORD_T>
2660  operator Rect<DIM,COORD_T>(void) const;
2661  protected:
2662  // These methods can only be accessed by accessor classes
2663  template<PrivilegeMode, typename, int, typename, typename, bool>
2664  friend class FieldAccessor;
2665  template<typename, bool, int, typename, typename, bool>
2666  friend class ReductionAccessor;
2667  template<typename, int, typename, typename, bool, bool, int>
2668  friend class MultiRegionAccessor;
2669  template<typename, int, typename, typename, bool>
2670  friend class PaddingAccessor;
2671  template<typename, int, typename, typename>
2672  friend class UnsafeFieldAccessor;
2673  template<typename, PrivilegeMode>
2674  friend class ArraySyntax::AccessorRefHelper;
2675  template<typename>
2676  friend class ArraySyntax::AffineRefHelper;
2677  friend class PieceIterator;
2678  template<PrivilegeMode, typename, int, typename>
2679  friend class SpanIterator;
2680  template<typename, int, typename>
2681  friend class UnsafeSpanIterator;
2682  Realm::RegionInstance get_instance_info(PrivilegeMode mode,
2683  FieldID fid, size_t field_size,
2684  void *realm_is, TypeTag type_tag,
2685  const char *warning_string,
2686  bool silence_warnings,
2687  bool generic_accessor,
2688  bool check_field_size,
2689  ReductionOpID redop = 0) const;
2690  Realm::RegionInstance get_instance_info(PrivilegeMode mode,
2691  const std::vector<PhysicalRegion> &other_regions,
2692  FieldID fid, size_t field_size,
2693  void *realm_is, TypeTag type_tag,
2694  const char *warning_string,
2695  bool silence_warnings,
2696  bool generic_accessor,
2697  bool check_field_size,
2698  bool need_bounds,
2699  ReductionOpID redop = 0) const;
2700  Realm::RegionInstance get_padding_info(FieldID fid, size_t field_size,
2701  Domain *inner, Domain &outer,
2702  const char *warning_string,
2703  bool silence_warnings,
2704  bool generic_accessor,
2705  bool check_field_size) const;
2706  void report_incompatible_accessor(const char *accessor_kind,
2707  Realm::RegionInstance instance, FieldID fid) const;
2708  void report_incompatible_multi_accessor(unsigned index, FieldID fid,
2709  Realm::RegionInstance inst1,
2710  Realm::RegionInstance inst2) const;
2711  void report_colocation_violation(const char *accessor_kind, FieldID fid,
2712  Realm::RegionInstance inst1,
2713  Realm::RegionInstance inst2,
2714  const PhysicalRegion &other,
2715  bool reduction = false) const;
2716  static void empty_colocation_regions(const char *accessor_kind,
2717  FieldID fid, bool reduction = false);
2718  static void fail_bounds_check(DomainPoint p, FieldID fid,
2719  PrivilegeMode mode, bool multi = false);
2720  static void fail_bounds_check(Domain d, FieldID fid,
2721  PrivilegeMode mode, bool multi = false);
2722  static void fail_privilege_check(DomainPoint p, FieldID fid,
2723  PrivilegeMode mode);
2724  static void fail_privilege_check(Domain d, FieldID fid,
2725  PrivilegeMode mode);
2726  static void fail_padding_check(DomainPoint p, FieldID fid);
2727  protected:
2728  void get_bounds(void *realm_is, TypeTag type_tag) const;
2729  };
2730 
2738  class ExternalResources : public Unserializable<ExternalResources> {
2739  public:
2740  ExternalResources(void);
2742  ExternalResources(ExternalResources &&rhs) noexcept;
2743  ~ExternalResources(void);
2744  private:
2745  Internal::ExternalResourcesImpl *impl;
2746  protected:
2747  FRIEND_ALL_RUNTIME_CLASSES
2748  explicit ExternalResources(Internal::ExternalResourcesImpl *impl);
2749  public:
2750  ExternalResources& operator=(const ExternalResources &rhs);
2751  ExternalResources& operator=(ExternalResources &&rhs) noexcept;
2752  inline bool exists(void) const { return (impl != NULL); }
2753  inline bool operator==(const ExternalResources &reg) const
2754  { return (impl == reg.impl); }
2755  inline bool operator<(const ExternalResources &reg) const
2756  { return (impl < reg.impl); }
2757  public:
2758  size_t size(void) const;
2759  PhysicalRegion operator[](unsigned index) const;
2760  };
2761 
2799  template<PrivilegeMode MODE, typename FT, int N, typename COORD_T = coord_t,
2800  typename A = Realm::GenericAccessor<FT,N,COORD_T>,
2801 #ifdef LEGION_BOUNDS_CHECKS
2802  bool CHECK_BOUNDS = true>
2803 #else
2804  bool CHECK_BOUNDS = false>
2805 #endif
2807  private:
2808  static_assert(N > 0, "N must be positive");
2809  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
2810  public:
2811  FieldAccessor(void) { }
2812  FieldAccessor(const PhysicalRegion &region, FieldID fid,
2813  // The actual field size in case it is different from the
2814  // one being used in FT and we still want to check it
2815  size_t actual_field_size = sizeof(FT),
2816 #ifdef DEBUG_LEGION
2817  bool check_field_size = true,
2818 #else
2819  bool check_field_size = false,
2820 #endif
2821  bool silence_warnings = false,
2822  const char *warning_string = NULL,
2823  size_t subfield_offset = 0) { }
2824  // For Realm::AffineAccessor specializations there are additional
2825  // methods for creating accessors with limited bounding boxes and
2826  // affine transformations for using alternative coordinates spaces
2827  // Specify a specific bounds rectangle to use for the accessor
2828  FieldAccessor(const PhysicalRegion &region, FieldID fid,
2829  const Rect<N,COORD_T> bounds,
2830  // The actual field size in case it is different from the
2831  // one being used in FT and we still want to check it
2832  size_t actual_field_size = sizeof(FT),
2833 #ifdef DEBUG_LEGION
2834  bool check_field_size = true,
2835 #else
2836  bool check_field_size = false,
2837 #endif
2838  bool silence_warnings = false,
2839  const char *warning_string = NULL,
2840  size_t subfield_offset = 0) { }
2841  // Specify a specific Affine transform to use for interpreting points
2842  // Not avalable for Realm::MultiAffineAccessor specializations
2843  template<int M>
2844  FieldAccessor(const PhysicalRegion &region, FieldID fid,
2845  const AffineTransform<M,N,COORD_T> transform,
2846  // The actual field size in case it is different from the
2847  // one being used in FT and we still want to check it
2848  size_t actual_field_size = sizeof(FT),
2849 #ifdef DEBUG_LEGION
2850  bool check_field_size = true,
2851 #else
2852  bool check_field_size = false,
2853 #endif
2854  bool silence_warnings = false,
2855  const char *warning_string = NULL,
2856  size_t subfield_offset = 0) { }
2857  // Specify both a transform and a bounds to use
2858  // Not avalable for Realm::MultiAffineAccessor specializations
2859  template<int M>
2860  FieldAccessor(const PhysicalRegion &region, FieldID fid,
2861  const AffineTransform<M,N,COORD_T> transform,
2862  const Rect<N,COORD_T> bounds,
2863  // The actual field size in case it is different from the
2864  // one being used in FT and we still want to check it
2865  size_t actual_field_size = sizeof(FT),
2866 #ifdef DEBUG_LEGION
2867  bool check_field_size = true,
2868 #else
2869  bool check_field_size = false,
2870 #endif
2871  bool silence_warnings = false,
2872  const char *warning_string = NULL,
2873  size_t subfield_offset = 0) { }
2874  // Create a field accessor for a Future
2875  // (only with READ-ONLY privileges and AffineAccessors)
2876  FieldAccessor(const Future &future,
2877  Memory::Kind kind = Memory::NO_MEMKIND,
2878  // The actual field size in case it is different from the
2879  // one being used in FT and we still want to check it
2880  size_t actual_field_size = sizeof(FT),
2881 #ifdef DEBUG_LEGION
2882  bool check_field_size = true,
2883 #else
2884  bool check_field_size = false,
2885 #endif
2886  bool silence_warnings = false,
2887  const char *warning_string = NULL,
2888  size_t subfield_offset = 0) { }
2889  // Create a field accessor for a Future
2890  // (only with READ-ONLY privileges and AffineAccessors)
2891  FieldAccessor(const Future &future,
2892  const Rect<N,COORD_T> bounds,
2893  Memory::Kind kind = Memory::NO_MEMKIND,
2894  // The actual field size in case it is different from the
2895  // one being used in FT and we still want to check it
2896  size_t actual_field_size = sizeof(FT),
2897 #ifdef DEBUG_LEGION
2898  bool check_field_size = true,
2899 #else
2900  bool check_field_size = false,
2901 #endif
2902  bool silence_warnings = false,
2903  const char *warning_string = NULL,
2904  size_t subfield_offset = 0) { }
2905  public:
2906  // Variations of the above four methods but with multiple physical
2907  // regions specified using input iterators for colocation regions
2908  // Colocation regions from [start, stop)
2909  template<typename InputIterator>
2910  FieldAccessor(InputIterator start_region,
2911  InputIterator stop_region, FieldID fid,
2912  // The actual field size in case it is different from the
2913  // one being used in FT and we still want to check it
2914  size_t actual_field_size = sizeof(FT),
2915 #ifdef DEBUG_LEGION
2916  bool check_field_size = true,
2917 #else
2918  bool check_field_size = false,
2919 #endif
2920  bool silence_warnings = false,
2921  const char *warning_string = NULL,
2922  size_t subfield_offset = 0) { }
2923  // For Realm::AffineAccessor specializations there are additional
2924  // methods for creating accessors with limited bounding boxes and
2925  // affine transformations for using alternative coordinates spaces
2926  // Specify a specific bounds rectangle to use for the accessor
2927  // Colocation regions from [start, stop)
2928  template<typename InputIterator>
2929  FieldAccessor(InputIterator start_region,
2930  InputIterator stop_region, FieldID fid,
2931  const Rect<N,COORD_T> bounds,
2932  // The actual field size in case it is different from the
2933  // one being used in FT and we still want to check it
2934  size_t actual_field_size = sizeof(FT),
2935 #ifdef DEBUG_LEGION
2936  bool check_field_size = true,
2937 #else
2938  bool check_field_size = false,
2939 #endif
2940  bool silence_warnings = false,
2941  const char *warning_string = NULL,
2942  size_t subfield_offset = 0) { }
2943  // Specify a specific Affine transform to use for interpreting points
2944  // Not avalable for Realm::MultiAffineAccessor specializations
2945  // Colocation regions from [start, stop)
2946  template<typename InputIterator, int M>
2947  FieldAccessor(InputIterator start_region,
2948  InputIterator stop_region, FieldID fid,
2949  const AffineTransform<M,N,COORD_T> transform,
2950  // The actual field size in case it is different from the
2951  // one being used in FT and we still want to check it
2952  size_t actual_field_size = sizeof(FT),
2953 #ifdef DEBUG_LEGION
2954  bool check_field_size = true,
2955 #else
2956  bool check_field_size = false,
2957 #endif
2958  bool silence_warnings = false,
2959  const char *warning_string = NULL,
2960  size_t subfield_offset = 0) { }
2961  // Specify both a transform and a bounds to use
2962  // Not avalable for Realm::MultiAffineAccessor specializations
2963  // Colocation regions from [start, stop)
2964  template<typename InputIterator, int M>
2965  FieldAccessor(InputIterator start_region,
2966  InputIterator stop_region, FieldID fid,
2967  const AffineTransform<M,N,COORD_T> transform,
2968  const Rect<N,COORD_T> bounds,
2969  // The actual field size in case it is different from the
2970  // one being used in FT and we still want to check it
2971  size_t actual_field_size = sizeof(FT),
2972 #ifdef DEBUG_LEGION
2973  bool check_field_size = true,
2974 #else
2975  bool check_field_size = false,
2976 #endif
2977  bool silence_warnings = false,
2978  const char *warning_string = NULL,
2979  size_t subfield_offset = 0) { }
2980  public:
2981  // Create a FieldAccessor for an UntypedDeferredValue
2982  // (only with AffineAccessors)
2983  FieldAccessor(const UntypedDeferredValue &value,
2984  // The actual field size in case it is different from the
2985  // one being used in FT and we still want to check it
2986  size_t actual_field_size = sizeof(FT),
2987 #ifdef DEBUG_LEGION
2988  bool check_field_size = true,
2989 #else
2990  bool check_field_size = false,
2991 #endif
2992  bool silence_warnings = false,
2993  const char *warning_string = NULL,
2994  size_t subfield_offset = 0) { }
2995  // Create a FieldAccessor for an UntypedDeferredValue
2996  // Specify a specific bounds rectangle to use for the accessor
2997  // (only with AffineAccessors)
2998  FieldAccessor(const UntypedDeferredValue &value,
2999  const Rect<N,COORD_T> &bounds,
3000  // The actual field size in case it is different from the
3001  // one being used in FT and we still want to check it
3002  size_t actual_field_size = sizeof(FT),
3003 #ifdef DEBUG_LEGION
3004  bool check_field_size = true,
3005 #else
3006  bool check_field_size = false,
3007 #endif
3008  bool silence_warnings = false,
3009  const char *warning_string = NULL,
3010  size_t subfield_offset = 0) { }
3011  public:
3012  // Create a FieldAccessor for UntypedDeferredBuffer
3013  // (only with AffineAccessors)
3015  // The actual field size in case it is different from the
3016  // one being used in FT and we still want to check it
3017  size_t actual_field_size = sizeof(FT),
3018 #ifdef DEBUG_LEGION
3019  bool check_field_size = true,
3020 #else
3021  bool check_field_size = false,
3022 #endif
3023  bool silence_warnings = false,
3024  const char *warning_string = NULL,
3025  size_t subfield_offset = 0) { }
3026  // Create a FieldAccessor for UntypedDeferredBuffer
3027  // Specify a specific bounds rectangle to use for the accessor
3028  // (only with AffineAccessors)
3030  const Rect<N,COORD_T> &bounds,
3031  // The actual field size in case it is different from the
3032  // one being used in FT and we still want to check it
3033  size_t actual_field_size = sizeof(FT),
3034 #ifdef DEBUG_LEGION
3035  bool check_field_size = true,
3036 #else
3037  bool check_field_size = false,
3038 #endif
3039  bool silence_warnings = false,
3040  const char *warning_string = NULL,
3041  size_t subfield_offset = 0) { }
3042  // Create a FieldAccessor for UntypedDeferredBuffer
3043  // Specify a specific Affine transform to use for interpreting points
3044  // (only with AffineAccessors)
3045  template<int M>
3047  const AffineTransform<M,N,COORD_T> &transform,
3048  // The actual field size in case it is different from the
3049  // one being used in FT and we still want to check it
3050  size_t actual_field_size = sizeof(FT),
3051 #ifdef DEBUG_LEGION
3052  bool check_field_size = true,
3053 #else
3054  bool check_field_size = false,
3055 #endif
3056  bool silence_warnings = false,
3057  const char *warning_string = NULL,
3058  size_t subfield_offset = 0) { }
3059  // Create a FieldAccessor for UntypedDeferredBuffer
3060  // Specify both a transform and a bounds to use
3061  // (only with AffineAccessors)
3062  template<int M>
3064  const AffineTransform<M,N,COORD_T> &transform,
3065  const Rect<N,COORD_T> &bounds,
3066  // The actual field size in case it is different from the
3067  // one being used in FT and we still want to check it
3068  size_t actual_field_size = sizeof(FT),
3069 #ifdef DEBUG_LEGION
3070  bool check_field_size = true,
3071 #else
3072  bool check_field_size = false,
3073 #endif
3074  bool silence_warnings = false,
3075  const char *warning_string = NULL,
3076  size_t subfield_offset = 0) { }
3077  public:
3078  typedef FT value_type;
3079  typedef FT& reference;
3080  typedef const FT& const_reference;
3081  static const int dim = N;
3082  };
3083 
3096  template<typename REDOP, bool EXCLUSIVE, int N, typename COORD_T = coord_t,
3097  typename A = Realm::GenericAccessor<typename REDOP::RHS,N,COORD_T>,
3098 #ifdef LEGION_BOUNDS_CHECKS
3099  bool CHECK_BOUNDS = true>
3100 #else
3101  bool CHECK_BOUNDS = false>
3102 #endif
3104  private:
3105  static_assert(N > 0, "N must be positive");
3106  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3107  public:
3108  ReductionAccessor(void) { }
3109  ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3110  ReductionOpID redop, bool silence_warnings = false,
3111  const char *warning_string = NULL,
3112  size_t subfield_offset = 0,
3113  size_t actual_field_size = sizeof(typename REDOP::RHS),
3114 #ifdef DEBUG_LEGION
3115  bool check_field_size = true
3116 #else
3117  bool check_field_size = false
3118 #endif
3119  ) { }
3120  // For Realm::AffineAccessor specializations there are additional
3121  // methods for creating accessors with limited bounding boxes and
3122  // affine transformations for using alternative coordinates spaces
3123  // Specify a specific bounds rectangle to use for the accessor
3124  ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3125  ReductionOpID redop,
3126  const Rect<N,COORD_T> bounds,
3127  bool silence_warnings = false,
3128  const char *warning_string = NULL,
3129  size_t subfield_offset = 0,
3130  size_t actual_field_size = sizeof(typename REDOP::RHS),
3131 #ifdef DEBUG_LEGION
3132  bool check_field_size = true
3133 #else
3134  bool check_field_size = false
3135 #endif
3136  ) { }
3137  // Specify a specific Affine transform to use for interpreting points
3138  // Not available for Realm::MultiAffineAccessor specializations
3139  template<int M>
3140  ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3141  ReductionOpID redop,
3142  const AffineTransform<M,N,COORD_T> transform,
3143  bool silence_warnings = false,
3144  const char *warning_string = NULL,
3145  size_t subfield_offset = 0,
3146  size_t actual_field_size = sizeof(typename REDOP::RHS),
3147 #ifdef DEBUG_LEGION
3148  bool check_field_size = true
3149 #else
3150  bool check_field_size = false
3151 #endif
3152  ) { }
3153  // Specify both a transform and a bounds to use
3154  // Not available for Realm::MultiAffineAccessor specializations
3155  template<int M>
3156  ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3157  ReductionOpID redop,
3158  const AffineTransform<M,N,COORD_T> transform,
3159  const Rect<N,COORD_T> bounds,
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  public:
3171  // Variations of the same four methods above but with multiple
3172  // physical regions specified using input iterators for colocation regions
3173  // Colocation regions from [start, stop)
3174  template<typename InputIterator>
3175  ReductionAccessor(InputIterator start_region,
3176  InputIterator stop_region, FieldID fid,
3177  ReductionOpID redop, bool silence_warnings = false,
3178  const char *warning_string = NULL,
3179  size_t subfield_offset = 0,
3180  size_t actual_field_size = sizeof(typename REDOP::RHS),
3181 #ifdef DEBUG_LEGION
3182  bool check_field_size = true
3183 #else
3184  bool check_field_size = false
3185 #endif
3186  ) { }
3187  // For Realm::AffineAccessor specializations there are additional
3188  // methods for creating accessors with limited bounding boxes and
3189  // affine transformations for using alternative coordinates spaces
3190  // Specify a specific bounds rectangle to use for the accessor
3191  // Colocation regions from [start, stop)
3192  template<typename InputIterator>
3193  ReductionAccessor(InputIterator start_region,
3194  InputIterator stop_region, FieldID fid,
3195  ReductionOpID redop,
3196  const Rect<N,COORD_T> bounds,
3197  bool silence_warnings = false,
3198  const char *warning_string = NULL,
3199  size_t subfield_offset = 0,
3200  size_t actual_field_size = sizeof(typename REDOP::RHS),
3201 #ifdef DEBUG_LEGION
3202  bool check_field_size = true
3203 #else
3204  bool check_field_size = false
3205 #endif
3206  ) { }
3207  // Specify a specific Affine transform to use for interpreting points
3208  // Not available for Realm::MultiAffineAccessor specializations
3209  // Colocation regions from [start, stop)
3210  template<typename InputIterator, int M>
3211  ReductionAccessor(InputIterator start_region,
3212  InputIterator stop_region, FieldID fid,
3213  ReductionOpID redop,
3214  const AffineTransform<M,N,COORD_T> transform,
3215  bool silence_warnings = false,
3216  const char *warning_string = NULL,
3217  size_t subfield_offset = 0,
3218  size_t actual_field_size = sizeof(typename REDOP::RHS),
3219 #ifdef DEBUG_LEGION
3220  bool check_field_size = true
3221 #else
3222  bool check_field_size = false
3223 #endif
3224  ) { }
3225  // Specify both a transform and a bounds to use
3226  // Not available for Realm::MultiAffineAccessor specializations
3227  // Colocation regions from [start, stop)
3228  template<typename InputIterator, int M>
3229  ReductionAccessor(InputIterator start_region,
3230  InputIterator stop_region, FieldID fid,
3231  ReductionOpID redop,
3232  const AffineTransform<M,N,COORD_T> transform,
3233  const Rect<N,COORD_T> bounds,
3234  bool silence_warnings = false,
3235  const char *warning_string = NULL,
3236  size_t subfield_offset = 0,
3237  size_t actual_field_size = sizeof(typename REDOP::RHS),
3238 #ifdef DEBUG_LEGION
3239  bool check_field_size = true
3240 #else
3241  bool check_field_size = false
3242 #endif
3243  ) { }
3244  public:
3245  // Create a ReductionAccessor for an UntypedDeferredValue
3246  // (only with AffineAccessors)
3248  bool silence_warnings = false,
3249  const char *warning_string = NULL,
3250  size_t subfield_offset = 0,
3251  size_t actual_field_size = sizeof(typename REDOP::RHS),
3252 #ifdef DEBUG_LEGION
3253  bool check_field_size = true
3254 #else
3255  bool check_field_size = false
3256 #endif
3257  ) { }
3258  // Create a ReductionAccessor for an UntypedDeferredValue
3259  // Specify a specific bounds rectangle to use for the accessor
3260  // (only with AffineAccessors)
3262  const Rect<N,COORD_T> &bounds,
3263  bool silence_warnings = false,
3264  const char *warning_string = NULL,
3265  size_t subfield_offset = 0,
3266  size_t actual_field_size = sizeof(typename REDOP::RHS),
3267 #ifdef DEBUG_LEGION
3268  bool check_field_size = true
3269 #else
3270  bool check_field_size = false
3271 #endif
3272  ) { }
3273  public:
3274  // Create a ReductionAccessor for an UntypedDeferredBuffer
3275  // (only with AffineAccessors)
3277  bool silence_warnings = false,
3278  const char *warning_string = NULL,
3279  size_t subfield_offset = 0,
3280  size_t actual_field_size = sizeof(typename REDOP::RHS),
3281 #ifdef DEBUG_LEGION
3282  bool check_field_size = true
3283 #else
3284  bool check_field_size = false
3285 #endif
3286  ) { }
3287  // Create a ReductionAccessor for an UntypedDeferredBuffer
3288  // Specify a specific bounds rectangle to use for the accessor
3289  // (only with AffineAccessors)
3291  const Rect<N,COORD_T> &bounds,
3292  bool silence_warnings = false,
3293  const char *warning_string = NULL,
3294  size_t subfield_offset = 0,
3295  size_t actual_field_size = sizeof(typename REDOP::RHS),
3296 #ifdef DEBUG_LEGION
3297  bool check_field_size = true
3298 #else
3299  bool check_field_size = false
3300 #endif
3301  ) { }
3302  // Create a ReductionAccessor for an UntypedDeferredBuffer
3303  // Specify a specific Affine transform to use for interpreting points
3304  // (only with AffineAccessors)
3305  template<int M>
3307  const AffineTransform<M,N,COORD_T> &transform,
3308  bool silence_warnings = false,
3309  const char *warning_string = NULL,
3310  size_t subfield_offset = 0,
3311  size_t actual_field_size = sizeof(typename REDOP::RHS),
3312 #ifdef DEBUG_LEGION
3313  bool check_field_size = true
3314 #else
3315  bool check_field_size = false
3316 #endif
3317  ) { }
3318  // Create a ReductionAccessor for an UntypedDeferredBuffer
3319  // Specify both a transform and a bounds to use
3320  // (only with AffineAccessors)
3321  template<int M>
3323  const AffineTransform<M,N,COORD_T> &transform,
3324  const Rect<N,COORD_T> &bounds,
3325  bool silence_warnings = false,
3326  const char *warning_string = NULL,
3327  size_t subfield_offset = 0,
3328  size_t actual_field_size = sizeof(typename REDOP::RHS),
3329 #ifdef DEBUG_LEGION
3330  bool check_field_size = true
3331 #else
3332  bool check_field_size = false
3333 #endif
3334  ) { }
3335  public:
3336  typedef typename REDOP::RHS value_type;
3337  typedef typename REDOP::RHS& reference;
3338  typedef const typename REDOP::RHS& const_reference;
3339  static const int dim = N;
3340  };
3341 
3364  template<typename FT, int N, typename COORD_T = coord_t,
3365  typename A = Realm::GenericAccessor<FT,N,COORD_T>,
3366 #ifdef LEGION_BOUNDS_CHECKS
3367  bool CHECK_BOUNDS = true>
3368 #else
3369  bool CHECK_BOUNDS = false>
3370 #endif
3372  public:
3373  PaddingAccessor(void) { }
3374  PaddingAccessor(const PhysicalRegion &region, FieldID fid,
3375  // The actual field size in case it is different from the
3376  // one being used in FT and we still want to check it
3377  size_t actual_field_size = sizeof(FT),
3378 #ifdef DEBUG_LEGION
3379  bool check_field_size = true,
3380 #else
3381  bool check_field_size = false,
3382 #endif
3383  bool silence_warnings = false,
3384  const char *warning_string = NULL,
3385  size_t subfield_offset = 0) { }
3386  };
3387 
3388 #ifdef LEGION_MULTI_REGION_ACCESSOR
3389  // Multi-Region Accessors are a provisional feature now and are likely
3390  // to be deprecated and removed in the near future. Instead of multi-region
3391  // accessors you should be able to use the new colocation constructors
3392  // on the traditional Field Accessors.
3422  template<typename FT, int N, typename COORD_T = coord_t,
3423  typename A = Realm::GenericAccessor<FT,N,COORD_T>,
3424 #ifdef LEGION_BOUNDS_CHECKS
3425  bool CHECK_BOUNDS = true,
3426 #else
3427  bool CHECK_BOUNDS = false,
3428 #endif
3429 #ifdef LEGION_PRIVILEGE_CHECKS
3430  bool CHECK_PRIVILEGES = true,
3431 #else
3432  bool CHECK_PRIVILEGES = false,
3433 #endif
3434  // Only used if bounds/privilege checks enabled
3435  // Can safely over-approximate, but may cost space
3436  // Especially GPU parameter space
3437  int MAX_REGIONS = 4>
3438  class MultiRegionAccessor {
3439  private:
3440  static_assert(N > 0, "N must be positive");
3441  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3442  public:
3443  MultiRegionAccessor(void) { }
3444  public: // iterator based construction of the multi-region accessors
3445  template<typename InputIterator>
3446  MultiRegionAccessor(InputIterator start, InputIterator stop,
3447  // The actual field size in case it is different from
3448  // the one being used in FT and we still want to check
3449  FieldID fid, size_t actual_field_size = sizeof(FT),
3450 #ifdef DEBUG_LEGION
3451  bool check_field_size = true,
3452 #else
3453  bool check_field_size = false,
3454 #endif
3455  bool silence_warnings = false,
3456  const char *warning_string = NULL,
3457  size_t subfield_offset = 0) { }
3458  // Specify a specific bounds rectangle to use for the accessor
3459  template<typename InputIterator>
3460  MultiRegionAccessor(InputIterator start, InputIterator stop,
3461  const Rect<N,COORD_T> bounds, FieldID fid,
3462  // The actual field size in case it is different from
3463  // the one being used in FT and we still want to check
3464  size_t actual_field_size = sizeof(FT),
3465 #ifdef DEBUG_LEGION
3466  bool check_field_size = true,
3467 #else
3468  bool check_field_size = false,
3469 #endif
3470  bool silence_warnings = false,
3471  const char *warning_string = NULL,
3472  size_t subfield_offset = 0) { }
3473  // Specify a specific Affine transform to use for interpreting points
3474  template<int M, typename InputIterator>
3475  MultiRegionAccessor(InputIterator start, InputIterator stop,
3476  const AffineTransform<M,N,COORD_T> transform,
3477  // The actual field size in case it is different from
3478  // the one being used in FT and we still want to check
3479  FieldID fid, size_t actual_field_size = sizeof(FT),
3480 #ifdef DEBUG_LEGION
3481  bool check_field_size = true,
3482 #else
3483  bool check_field_size = false,
3484 #endif
3485  bool silence_warnings = false,
3486  const char *warning_string = NULL,
3487  size_t subfield_offset = 0) { }
3488  // Specify both a transform and a bounds to use
3489  template<int M, typename InputIterator>
3490  MultiRegionAccessor(InputIterator start, InputIterator stop,
3491  const AffineTransform<M,N,COORD_T> transform,
3492  const Rect<N,COORD_T> bounds, FieldID fid,
3493  // The actual field size in case it is different from the
3494  // one being used in FT and we still want to check it
3495  size_t actual_field_size = sizeof(FT),
3496 #ifdef DEBUG_LEGION
3497  bool check_field_size = true,
3498 #else
3499  bool check_field_size = false,
3500 #endif
3501  bool silence_warnings = false,
3502  const char *warning_string = NULL,
3503  size_t subfield_offset = 0) { }
3504  public: // explicit data structure versions of the implicit iterators above
3505  MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3506  // The actual field size in case it is different from
3507  // the one being used in FT and we still want to check
3508  FieldID fid, size_t actual_field_size = sizeof(FT),
3509 #ifdef DEBUG_LEGION
3510  bool check_field_size = true,
3511 #else
3512  bool check_field_size = false,
3513 #endif
3514  bool silence_warnings = false,
3515  const char *warning_string = NULL,
3516  size_t subfield_offset = 0) { }
3517  // Specify a specific bounds rectangle to use for the accessor
3518  MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3519  const Rect<N,COORD_T> bounds, FieldID fid,
3520  // The actual field size in case it is different from
3521  // the one being used in FT and we still want to check
3522  size_t actual_field_size = sizeof(FT),
3523 #ifdef DEBUG_LEGION
3524  bool check_field_size = true,
3525 #else
3526  bool check_field_size = false,
3527 #endif
3528  bool silence_warnings = false,
3529  const char *warning_string = NULL,
3530  size_t subfield_offset = 0) { }
3531  // Specify a specific Affine transform to use for interpreting points
3532  template<int M>
3533  MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3534  const AffineTransform<M,N,COORD_T> transform,
3535  // The actual field size in case it is different from
3536  // the one being used in FT and we still want to check
3537  FieldID fid, size_t actual_field_size = sizeof(FT),
3538 #ifdef DEBUG_LEGION
3539  bool check_field_size = true,
3540 #else
3541  bool check_field_size = false,
3542 #endif
3543  bool silence_warnings = false,
3544  const char *warning_string = NULL,
3545  size_t subfield_offset = 0) { }
3546  // Specify both a transform and a bounds to use
3547  template<int M>
3548  MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3549  const AffineTransform<M,N,COORD_T> transform,
3550  const Rect<N,COORD_T> bounds, FieldID fid,
3551  // The actual field size in case it is different from the
3552  // one being used in FT and we still want to check it
3553  size_t actual_field_size = sizeof(FT),
3554 #ifdef DEBUG_LEGION
3555  bool check_field_size = true,
3556 #else
3557  bool check_field_size = false,
3558 #endif
3559  bool silence_warnings = false,
3560  const char *warning_string = NULL,
3561  size_t subfield_offset = 0) { }
3562  public:
3563  typedef FT value_type;
3564  typedef FT& reference;
3565  typedef const FT& const_reference;
3566  static const int dim = N;
3567  };
3568 #endif // LEGION_MULTI_REGION_ACCESSOR
3569 
3594  public:
3595  PieceIterator(void);
3596  PieceIterator(const PieceIterator &rhs);
3597  PieceIterator(PieceIterator &&rhs) noexcept;
3598  PieceIterator(const PhysicalRegion &region, FieldID fid,
3599  bool privilege_only = true,
3600  bool silence_warnings = false,
3601  const char *warning_string = NULL);
3602  ~PieceIterator(void);
3603  public:
3604  PieceIterator& operator=(const PieceIterator &rhs);
3605  PieceIterator& operator=(PieceIterator &&rhs) noexcept;
3606  public:
3607  inline bool valid(void) const;
3608  bool step(void);
3609  public:
3610  inline operator bool(void) const;
3611  inline bool operator()(void) const;
3612  inline const Domain& operator*(void) const;
3613  inline const Domain* operator->(void) const;
3614  inline PieceIterator& operator++(void);
3615  inline PieceIterator operator++(int/*postfix*/);
3616  public:
3617  bool operator<(const PieceIterator &rhs) const;
3618  bool operator==(const PieceIterator &rhs) const;
3619  bool operator!=(const PieceIterator &rhs) const;
3620  private:
3621  Internal::PieceIteratorImpl *impl;
3622  int index;
3623  protected:
3624  Domain current_piece;
3625  };
3626 
3632  template<int DIM, typename COORD_T = coord_t>
3634  private:
3635  static_assert(DIM > 0, "DIM must be positive");
3636  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3637  public:
3638  PieceIteratorT(void);
3639  PieceIteratorT(const PieceIteratorT &rhs);
3640  PieceIteratorT(PieceIteratorT &&rhs) noexcept;
3641  PieceIteratorT(const PhysicalRegion &region, FieldID fid,
3642  bool privilege_only,
3643  bool silence_warnings = false,
3644  const char *warning_string = NULL);
3645  public:
3646  PieceIteratorT<DIM,COORD_T>& operator=(const PieceIteratorT &rhs);
3647  PieceIteratorT<DIM,COORD_T>& operator=(PieceIteratorT &&rhs) noexcept;
3648  public:
3649  inline bool step(void);
3650  inline const Rect<DIM,COORD_T>& operator*(void) const;
3651  inline const Rect<DIM,COORD_T>* operator->(void) const;
3652  inline PieceIteratorT<DIM,COORD_T>& operator++(void);
3653  inline PieceIteratorT<DIM,COORD_T> operator++(int/*postfix*/);
3654  protected:
3655  Rect<DIM,COORD_T> current_rect;
3656  };
3657 
3667  template<PrivilegeMode PM, typename FT, int DIM, typename COORD_T = coord_t>
3669  private:
3670  static_assert(DIM > 0, "DIM must be positive");
3671  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3672  public:
3673  SpanIterator(void) { }
3674  SpanIterator(const PhysicalRegion &region, FieldID fid,
3675  // The actual field size in case it is different from the
3676  // one being used in FT and we still want to check it
3677  size_t actual_field_size = sizeof(FT),
3678 #ifdef DEBUG_LEGION
3679  bool check_field_size = true,
3680 #else
3681  bool check_field_size = false,
3682 #endif
3683  // Iterate only the spans that we have privileges on
3684  bool privileges_only = true,
3685  bool silence_warnings = false,
3686  const char *warning_string = NULL);
3687  public:
3688  inline bool valid(void) const;
3689  inline bool step(void);
3690  public:
3691  inline operator bool(void) const;
3692  inline bool operator()(void) const;
3693  inline const Span<FT,PM>& operator*(void) const;
3694  inline const Span<FT,PM>* operator->(void) const;
3695  inline SpanIterator<PM,FT,DIM,COORD_T>& operator++(void);
3696  inline SpanIterator<PM,FT,DIM,COORD_T> operator++(int);
3697  private:
3698  PieceIteratorT<DIM,COORD_T> piece_iterator;
3699  Realm::MultiAffineAccessor<FT,DIM,COORD_T> accessor;
3700  Span<FT,PM> current;
3701  Point<DIM,COORD_T> partial_step_point;
3702  int dim_order[DIM];
3703  int partial_step_dim;
3704  bool partial_piece;
3705  };
3706 
3720  template<typename T>
3722  public:
3723  DeferredValue(T initial_value,
3724  size_t alignment = std::alignment_of<T>());
3725  public:
3726  __CUDA_HD__
3727  inline T read(void) const;
3728  __CUDA_HD__
3729  inline void write(T value) const;
3730  __CUDA_HD__
3731  inline T* ptr(void) const;
3732  __CUDA_HD__
3733  inline T& ref(void) const;
3734  __CUDA_HD__
3735  inline operator T(void) const;
3736  __CUDA_HD__
3737  inline DeferredValue<T>& operator=(T value);
3738  public:
3739  inline void finalize(Context ctx) const;
3740  protected:
3741  friend class UntypedDeferredValue;
3742  DeferredValue(void);
3743  Realm::RegionInstance instance;
3744  Realm::AffineAccessor<T,1,coord_t> accessor;
3745  };
3746 
3756  template<typename REDOP, bool EXCLUSIVE=false>
3757  class DeferredReduction: public DeferredValue<typename REDOP::RHS> {
3758  public:
3760  size_t alignment = std::alignment_of<typename REDOP::RHS>());
3761  public:
3762  __CUDA_HD__
3763  inline void reduce(typename REDOP::RHS val) const;
3764  __CUDA_HD__
3765  inline void operator<<=(typename REDOP::RHS val) const;
3766  };
3767 
3773  public:
3774  UntypedDeferredValue(void);
3775  UntypedDeferredValue(size_t field_size, Memory target_memory,
3776  const void *initial_value = NULL,
3777  size_t alignment = 16);
3778  UntypedDeferredValue(size_t field_size,
3779  Memory::Kind memory_kind = Memory::Z_COPY_MEM,
3780  const void *initial_value = NULL,
3781  size_t alignment = 16);
3782  template<typename T>
3784  template<typename REDOP, bool EXCLUSIVE>
3786  public:
3787  template<typename T>
3788  inline operator DeferredValue<T>(void) const;
3789  template<typename REDOP, bool EXCLUSIVE>
3790  inline operator DeferredReduction<REDOP,EXCLUSIVE>(void) const;
3791  public:
3792  void finalize(Context ctx) const;
3793  Realm::RegionInstance get_instance() const;
3794  private:
3795  template<PrivilegeMode,typename,int,typename,typename,bool>
3796  friend class FieldAccessor;
3797  template<typename,bool,int,typename,typename,bool>
3798  friend class ReductionAccessor;
3799  Realm::RegionInstance instance;
3800  size_t field_size;
3801  };
3802 
3820  template<typename T, int DIM, typename COORD_T = coord_t,
3821 #ifdef LEGION_BOUNDS_CHECKS
3822  bool CHECK_BOUNDS = true>
3823 #else
3824  bool CHECK_BOUNDS = false>
3825 #endif
3827  private:
3828  static_assert(DIM > 0, "DIM must be positive");
3829  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3830  public:
3831  DeferredBuffer(void);
3832  public: // Constructors specifying a generic memory kind
3833  DeferredBuffer(Memory::Kind kind,
3834  const Domain &bounds,
3835  const T *initial_value = NULL,
3836  size_t alignment = std::alignment_of<T>(),
3837  bool fortran_order_dims = false);
3838  DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3839  Memory::Kind kind,
3840  const T *initial_value = NULL,
3841  size_t alignment = std::alignment_of<T>(),
3842  bool fortran_order_dims = false);
3843  public: // Constructors specifying a specific memory
3844  DeferredBuffer(Memory memory,
3845  const Domain &bounds,
3846  const T *initial_value = NULL,
3847  size_t alignment = std::alignment_of<T>(),
3848  bool fortran_order_dims = false);
3849  DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3850  Memory memory,
3851  const T *initial_value = NULL,
3852  size_t alignment = std::alignment_of<T>(),
3853  bool fortran_order_dims = false);
3854  public: // Constructors specifying a specific ordering
3855  DeferredBuffer(Memory::Kind kind,
3856  const Domain &bounds,
3857  std::array<DimensionKind,DIM> ordering,
3858  const T *initial_value = NULL,
3859  size_t alignment = std::alignment_of<T>());
3860  DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3861  Memory::Kind kind,
3862  std::array<DimensionKind,DIM> ordering,
3863  const T *initial_value = NULL,
3864  size_t alignment = std::alignment_of<T>());
3865  DeferredBuffer(Memory memory,
3866  const Domain &bounds,
3867  std::array<DimensionKind,DIM> ordering,
3868  const T *initial_value = NULL,
3869  size_t alignment = std::alignment_of<T>());
3870  DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3871  Memory memory,
3872  std::array<DimensionKind,DIM> ordering,
3873  const T *initial_value = NULL,
3874  size_t alignment = std::alignment_of<T>());
3875  protected:
3876  Memory get_memory_from_kind(Memory::Kind kind);
3877  void initialize_layout(size_t alignment, bool fortran_order_dims);
3878  void initialize(Memory memory,
3879  DomainT<DIM,COORD_T> bounds,
3880  const T *initial_value);
3881  public:
3882  __CUDA_HD__
3883  inline T read(const Point<DIM,COORD_T> &p) const;
3884  __CUDA_HD__
3885  inline void write(const Point<DIM,COORD_T> &p, T value) const;
3886  __CUDA_HD__
3887  inline T* ptr(const Point<DIM,COORD_T> &p) const;
3888  __CUDA_HD__
3889  inline T* ptr(const Rect<DIM,COORD_T> &r) const; // must be dense
3890  __CUDA_HD__
3891  inline T* ptr(const Rect<DIM,COORD_T> &r, size_t strides[DIM]) const;
3892  __CUDA_HD__
3893  inline T& operator[](const Point<DIM,COORD_T> &p) const;
3894  public:
3895  void destroy();
3896  Realm::RegionInstance get_instance() const;
3897  protected:
3898  friend class OutputRegion;
3899  friend class UntypedDeferredBuffer<COORD_T>;
3900  Realm::RegionInstance instance;
3901  Realm::AffineAccessor<T,DIM,COORD_T> accessor;
3902  std::array<DimensionKind,DIM> ordering;
3903  size_t alignment;
3904 #ifdef LEGION_BOUNDS_CHECKS
3905  DomainT<DIM,COORD_T> bounds;
3906 #endif
3907  };
3908 
3915  template<typename COORD_T = coord_t>
3917  private:
3918  static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3919  public:
3920  UntypedDeferredBuffer(void);
3921  public: // Constructors specifying a generic memory kind
3922  UntypedDeferredBuffer(size_t field_size, int dims,
3923  Memory::Kind kind,
3924  const Domain &bounds,
3925  const void *initial_value = NULL,
3926  size_t alignment = 16,
3927  bool fortran_order_dims = false);
3928  UntypedDeferredBuffer(size_t field_size, int dims,
3929  Memory::Kind kind,
3930  IndexSpace bounds,
3931  const void *initial_value = NULL,
3932  size_t alignment = 16,
3933  bool fortran_order_dims = false);
3934  public: // Constructors specifying a specific memory
3935  UntypedDeferredBuffer(size_t field_size, int dims,
3936  Memory memory,
3937  const Domain &bounds,
3938  const void *initial_value = NULL,
3939  size_t alignment = 16,
3940  bool fortran_order_dims = false);
3941  UntypedDeferredBuffer(size_t field_size, int dims,
3942  Memory memory,
3943  IndexSpace bounds,
3944  const void *initial_value = NULL,
3945  size_t alignment = 16,
3946  bool fortran_order_dims = false);
3947  public:
3948  template<typename T, int DIM>
3950  public:
3951  template<typename T, int DIM, bool BC>
3952  inline operator DeferredBuffer<T,DIM,COORD_T,BC>(void) const;
3953  public:
3954  inline void destroy(void);
3955  inline Realm::RegionInstance get_instance(void) const { return instance; }
3956  private:
3957  template<PrivilegeMode,typename,int,typename,typename,bool>
3958  friend class FieldAccessor;
3959  template<typename,bool,int,typename,typename,bool>
3960  friend class ReductionAccessor;
3961  Realm::RegionInstance instance;
3962  size_t field_size;
3963  int dims;
3964  };
3965 
3972  class OutputRegion : public Unserializable<OutputRegion> {
3973  public:
3974  OutputRegion(void);
3975  OutputRegion(const OutputRegion &rhs);
3976  ~OutputRegion(void);
3977  private:
3978  Internal::OutputRegionImpl *impl;
3979  protected:
3980  FRIEND_ALL_RUNTIME_CLASSES
3981  explicit OutputRegion(Internal::OutputRegionImpl *impl);
3982  public:
3983  OutputRegion& operator=(const OutputRegion &rhs);
3984  public:
3985  Memory target_memory(void) const;
3986  // Returns the logical region of this output region.
3987  // The call is legal only when the output region is valid and
3988  // will raise an error otherwise.
3989  LogicalRegion get_logical_region(void) const;
3990  bool is_valid_output_region(void) const;
3991  public:
3992  // Returns a deferred buffer that satisfies the layout constraints of
3993  // this output region. The caller still needs to pass this buffer to
3994  // a return_data call if the buffer needs to be bound to this output
3995  // region. The caller can optionally choose to bind the returned buffer
3996  // to the output region; such a call cannot be made more than once.
3997  template<typename T,
3998  int DIM,
3999  typename COORD_T = coord_t,
4000 #ifdef LEGION_BOUNDS_CHECKS
4001  bool CHECK_BOUNDS = true>
4002 #else
4003  bool CHECK_BOUNDS = false>
4004 #endif
4006  create_buffer(const Point<DIM, COORD_T> &extents,
4007  FieldID field_id,
4008  const T *initial_value = NULL,
4009  bool return_buffer = false);
4010  private:
4011  void check_type_tag(TypeTag type_tag) const;
4012  void check_field_size(FieldID field_id, size_t field_size) const;
4013  void get_layout(FieldID field_id,
4014  std::vector<DimensionKind> &ordering,
4015  size_t &alignment) const;
4016  public:
4017  template<typename T,
4018  int DIM,
4019  typename COORD_T = coord_t,
4020 #ifdef LEGION_BOUNDS_CHECKS
4021  bool CHECK_BOUNDS = true>
4022 #else
4023  bool CHECK_BOUNDS = false>
4024 #endif
4025  void return_data(const Point<DIM,COORD_T> &extents,
4026  FieldID field_id,
4028  void return_data(const DomainPoint &extents,
4029  FieldID field_id,
4030  Realm::RegionInstance instance,
4031  bool check_constraints = true);
4032  private:
4033  void return_data(const DomainPoint &extents,
4034  FieldID field_id,
4035  Realm::RegionInstance instance,
4036  const LayoutConstraintSet *constraints,
4037  bool check_constraints);
4038  };
4039 
4040  //==========================================================================
4041  // Software Coherence Classes
4042  //==========================================================================
4043 
4056  public:
4057  AcquireLauncher(LogicalRegion logical_region,
4058  LogicalRegion parent_region,
4059  PhysicalRegion physical_region = PhysicalRegion(),
4060  Predicate pred = Predicate::TRUE_PRED,
4061  MapperID id = 0, MappingTagID tag = 0,
4062  UntypedBuffer map_arg = UntypedBuffer(),
4063  const char *provenance = "");
4064  public:
4065  inline void add_field(FieldID f);
4066  inline void add_grant(Grant g);
4067  inline void add_wait_barrier(PhaseBarrier pb);
4068  inline void add_arrival_barrier(PhaseBarrier pb);
4069  inline void add_wait_handshake(LegionHandshake handshake);
4070  inline void add_arrival_handshake(LegionHandshake handshake);
4071  public:
4072  LogicalRegion logical_region;
4073  LogicalRegion parent_region;
4074  std::set<FieldID> fields;
4075  public:
4076  // This field is now optional (but required with control replication)
4077  PhysicalRegion physical_region;
4078  public:
4079  std::vector<Grant> grants;
4080  std::vector<PhaseBarrier> wait_barriers;
4081  std::vector<PhaseBarrier> arrive_barriers;
4082  Predicate predicate;
4083  MapperID map_id;
4084  MappingTagID tag;
4085  UntypedBuffer map_arg;
4086  public:
4087  // Provenance string for the runtime and tools to use
4088  std::string provenance;
4089  public:
4090  // Inform the runtime about any static dependences
4091  // These will be ignored outside of static traces
4092  const std::vector<StaticDependence> *static_dependences;
4093  public:
4094  bool silence_warnings;
4095  };
4096 
4104  public:
4105  ReleaseLauncher(LogicalRegion logical_region,
4106  LogicalRegion parent_region,
4107  PhysicalRegion physical_region = PhysicalRegion(),
4108  Predicate pred = Predicate::TRUE_PRED,
4109  MapperID id = 0, MappingTagID tag = 0,
4110  UntypedBuffer map_arg = UntypedBuffer(),
4111  const char *provenance = "");
4112  public:
4113  inline void add_field(FieldID f);
4114  inline void add_grant(Grant g);
4115  inline void add_wait_barrier(PhaseBarrier pb);
4116  inline void add_arrival_barrier(PhaseBarrier pb);
4117  inline void add_wait_handshake(LegionHandshake handshake);
4118  inline void add_arrival_handshake(LegionHandshake handshake);
4119  public:
4120  LogicalRegion logical_region;
4121  LogicalRegion parent_region;
4122  std::set<FieldID> fields;
4123  public:
4124  // This field is now optional (but required with control replication)
4125  PhysicalRegion physical_region;
4126  public:
4127  std::vector<Grant> grants;
4128  std::vector<PhaseBarrier> wait_barriers;
4129  std::vector<PhaseBarrier> arrive_barriers;
4130  Predicate predicate;
4131  MapperID map_id;
4132  MappingTagID tag;
4133  UntypedBuffer map_arg;
4134  public:
4135  // Provenance string for the runtime and tools to use
4136  std::string provenance;
4137  public:
4138  // Inform the runtime about any static dependences
4139  // These will be ignored outside of static traces
4140  const std::vector<StaticDependence> *static_dependences;
4141  public:
4142  bool silence_warnings;
4143  };
4144 
4145  //==========================================================================
4146  // Must Parallelism Classes
4147  //==========================================================================
4148 
4163  public:
4164  MustEpochLauncher(MapperID id = 0, MappingTagID tag = 0);
4165  public:
4166  inline void add_single_task(const DomainPoint &point,
4167  const TaskLauncher &launcher);
4168  inline void add_index_task(const IndexTaskLauncher &launcher);
4169  public:
4170  MapperID map_id;
4171  MappingTagID mapping_tag;
4172  std::vector<TaskLauncher> single_tasks;
4173  std::vector<IndexTaskLauncher> index_tasks;
4174  public:
4175  Domain launch_domain;
4176  IndexSpace launch_space;
4177  // Will only be used in control replication context. If left
4178  // unset the runtime will use launch_space/launch_domain
4179  IndexSpace sharding_space;
4180  public:
4181  // Provenance string for the runtime and tools to use
4182  std::string provenance;
4183  public:
4184  bool silence_warnings;
4185  };
4186 
4187  //==========================================================================
4188  // Interoperability Classes
4189  //==========================================================================
4190 
4201  class LegionHandshake : public Unserializable<LegionHandshake> {
4202  public:
4203  LegionHandshake(void);
4204  LegionHandshake(const LegionHandshake &rhs);
4205  ~LegionHandshake(void);
4206  protected:
4207  Internal::LegionHandshakeImpl *impl;
4208  protected:
4209  // Only the runtime should be able to make these
4210  FRIEND_ALL_RUNTIME_CLASSES
4211  explicit LegionHandshake(Internal::LegionHandshakeImpl *impl);
4212  public:
4213  bool operator==(const LegionHandshake &h) const
4214  { return impl == h.impl; }
4215  bool operator<(const LegionHandshake &h) const
4216  { return impl < h.impl; }
4217  LegionHandshake& operator=(const LegionHandshake &rhs);
4218  public:
4223  void ext_handoff_to_legion(void) const;
4229  void ext_wait_on_legion(void) const;
4230  public:
4235  void legion_handoff_to_ext(void) const;
4240  void legion_wait_on_ext(void) const;
4241  public:
4242  /*
4243  * For asynchronous Legion execution, you can use these
4244  * methods to get a phase barrier associated with the
4245  * handshake object instead of blocking on the legion side
4246  */
4258  void advance_legion_handshake(void) const;
4259  };
4260 
4267  public:
4268  MPILegionHandshake(void);
4270  ~MPILegionHandshake(void);
4271  protected:
4272  // Only the runtime should be able to make these
4273  FRIEND_ALL_RUNTIME_CLASSES
4274  explicit MPILegionHandshake(Internal::LegionHandshakeImpl *impl);
4275  public:
4276  bool operator==(const MPILegionHandshake &h) const
4277  { return impl == h.impl; }
4278  bool operator<(const MPILegionHandshake &h) const
4279  { return impl < h.impl; }
4280  MPILegionHandshake& operator=(const MPILegionHandshake &rhs);
4281  public:
4286  inline void mpi_handoff_to_legion(void) const { ext_handoff_to_legion(); }
4291  inline void mpi_wait_on_legion(void) const { ext_wait_on_legion(); }
4292  public:
4297  inline void legion_handoff_to_mpi(void) const { legion_handoff_to_ext(); }
4302  inline void legion_wait_on_mpi(void) const { legion_wait_on_ext(); }
4303  };
4304 
4305  //==========================================================================
4306  // Operation Classes
4307  //==========================================================================
4308 
4315  class Mappable {
4316  public:
4317  Mappable(void);
4318  public:
4319  // Return a globally unique ID for this operation
4320  virtual UniqueID get_unique_id(void) const = 0;
4321  // Return the number of operations that came before
4322  // this operation in the same context (close operations
4323  // return number of previous close operations)
4324  virtual uint64_t get_context_index(void) const = 0;
4325  // Return the depth of this operation in the task tree
4326  virtual int get_depth(void) const = 0;
4327  // Get the parent task associated with this mappable
4328  virtual const Task* get_parent_task(void) const = 0;
4329  // Get the provenance string for this mappable
4330  // By default we return the human readable component but
4331  // you can also get the machine component as well
4332  virtual const std::string_view& get_provenance_string(
4333  bool human = true) const = 0;
4334  public:
4335  virtual MappableType get_mappable_type(void) const = 0;
4336  virtual const Task* as_task(void) const { return NULL; }
4337  virtual const Copy* as_copy(void) const { return NULL; }
4338  virtual const InlineMapping* as_inline(void) const { return NULL; }
4339  virtual const Acquire* as_acquire(void) const { return NULL; }
4340  virtual const Release* as_release(void) const { return NULL; }
4341  virtual const Close* as_close(void) const { return NULL; }
4342  virtual const Fill* as_fill(void) const { return NULL; }
4343  virtual const Partition* as_partition(void) const { return NULL; }
4344  virtual const MustEpoch* as_must_epoch(void) const { return NULL; }
4345  public:
4346  MapperID map_id;
4347  MappingTagID tag;
4348  public:
4349  // The 'parent_task' member is here for backwards compatibility
4350  // It's better to use the 'get_parent_task' method
4351  // as this may be NULL until that method is called
4352  mutable const Task* parent_task;
4353  public:
4354  // Mapper annotated data
4355  void* mapper_data;
4356  size_t mapper_data_size;
4357  public:
4358  // These are here for backwards compatibility from a time when
4359  // the MappableType enum was inside of this class
4360 #ifndef __GNUC__
4361  // GCC doesn't like this line even though it's just creating a
4362  // type alias, who knows what their problem is
4363  typedef Legion::MappableType MappableType;
4364 #endif
4365  static const MappableType TASK_MAPPABLE = ::LEGION_TASK_MAPPABLE;
4366  static const MappableType COPY_MAPPABLE = ::LEGION_COPY_MAPPABLE;
4367  static const MappableType INLINE_MAPPABLE = ::LEGION_INLINE_MAPPABLE;
4368  static const MappableType ACQUIRE_MAPPABLE = ::LEGION_ACQUIRE_MAPPABLE;
4369  static const MappableType RELEASE_MAPPABLE = ::LEGION_RELEASE_MAPPABLE;
4370  static const MappableType CLOSE_MAPPABLE = ::LEGION_CLOSE_MAPPABLE;
4371  static const MappableType FILL_MAPPABLE = ::LEGION_FILL_MAPPABLE;
4372  static const MappableType PARTITION_MAPPABLE =
4373  ::LEGION_PARTITION_MAPPABLE;
4374  static const MappableType MUST_EPOCH_MAPPABLE =
4375  ::LEGION_MUST_EPOCH_MAPPABLE;
4376  };
4377 
4386  class Task : public Mappable {
4387  public:
4388  Task(void);
4389  public:
4390  // Check whether this task has a parent task.
4391  virtual bool has_parent_task(void) const = 0;
4392  // Return the name of the task.
4393  virtual const char* get_task_name(void) const = 0;
4394  // Returns the current slice of the index domain that this
4395  // task is operating over. This method will only return a
4396  // valid domain if this is part of an index space task.
4397  virtual Domain get_slice_domain(void) const = 0;
4398  //------------------------------------------------------------------------
4399  // Control Replication methods
4400  // In general SPMD-style programming in Legion is wrong. If you find
4401  // yourself writing SPMD-style code for large fractions of your program
4402  // then you're probably doing something wrong. There are a few exceptions:
4403  // 1. index attach/detach operations are collective and may need
4404  // to do per-shard work
4405  // 2. I/O in general often needs to do per-shard work
4406  // 3. interaction with collective frameworks like MPI and NCCL
4407  // 4. others?
4408  // For these reasons we allow users to get access to sharding information
4409  // Please, please, please be careful with how you use it
4410  //------------------------------------------------------------------------
4411  virtual ShardID get_shard_id(void) const = 0;
4412  virtual size_t get_total_shards(void) const = 0;
4413  virtual DomainPoint get_shard_point(void) const = 0;
4414  virtual Domain get_shard_domain(void) const = 0;
4415  public:
4416  virtual MappableType get_mappable_type(void) const
4417  { return LEGION_TASK_MAPPABLE; }
4418  virtual const Task* as_task(void) const { return this; }
4419  public:
4420  // Task argument information
4421  TaskID task_id;
4422  std::vector<IndexSpaceRequirement> indexes;
4423  std::vector<RegionRequirement> regions;
4424  std::vector<OutputRequirement> output_regions;
4425  std::vector<Future> futures;
4426  std::vector<Grant> grants;
4427  std::vector<PhaseBarrier> wait_barriers;
4428  std::vector<PhaseBarrier> arrive_barriers;
4429  void* args;
4430  size_t arglen;
4431  public:
4432  // Index task argument information
4433  bool is_index_space;
4434  bool concurrent_task;
4435  bool must_epoch_task;
4436  Domain index_domain;
4437  DomainPoint index_point;
4438  IndexSpace sharding_space;
4439  void* local_args;
4440  size_t local_arglen;
4441  public:
4442  // Meta data information from the runtime
4443  Processor orig_proc;
4444  Processor current_proc;
4445  Processor target_proc;
4446  unsigned steal_count;
4447  bool stealable;
4448  bool speculated;
4449  bool local_function;
4450  };
4451 
4457  class Copy : public Mappable {
4458  public:
4459  Copy(void);
4460  public:
4461  virtual MappableType get_mappable_type(void) const
4462  { return LEGION_COPY_MAPPABLE; }
4463  virtual const Copy* as_copy(void) const { return this; }
4464  public:
4465  // Copy Launcher arguments
4466  std::vector<RegionRequirement> src_requirements;
4467  std::vector<RegionRequirement> dst_requirements;
4468  std::vector<RegionRequirement> src_indirect_requirements;
4469  std::vector<RegionRequirement> dst_indirect_requirements;
4470  std::vector<Grant> grants;
4471  std::vector<PhaseBarrier> wait_barriers;
4472  std::vector<PhaseBarrier> arrive_barriers;
4473  public:
4474  // Index copy argument information
4475  bool is_index_space;
4476  Domain index_domain;
4477  DomainPoint index_point;
4478  IndexSpace sharding_space;
4479  };
4480 
4486  class InlineMapping : public Mappable {
4487  public:
4488  InlineMapping(void);
4489  public:
4490  virtual MappableType get_mappable_type(void) const
4491  { return LEGION_INLINE_MAPPABLE; }
4492  virtual const InlineMapping* as_inline(void) const { return this; }
4493  virtual ShardID get_parent_shard(void) const { return 0; }
4494  public:
4495  // Inline Launcher arguments
4496  RegionRequirement requirement;
4497  std::vector<Grant> grants;
4498  std::vector<PhaseBarrier> wait_barriers;
4499  std::vector<PhaseBarrier> arrive_barriers;
4500  LayoutConstraintID layout_constraint_id;
4501  };
4502 
4508  class Acquire : public Mappable {
4509  public:
4510  Acquire(void);
4511  public:
4512  virtual MappableType get_mappable_type(void) const
4513  { return LEGION_ACQUIRE_MAPPABLE; }
4514  virtual const Acquire* as_acquire(void) const { return this; }
4515  public:
4516  // Acquire Launcher arguments
4517  LogicalRegion logical_region;
4518  LogicalRegion parent_region;
4519  std::set<FieldID> fields;
4520  std::vector<Grant> grants;
4521  std::vector<PhaseBarrier> wait_barriers;
4522  std::vector<PhaseBarrier> arrive_barriers;
4523  };
4524 
4530  class Release : public Mappable {
4531  public:
4532  Release(void);
4533  public:
4534  virtual MappableType get_mappable_type(void) const
4535  { return LEGION_RELEASE_MAPPABLE; }
4536  virtual const Release* as_release(void) const { return this; }
4537  public:
4538  // Release Launcher arguments
4539  LogicalRegion logical_region;
4540  LogicalRegion parent_region;
4541  std::set<FieldID> fields;
4542  std::vector<Grant> grants;
4543  std::vector<PhaseBarrier> wait_barriers;
4544  std::vector<PhaseBarrier> arrive_barriers;
4545  };
4546 
4556  class Close : public Mappable {
4557  public:
4558  Close(void);
4559  public:
4560  virtual MappableType get_mappable_type(void) const
4561  { return LEGION_CLOSE_MAPPABLE; }
4562  virtual const Close* as_close(void) const { return this; }
4563  public:
4564  // Synthesized region requirement
4565  RegionRequirement requirement;
4566  };
4567 
4574  class Fill : public Mappable {
4575  public:
4576  Fill(void);
4577  public:
4578  virtual MappableType get_mappable_type(void) const
4579  { return LEGION_FILL_MAPPABLE; }
4580  virtual const Fill* as_fill(void) const { return this; }
4581  public:
4582  // Synthesized region requirement
4583  RegionRequirement requirement;
4584  std::vector<Grant> grants;
4585  std::vector<PhaseBarrier> wait_barriers;
4586  std::vector<PhaseBarrier> arrive_barriers;
4587  public:
4588  // Index fill argument information
4589  bool is_index_space;
4590  Domain index_domain;
4591  DomainPoint index_point;
4592  IndexSpace sharding_space;
4593  };
4594 
4602  class Partition : public Mappable {
4603  public:
4604  Partition(void);
4605  public:
4606  virtual MappableType get_mappable_type(void) const
4607  { return LEGION_PARTITION_MAPPABLE; }
4608  virtual const Partition* as_partition(void) const { return this; }
4609  public:
4610  enum PartitionKind {
4611  BY_FIELD, // create partition by field
4612  BY_IMAGE, // create partition by image
4613  BY_IMAGE_RANGE, // create partition by image range
4614  BY_PREIMAGE, // create partition by preimage
4615  BY_PREIMAGE_RANGE, // create partition by preimage range
4616  BY_ASSOCIATION, // create partition by association
4617  };
4618  virtual PartitionKind get_partition_kind(void) const = 0;
4619  public:
4620  // Synthesized region requirement
4621  RegionRequirement requirement;
4622  public:
4623  // Index partition argument information
4624  bool is_index_space;
4625  Domain index_domain;
4626  DomainPoint index_point;
4627  };
4628 
4635  class MustEpoch : public Mappable {
4636  public:
4637  MustEpoch(void);
4638  public:
4639  virtual MappableType get_mappable_type(void) const
4640  { return LEGION_MUST_EPOCH_MAPPABLE; }
4641  virtual const MustEpoch* as_must_epoch(void) const { return this; }
4642  public:
4643  std::vector<const Task*> individual_tasks;
4644  std::vector<const Task*> index_space_tasks;
4645  public:
4646  // Index space of points for the must epoch operation
4647  Domain launch_domain;
4648  IndexSpace sharding_space;
4649  };
4650 
4651  //==========================================================================
4652  // Runtime Classes
4653  //==========================================================================
4654 
4660  struct InputArgs {
4661  public:
4662  char **argv;
4663  int argc;
4664  };
4665 
4671  Machine machine;
4672  Runtime *runtime;
4673  std::set<Processor> local_procs;
4674  UntypedBuffer buffer;
4675  };
4676 
4690  public:
4691  TaskConfigOptions(bool leaf = false,
4692  bool inner = false,
4693  bool idempotent = false);
4694  public:
4695  bool leaf;
4696  bool inner;
4697  bool idempotent;
4698  };
4699 
4718  public:
4719  ProjectionFunctor(void);
4721  virtual ~ProjectionFunctor(void);
4722  public:
4739  virtual LogicalRegion project(const Mappable *mappable, unsigned index,
4740  LogicalRegion upper_bound,
4741  const DomainPoint &point);
4750  virtual LogicalRegion project(const Mappable *mappable, unsigned index,
4751  LogicalPartition upper_bound,
4752  const DomainPoint &point);
4753 
4764  virtual LogicalRegion project(LogicalRegion upper_bound,
4765  const DomainPoint &point,
4766  const Domain &launch_domain);
4767 
4779  const DomainPoint &point,
4780  const Domain &launch_domain);
4781 
4794  virtual LogicalRegion project(LogicalRegion upper_bound,
4795  const DomainPoint &point,
4796  const Domain &launch_domain,
4797  const void *args, size_t size);
4798 
4812  const DomainPoint &point,
4813  const Domain &launch_domain,
4814  const void *args, size_t size);
4815 
4827  LEGION_DEPRECATED("The interface for projection functors has been "
4828  "updated. Please use the new 'project' methods.")
4829  virtual LogicalRegion project(Context ctx, Task *task,
4830  unsigned index,
4831  LogicalRegion upper_bound,
4832  const DomainPoint &point);
4844  LEGION_DEPRECATED("The interface for projection functors has been "
4845  "updated. Please use the new 'project' methods.")
4846  virtual LogicalRegion project(Context ctx, Task *task,
4847  unsigned index,
4848  LogicalPartition upper_bound,
4849  const DomainPoint &point);
4851 
4859  virtual void invert(LogicalRegion region, LogicalRegion upper_bound,
4860  const Domain &launch_domain,
4861  std::vector<DomainPoint> &ordered_points);
4862  virtual void invert(LogicalRegion region, LogicalPartition upper_bound,
4863  const Domain &launch_domain,
4864  std::vector<DomainPoint> &ordered_points);
4866 
4868 
4888  virtual bool is_complete(LogicalRegion upper_bound,
4889  const Domain &launch_domain);
4890  virtual bool is_complete(LogicalPartition upper_bound,
4891  const Domain &launch_domain);
4892  virtual bool is_complete(Mappable *mappable, unsigned index,
4893  LogicalRegion upper_bound, const Domain &launch_domain);
4894  virtual bool is_complete(Mappable *mappable, unsigned index,
4895  LogicalPartition upper_bound, const Domain &launch_domain);
4897 
4904  virtual bool is_exclusive(void) const { return false; }
4905 
4906  /*
4907  * Indicate whether this is a functional projection
4908  * functor or whether it depends on the operation being
4909  * launched. This will determine which project method
4910  * is invoked by the runtime.
4911  */
4912  virtual bool is_functional(void) const { return false; }
4913 
4919  virtual bool is_invertible(void) const { return false; }
4920 
4932  virtual unsigned get_depth(void) const = 0;
4933  private:
4934  friend class Internal::Runtime;
4935  // For pre-registered projection functors the runtime will
4936  // use this to initialize the runtime pointer
4937  inline void set_runtime(Runtime *rt) { runtime = rt; }
4938  protected:
4939  Runtime *runtime;
4940  };
4941 
4956  public:
4957  ShardingFunctor(void);
4958  virtual ~ShardingFunctor(void);
4959  public:
4960  // Indicate whether this functor wants to use the ShardID or
4961  // DomainPoint versions of these methods
4962  virtual bool use_points(void) const { return false; }
4963  public:
4964  // The ShardID version of this method
4965  virtual ShardID shard(const DomainPoint &index_point,
4966  const Domain &index_domain,
4967  const size_t total_shards);
4968  // The DomainPoint version of this method
4969  virtual DomainPoint shard_points(const DomainPoint &index_point,
4970  const Domain &index_domain,
4971  const std::vector<DomainPoint> &shard_points,
4972  const Domain &shard_domain);
4973  public:
4974  virtual bool is_invertible(void) const { return false; }
4975  // The ShardID version of this method
4976  virtual void invert(ShardID shard,
4977  const Domain &sharding_domain,
4978  const Domain &index_domain,
4979  const size_t total_shards,
4980  std::vector<DomainPoint> &points);
4981  // The DomainPoint version of this method
4982  virtual void invert_points(const DomainPoint &shard_point,
4983  const std::vector<DomainPoint> &shard_points,
4984  const Domain &shard_domain,
4985  const Domain &index_domain,
4986  const Domain &sharding_domain,
4987  std::vector<DomainPoint> &index_points);
4988  };
4989 
5006  public:
5007  virtual ~FutureFunctor(void) { }
5008  public:
5009  virtual const void* callback_get_future(size_t &size, bool &owned,
5010  const Realm::ExternalInstanceResource *&resource,
5011  void (*&freefunc)(const Realm::ExternalInstanceResource&),
5012  const void *&metadata, size_t &metasize) = 0;
5013  virtual void callback_release_future(void) = 0;
5014  };
5015 
5025  public:
5026  virtual ~PointTransformFunctor(void) { }
5027  public:
5028  virtual bool is_invertible(void) const { return false; }
5029  // Transform a point from the domain into a point in the range
5030  virtual DomainPoint transform_point(const DomainPoint &point,
5031  const Domain &domain,
5032  const Domain &range) = 0;
5033  // Invert a point from range and convert it into a point in the domain
5034  // This is only called if is_invertible returns true
5035  virtual DomainPoint invert_point(const DomainPoint &point,
5036  const Domain &domain,
5037  const Domain &range)
5038  { return DomainPoint(); }
5039  };
5040 
5064  class Runtime {
5065  protected:
5066  // The Runtime bootstraps itself and should
5067  // never need to be explicitly created.
5068  friend class Internal::Runtime;
5069  friend class Future;
5070  Runtime(Internal::Runtime *rt);
5071  public:
5072  //------------------------------------------------------------------------
5073  // Index Space Operations
5074  //------------------------------------------------------------------------
5076 
5087  IndexSpace create_index_space(Context ctx, const Domain &bounds,
5088  TypeTag type_tag = 0,
5089  const char *provenance = NULL);
5090  // Template version
5091  template<int DIM, typename COORD_T>
5092  IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5093  const Rect<DIM,COORD_T> &bounds,
5094  const char *provenance = NULL);
5095  template<int DIM, typename COORD_T>
5096  IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5097  const DomainT<DIM,COORD_T> &bounds,
5098  const char *provenance = NULL);
5101 
5114  IndexSpace create_index_space(Context ctx, size_t dimensions,
5115  const Future &f, TypeTag type_tag = 0,
5116  const char *provenance = NULL);
5117  template<int DIM, typename COORD_T>
5118  IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx, const Future &f,
5119  const char *provenance = NULL);
5122 
5131  const std::vector<DomainPoint> &points,
5132  const char *provenance = NULL);
5133  // Template version
5134  template<int DIM, typename COORD_T>
5135  IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5136  const std::vector<Point<DIM,COORD_T> > &points,
5137  const char *provenance = NULL);
5140 
5149  const std::vector<Domain> &rects,
5150  const char *provenance = NULL);
5151  // Template version
5152  template<int DIM, typename COORD_T>
5153  IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5154  const std::vector<Rect<DIM,COORD_T> > &rects,
5155  const char *provenance = NULL);
5158 
5168  const std::vector<IndexSpace> &spaces,
5169  const char *provenance = NULL);
5170  // Template version
5171  template<int DIM, typename COORD_T>
5172  IndexSpaceT<DIM,COORD_T> union_index_spaces(Context ctx,
5173  const std::vector<IndexSpaceT<DIM,COORD_T> > &spaces,
5174  const char *provenance = NULL);
5177 
5187  const std::vector<IndexSpace> &spaces,
5188  const char *provenance = NULL);
5189  // Template version
5190  template<int DIM, typename COORD_T>
5191  IndexSpaceT<DIM,COORD_T> intersect_index_spaces(Context ctx,
5192  const std::vector<IndexSpaceT<DIM,COORD_T> > &spaces,
5193  const char *provenance = NULL);
5196 
5203  IndexSpace left, IndexSpace right,
5204  const char *provenance = NULL);
5205  // Template version
5206  template<int DIM, typename COORD_T>
5207  IndexSpaceT<DIM,COORD_T> subtract_index_spaces(Context ctx,
5209  const char *provenance = NULL);
5211 
5218  LEGION_DEPRECATED("Use the new index space creation routines with a "
5219  "single domain or rectangle.")
5220  IndexSpace create_index_space(Context ctx, size_t max_num_elmts);
5228  LEGION_DEPRECATED("Use the new index space creation routines with a "
5229  "single domain or rectangle.")
5230  IndexSpace create_index_space(Context ctx,
5231  const std::set<Domain> &domains);
5242  void create_shared_ownership(Context ctx, IndexSpace handle);
5253  void destroy_index_space(Context ctx, IndexSpace handle,
5254  const bool unordered = false,
5255  const bool recurse = true,
5256  const char *provenance = NULL);
5257  public:
5268  void create_shared_ownership(Context ctx, IndexPartition handle);
5279  void destroy_index_partition(Context ctx, IndexPartition handle,
5280  const bool unordered = false,
5281  const bool recurse = true,
5282  const char *provenance = NULL);
5283  public:
5284  //------------------------------------------------------------------------
5285  // Dependent Partitioning Operations
5286  //------------------------------------------------------------------------
5288 
5308  IndexPartition create_equal_partition(Context ctx, IndexSpace parent,
5309  IndexSpace color_space,
5310  size_t granularity = 1,
5311  Color color =
5312  LEGION_AUTO_GENERATE_ID,
5313  const char *provenance = NULL);
5314  template<int DIM, typename COORD_T,
5315  int COLOR_DIM, typename COLOR_COORD_T>
5316  IndexPartitionT<DIM,COORD_T> create_equal_partition(Context ctx,
5317  IndexSpaceT<DIM,COORD_T> parent,
5318  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5319  size_t granularity = 1,
5320  Color color = LEGION_AUTO_GENERATE_ID,
5321  const char *provenance = NULL);
5324 
5341  IndexPartition create_partition_by_weights(Context ctx, IndexSpace parent,
5342  const std::map<DomainPoint,int> &weights,
5343  IndexSpace color_space,
5344  size_t granularity = 1,
5345  Color color = LEGION_AUTO_GENERATE_ID,
5346  const char *provenance = NULL);
5347  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5348  IndexPartitionT<DIM,COORD_T> create_partition_by_weights(Context ctx,
5349  IndexSpaceT<DIM,COORD_T> parent,
5350  const std::map<Point<COLOR_DIM,COLOR_COORD_T>,int> &weights,
5351  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5352  size_t granularity = 1,
5353  Color color = LEGION_AUTO_GENERATE_ID,
5354  const char *provenance = NULL);
5355  // 64-bit versions
5356  IndexPartition create_partition_by_weights(Context ctx, IndexSpace parent,
5357  const std::map<DomainPoint,size_t> &weights,
5358  IndexSpace color_space,
5359  size_t granularity = 1,
5360  Color color = LEGION_AUTO_GENERATE_ID,
5361  const char *provenance = NULL);
5362  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5363  IndexPartitionT<DIM,COORD_T> create_partition_by_weights(Context ctx,
5364  IndexSpaceT<DIM,COORD_T> parent,
5365  const std::map<Point<COLOR_DIM,COLOR_COORD_T>,size_t> &weights,
5366  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5367  size_t granularity = 1, Color color = LEGION_AUTO_GENERATE_ID,
5368  const char *provenance = NULL);
5369  // Alternate versions of the above method that take a future map where
5370  // the values in the future map will be interpretted as integer weights
5371  // You can use this method with both 32 and 64 bit weights
5372  IndexPartition create_partition_by_weights(Context ctx, IndexSpace parent,
5373  const FutureMap &weights,
5374  IndexSpace color_space,
5375  size_t granularity = 1,
5376  Color color =
5377  LEGION_AUTO_GENERATE_ID,
5378  const char *provenance = NULL);
5379  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5380  IndexPartitionT<DIM,COORD_T> create_partition_by_weights(Context ctx,
5381  IndexSpaceT<DIM,COORD_T> parent,
5382  const FutureMap &weights,
5383  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5384  size_t granularity = 1,
5385  Color color = LEGION_AUTO_GENERATE_ID,
5386  const char *provenance = NULL);
5389 
5413  IndexPartition create_partition_by_union(Context ctx,
5414  IndexSpace parent,
5415  IndexPartition handle1,
5416  IndexPartition handle2,
5417  IndexSpace color_space,
5418  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5419  Color color = LEGION_AUTO_GENERATE_ID,
5420  const char *provenance = NULL);
5421  template<int DIM, typename COORD_T,
5422  int COLOR_DIM, typename COLOR_COORD_T>
5423  IndexPartitionT<DIM,COORD_T> create_partition_by_union(Context ctx,
5424  IndexSpaceT<DIM,COORD_T> parent,
5425  IndexPartitionT<DIM,COORD_T> handle1,
5426  IndexPartitionT<DIM,COORD_T> handle2,
5427  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5428  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5429  Color color = LEGION_AUTO_GENERATE_ID,
5430  const char *provenance = NULL);
5433 
5458  IndexPartition create_partition_by_intersection(Context ctx,
5459  IndexSpace parent,
5460  IndexPartition handle1,
5461  IndexPartition handle2,
5462  IndexSpace color_space,
5463  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5464  Color color = LEGION_AUTO_GENERATE_ID,
5465  const char *provenance = NULL);
5466  template<int DIM, typename COORD_T,
5467  int COLOR_DIM, typename COLOR_COORD_T>
5468  IndexPartitionT<DIM,COORD_T> create_partition_by_intersection(
5469  Context ctx,
5470  IndexSpaceT<DIM,COORD_T> parent,
5471  IndexPartitionT<DIM,COORD_T> handle1,
5472  IndexPartitionT<DIM,COORD_T> handle2,
5473  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5474  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5475  Color color = LEGION_AUTO_GENERATE_ID,
5476  const char *provenance = NULL);
5479 
5499  IndexPartition create_partition_by_intersection(Context ctx,
5500  IndexSpace parent,
5501  IndexPartition partition,
5502  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5503  Color color = LEGION_AUTO_GENERATE_ID,
5504  bool dominates = false,
5505  const char *provenance = NULL);
5506  template<int DIM, typename COORD_T>
5507  IndexPartitionT<DIM,COORD_T> create_partition_by_intersection(Context ctx,
5508  IndexSpaceT<DIM,COORD_T> parent,
5509  IndexPartitionT<DIM,COORD_T> partition,
5510  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5511  Color color = LEGION_AUTO_GENERATE_ID,
5512  bool dominates = false,
5513  const char *provenance = NULL);
5516 
5541  IndexPartition create_partition_by_difference(Context ctx,
5542  IndexSpace parent,
5543  IndexPartition handle1,
5544  IndexPartition handle2,
5545  IndexSpace color_space,
5546  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5547  Color color = LEGION_AUTO_GENERATE_ID,
5548  const char *provenance = NULL);
5549  template<int DIM, typename COORD_T,
5550  int COLOR_DIM, typename COLOR_COORD_T>
5551  IndexPartitionT<DIM,COORD_T> create_partition_by_difference(Context ctx,
5552  IndexSpaceT<DIM,COORD_T> parent,
5553  IndexPartitionT<DIM,COORD_T> handle1,
5554  IndexPartitionT<DIM,COORD_T> handle2,
5555  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5556  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5557  Color color = LEGION_AUTO_GENERATE_ID,
5558  const char *provenance = NULL);
5561 
5586  Color create_cross_product_partitions(Context ctx,
5587  IndexPartition handle1,
5588  IndexPartition handle2,
5589  std::map<IndexSpace,IndexPartition> &handles,
5590  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5591  Color color = LEGION_AUTO_GENERATE_ID,
5592  const char *provenance = NULL);
5593  template<int DIM, typename COORD_T,
5594  int COLOR_DIM, typename COLOR_COORD_T>
5595  Color create_cross_product_partitions(Context ctx,
5596  IndexPartitionT<DIM,COORD_T> handle1,
5597  IndexPartitionT<DIM,COORD_T> handle2,
5598  typename std::map<
5599  IndexSpaceT<DIM,COORD_T>,
5600  IndexPartitionT<DIM,COORD_T> > &handles,
5601  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5602  Color color = LEGION_AUTO_GENERATE_ID,
5603  const char *provenance = NULL);
5606 
5630  void create_association(Context ctx,
5631  LogicalRegion domain,
5632  LogicalRegion domain_parent,
5633  FieldID domain_fid,
5634  IndexSpace range,
5635  MapperID id = 0,
5636  MappingTagID tag = 0,
5637  UntypedBuffer map_arg = UntypedBuffer(),
5638  const char *provenance = NULL);
5639  void create_bidirectional_association(Context ctx,
5640  LogicalRegion domain,
5641  LogicalRegion domain_parent,
5642  FieldID domain_fid,
5643  LogicalRegion range,
5644  LogicalRegion range_parent,
5645  FieldID range_fid,
5646  MapperID id = 0,
5647  MappingTagID tag = 0,
5648  UntypedBuffer map_arg =
5649  UntypedBuffer(),
5650  const char *provenance = NULL);
5651  // Template versions
5652  template<int DIM1, typename COORD_T1, int DIM2, typename COORD_T2>
5653  void create_association(Context ctx,
5654  LogicalRegionT<DIM1,COORD_T1> domain,
5655  LogicalRegionT<DIM1,COORD_T1> domain_parent,
5656  FieldID domain_fid, // type: Point<DIM2,COORD_T2>
5657  IndexSpaceT<DIM2,COORD_T2> range,
5658  MapperID id = 0,
5659  MappingTagID tag = 0,
5660  UntypedBuffer map_arg = UntypedBuffer(),
5661  const char *provenance = NULL);
5662  template<int DIM1, typename COORD_T1, int DIM2, typename COORD_T2>
5663  void create_bidirectional_association(Context ctx,
5664  LogicalRegionT<DIM1,COORD_T1> domain,
5665  LogicalRegionT<DIM1,COORD_T1> domain_parent,
5666  FieldID domain_fid, // type: Point<DIM2,COORD_T2>
5667  LogicalRegionT<DIM2,COORD_T2> range,
5668  LogicalRegionT<DIM2,COORD_T2> range_parent,
5669  FieldID range_fid, // type: Point<DIM1,COORD_T1>
5670  MapperID id = 0,
5671  MappingTagID tag = 0,
5672  UntypedBuffer map_arg = UntypedBuffer(),
5673  const char *provenance = NULL);
5676 
5701  IndexPartition create_partition_by_restriction(Context ctx,
5702  IndexSpace parent,
5703  IndexSpace color_space,
5704  DomainTransform transform,
5705  Domain extent,
5706  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5707  Color color = LEGION_AUTO_GENERATE_ID,
5708  const char *provenance = NULL);
5709  // Template version
5710  template<int DIM, int COLOR_DIM, typename COORD_T>
5711  IndexPartitionT<DIM,COORD_T> create_partition_by_restriction(Context ctx,
5712  IndexSpaceT<DIM,COORD_T> parent,
5713  IndexSpaceT<COLOR_DIM,COORD_T> color_space,
5714  Transform<DIM,COLOR_DIM,COORD_T> transform,
5715  Rect<DIM,COORD_T> extent,
5716  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5717  Color color = LEGION_AUTO_GENERATE_ID,
5718  const char *provenance = NULL);
5721 
5736  IndexPartition create_partition_by_blockify(Context ctx,
5737  IndexSpace parent,
5738  DomainPoint blocking_factor,
5739  Color color = LEGION_AUTO_GENERATE_ID,
5740  const char *provenance = NULL);
5741  // Template version
5742  template<int DIM, typename COORD_T>
5743  IndexPartitionT<DIM,COORD_T> create_partition_by_blockify(Context ctx,
5744  IndexSpaceT<DIM,COORD_T> parent,
5745  Point<DIM,COORD_T> blocking_factor,
5746  Color color = LEGION_AUTO_GENERATE_ID,
5747  const char *provenance = NULL);
5760  IndexPartition create_partition_by_blockify(Context ctx,
5761  IndexSpace parent,
5762  DomainPoint blockify_factor,
5763  DomainPoint origin,
5764  Color color = LEGION_AUTO_GENERATE_ID,
5765  const char *provenance = NULL);
5766  // Template version
5767  template<int DIM, typename COORD_T>
5768  IndexPartitionT<DIM,COORD_T> create_partition_by_blockify(Context ctx,
5769  IndexSpaceT<DIM,COORD_T> parent,
5770  Point<DIM,COORD_T> blocking_factor,
5771  Point<DIM,COORD_T> origin,
5772  Color color = LEGION_AUTO_GENERATE_ID,
5773  const char *provenance = NULL);
5776 
5796  IndexPartition create_partition_by_domain(Context ctx,
5797  IndexSpace parent,
5798  const std::map<DomainPoint,Domain> &domains,
5799  IndexSpace color_space,
5800  bool perform_intersections = true,
5801  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5802  Color color = LEGION_AUTO_GENERATE_ID,
5803  const char *provenance = NULL);
5804  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5805  IndexPartitionT<DIM,COORD_T> create_partition_by_domain(Context ctx,
5806  IndexSpaceT<DIM,COORD_T> parent,
5807  const std::map<
5808  Point<COLOR_DIM,COLOR_COORD_T>,
5809  DomainT<DIM,COORD_T> > &domains,
5810  IndexSpaceT<COLOR_DIM,
5811  COLOR_COORD_T> color_space,
5812  bool perform_intersections = true,
5813  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5814  Color color = LEGION_AUTO_GENERATE_ID,
5815  const char *provenance = NULL);
5833  IndexPartition create_partition_by_domain(Context ctx,
5834  IndexSpace parent,
5835  const FutureMap &domain_future_map,
5836  IndexSpace color_space,
5837  bool perform_intersections = true,
5838  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5839  Color color = LEGION_AUTO_GENERATE_ID,
5840  const char *provenance = NULL);
5841  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5842  IndexPartitionT<DIM,COORD_T> create_partition_by_domain(Context ctx,
5843  IndexSpaceT<DIM,COORD_T> parent,
5844  const FutureMap &domain_future_map,
5845  IndexSpaceT<COLOR_DIM,
5846  COLOR_COORD_T> color_space,
5847  bool perform_intersections = true,
5848  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5849  Color color = LEGION_AUTO_GENERATE_ID,
5850  const char *provenance = NULL);
5853 
5870  template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5871  IndexPartitionT<DIM,COORD_T> create_partition_by_rectangles(Context ctx,
5872  IndexSpaceT<DIM,COORD_T> parent,
5873  const std::map<Point<COLOR_DIM,COLOR_COORD_T>,
5874  std::vector<Rect<DIM,COORD_T> > > &rectangles,
5875  IndexSpaceT<COLOR_DIM,
5876  COLOR_COORD_T> color_space,
5877  bool perform_intersections = true,
5878  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5879  Color color = LEGION_AUTO_GENERATE_ID,
5880  const char *provenance = NULL,
5881  bool collective = false);
5884 
5912  IndexPartition create_partition_by_field(Context ctx,
5913  LogicalRegion handle,
5914  LogicalRegion parent,
5915  FieldID fid,
5916  IndexSpace color_space,
5917  Color color =
5918  LEGION_AUTO_GENERATE_ID,
5919  MapperID id = 0,
5920  MappingTagID tag = 0,
5921  PartitionKind part_kind =
5922  LEGION_DISJOINT_KIND,
5923  UntypedBuffer map_arg =
5924  UntypedBuffer(),
5925  const char *provenance = NULL);
5926  template<int DIM, typename COORD_T,
5927  int COLOR_DIM, typename COLOR_COORD_T>
5928  IndexPartitionT<DIM,COORD_T> create_partition_by_field(Context ctx,
5929  LogicalRegionT<DIM,COORD_T> handle,
5930  LogicalRegionT<DIM,COORD_T> parent,
5931  FieldID fid, // type: Point<COLOR_DIM,COLOR_COORD_T>
5932  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5933  Color color = LEGION_AUTO_GENERATE_ID,
5934  MapperID id = 0, MappingTagID tag = 0,
5935  PartitionKind part_kind = LEGION_DISJOINT_KIND,
5936  UntypedBuffer map_arg = UntypedBuffer(),
5937  const char *provenance = NULL);
5940 
5973  IndexPartition create_partition_by_image(Context ctx,
5974  IndexSpace handle,
5975  LogicalPartition projection,
5976  LogicalRegion parent,
5977  FieldID fid,
5978  IndexSpace color_space,
5979  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5980  Color color = LEGION_AUTO_GENERATE_ID,
5981  MapperID id = 0, MappingTagID tag = 0,
5982  UntypedBuffer map_arg = UntypedBuffer(),
5983  const char *provenance = NULL);
5984  template<int DIM1, typename COORD_T1,
5985  int DIM2, typename COORD_T2,
5986  int COLOR_DIM, typename COLOR_COORD_T>
5987  IndexPartitionT<DIM2,COORD_T2> create_partition_by_image(Context ctx,
5988  IndexSpaceT<DIM2,COORD_T2> handle,
5989  LogicalPartitionT<DIM1,COORD_T1> projection,
5990  LogicalRegionT<DIM1,COORD_T1> parent,
5991  FieldID fid, // type: Point<DIM2,COORD_T2>
5992  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5993  PartitionKind part_kind = LEGION_COMPUTE_KIND,
5994  Color color = LEGION_AUTO_GENERATE_ID,
5995  MapperID id = 0, MappingTagID tag = 0,
5996  UntypedBuffer map_arg = UntypedBuffer(),
5997  const char *provenance = NULL);
5998  // Range versions of image
5999  IndexPartition create_partition_by_image_range(Context ctx,
6000  IndexSpace handle,
6001  LogicalPartition projection,
6002  LogicalRegion parent,
6003  FieldID fid,
6004  IndexSpace color_space,
6005  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6006  Color color = LEGION_AUTO_GENERATE_ID,
6007  MapperID id = 0, MappingTagID tag = 0,
6008  UntypedBuffer map_arg = UntypedBuffer(),
6009  const char *provenance = NULL);
6010  template<int DIM1, typename COORD_T1,
6011  int DIM2, typename COORD_T2,
6012  int COLOR_DIM, typename COLOR_COORD_T>
6013  IndexPartitionT<DIM2,COORD_T2> create_partition_by_image_range(
6014  Context ctx,
6015  IndexSpaceT<DIM2,COORD_T2> handle,
6016  LogicalPartitionT<DIM1,COORD_T1> projection,
6017  LogicalRegionT<DIM1,COORD_T1> parent,
6018  FieldID fid, // type: Rect<DIM2,COORD_T2>
6019  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6020  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6021  Color color = LEGION_AUTO_GENERATE_ID,
6022  MapperID id = 0, MappingTagID tag = 0,
6023  UntypedBuffer map_arg = UntypedBuffer(),
6024  const char *provenance = NULL);
6027 
6057  IndexPartition create_partition_by_preimage(Context ctx,
6058  IndexPartition projection,
6059  LogicalRegion handle,
6060  LogicalRegion parent,
6061  FieldID fid,
6062  IndexSpace color_space,
6063  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6064  Color color = LEGION_AUTO_GENERATE_ID,
6065  MapperID id = 0, MappingTagID tag = 0,
6066  UntypedBuffer map_arg = UntypedBuffer(),
6067  const char *provenance = NULL);
6068  template<int DIM1, typename COORD_T1,
6069  int DIM2, typename COORD_T2,
6070  int COLOR_DIM, typename COLOR_COORD_T>
6071  IndexPartitionT<DIM1,COORD_T1> create_partition_by_preimage(Context ctx,
6072  IndexPartitionT<DIM2,COORD_T2> projection,
6073  LogicalRegionT<DIM1,COORD_T1> handle,
6074  LogicalRegionT<DIM1,COORD_T1> parent,
6075  FieldID fid, // type: Point<DIM2,COORD_T2>
6076  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6077  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6078  Color color = LEGION_AUTO_GENERATE_ID,
6079  MapperID id = 0, MappingTagID tag = 0,
6080  UntypedBuffer map_arg = UntypedBuffer(),
6081  const char *provenance = NULL);
6082  // Range versions of preimage
6083  IndexPartition create_partition_by_preimage_range(Context ctx,
6084  IndexPartition projection,
6085  LogicalRegion handle,
6086  LogicalRegion parent,
6087  FieldID fid,
6088  IndexSpace color_space,
6089  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6090  Color color = LEGION_AUTO_GENERATE_ID,
6091  MapperID id = 0, MappingTagID tag = 0,
6092  UntypedBuffer map_arg = UntypedBuffer(),
6093  const char *provenance = NULL);
6094  template<int DIM1, typename COORD_T1,
6095  int DIM2, typename COORD_T2,
6096  int COLOR_DIM, typename COLOR_COORD_T>
6097  IndexPartitionT<DIM1,COORD_T1> create_partition_by_preimage_range(
6098  Context ctx,
6099  IndexPartitionT<DIM2,COORD_T2> projection,
6100  LogicalRegionT<DIM1,COORD_T1> handle,
6101  LogicalRegionT<DIM1,COORD_T1> parent,
6102  FieldID fid, // type: Rect<DIM2,COORD_T2>
6103  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6104  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6105  Color color = LEGION_AUTO_GENERATE_ID,
6106  MapperID id = 0, MappingTagID tag = 0,
6107  UntypedBuffer map_arg = UntypedBuffer(),
6108  const char *provenance = NULL);
6110  public:
6111  //------------------------------------------------------------------------
6112  // Computed Index Spaces and Partitions
6113  //------------------------------------------------------------------------
6115 
6141  IndexPartition create_pending_partition(Context ctx,
6142  IndexSpace parent,
6143  IndexSpace color_space,
6144  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6145  Color color = LEGION_AUTO_GENERATE_ID,
6146  const char *provenance = NULL);
6147  template<int DIM, typename COORD_T,
6148  int COLOR_DIM, typename COLOR_COORD_T>
6149  IndexPartitionT<DIM,COORD_T> create_pending_partition(Context ctx,
6150  IndexSpaceT<DIM,COORD_T> parent,
6151  IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6152  PartitionKind part_kind = LEGION_COMPUTE_KIND,
6153  Color color = LEGION_AUTO_GENERATE_ID,
6154  const char *provenance = NULL);
6157 
6173  IndexSpace create_index_space_union(Context ctx, IndexPartition parent,
6174  const DomainPoint &color,
6175  const std::vector<IndexSpace> &handles,
6176  const char *provenance = NULL);
6177  template<int DIM, typename COORD_T,
6178  int COLOR_DIM, typename COLOR_COORD_T>
6179  IndexSpaceT<DIM,COORD_T> create_index_space_union(Context ctx,
6180  IndexPartitionT<DIM,COORD_T> parent,
6181  Point<COLOR_DIM,COLOR_COORD_T> color,
6182  const typename std::vector<
6183  IndexSpaceT<DIM,COORD_T> > &handles,
6184  const char *provenance = NULL);
6187 
6200  IndexSpace create_index_space_union(Context ctx, IndexPartition parent,
6201  const DomainPoint &color,
6202  IndexPartition handle,
6203  const char *provenance = NULL);
6204  template<int DIM, typename COORD_T,
6205  int COLOR_DIM, typename COLOR_COORD_T>
6206  IndexSpaceT<DIM,COORD_T> create_index_space_union(Context ctx,
6207  IndexPartitionT<DIM,COORD_T> parent,
6208  Point<COLOR_DIM,COLOR_COORD_T> color,
6209  IndexPartitionT<DIM,COORD_T> handle,
6210  const char *provenance = NULL);
6213 
6229  IndexSpace create_index_space_intersection(Context ctx,
6230  IndexPartition parent,
6231  const DomainPoint &color,
6232  const std::vector<IndexSpace> &handles,
6233  const char *provenance = NULL);
6234  template<int DIM, typename COORD_T,
6235  int COLOR_DIM, typename COLOR_COORD_T>
6236  IndexSpaceT<DIM,COORD_T> create_index_space_intersection(Context ctx,
6237  IndexPartitionT<DIM,COORD_T> parent,
6238  Point<COLOR_DIM,COLOR_COORD_T> color,
6239  const typename std::vector<
6240  IndexSpaceT<DIM,COORD_T> > &handles,
6241  const char *provenance = NULL);
6244 
6257  IndexSpace create_index_space_intersection(Context ctx,
6258  IndexPartition parent,
6259  const DomainPoint &color,
6260  IndexPartition handle,
6261  const char *provenannce=NULL);
6262  template<int DIM, typename COORD_T,
6263  int COLOR_DIM, typename COLOR_COORD_T>
6264  IndexSpaceT<DIM,COORD_T> create_index_space_intersection(Context ctx,
6265  IndexPartitionT<DIM,COORD_T> parent,
6266  Point<COLOR_DIM,COLOR_COORD_T> color,
6267  IndexPartitionT<DIM,COORD_T> handle,
6268  const char *provenance = NULL);
6271 
6292  IndexSpace create_index_space_difference(Context ctx,
6293  IndexPartition parent,
6294  const DomainPoint &color,
6295  IndexSpace initial,
6296  const std::vector<IndexSpace> &handles,
6297  const char *provenancne = NULL);
6298  template<int DIM, typename COORD_T,
6299  int COLOR_DIM, typename COLOR_COORD_T>
6300  IndexSpaceT<DIM,COORD_T> create_index_space_difference(Context ctx,
6301  IndexPartitionT<DIM,COORD_T> parent,
6302  Point<COLOR_DIM,COLOR_COORD_T> color,
6303  IndexSpaceT<DIM,COORD_T> initial,
6304  const typename std::vector<
6305  IndexSpaceT<DIM,COORD_T> > &handles,
6306  const char *provenance = NULL);
6308  public:
6309  //------------------------------------------------------------------------
6310  // Index Tree Traversal Operations
6311  //------------------------------------------------------------------------
6313 
6321  IndexPartition get_index_partition(Context ctx, IndexSpace parent,
6322  Color color);
6323  IndexPartition get_index_partition(Context ctx, IndexSpace parent,
6324  const DomainPoint &color);
6325  // Context free versions
6326  IndexPartition get_index_partition(IndexSpace parent, Color color);
6327  IndexPartition get_index_partition(IndexSpace parent,
6328  const DomainPoint &color);
6329  // Template version
6330  template<int DIM, typename COORD_T>
6331  IndexPartitionT<DIM,COORD_T> get_index_partition(
6332  IndexSpaceT<DIM,COORD_T> parent, Color color);
6333 
6335 
6337 
6345  bool has_index_partition(Context ctx, IndexSpace parent, Color color);
6346  bool has_index_partition(Context ctx, IndexSpace parent,
6347  const DomainPoint &color);
6348  // Context free
6349  bool has_index_partition(IndexSpace parent, Color color);
6350  bool has_index_partition(IndexSpace parent,
6351  const DomainPoint &color);
6352  // Template version
6353  template<int DIM, typename COORD_T>
6354  bool has_index_partition(IndexSpaceT<DIM,COORD_T> parent, Color color);
6356 
6358 
6366  IndexSpace get_index_subspace(Context ctx, IndexPartition p,
6367  Color color);
6368  IndexSpace get_index_subspace(Context ctx, IndexPartition p,
6369  const DomainPoint &color);
6370  // Context free versions
6371  IndexSpace get_index_subspace(IndexPartition p, Color color);
6372  IndexSpace get_index_subspace(IndexPartition p,
6373  const DomainPoint &color);
6374  // Template version
6375  template<int DIM, typename COORD_T,
6376  int COLOR_DIM, typename COLOR_COORD_T>
6377  IndexSpaceT<DIM,COORD_T> get_index_subspace(
6378  IndexPartitionT<DIM,COORD_T> p,
6379  Point<COLOR_DIM,COLOR_COORD_T> color);
6381 
6383 
6391  bool has_index_subspace(Context ctx, IndexPartition p,
6392  const DomainPoint &color);
6393  // Context free
6394  bool has_index_subspace(IndexPartition p,
6395  const DomainPoint &color);
6396  // Template version
6397  template<int DIM, typename COORD_T,
6398  int COLOR_DIM, typename COLOR_COORD_T>
6399  bool has_index_subspace(IndexPartitionT<DIM,COORD_T> p,
6400  Point<COLOR_DIM,COLOR_COORD_T> color);
6402 
6404 
6414  LEGION_DEPRECATED("Multiple domains are no longer supported.")
6415  bool has_multiple_domains(Context ctx, IndexSpace handle);
6416  // Context free
6417  LEGION_DEPRECATED("Multiple domains are no longer supported.")
6418  bool has_multiple_domains(IndexSpace handle);
6420 
6422 
6429  Domain get_index_space_domain(Context ctx, IndexSpace handle);
6430  // Context free
6431  Domain get_index_space_domain(IndexSpace handle);
6432  // Template version
6433  template<int DIM, typename COORD_T>
6434  DomainT<DIM,COORD_T> get_index_space_domain(
6435  IndexSpaceT<DIM,COORD_T> handle);
6437 
6439 
6449  LEGION_DEPRECATED("Multiple domains are no longer supported.")
6450  void get_index_space_domains(Context ctx, IndexSpace handle,
6451  std::vector<Domain> &domains);
6452  // Context free
6453  LEGION_DEPRECATED("Multiple domains are no longer supported.")
6454  void get_index_space_domains(IndexSpace handle,
6455  std::vector<Domain> &domains);
6457 
6459 
6466  Domain get_index_partition_color_space(Context ctx, IndexPartition p);
6467  // Context free
6468  Domain get_index_partition_color_space(IndexPartition p);
6469  // Template version
6470  template<int DIM, typename COORD_T,
6471  int COLOR_DIM, typename COLOR_COORD_T>
6472  DomainT<COLOR_DIM,COLOR_COORD_T>
6473  get_index_partition_color_space(IndexPartitionT<DIM,COORD_T> p);
6475 
6477 
6483  IndexSpace get_index_partition_color_space_name(Context ctx,
6484  IndexPartition p);
6485  // Context free
6486  IndexSpace get_index_partition_color_space_name(IndexPartition p);
6487  // Template version
6488  template<int DIM, typename COORD_T,
6489  int COLOR_DIM, typename COLOR_COORD_T>
6490  IndexSpaceT<COLOR_DIM,COLOR_COORD_T>
6491  get_index_partition_color_space_name(IndexPartitionT<DIM,COORD_T> p);
6493 
6495 
6504  void get_index_space_partition_colors(Context ctx, IndexSpace sp,
6505  std::set<Color> &colors);
6506  void get_index_space_partition_colors(Context ctx, IndexSpace sp,
6507  std::set<DomainPoint> &colors);
6508  // Context free versions
6509  void get_index_space_partition_colors(IndexSpace sp,
6510  std::set<Color> &colors);
6511  void get_index_space_partition_colors(IndexSpace sp,
6512  std::set<DomainPoint> &colors);
6514 
6516 
6522  bool is_index_partition_disjoint(Context ctx, IndexPartition p);
6523  // Context free
6524  bool is_index_partition_disjoint(IndexPartition p);
6526 
6528 
6534  bool is_index_partition_complete(Context ctx, IndexPartition p);
6535  // Context free
6536  bool is_index_partition_complete(IndexPartition p);
6538 
6540 
6548  Color get_index_space_color(Context ctx, IndexSpace handle);
6549  DomainPoint get_index_space_color_point(Context ctx, IndexSpace handle);
6550  // Context free
6551  Color get_index_space_color(IndexSpace handle);
6552  DomainPoint get_index_space_color_point(IndexSpace handle);
6553  // Template version
6554  template<int DIM, typename COORD_T,
6555  int COLOR_DIM, typename COLOR_COORD_T>
6556  Point<COLOR_DIM,COLOR_COORD_T>
6557  get_index_space_color(IndexSpaceT<DIM,COORD_T> handle);
6559 
6561 
6568  Color get_index_partition_color(Context ctx, IndexPartition handle);
6569  DomainPoint get_index_partition_color_point(Context ctx,
6570  IndexPartition handle);
6571  // Context free
6572  Color get_index_partition_color(IndexPartition handle);
6573  DomainPoint get_index_partition_color_point(IndexPartition handle);
6575 
6577 
6583  IndexSpace get_parent_index_space(Context ctx, IndexPartition handle);
6584  // Context free
6585  IndexSpace get_parent_index_space(IndexPartition handle);
6586  // Template version
6587  template<int DIM, typename COORD_T>
6588  IndexSpaceT<DIM,COORD_T> get_parent_index_space(
6589  IndexPartitionT<DIM,COORD_T> handle);
6591 
6593 
6599  bool has_parent_index_partition(Context ctx, IndexSpace handle);
6600  // Context free
6601  bool has_parent_index_partition(IndexSpace handle);
6603 
6605 
6612  IndexPartition get_parent_index_partition(Context ctx, IndexSpace handle);
6613  // Context free
6614  IndexPartition get_parent_index_partition(IndexSpace handle);
6615  // Template version
6616  template<int DIM, typename COORD_T>
6617  IndexPartitionT<DIM,COORD_T> get_parent_index_partition(
6618  IndexSpaceT<DIM,COORD_T> handle);
6620 
6622 
6628  unsigned get_index_space_depth(Context ctx, IndexSpace handle);
6629  // Context free
6630  unsigned get_index_space_depth(IndexSpace handle);
6632 
6634 
6640  unsigned get_index_partition_depth(Context ctx, IndexPartition handle);
6641  // Context free
6642  unsigned get_index_partition_depth(IndexPartition handle);
6644  public:
6645  //------------------------------------------------------------------------
6646  // Safe Cast Operations
6647  //------------------------------------------------------------------------
6657  DomainPoint safe_cast(Context ctx, DomainPoint point,
6658  LogicalRegion region);
6659 
6668  template<int DIM, typename COORD_T>
6669  bool safe_cast(Context ctx,
6670  Point<DIM,COORD_T> point,
6671  LogicalRegionT<DIM,COORD_T> region);
6672  public:
6673  //------------------------------------------------------------------------
6674  // Field Space Operations
6675  //------------------------------------------------------------------------
6683  FieldSpace create_field_space(Context ctx, const char *provenance = NULL);
6695  FieldSpace create_field_space(Context ctx,
6696  const std::vector<size_t> &field_sizes,
6697  std::vector<FieldID> &resulting_fields,
6698  CustomSerdezID serdez_id = 0,
6699  const char *provenance = NULL);
6711  FieldSpace create_field_space(Context ctx,
6712  const std::vector<Future> &field_sizes,
6713  std::vector<FieldID> &resulting_fields,
6714  CustomSerdezID serdez_id = 0,
6715  const char *provenance = NULL);
6726  void create_shared_ownership(Context ctx, FieldSpace handle);
6736  void destroy_field_space(Context ctx, FieldSpace handle,
6737  const bool unordered = false,
6738  const char *provenance = NULL);
6739 
6741 
6748  size_t get_field_size(Context ctx, FieldSpace handle, FieldID fid);
6749  // Context free
6750  size_t get_field_size(FieldSpace handle, FieldID fid);
6752 
6754 
6760  void get_field_space_fields(Context ctx, FieldSpace handle,
6761  std::vector<FieldID> &fields);
6762  // Context free
6763  void get_field_space_fields(FieldSpace handle,
6764  std::vector<FieldID> &fields);
6766 
6768 
6774  void get_field_space_fields(Context ctx, FieldSpace handle,
6775  std::set<FieldID> &fields);
6776  // Context free
6777  void get_field_space_fields(FieldSpace handle,
6778  std::set<FieldID> &fields);
6780  public:
6781  //------------------------------------------------------------------------
6782  // Logical Region Operations
6783  //------------------------------------------------------------------------
6797  LogicalRegion create_logical_region(Context ctx, IndexSpace index,
6798  FieldSpace fields,
6799  bool task_local = false,
6800  const char *provenance = NULL);
6801  // Template version
6802  template<int DIM, typename COORD_T>
6803  LogicalRegionT<DIM,COORD_T> create_logical_region(Context ctx,
6804  IndexSpaceT<DIM,COORD_T> index,
6805  FieldSpace fields,
6806  bool task_local = false,
6807  const char *provenance = NULL);
6818  void create_shared_ownership(Context ctx, LogicalRegion handle);
6828  void destroy_logical_region(Context ctx, LogicalRegion handle,
6829  const bool unordered = false,
6830  const char *provenance = NULL);
6831 
6839  LEGION_DEPRECATED("Destruction of logical partitions are no-ops now."
6840  "Logical partitions are automatically destroyed when their root "
6841  "logical region or their index spartition are destroyed.")
6842  void destroy_logical_partition(Context ctx, LogicalPartition handle,
6843  const bool unordered = false);
6844 
6863  void reset_equivalence_sets(Context ctx, LogicalRegion parent,
6864  LogicalRegion region,
6865  const std::set<FieldID> &fields);
6866  public:
6867  //------------------------------------------------------------------------
6868  // Logical Region Tree Traversal Operations
6869  //------------------------------------------------------------------------
6871 
6880  LogicalPartition get_logical_partition(Context ctx, LogicalRegion parent,
6881  IndexPartition handle);
6882  // Context free
6883  LogicalPartition get_logical_partition(LogicalRegion parent,
6884  IndexPartition handle);
6885  // Template version
6886  template<int DIM, typename COORD_T>
6887  LogicalPartitionT<DIM,COORD_T> get_logical_partition(
6888  LogicalRegionT<DIM,COORD_T> parent,
6889  IndexPartitionT<DIM,COORD_T> handle);
6891 
6893 
6901  LogicalPartition get_logical_partition_by_color(Context ctx,
6902  LogicalRegion parent,
6903  Color c);
6904  LogicalPartition get_logical_partition_by_color(Context ctx,
6905  LogicalRegion parent,
6906  const DomainPoint &c);
6907  // Context free
6908  LogicalPartition get_logical_partition_by_color(LogicalRegion parent,
6909  Color c);
6910  LogicalPartition get_logical_partition_by_color(LogicalRegion parent,
6911  const DomainPoint &c);
6912  // Template version
6913  template<int DIM, typename COORD_T>
6914  LogicalPartitionT<DIM,COORD_T> get_logical_partition_by_color(
6915  LogicalRegionT<DIM,COORD_T> parent,
6916  Color c);
6918 
6920 
6928  bool has_logical_partition_by_color(Context ctx,
6929  LogicalRegion parent,
6930  const DomainPoint &c);
6931  // Context free
6932  bool has_logical_partition_by_color(LogicalRegion parent,
6933  const DomainPoint &c);
6935 
6937 
6946  LogicalPartition get_logical_partition_by_tree(Context ctx,
6947  IndexPartition handle,
6948  FieldSpace fspace,
6949  RegionTreeID tid);
6950  // Context free
6951  LogicalPartition get_logical_partition_by_tree(IndexPartition handle,
6952  FieldSpace fspace,
6953  RegionTreeID tid);
6954  // Template version
6955  template<int DIM, typename COORD_T>
6956  LogicalPartitionT<DIM,COORD_T> get_logical_partition_by_tree(
6957  IndexPartitionT<DIM,COORD_T> handle,
6958  FieldSpace fspace, RegionTreeID tid);
6960 
6962 
6971  LogicalRegion get_logical_subregion(Context ctx, LogicalPartition parent,
6972  IndexSpace handle);
6973  // Context free
6974  LogicalRegion get_logical_subregion(LogicalPartition parent,
6975  IndexSpace handle);
6976  // Template version
6977  template<int DIM, typename COORD_T>
6978  LogicalRegionT<DIM,COORD_T> get_logical_subregion(
6979  LogicalPartitionT<DIM,COORD_T> parent,
6980  IndexSpaceT<DIM,COORD_T> handle);
6982 
6984 
6992  LogicalRegion get_logical_subregion_by_color(Context ctx,
6993  LogicalPartition parent,
6994  Color c);
6995  LogicalRegion get_logical_subregion_by_color(Context ctx,
6996  LogicalPartition parent,
6997  const DomainPoint &c);
6998  // Context free
6999  LogicalRegion get_logical_subregion_by_color(LogicalPartition parent,
7000  Color c);
7001  LogicalRegion get_logical_subregion_by_color(LogicalPartition parent,
7002  const DomainPoint &c);
7003  // Template version
7004  template<int DIM, typename COORD_T,
7005  int COLOR_DIM, typename COLOR_COORD_T>
7006  LogicalRegionT<DIM,COORD_T> get_logical_subregion_by_color(
7007  LogicalPartitionT<DIM,COORD_T> parent,
7008  Point<COLOR_DIM,COLOR_COORD_T> color);
7010 
7012 
7020  bool has_logical_subregion_by_color(Context ctx,
7021  LogicalPartition parent,
7022  const DomainPoint &c);
7023  // Context free
7024  bool has_logical_subregion_by_color(LogicalPartition parent,
7025  const DomainPoint &c);
7026  // Template version
7027  template<int DIM, typename COORD_T,
7028  int COLOR_DIM, typename COLOR_COORD_T>
7029  bool has_logical_subregion_by_color(LogicalPartitionT<DIM,COORD_T> parent,
7030  Point<COLOR_DIM,COLOR_COORD_T> color);
7032 
7034 
7043  LogicalRegion get_logical_subregion_by_tree(Context ctx,
7044  IndexSpace handle,
7045  FieldSpace fspace,
7046  RegionTreeID tid);
7047  // Context free
7048  LogicalRegion get_logical_subregion_by_tree(IndexSpace handle,
7049  FieldSpace fspace,
7050  RegionTreeID tid);
7051  // Template version
7052  template<int DIM, typename COORD_T>
7053  LogicalRegionT<DIM,COORD_T> get_logical_subregion_by_tree(
7054  IndexSpaceT<DIM,COORD_T> handle,
7055  FieldSpace space, RegionTreeID tid);
7057 
7059 
7067  Color get_logical_region_color(Context ctx, LogicalRegion handle);
7068  DomainPoint get_logical_region_color_point(Context ctx,
7069  LogicalRegion handle);
7070  // Context free versions
7071  Color get_logical_region_color(LogicalRegion handle);
7072  DomainPoint get_logical_region_color_point(LogicalRegion handle);
7073  // Template version
7074  template<int DIM, typename COORD_T,
7075  int COLOR_DIM, typename COLOR_COORD_T>
7076  Point<COLOR_DIM,COLOR_COORD_T>
7077  get_logical_region_color_point(LogicalRegionT<DIM,COORD_T> handle);
7079 
7081 
7088  Color get_logical_partition_color(Context ctx, LogicalPartition handle);
7089  DomainPoint get_logical_partition_color_point(Context ctx,
7090  LogicalPartition handle);
7091  // Context free versions
7092  Color get_logical_partition_color(LogicalPartition handle);
7093  DomainPoint get_logical_partition_color_point(LogicalPartition handle);
7095 
7097 
7103  LogicalRegion get_parent_logical_region(Context ctx,
7104  LogicalPartition handle);
7105  // Context free
7106  LogicalRegion get_parent_logical_region(LogicalPartition handle);
7107  // Template version
7108  template<int DIM, typename COORD_T>
7109  LogicalRegionT<DIM,COORD_T> get_parent_logical_region(
7110  LogicalPartitionT<DIM,COORD_T> handle);
7112 
7114 
7120  bool has_parent_logical_partition(Context ctx, LogicalRegion handle);
7121  // Context free
7122  bool has_parent_logical_partition(LogicalRegion handle);
7124 
7126 
7132  LogicalPartition get_parent_logical_partition(Context ctx,
7133  LogicalRegion handle);
7134  // Context free
7135  LogicalPartition get_parent_logical_partition(LogicalRegion handle);
7136  // Template version
7137  template<int DIM, typename COORD_T>
7138  LogicalPartitionT<DIM,COORD_T> get_parent_logical_partition(
7139  LogicalRegionT<DIM,COORD_T> handle);
7141  public:
7142  //------------------------------------------------------------------------
7143  // Allocator and Argument Map Operations
7144  //------------------------------------------------------------------------
7151  FieldAllocator create_field_allocator(Context ctx, FieldSpace handle);
7152 
7161  LEGION_DEPRECATED("ArgumentMap can be constructed directly.")
7162  ArgumentMap create_argument_map(Context ctx);
7163  public:
7164  //------------------------------------------------------------------------
7165  // Task Launch Operations
7166  //------------------------------------------------------------------------
7176  Future execute_task(Context ctx,
7177  const TaskLauncher &launcher,
7178  std::vector<OutputRequirement> *outputs = NULL);
7179 
7190  FutureMap execute_index_space(
7191  Context ctx, const IndexTaskLauncher &launcher,
7192  std::vector<OutputRequirement> *outputs = NULL);
7193 
7216  Future execute_index_space(
7217  Context ctx, const IndexTaskLauncher &launcher,
7218  ReductionOpID redop, bool ordered = true,
7219  std::vector<OutputRequirement> *outputs = NULL);
7220 
7244  Future reduce_future_map(Context ctx, const FutureMap &future_map,
7245  ReductionOpID redop, bool ordered = true,
7246  MapperID map_id = 0, MappingTagID tag = 0,
7247  const char *provenance = NULL,
7248  Future initial_value = Future());
7249 
7277  FutureMap construct_future_map(Context ctx, IndexSpace domain,
7278  const std::map<DomainPoint,UntypedBuffer> &data,
7279  bool collective = false, ShardingID sid = 0,
7280  bool implicit_sharding = false,
7281  const char *provenance = NULL);
7282  LEGION_DEPRECATED("Use the version that takes an IndexSpace instead")
7283  FutureMap construct_future_map(Context ctx, const Domain &domain,
7284  const std::map<DomainPoint,UntypedBuffer> &data,
7285  bool collective = false, ShardingID sid = 0,
7286  bool implicit_sharding = false);
7287 
7311  FutureMap construct_future_map(Context ctx, IndexSpace domain,
7312  const std::map<DomainPoint,Future> &futures,
7313  bool collective = false, ShardingID sid = 0,
7314  bool implicit_sharding = false,
7315  const char *provenance = NULL);
7316  LEGION_DEPRECATED("Use the version that takes an IndexSpace instead")
7317  FutureMap construct_future_map(Context ctx, const Domain &domain,
7318  const std::map<DomainPoint,Future> &futures,
7319  bool collective = false, ShardingID sid = 0,
7320  bool implicit_sharding = false);
7321 
7339  typedef DomainPoint (*PointTransformFnptr)(const DomainPoint &point,
7340  const Domain &domain,
7341  const Domain &range);
7342  FutureMap transform_future_map(Context ctx, const FutureMap &fm,
7343  IndexSpace new_domain,
7344  PointTransformFnptr fnptr,
7345  const char *provenance = NULL);
7363  FutureMap transform_future_map(Context ctx, const FutureMap &fm,
7364  IndexSpace new_domain,
7365  PointTransformFunctor *functor,
7366  bool take_ownership = false,
7367  const char *provenance = NULL);
7368 
7384  LEGION_DEPRECATED("Launching tasks should be done with the new task "
7385  "launcher interface.")
7386  Future execute_task(Context ctx, TaskID task_id,
7387  const std::vector<IndexSpaceRequirement> &indexes,
7388  const std::vector<FieldSpaceRequirement> &fields,
7389  const std::vector<RegionRequirement> &regions,
7390  const UntypedBuffer &arg,
7391  const Predicate &predicate = Predicate::TRUE_PRED,
7392  MapperID id = 0,
7393  MappingTagID tag = 0);
7394 
7413  LEGION_DEPRECATED("Launching tasks should be done with the new task "
7414  "launcher interface.")
7415  FutureMap execute_index_space(Context ctx, TaskID task_id,
7416  const Domain domain,
7417  const std::vector<IndexSpaceRequirement> &indexes,
7418  const std::vector<FieldSpaceRequirement> &fields,
7419  const std::vector<RegionRequirement> &regions,
7420  const UntypedBuffer &global_arg,
7421  const ArgumentMap &arg_map,
7422  const Predicate &predicate = Predicate::TRUE_PRED,
7423  bool must_paralleism = false,
7424  MapperID id = 0,
7425  MappingTagID tag = 0);
7426 
7448  LEGION_DEPRECATED("Launching tasks should be done with the new task "
7449  "launcher interface.")
7450  Future execute_index_space(Context ctx, TaskID task_id,
7451  const Domain domain,
7452  const std::vector<IndexSpaceRequirement> &indexes,
7453  const std::vector<FieldSpaceRequirement> &fields,
7454  const std::vector<RegionRequirement> &regions,
7455  const UntypedBuffer &global_arg,
7456  const ArgumentMap &arg_map,
7457  ReductionOpID reduction,
7458  const UntypedBuffer &initial_value,
7459  const Predicate &predicate = Predicate::TRUE_PRED,
7460  bool must_parallelism = false,
7461  MapperID id = 0,
7462  MappingTagID tag = 0);
7463  public:
7464  //------------------------------------------------------------------------
7465  // Inline Mapping Operations
7466  //------------------------------------------------------------------------
7476  PhysicalRegion map_region(Context ctx, const InlineLauncher &launcher);
7477 
7491  PhysicalRegion map_region(Context ctx, const RegionRequirement &req,
7492  MapperID id = 0, MappingTagID tag = 0,
7493  const char *provenance = NULL);
7494 
7506  PhysicalRegion map_region(Context ctx, unsigned idx,
7507  MapperID id = 0, MappingTagID tag = 0,
7508  const char *provenance = NULL);
7509 
7519  void remap_region(Context ctx, PhysicalRegion region,
7520  const char *provenance = NULL);
7521 
7529  void unmap_region(Context ctx, PhysicalRegion region);
7530 
7538  void unmap_all_regions(Context ctx);
7539  public:
7540  //------------------------------------------------------------------------
7541  // Output Region Operations
7542  //------------------------------------------------------------------------
7548  OutputRegion get_output_region(Context ctx, unsigned index);
7549 
7555  void get_output_regions(Context ctx, std::vector<OutputRegion> &regions);
7556  public:
7557  //------------------------------------------------------------------------
7558  // Fill Field Operations
7559  //------------------------------------------------------------------------
7574  template<typename T>
7575  void fill_field(Context ctx, LogicalRegion handle, LogicalRegion parent,
7576  FieldID fid, const T &value,
7577  Predicate pred = Predicate::TRUE_PRED);
7578 
7592  void fill_field(Context ctx, LogicalRegion handle, LogicalRegion parent,
7593  FieldID fid, const void *value, size_t value_size,
7594  Predicate pred = Predicate::TRUE_PRED);
7595 
7608  void fill_field(Context ctx, LogicalRegion handle, LogicalRegion parent,
7609  FieldID fid, Future f,
7610  Predicate pred = Predicate::TRUE_PRED);
7611 
7622  template<typename T>
7623  void fill_fields(Context ctx, LogicalRegion handle, LogicalRegion parent,
7624  const std::set<FieldID> &fields, const T &value,
7625  Predicate pred = Predicate::TRUE_PRED);
7626 
7639  void fill_fields(Context ctx, LogicalRegion handle, LogicalRegion parent,
7640  const std::set<FieldID> &fields,
7641  const void *value, size_t value_size,
7642  Predicate pred = Predicate::TRUE_PRED);
7643 
7654  void fill_fields(Context ctx, LogicalRegion handle, LogicalRegion parent,
7655  const std::set<FieldID> &fields,
7656  Future f, Predicate pred = Predicate::TRUE_PRED);
7657 
7664  void fill_fields(Context ctx, const FillLauncher &launcher);
7665 
7672  void fill_fields(Context ctx, const IndexFillLauncher &launcher);
7673 
7679  void discard_fields(Context ctx, const DiscardLauncher &launcher);
7680  public:
7681  //------------------------------------------------------------------------
7682  // Attach Operations
7683  //------------------------------------------------------------------------
7684 
7691  PhysicalRegion attach_external_resource(Context ctx,
7692  const AttachLauncher &launcher);
7693 
7705  Future detach_external_resource(Context ctx, PhysicalRegion region,
7706  const bool flush = true,
7707  const bool unordered = false,
7708  const char *provenance = NULL);
7709 
7727  ExternalResources attach_external_resources(Context ctx,
7728  const IndexAttachLauncher &launcher);
7729 
7742  Future detach_external_resources(Context ctx, ExternalResources external,
7743  const bool flush = true,
7744  const bool unordered = false,
7745  const char *provenance = NULL);
7746 
7753  void progress_unordered_operations(Context ctx);
7754 
7785  LEGION_DEPRECATED("Attaching specific HDF5 file type is deprecated "
7786  "in favor of generic attach launcher interface.")
7787  PhysicalRegion attach_hdf5(Context ctx, const char *file_name,
7788  LogicalRegion handle, LogicalRegion parent,
7789  const std::map<FieldID,const char*> &field_map,
7790  LegionFileMode mode);
7791 
7808  LEGION_DEPRECATED("Detaching specific HDF5 file type is deprecated "
7809  "in favor of generic detach interface.")
7810  void detach_hdf5(Context ctx, PhysicalRegion region);
7811 
7818  LEGION_DEPRECATED("Attaching generic file type is deprecated "
7819  "in favor of generic attach launcher interface.")
7820  PhysicalRegion attach_file(Context ctx, const char *file_name,
7821  LogicalRegion handle, LogicalRegion parent,
7822  const std::vector<FieldID> &field_vec,
7823  LegionFileMode mode);
7824 
7830  LEGION_DEPRECATED("Detaching generic file type is deprecated "
7831  "in favor of generic detach interface.")
7832  void detach_file(Context ctx, PhysicalRegion region);
7833  public:
7834  //------------------------------------------------------------------------
7835  // Copy Operations
7836  //------------------------------------------------------------------------
7844  void issue_copy_operation(Context ctx, const CopyLauncher &launcher);
7845 
7853  void issue_copy_operation(Context ctx, const IndexCopyLauncher &launcher);
7854  public:
7855  //------------------------------------------------------------------------
7856  // Predicate Operations
7857  //------------------------------------------------------------------------
7867  Predicate create_predicate(Context ctx, const Future &f,
7868  const char *provenance = NULL);
7869 
7879  Predicate predicate_not(Context ctx, const Predicate &p,
7880  const char *provenance = NULL);
7881 
7892  Predicate predicate_and(Context ctx,
7893  const Predicate &p1, const Predicate &p2,
7894  const char *provenance = NULL);
7895 
7906  Predicate predicate_or(Context ctx,
7907  const Predicate &p1, const Predicate &p2,
7908  const char *provenance = NULL);
7909 
7916  Predicate create_predicate(Context ctx,const PredicateLauncher &launcher);
7917 
7926  Future get_predicate_future(Context ctx, const Predicate &p,
7927  const char *provenance = NULL);
7928  public:
7929  //------------------------------------------------------------------------
7930  // Lock Operations
7931  //------------------------------------------------------------------------
7937  Lock create_lock(Context ctx);
7938 
7949  void destroy_lock(Context ctx, Lock l);
7950 
7963  Grant acquire_grant(Context ctx,
7964  const std::vector<LockRequest> &requests);
7965 
7975  void release_grant(Context ctx, Grant grant);
7976  public:
7977  //------------------------------------------------------------------------
7978  // Phase Barrier operations
7979  //------------------------------------------------------------------------
7989  PhaseBarrier create_phase_barrier(Context ctx, unsigned arrivals);
7990 
8001  void destroy_phase_barrier(Context ctx, PhaseBarrier pb);
8002 
8018  PhaseBarrier advance_phase_barrier(Context ctx, PhaseBarrier pb);
8019  public:
8020  //------------------------------------------------------------------------
8021  // Dynamic Collective operations
8022  //------------------------------------------------------------------------
8037  DynamicCollective create_dynamic_collective(Context ctx,
8038  unsigned arrivals,
8039  ReductionOpID redop,
8040  const void *init_value,
8041  size_t init_size);
8042 
8049  void destroy_dynamic_collective(Context ctx, DynamicCollective dc);
8050 
8060  void arrive_dynamic_collective(Context ctx,
8061  DynamicCollective dc,
8062  const void *buffer,
8063  size_t size, unsigned count = 1);
8064 
8074  void defer_dynamic_collective_arrival(Context ctx,
8075  DynamicCollective dc,
8076  const Future &f,
8077  unsigned count = 1);
8078 
8089  Future get_dynamic_collective_result(Context ctx, DynamicCollective dc,
8090  const char *provenance = NULL);
8091 
8100  DynamicCollective advance_dynamic_collective(Context ctx,
8101  DynamicCollective dc);
8102  public:
8103  //------------------------------------------------------------------------
8104  // User-Managed Software Coherence
8105  //------------------------------------------------------------------------
8112  void issue_acquire(Context ctx, const AcquireLauncher &launcher);
8113 
8120  void issue_release(Context ctx, const ReleaseLauncher &launcher);
8121  public:
8122  //------------------------------------------------------------------------
8123  // Fence Operations
8124  //------------------------------------------------------------------------
8133  Future issue_mapping_fence(Context ctx, const char *provenance = NULL);
8134 
8144  Future issue_execution_fence(Context ctx, const char *provenance = NULL);
8145  public:
8146  //------------------------------------------------------------------------
8147  // Tracing Operations
8148  //------------------------------------------------------------------------
8178  void begin_trace(Context ctx, TraceID tid, bool logical_only = false,
8179  bool static_trace = false, const std::set<RegionTreeID> *managed = NULL,
8180  const char *provenance = NULL);
8184  void end_trace(Context ctx, TraceID tid, const char *provenance = NULL);
8199  LEGION_DEPRECATED("Use begin_trace with static_trace=true")
8200  void begin_static_trace(Context ctx,
8201  const std::set<RegionTreeID> *managed = NULL);
8206  LEGION_DEPRECATED("Use end_trace")
8207  void end_static_trace(Context ctx);
8208 
8213  TraceID generate_dynamic_trace_id(void);
8214 
8225  TraceID generate_library_trace_ids(const char *name, size_t count);
8226 
8234  static TraceID generate_static_trace_id(void);
8235  public:
8236  //------------------------------------------------------------------------
8237  // Frame Operations
8238  //------------------------------------------------------------------------
8252  void complete_frame(Context ctx, const char *provenance = NULL);
8253  public:
8254  //------------------------------------------------------------------------
8255  // Must Parallelism
8256  //------------------------------------------------------------------------
8264  FutureMap execute_must_epoch(Context ctx,
8265  const MustEpochLauncher &launcher);
8266  public:
8267  //------------------------------------------------------------------------
8268  // Tunable Variables
8269  //------------------------------------------------------------------------
8270 
8284  Future select_tunable_value(Context ctx, TunableID tid,
8285  MapperID mapper = 0, MappingTagID tag = 0,
8286  const void *args = NULL, size_t argsize = 0);
8287  Future select_tunable_value(Context ctx, const TunableLauncher &launcher);
8288 
8295  LEGION_DEPRECATED("Tunable values should now be obtained via the "
8296  "generic interface that returns a future result.")
8297  int get_tunable_value(Context ctx, TunableID tid,
8298  MapperID mapper = 0, MappingTagID tag = 0);
8299  public:
8300  //------------------------------------------------------------------------
8301  // Task Local Interface
8302  //------------------------------------------------------------------------
8308  const Task* get_local_task(Context ctx);
8309 
8317  void* get_local_task_variable_untyped(Context ctx, LocalVariableID id);
8318  template<typename T>
8319  T* get_local_task_variable(Context ctx, LocalVariableID id);
8320 
8331  void set_local_task_variable_untyped(Context ctx, LocalVariableID id,
8332  const void *value, void (*destructor)(void*) = NULL);
8333  template<typename T>
8334  void set_local_task_variable(Context ctx, LocalVariableID id,
8335  const T* value, void (*destructor)(void*) = NULL);
8336  public:
8337  //------------------------------------------------------------------------
8338  // Timing Operations
8339  //------------------------------------------------------------------------
8348  Future get_current_time(Context ctx, Future precondition = Future());
8349 
8358  Future get_current_time_in_microseconds(Context ctx,
8359  Future precondition = Future());
8360 
8369  Future get_current_time_in_nanoseconds(Context ctx,
8370  Future precondition = Future());
8371 
8378  Future issue_timing_measurement(Context ctx,
8379  const TimingLauncher &launcher);
8380 
8387  static long long get_zero_time(void);
8388  public:
8389  //------------------------------------------------------------------------
8390  // Miscellaneous Operations
8391  //------------------------------------------------------------------------
8406  Mapping::Mapper* get_mapper(Context ctx, MapperID id,
8407  Processor target = Processor::NO_PROC);
8408 
8422  Mapping::MapperContext begin_mapper_call(Context ctx, MapperID id,
8423  Processor target = Processor::NO_PROC);
8424 
8430  void end_mapper_call(Mapping::MapperContext ctx);
8431 
8438  Processor get_executing_processor(Context ctx);
8439 
8446  const Task* get_current_task(Context ctx);
8447 
8459  size_t query_available_memory(Context ctx, Memory target);
8460 
8477  void raise_region_exception(Context ctx, PhysicalRegion region,
8478  bool nuclear);
8479 
8490  void yield(Context ctx);
8491 
8529  void concurrent_task_barrier(Context ctx);
8530 
8542  void start_profiling_range(Context ctx);
8543  void stop_profiling_range(Context ctx, const char *provenance);
8544  public:
8545  //------------------------------------------------------------------------
8546  // MPI Interoperability
8547  //------------------------------------------------------------------------
8551  bool is_MPI_interop_configured(void);
8552 
8560  const std::map<int/*rank*/,AddressSpace>& find_forward_MPI_mapping(void);
8561 
8569  const std::map<AddressSpace,int/*rank*/>& find_reverse_MPI_mapping(void);
8570 
8574  int find_local_MPI_rank(void);
8575  public:
8576  //------------------------------------------------------------------------
8577  // Semantic Information
8578  //------------------------------------------------------------------------
8588  void attach_semantic_information(TaskID task_id, SemanticTag tag,
8589  const void *buffer, size_t size,
8590  bool is_mutable = false, bool local_only = false);
8591 
8600  void attach_semantic_information(IndexSpace handle, SemanticTag tag,
8601  const void *buffer, size_t size, bool is_mutable = false);
8602 
8611  void attach_semantic_information(IndexPartition handle, SemanticTag tag,
8612  const void *buffer, size_t size, bool is_mutable = false);
8613 
8622  void attach_semantic_information(FieldSpace handle, SemanticTag tag,
8623  const void *buffer, size_t size, bool is_mutable = false);
8624 
8634  void attach_semantic_information(FieldSpace handle, FieldID fid,
8635  SemanticTag tag, const void *buffer,
8636  size_t size, bool is_mutable = false);
8637 
8646  void attach_semantic_information(LogicalRegion handle, SemanticTag tag,
8647  const void *buffer, size_t size, bool is_mutable = false);
8648 
8657  void attach_semantic_information(LogicalPartition handle,
8658  SemanticTag tag, const void *buffer,
8659  size_t size, bool is_mutable = false);
8660 
8668  void attach_name(TaskID task_id, const char *name,
8669  bool is_mutable = false,
8670  bool local_only = false);
8671 
8678  void attach_name(IndexSpace handle, const char *name,
8679  bool is_mutable = false);
8680 
8687  void attach_name(IndexPartition handle, const char *name,
8688  bool is_mutable = false);
8689 
8696  void attach_name(FieldSpace handle, const char *name,
8697  bool is_mutable = false);
8698 
8706  void attach_name(FieldSpace handle, FieldID fid,
8707  const char *name, bool is_mutable = false);
8708 
8715  void attach_name(LogicalRegion handle, const char *name,
8716  bool is_mutable = false);
8717 
8724  void attach_name(LogicalPartition handle, const char *name,
8725  bool is_mutable = false);
8726 
8737  bool retrieve_semantic_information(TaskID task_id, SemanticTag tag,
8738  const void *&result, size_t &size,
8739  bool can_fail = false,
8740  bool wait_until_ready = false);
8741 
8752  bool retrieve_semantic_information(IndexSpace handle, SemanticTag tag,
8753  const void *&result, size_t &size,
8754  bool can_fail = false,
8755  bool wait_until_ready = false);
8756 
8767  bool retrieve_semantic_information(IndexPartition handle, SemanticTag tag,
8768  const void *&result, size_t &size,
8769  bool can_fail = false,
8770  bool wait_until_ready = false);
8771 
8782  bool retrieve_semantic_information(FieldSpace handle, SemanticTag tag,
8783  const void *&result, size_t &size,
8784  bool can_fail = false,
8785  bool wait_until_ready = false);
8786 
8798  bool retrieve_semantic_information(FieldSpace handle, FieldID fid,
8799  SemanticTag tag,
8800  const void *&result, size_t &size,
8801  bool can_fail = false,
8802  bool wait_until_ready = false);
8803 
8814  bool retrieve_semantic_information(LogicalRegion handle, SemanticTag tag,
8815  const void *&result, size_t &size,
8816  bool can_fail = false,
8817  bool wait_until_ready = false);
8818 
8829  bool retrieve_semantic_information(LogicalPartition handle,
8830  SemanticTag tag,
8831  const void *&result, size_t &size,
8832  bool can_fail = false,
8833  bool wait_until_ready = false);
8834 
8840  void retrieve_name(TaskID task_id, const char *&result);
8841 
8847  void retrieve_name(IndexSpace handle, const char *&result);
8848 
8854  void retrieve_name(IndexPartition handle, const char *&result);
8855 
8861  void retrieve_name(FieldSpace handle, const char *&result);
8862 
8869  void retrieve_name(FieldSpace handle, FieldID fid, const char *&result);
8870 
8876  void retrieve_name(LogicalRegion handle, const char *&result);
8877 
8883  void retrieve_name(LogicalPartition handle, const char *&result);
8884 
8885  public:
8886  //------------------------------------------------------------------------
8887  // Printing operations, these are useful for only generating output
8888  // from a single task if the task has been replicated (either directly
8889  // or as part of control replication).
8890  //------------------------------------------------------------------------
8898  void print_once(Context ctx, FILE *f, const char *message);
8899 
8906  void log_once(Context ctx, Realm::LoggerMessage &message);
8907  public:
8908  //------------------------------------------------------------------------
8909  // Registration Callback Operations
8910  // All of these calls must be made while in the registration
8911  // function called before start-up. This function is specified
8912  // by calling the 'set_registration_callback' static method.
8913  //------------------------------------------------------------------------
8914 
8919  Mapping::MapperRuntime* get_mapper_runtime(void);
8920 
8925  MapperID generate_dynamic_mapper_id(void);
8926 
8937  MapperID generate_library_mapper_ids(const char *name, size_t count);
8938 
8946  static MapperID generate_static_mapper_id(void);
8947 
8959  void add_mapper(MapperID map_id, Mapping::Mapper *mapper,
8960  Processor proc = Processor::NO_PROC);
8961 
8973  void replace_default_mapper(Mapping::Mapper *mapper,
8974  Processor proc = Processor::NO_PROC);
8975 
8976  public:
8981  ProjectionID generate_dynamic_projection_id(void);
8982 
8993  ProjectionID generate_library_projection_ids(const char *name,
8994  size_t count);
8995 
9003  static ProjectionID generate_static_projection_id(void);
9004 
9018  void register_projection_functor(ProjectionID pid,
9019  ProjectionFunctor *functor,
9020  bool silence_warnings = false,
9021  const char *warning_string = NULL);
9022 
9032  static void preregister_projection_functor(ProjectionID pid,
9033  ProjectionFunctor *functor);
9034 
9041  static ProjectionFunctor* get_projection_functor(ProjectionID pid);
9042 
9047  ShardingID generate_dynamic_sharding_id(void);
9048 
9059  ShardingID generate_library_sharding_ids(const char *name, size_t count);
9060 
9068  static ShardingID generate_static_sharding_id(void);
9069 
9082  void register_sharding_functor(ShardingID sid,
9083  ShardingFunctor *functor,
9084  bool silence_warnings = false,
9085  const char *warning_string = NULL);
9086 
9097  static void preregister_sharding_functor(ShardingID sid,
9098  ShardingFunctor *functor);
9099 
9106  static ShardingFunctor* get_sharding_functor(ShardingID sid);
9107  public:
9112  ReductionOpID generate_dynamic_reduction_id(void);
9113 
9124  ReductionOpID generate_library_reduction_ids(const char *name,
9125  size_t count);
9126 
9134  static ReductionOpID generate_static_reduction_id(void);
9135 
9150  template<typename REDOP>
9151  static void register_reduction_op(ReductionOpID redop_id,
9152  bool permit_duplicates = false);
9153 
9174  static void register_reduction_op(ReductionOpID redop_id,
9175  ReductionOp *op,
9176  SerdezInitFnptr init_fnptr = NULL,
9177  SerdezFoldFnptr fold_fnptr = NULL,
9178  bool permit_duplicates = false);
9179 
9185  static const ReductionOp* get_reduction_op(ReductionOpID redop_id);
9186 
9187 #ifdef LEGION_GPU_REDUCTIONS
9188  template<typename REDOP>
9189  LEGION_DEPRECATED("Use register_reduction_op instead")
9190  static void preregister_gpu_reduction_op(ReductionOpID redop_id);
9191 #endif
9192  public:
9197  CustomSerdezID generate_dynamic_serdez_id(void);
9198 
9209  CustomSerdezID generate_library_serdez_ids(const char *name,
9210  size_t count);
9211 
9219  static CustomSerdezID generate_static_serdez_id(void);
9220 
9234  template<typename SERDEZ>
9235  static void register_custom_serdez_op(CustomSerdezID serdez_id,
9236  bool permit_duplicates = false);
9237 
9250  static void register_custom_serdez_op(CustomSerdezID serdez_id,
9251  SerdezOp *serdez_op,
9252  bool permit_duplicates = false);
9253 
9259  static const SerdezOp* get_serdez_op(CustomSerdezID serdez_id);
9260  public:
9261  //------------------------------------------------------------------------
9262  // Start-up Operations
9263  // Everything below here is a static function that is used to configure
9264  // the runtime prior to calling the start method to begin execution.
9265  //------------------------------------------------------------------------
9266  public:
9272  static const char* get_legion_version(void);
9273 
9462  static int start(int argc, char **argv, bool background = false,
9463  bool supply_default_mapper = true, bool filter = false);
9464 
9480  static void initialize(int *argc, char ***argv,
9481  bool filter = false, bool parse = true);
9482 
9488  static int wait_for_shutdown(void);
9489 
9497  static void set_return_code(int return_code);
9498 
9506  static void set_top_level_task_id(TaskID top_id);
9507 
9514  static void set_top_level_task_mapper_id(MapperID mapper_id);
9515 
9523 
9542  Context begin_implicit_task(TaskID top_task_id,
9543  MapperID mapper_id,
9544  Processor::Kind proc_kind,
9545  const char *task_name = NULL,
9546  bool control_replicable = false,
9547  unsigned shard_per_address_space = 1,
9548  int shard_id = -1,
9549  DomainPoint shard_point = DomainPoint());
9550 
9559 
9567 
9578  void finish_implicit_task(Context ctx,
9579  Realm::Event effects = Realm::Event::NO_EVENT);
9580 
9586  static size_t get_maximum_dimension(void);
9587 
9597  static void configure_MPI_interoperability(int rank);
9598 
9612  static LegionHandshake create_external_handshake(bool init_in_ext = true,
9613  int ext_participants = 1,
9614  int legion_participants = 1);
9615 
9627  static MPILegionHandshake create_handshake(bool init_in_MPI = true,
9628  int mpi_participants = 1,
9629  int legion_participants = 1);
9630 
9641  template<LogicalRegion (*PROJ_PTR)(LogicalRegion, const DomainPoint&,
9642  Runtime*)>
9643  LEGION_DEPRECATED("Projection functions should now be specified "
9644  "using projection functor objects")
9645  static ProjectionID register_region_function(ProjectionID handle);
9646 
9656  template<LogicalRegion (*PROJ_PTR)(LogicalPartition, const DomainPoint&,
9657  Runtime*)>
9658  LEGION_DEPRECATED("Projection functions should now be specified "
9659  "using projection functor objects")
9660  static ProjectionID register_partition_function(ProjectionID handle);
9661  public:
9678  static void add_registration_callback(RegistrationCallbackFnptr callback,
9679  bool dedup = true, size_t dedup_tag = 0);
9680  static void add_registration_callback(
9681  RegistrationWithArgsCallbackFnptr callback, const UntypedBuffer &buffer,
9682  bool dedup = true, size_t dedup_tag = 0);
9683 
9709  RegistrationCallbackFnptr callback, bool global,
9710  bool deduplicate = true, size_t dedup_tag = 0);
9711  static void perform_registration_callback(
9712  RegistrationWithArgsCallbackFnptr callback,
9713  const UntypedBuffer &buffer, bool global,
9714  bool deduplicate = true , size_t dedup_tag = 0);
9715 
9727  LEGION_DEPRECATED("Legion now supports multiple registration callbacks "
9728  "added via the add_registration_callback method.")
9729  static void set_registration_callback(RegistrationCallbackFnptr callback);
9730 
9736  static const InputArgs& get_input_args(void);
9737  public:
9741  static void enable_profiling(void);
9745  static void disable_profiling(void);
9749  static void dump_profiling(void);
9750  public:
9751  //------------------------------------------------------------------------
9752  // Layout Registration Operations
9753  //------------------------------------------------------------------------
9762  LayoutConstraintID register_layout(
9763  const LayoutConstraintRegistrar &registrar);
9764 
9770  void release_layout(LayoutConstraintID layout_id);
9771 
9783  static LayoutConstraintID preregister_layout(
9784  const LayoutConstraintRegistrar &registrar,
9785  LayoutConstraintID layout_id =
9786  LEGION_AUTO_GENERATE_ID);
9787 
9793  FieldSpace get_layout_constraint_field_space(
9794  LayoutConstraintID layout_id);
9795 
9801  void get_layout_constraints(LayoutConstraintID layout_id,
9802  LayoutConstraintSet &layout_constraints);
9803 
9809  const char* get_layout_constraints_name(LayoutConstraintID layout_id);
9810  public:
9811  //------------------------------------------------------------------------
9812  // Task Registration Operations
9813  //------------------------------------------------------------------------
9814 
9819  TaskID generate_dynamic_task_id(void);
9820 
9831  TaskID generate_library_task_ids(const char *name, size_t count);
9832 
9840  static TaskID generate_static_task_id(void);
9841 
9849  template<typename T,
9850  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9851  Context, Runtime*)>
9852  VariantID register_task_variant(const TaskVariantRegistrar &registrar,
9853  VariantID vid = LEGION_AUTO_GENERATE_ID);
9854 
9863  template<typename T, typename UDT,
9864  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9865  Context, Runtime*, const UDT&)>
9866  VariantID register_task_variant(const TaskVariantRegistrar &registrar,
9867  const UDT &user_data,
9868  VariantID vid = LEGION_AUTO_GENERATE_ID);
9869 
9877  template<
9878  void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9879  Context, Runtime*)>
9880  VariantID register_task_variant(const TaskVariantRegistrar &registrar,
9881  VariantID vid = LEGION_AUTO_GENERATE_ID);
9882 
9891  template<typename UDT,
9892  void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9893  Context, Runtime*, const UDT&)>
9894  VariantID register_task_variant(const TaskVariantRegistrar &registrar,
9895  const UDT &user_data,
9896  VariantID vid = LEGION_AUTO_GENERATE_ID);
9897 
9917  VariantID register_task_variant(const TaskVariantRegistrar &registrar,
9918  const CodeDescriptor &codedesc,
9919  const void *user_data = NULL,
9920  size_t user_len = 0,
9921  size_t return_type_size =
9922  LEGION_MAX_RETURN_SIZE,
9923  VariantID vid = LEGION_AUTO_GENERATE_ID,
9924  bool has_return_type_size = true);
9925 
9936  template<typename T,
9937  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9938  Context, Runtime*)>
9939  static VariantID preregister_task_variant(
9940  const TaskVariantRegistrar &registrar,
9941  const char *task_name = NULL,
9942  VariantID vid = LEGION_AUTO_GENERATE_ID);
9943 
9955  template<typename T, typename UDT,
9956  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9957  Context, Runtime*, const UDT&)>
9958  static VariantID preregister_task_variant(
9959  const TaskVariantRegistrar &registrar,
9960  const UDT &user_data,
9961  const char *task_name = NULL,
9962  VariantID vid = LEGION_AUTO_GENERATE_ID);
9963 
9974  template<
9975  void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9976  Context, Runtime*)>
9977  static VariantID preregister_task_variant(
9978  const TaskVariantRegistrar &registrar,
9979  const char *task_name = NULL,
9980  VariantID vid = LEGION_AUTO_GENERATE_ID);
9981 
9993  template<typename UDT,
9994  void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
9995  Context, Runtime*, const UDT&)>
9996  static VariantID preregister_task_variant(
9997  const TaskVariantRegistrar &registrar, const UDT &user_data,
9998  const char *task_name = NULL,
9999  VariantID vid = LEGION_AUTO_GENERATE_ID);
10000 
10022  static VariantID preregister_task_variant(
10023  const TaskVariantRegistrar &registrar,
10024  const CodeDescriptor &codedesc,
10025  const void *user_data = NULL,
10026  size_t user_len = 0,
10027  const char *task_name = NULL,
10028  VariantID vid = LEGION_AUTO_GENERATE_ID,
10029  size_t return_type_size = LEGION_MAX_RETURN_SIZE,
10030  bool has_return_type_size = true,
10031  bool check_task_id = true);
10032 
10046  static void legion_task_preamble(const void *data, size_t datalen,
10047  Processor p, const Task *& task,
10048  const std::vector<PhysicalRegion> *& reg,
10049  Context& ctx, Runtime *& runtime);
10050 
10068  static void legion_task_postamble(Context ctx,
10069  const void *retvalptr = NULL,
10070  size_t retvalsize = 0,
10071  bool owned = false,
10072  Realm::RegionInstance inst =
10073  Realm::RegionInstance::NO_INST,
10074  const void *metadataptr = NULL,
10075  size_t metadatasize = 0);
10076 
10095  static void legion_task_postamble(Context ctx,
10096  const void *retvalptr, size_t retvalsize, bool owned,
10097  const Realm::ExternalInstanceResource &allocation,
10098  void (*freefunc)(const Realm::ExternalInstanceResource&) = NULL,
10099  const void *metadataptr = NULL, size_t metadatasize = 0);
10100 
10110  static void legion_task_postamble(Context ctx,
10111  FutureFunctor *callback_functor,
10112  bool owned = false);
10113  public:
10114  // ------------------ Deprecated task registration -----------------------
10128  template<typename T,
10129  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10130  Context, Runtime*)>
10131  LEGION_DEPRECATED("Task registration should be done with "
10132  "a TaskVariantRegistrar")
10133  static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10134  bool single, bool index,
10135  VariantID vid =LEGION_AUTO_GENERATE_ID,
10137  const char *task_name = NULL);
10151  template<
10152  void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10153  Context, Runtime*)>
10154  LEGION_DEPRECATED("Task registration should be done with "
10156  static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10157  bool single, bool index,
10158  VariantID vid =LEGION_AUTO_GENERATE_ID,
10160  const char *task_name = NULL);
10176  template<typename T, typename UDT,
10177  T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10178  Context, Runtime*, const UDT&)>
10179  LEGION_DEPRECATED("Task registration should be done with "
10181  static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10182  bool single, bool index,
10183  const UDT &user_data,
10184  VariantID vid =LEGION_AUTO_GENERATE_ID,
10186  const char *task_name = NULL);
10202  template<typename UDT,
10203  void (*TASK_PTR)(const Task*,const std::vector<PhysicalRegion>&,
10204  Context, Runtime*, const UDT&)>
10205  LEGION_DEPRECATED("Task registration should be done with "
10207  static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10208  bool single, bool index,
10209  const UDT &user_data,
10210  VariantID vid =LEGION_AUTO_GENERATE_ID,
10212  const char *task_name = NULL);
10213  public:
10220  static bool has_runtime(void);
10221 
10229  static Runtime* get_runtime(Processor p = Processor::NO_PROC);
10230 
10237  static bool has_context(void);
10238 
10245  static Context get_context(void);
10246 
10252  static const Task* get_context_task(Context ctx);
10253  private:
10254  IndexPartition create_restricted_partition(Context ctx,
10255  IndexSpace parent,
10256  IndexSpace color_space,
10257  const void *transform,
10258  size_t transform_size,
10259  const void *extent,
10260  size_t extent_size,
10261  PartitionKind part_kind, Color color,
10262  const char *provenance);
10263  IndexSpace create_index_space_union_internal(Context ctx,
10264  IndexPartition parent,
10265  const void *realm_color,size_t color_size,
10266  TypeTag type_tag, const char *provenance,
10267  const std::vector<IndexSpace> &handles);
10268  IndexSpace create_index_space_union_internal(Context ctx,
10269  IndexPartition parent,
10270  const void *realm_color,size_t color_size,
10271  TypeTag type_tag, const char *provenance,
10272  IndexPartition handle);
10273  IndexSpace create_index_space_intersection_internal(Context ctx,
10274  IndexPartition parent,
10275  const void *realm_color,size_t color_size,
10276  TypeTag type_tag, const char *provenance,
10277  const std::vector<IndexSpace> &handles);
10278  IndexSpace create_index_space_intersection_internal(Context ctx,
10279  IndexPartition parent,
10280  const void *realm_color,size_t color_size,
10281  TypeTag type_tag, const char *provenance,
10282  IndexPartition handle);
10283  IndexSpace create_index_space_difference_internal(Context ctx,
10284  IndexPartition paretn,
10285  const void *realm_color, size_t color_size,
10286  TypeTag type_tag, const char *provenance,
10287  IndexSpace initial,
10288  const std::vector<IndexSpace> &handles);
10289  IndexSpace get_index_subspace_internal(IndexPartition handle,
10290  const void *realm_color,TypeTag type_tag);
10291  bool has_index_subspace_internal(IndexPartition handle,
10292  const void *realm_color,TypeTag type_tag);
10293  void get_index_partition_color_space_internal(IndexPartition handle,
10294  void *realm_is, TypeTag type_tag);
10295  void get_index_space_domain_internal(IndexSpace handle,
10296  void *realm_is, TypeTag type_tag);
10297  void get_index_space_color_internal(IndexSpace handle,
10298  void *realm_color, TypeTag type_tag);
10299  bool safe_cast_internal(Context ctx, LogicalRegion region,
10300  const void *realm_point,TypeTag type_tag);
10301  LogicalRegion get_logical_subregion_by_color_internal(
10302  LogicalPartition parent,
10303  const void *realm_color,TypeTag type_tag);
10304  bool has_logical_subregion_by_color_internal(
10305  LogicalPartition parent,
10306  const void *realm_color,TypeTag type_tag);
10307  private:
10308  // Methods for the wrapper functions to get information from the runtime
10309  friend class LegionTaskWrapper;
10310  friend class LegionSerialization;
10311  private:
10312  template<typename T>
10313  friend class DeferredValue;
10314  template<typename T, int DIM, typename COORD_T, bool CHECK_BOUNDS>
10315  friend class DeferredBuffer;
10316  friend class UntypedDeferredValue;
10317  template<typename>
10318  friend class UntypedDeferredBuffer;
10319  Realm::RegionInstance create_task_local_instance(Memory memory,
10320  Realm::InstanceLayoutGeneric *layout);
10321  void destroy_task_local_instance(Realm::RegionInstance instance);
10322  public:
10323  // This method is hidden down here and not publicly documented because
10324  // users shouldn't really need it for anything, however there are some
10325  // reasonable cases where it might be utilitized for things like doing
10326  // file I/O or printf that people might want it for so we've got it
10327  ShardID get_shard_id(Context ctx, bool I_know_what_I_am_doing = false);
10328  // We'll also allow users to get the total number of shards in the context
10329  // if they also ar willing to attest they know what they are doing
10330  size_t get_num_shards(Context ctx, bool I_know_what_I_am_doing = false);
10331  // This is another hidden method for control replication because it's
10332  // still somewhat experimental. In some cases there are unavoidable
10333  // sources of randomness that can mess with the needed invariants for
10334  // control replication (e.g. garbage collectors). This method will
10335  // allow the application to pass in an array of elements from each shard
10336  // and the runtime will fill in an output buffer with an ordered array of
10337  // elements that were passed in by every shard. Each shard will get the
10338  // same elements that were present in all the other shards in the same
10339  // order in the output array. The number of elements in the output buffer
10340  // is returned as a future (of type size_t) as the runtime will return
10341  // immediately and the application can continue running ahead. The
10342  // application must keep the input and output buffers allocated until
10343  // the future resolves. By definition the output buffer need be no bigger
10344  // than the input buffer since only elements that are in the input buffer
10345  // on any shard can appear in the output buffer. Note you can use this
10346  // method safely in contexts that are not control replicated as well:
10347  // the input will just be mem-copied to the output and num_elements
10348  // returned as the future result.
10349  Future consensus_match(Context ctx, const void *input, void *output,
10350  size_t num_elements, size_t element_size, const char *provenance = NULL);
10351  private:
10352  friend class Mapper;
10353  Internal::Runtime *runtime;
10354  };
10355 
10356 }; // namespace Legion
10357 
10358 #include "legion/legion.inl"
10359 
10360 // Include this here so we get the mapper interface in the header file
10361 // We have to put it here though since the mapper interface depends
10362 // on the rest of the legion interface
10363 #include "legion/legion_mapping.h"
10364 
10365 #endif // __LEGION_RUNTIME_H__
10366 #endif // defined LEGION_ENABLE_CXX_BINDINGS
10367 
10368 // EOF
Definition: legion.h:4508
Definition: legion.h:563
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:209
Definition: legion_types.h:210
Definition: legion.h:4556
Definition: legion.h:4457
Definition: legion.h:3826
Definition: legion.h:3757
Definition: legion.h:3721
Definition: legion_domain.h:253
Definition: legion_domain.h:132
Definition: legion_domain.h:610
Definition: legion.h:843
Definition: legion.h:2738
Definition: legion.h:2806
Definition: legion.h:378
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:200
static const FieldSpace NO_SPACE
Definition: legion.h:202
Definition: legion.h:4574
Definition: legion.h:5005
Definition: legion.h:1183
void get_memories(std::set< Memory > &memories, bool silence_warnings=false, const char *warning_string=NULL) const
void get_void_result(bool silence_warnings=false, const char *warning_string=NULL) const
T get_result(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
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
bool is_ready(bool subscribe=false) const
Definition: legion.h:1397
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:760
Definition: legion.h:141
Definition: legion.h:176
Definition: legion.h:85
static const IndexSpace NO_SPACE
Definition: legion.h:87
Definition: legion.h:120
Definition: legion.h:4486
Definition: legion_types.h:2967
Definition: legion.h:4201
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:715
Definition: legion.h:304
static const LogicalPartition NO_PART
Definition: legion.h:306
Definition: legion.h:343
Definition: legion.h:236
static const LogicalRegion NO_REGION
Definition: legion.h:238
Definition: legion.h:274
Definition: legion.h:4266
void legion_handoff_to_mpi(void) const
Definition: legion.h:4297
void mpi_handoff_to_legion(void) const
Definition: legion.h:4286
void legion_wait_on_mpi(void) const
Definition: legion.h:4302
void mpi_wait_on_legion(void) const
Definition: legion.h:4291
Definition: legion.h:4315
Definition: legion.h:4635
Definition: legion.h:3972
Definition: legion.h:3371
Definition: legion.h:4602
Definition: legion.h:807
Definition: legion.h:2591
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:3593
Definition: legion.h:3633
Definition: legion.h:5024
Definition: legion.h:656
Definition: legion.h:4717
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:4919
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:3103
Definition: legion.h:4530
Definition: legion.h:5064
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:4955
Definition: legion_domain.h:734
Definition: legion.h:3668
Definition: legion.h:4386
Definition: legion_types.h:207
Definition: legion_types.h:3475
Definition: legion.h:524
Definition: legion.h:3916
Definition: legion.h:3772
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:4055
Definition: legion_domain.h:46
Definition: legion.h:2212
Definition: legion.h:1835
Definition: legion.h:2171
Definition: legion.h:1146
Definition: legion.h:2004
Definition: legion.h:2304
Definition: legion.h:1916
Definition: legion.h:2064
Definition: legion.h:1118
Definition: legion.h:1650
Definition: legion.h:1775
Definition: legion.h:4660
Definition: legion.h:2460
Definition: legion.h:739
Definition: legion.h:4162
Definition: legion.h:1078
IndexSpace color_space
Definition: legion.h:1108
FieldSpace field_space
Definition: legion.h:1105
bool global_indexing
Definition: legion.h:1106
bool valid_requirement
Definition: legion.h:1107
Definition: legion.h:2497
Definition: legion.h:2394
Definition: legion.h:875
ProjectionType handle_type
Definition: legion.h:1003
std::set< FieldID > privilege_fields
Definition: legion.h:994
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:1004
LogicalRegion parent
Definition: legion.h:998
void * projection_args
Definition: legion.h:1006
std::vector< FieldID > instance_fields
Definition: legion.h:995
LogicalPartition partition
Definition: legion.h:993
MappingTagID tag
Definition: legion.h:1000
CoherenceProperty prop
Definition: legion.h:997
ReductionOpID redop
Definition: legion.h:999
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:996
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:1007
RegionFlags flags
Definition: legion.h:1001
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:992
Definition: legion.h:4670
Definition: legion.h:4103
Definition: legion.h:1509
Definition: legion.h:4689
Definition: legion.h:1547
Definition: legion.h:2521
Definition: legion.h:2410
Definition: legion.h:2428