Legion Runtime
Loading...
Searching...
No Matches
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"
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
72namespace 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
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:
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>
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:
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
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);
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
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(RegionRequirement &&rhs) noexcept;
960 ~RegionRequirement(void);
961 RegionRequirement& operator=(const RegionRequirement &rhs);
962 RegionRequirement& operator=(RegionRequirement &&rhs) noexcept;
963 public:
964 bool operator==(const RegionRequirement &req) const;
965 bool operator<(const RegionRequirement &req) const;
966 public:
972 inline RegionRequirement& add_field(FieldID fid, bool instance = true);
973 inline RegionRequirement& add_fields(const std::vector<FieldID>& fids,
974 bool instance = true);
975
976 inline RegionRequirement& add_flags(RegionFlags new_flags);
977 public:
978 inline bool is_verified(void) const
979 { return (flags & LEGION_VERIFIED_FLAG); }
980 inline bool is_no_access(void) const
981 { return (flags & LEGION_NO_ACCESS_FLAG); }
982 inline bool is_restricted(void) const
983 { return (flags & LEGION_RESTRICTED_FLAG); }
984 LEGION_DEPRECATED("Premapping regions is no longer supported.")
985 inline bool must_premap(void) const
986 { return false; }
987 public:
988 const void* get_projection_args(size_t *size) const;
989 void set_projection_args(const void *args, size_t size, bool own = false);
990 public:
991 bool has_field_privilege(FieldID fid) const;
992 public:
993 // Fields used for controlling task launches
996 std::set<FieldID> privilege_fields;
997 std::vector<FieldID> instance_fields;
998 PrivilegeMode privilege;
999 CoherenceProperty prop;
1001 ReductionOpID redop;
1002 MappingTagID tag;
1003 RegionFlags flags;
1004 public:
1005 ProjectionType handle_type;
1006 ProjectionID projection;
1007 public:
1010 };
1011
1081 public:
1082 OutputRequirement(bool valid_requirement = false);
1084 OutputRequirement(FieldSpace field_space,
1085 const std::set<FieldID> &fields,
1086 int dim = 1,
1087 bool global_indexing = false);
1088 public:
1090 ~OutputRequirement(void);
1091 OutputRequirement& operator=(const RegionRequirement &req);
1092 OutputRequirement& operator=(const OutputRequirement &req);
1093 public:
1094 bool operator==(const OutputRequirement &req) const;
1095 bool operator<(const OutputRequirement &req) const;
1096 public:
1097 template <int DIM, typename COORD_T>
1098 void set_type_tag();
1099 // Specifies a projection functor id for this requirement.
1100 // For a projection output requirement, a color space must be specified.
1101 // The projection functor must be a bijective mapping from the launch
1102 // domain to the color space. This implies that the launch domain's
1103 // volume must be the same as the color space's.
1104 void set_projection(ProjectionID projection, IndexSpace color_space);
1105 public:
1106 TypeTag type_tag;
1111 };
1112
1121 public:
1122 IndexSpace handle;
1123 AllocateMode privilege;
1124 IndexSpace parent;
1125 bool verified;
1126 public:
1129 AllocateMode _priv,
1130 IndexSpace _parent,
1131 bool _verified = false);
1132 public:
1133 bool operator<(const IndexSpaceRequirement &req) const;
1134 bool operator==(const IndexSpaceRequirement &req) const;
1135 };
1136
1149 public:
1150 FieldSpace handle;
1151 AllocateMode privilege;
1152 bool verified;
1153 public:
1156 AllocateMode _priv,
1157 bool _verified = false);
1158 public:
1159 bool operator<(const FieldSpaceRequirement &req) const;
1160 bool operator==(const FieldSpaceRequirement &req) const;
1161 };
1162
1163 //==========================================================================
1164 // Future Value Classes
1165 //==========================================================================
1166
1185 class Future : public Unserializable<Future> {
1186 public:
1187 Future(void);
1188 Future(const Future &f);
1189 Future(Future &&f) noexcept;
1190 ~Future(void);
1191 private:
1192 Internal::FutureImpl *impl;
1193 protected:
1194 // Only the runtime should be allowed to make these
1195 FRIEND_ALL_RUNTIME_CLASSES
1196 explicit Future(Internal::FutureImpl *impl);
1197 public:
1198 inline bool exists(void) const { return (impl != NULL); }
1199 inline bool operator==(const Future &f) const
1200 { return impl == f.impl; }
1201 inline bool operator<(const Future &f) const
1202 { return impl < f.impl; }
1203 Future& operator=(const Future &f);
1204 Future& operator=(Future &&f) noexcept;
1205 std::size_t hash(void) const;
1206 public:
1215 template<typename T>
1216 inline T get_result(bool silence_warnings = false,
1217 const char *warning_string = NULL) const;
1223 void get_void_result(bool silence_warnings = false,
1224 const char *warning_string = NULL) const;
1236 bool is_empty(bool block = false, bool silence_warnings = false,
1237 const char *warning_string = NULL) const;
1245 bool is_ready(bool subscribe = false) const;
1246 public:
1261 template<typename T, PrivilegeMode PM = LEGION_READ_ONLY>
1262 Span<T,PM> get_span(Memory::Kind memory,
1263 bool silence_warnings = false,
1264 const char *warning_string = NULL) const;
1265
1279 const void* get_buffer(Memory::Kind memory,
1280 size_t *extent_in_bytes = NULL,
1281 bool check_extent = false,
1282 bool silence_warnings = false,
1283 const char *warning_string = NULL) const;
1284
1292 void get_memories(std::set<Memory> &memories,
1293 bool silence_warnings = false,
1294 const char *warning_string = NULL) const;
1295
1309 template<typename T>
1310 LEGION_DEPRECATED("Use 'Future::get_span' instead")
1311 inline const T& get_reference(bool silence_warnings = false,
1312 const char *warning_string = NULL) const;
1323 LEGION_DEPRECATED("Use 'Future::get_buffer' instead")
1324 inline const void* get_untyped_pointer(bool silence_warnings = false,
1325 const char *warning_string = NULL) const;
1326
1330 size_t get_untyped_size(void) const;
1331
1340 const void* get_metadata(size_t *size = NULL) const;
1341 public:
1342 // These methods provide partial support the C++ future interface
1343 template<typename T>
1344 inline T get(void);
1345
1346 inline bool valid(void) const;
1347
1348 inline void wait(void) const;
1349 public:
1355 template<typename T>
1356 LEGION_DEPRECATED("Use the version without a runtime pointer argument")
1357 static inline Future from_value(Runtime *rt, const T &value);
1358 template<typename T>
1359 static inline Future from_value(const T &value);
1365 static Future from_domain(const Domain &d, bool take_ownership,
1366 const char *provenance = NULL, bool shard_local = false);
1367
1372 LEGION_DEPRECATED("Use the version without a runtime pointer argument")
1373 static Future from_untyped_pointer(Runtime *rt,
1374 const void *buffer, size_t bytes, bool take_ownership = false);
1375 static Future from_untyped_pointer(
1376 const void *buffer, size_t bytes, bool take_ownership = false,
1377 const char *provenance = NULL, bool shard_local = false);
1378 static Future from_value(const void *buffer, size_t bytes, bool owned,
1379 const Realm::ExternalInstanceResource &resource,
1380 void (*freefunc)(const Realm::ExternalInstanceResource&) = NULL,
1381 const char *provenance = NULL, bool shard_local = false);
1382 private:
1383 // This should only be available for accessor classes
1384 template<PrivilegeMode, typename, int, typename, typename, bool>
1385 friend class FieldAccessor;
1386 Realm::RegionInstance get_instance(Memory::Kind kind,
1387 size_t field_size, bool check_field_size,
1388 const char *warning_string, bool silence_warnings) const;
1389 void report_incompatible_accessor(const char *accessor_kind,
1390 Realm::RegionInstance instance) const;
1391 };
1392
1407 public:
1408 FutureMap(void);
1409 FutureMap(const FutureMap &map);
1410 FutureMap(FutureMap &&map) noexcept;
1411 ~FutureMap(void);
1412 private:
1413 Internal::FutureMapImpl *impl;
1414 protected:
1415 // Only the runtime should be allowed to make these
1416 FRIEND_ALL_RUNTIME_CLASSES
1417 explicit FutureMap(Internal::FutureMapImpl *impl);
1418 public:
1419 inline bool exists(void) const { return (impl != NULL); }
1420 inline bool operator==(const FutureMap &f) const
1421 { return impl == f.impl; }
1422 inline bool operator<(const FutureMap &f) const
1423 { return impl < f.impl; }
1424 inline Future operator[](const DomainPoint &point) const
1425 { return get_future(point); }
1426 FutureMap& operator=(const FutureMap &f);
1427 FutureMap& operator=(FutureMap &&f) noexcept;
1428 std::size_t hash(void) const;
1429 public:
1438 template<typename T>
1439 inline T get_result(const DomainPoint &point,
1440 bool silence_warnings = false,
1441 const char *warning_string = NULL) const;
1449 Future get_future(const DomainPoint &point) const;
1457 void get_void_result(const DomainPoint &point,
1458 bool silence_warnings = false,
1459 const char *warning_string = NULL) const;
1460 public:
1468 template<typename RT, typename PT, unsigned DIM>
1469 inline RT get_result(const PT point[DIM]) const;
1478 template<typename PT, unsigned DIM>
1479 inline Future get_future(const PT point[DIM]) const;
1485 template<typename PT, unsigned DIM>
1486 inline void get_void_result(const PT point[DIM]) const;
1487 public:
1494 void wait_all_results(bool silence_warnings = false,
1495 const char *warning_string = NULL) const;
1496 public:
1503 };
1504
1505
1506 //==========================================================================
1507 // Operation Launcher Classes
1508 //==========================================================================
1509
1518 struct StaticDependence : public Unserializable<StaticDependence> {
1519 public:
1520 StaticDependence(void);
1521 StaticDependence(unsigned previous_offset,
1522 unsigned previous_req_index,
1523 unsigned current_req_index,
1524 DependenceType dtype,
1525 bool validates = false,
1526 bool shard_only = false);
1527 public:
1528 inline void add_field(FieldID fid);
1529 public:
1530 // The relative offset from this operation to
1531 // previous operation in the stream of operations
1532 // (e.g. 1 is the operation launched immediately before)
1533 unsigned previous_offset;
1534 // Region requirement of the previous operation for the dependence
1535 unsigned previous_req_index;
1536 // Region requirement of the current operation for the dependence
1537 unsigned current_req_index;
1538 // The type of the dependence
1539 DependenceType dependence_type;
1540 // Whether this requirement validates the previous writer
1541 bool validates;
1542 // Whether this dependence is a shard-only dependence for
1543 // control replication or it depends on all other copies
1544 bool shard_only;
1545 // Fields that have the dependence
1546 std::set<FieldID> dependent_fields;
1547 };
1548
1557 public:
1558 TaskLauncher(void);
1559 TaskLauncher(TaskID tid,
1560 UntypedBuffer arg,
1561 Predicate pred = Predicate::TRUE_PRED,
1562 MapperID id = 0,
1563 MappingTagID tag = 0,
1564 UntypedBuffer map_arg = UntypedBuffer(),
1565 const char *provenance = "");
1566 public:
1567 inline IndexSpaceRequirement&
1568 add_index_requirement(const IndexSpaceRequirement &req);
1569 inline RegionRequirement&
1570 add_region_requirement(const RegionRequirement &req);
1571 inline void add_field(unsigned idx, FieldID fid, bool inst = true);
1572 public:
1573 inline void add_future(Future f);
1574 inline void add_grant(Grant g);
1575 inline void add_wait_barrier(PhaseBarrier bar);
1576 inline void add_arrival_barrier(PhaseBarrier bar);
1577 inline void add_wait_handshake(LegionHandshake handshake);
1578 inline void add_arrival_handshake(LegionHandshake handshake);
1579 public:
1580 inline void set_predicate_false_future(Future f);
1581 inline void set_predicate_false_result(UntypedBuffer arg);
1582 public:
1583 inline void set_independent_requirements(bool independent);
1584 public:
1585 TaskID task_id;
1586 std::vector<IndexSpaceRequirement> index_requirements;
1587 std::vector<RegionRequirement> region_requirements;
1588 std::vector<Future> futures;
1589 std::vector<Grant> grants;
1590 std::vector<PhaseBarrier> wait_barriers;
1591 std::vector<PhaseBarrier> arrive_barriers;
1592 UntypedBuffer argument;
1593 Predicate predicate;
1594 MapperID map_id;
1595 MappingTagID tag;
1596 UntypedBuffer map_arg;
1597 DomainPoint point;
1598 // Only used in control replication contexts for
1599 // doing sharding. If left unspecified the runtime
1600 // will use an index space of size 1 containing 'point'
1601 IndexSpace sharding_space;
1602 public:
1603 // If the predicate is set to anything other than
1604 // Predicate::TRUE_PRED, then the application must
1605 // specify a value for the future in the case that
1606 // the predicate resolves to false. UntypedBuffer(NULL,0)
1607 // can be used if the task's return type is void.
1608 Future predicate_false_future;
1609 UntypedBuffer predicate_false_result;
1610 public:
1611 // Provenance string for the runtime and tools to use
1612 std::string provenance;
1613 public:
1614 // Inform the runtime about any static dependences
1615 // These will be ignored outside of static traces
1616 const std::vector<StaticDependence> *static_dependences;
1617 public:
1618 // Users can tell the runtime this task is eligible
1619 // for inlining by the mapper. This will invoke the
1620 // select_task_options call inline as part of the launch
1621 // logic for this task to allow the mapper to decide
1622 // whether to inline the task or not. Note that if the
1623 // mapper pre-empts during execution then resuming it
1624 // may take a long time if another long running task
1625 // gets scheduled on the processor that launched this task.
1626 bool enable_inlining;
1627 public:
1628 // In some cases users (most likely compilers) will want
1629 // to run a light-weight function (e.g. a continuation)
1630 // as a task that just depends on futures once those futures
1631 // are ready on a local processor where the parent task
1632 // is executing. We call this a local function task and it
1633 // must not have any region requirements. It must als be a
1634 // pure function with no side effects. This task will
1635 // not have the option of being distributed to remote nodes.
1636 bool local_function_task;
1637 public:
1638 // Users can inform the runtime that all region requirements
1639 // are independent of each other in this task. Independent
1640 // means that either field sets are independent or region
1641 // requirements are disjoint based on the region tree.
1642 bool independent_requirements;
1643 public:
1644 // Instruct the runtime that it does not need to produce
1645 // a future or future map result for this index task
1646 bool elide_future_return;
1647 // Provide an optional future return size. In general you
1648 // shouldn't need to use this and should prefer specifying
1649 // the future return size when you register a task variant.
1650 std::optional<size_t> future_return_size;
1651 public:
1652 bool silence_warnings;
1653 };
1654
1664 public:
1665 IndexTaskLauncher(void);
1666 IndexTaskLauncher(TaskID tid,
1667 Domain domain,
1668 UntypedBuffer global_arg,
1669 ArgumentMap map,
1670 Predicate pred = Predicate::TRUE_PRED,
1671 bool must = false,
1672 MapperID id = 0,
1673 MappingTagID tag = 0,
1674 UntypedBuffer map_arg = UntypedBuffer(),
1675 const char *provenance = "");
1676 IndexTaskLauncher(TaskID tid,
1677 IndexSpace launch_space,
1678 UntypedBuffer global_arg,
1679 ArgumentMap map,
1680 Predicate pred = Predicate::TRUE_PRED,
1681 bool must = false,
1682 MapperID id = 0,
1683 MappingTagID tag = 0,
1684 UntypedBuffer map_arg = UntypedBuffer(),
1685 const char *provenance = "");
1686 public:
1687 inline IndexSpaceRequirement&
1688 add_index_requirement(const IndexSpaceRequirement &req);
1689 inline RegionRequirement&
1690 add_region_requirement(const RegionRequirement &req);
1691 inline void add_field(unsigned idx, FieldID fid, bool inst = true);
1692 public:
1693 inline void add_future(Future f);
1694 inline void add_grant(Grant g);
1695 inline void add_wait_barrier(PhaseBarrier bar);
1696 inline void add_arrival_barrier(PhaseBarrier bar);
1697 inline void add_wait_handshake(LegionHandshake handshake);
1698 inline void add_arrival_handshake(LegionHandshake handshake);
1699 public:
1700 inline void set_predicate_false_future(Future f);
1701 inline void set_predicate_false_result(UntypedBuffer arg);
1702 public:
1703 inline void set_independent_requirements(bool independent);
1704 public:
1705 TaskID task_id;
1706 Domain launch_domain;
1707 IndexSpace launch_space;
1708 // Will only be used in control replication context. If left
1709 // unset the runtime will use launch_domain/launch_space
1710 IndexSpace sharding_space;
1711 std::vector<IndexSpaceRequirement> index_requirements;
1712 std::vector<RegionRequirement> region_requirements;
1713 std::vector<Future> futures;
1714 // These are appended to the futures for the point
1715 // task after the futures sent to all points above
1716 std::vector<ArgumentMap> point_futures;
1717 std::vector<Grant> grants;
1718 std::vector<PhaseBarrier> wait_barriers;
1719 std::vector<PhaseBarrier> arrive_barriers;
1720 UntypedBuffer global_arg;
1721 ArgumentMap argument_map;
1722 Predicate predicate;
1723 // Specify that all the point tasks in this index launch be
1724 // able to run concurrently, meaning they all must map to
1725 // different processors and they cannot have interfering region
1726 // requirements that might lead to dependences. Note that the
1727 // runtime guarantees that concurrent index launches will not
1728 // deadlock with other concurrent index launches which requires
1729 // additional analysis. Currently concurrent index space launches
1730 // will only be allowed to map to leaf task variants currently.
1731 ConcurrentID concurrent_functor; // = 0
1732 bool concurrent; // = false
1733 // This will convert this index space launch into a must
1734 // epoch launch which supports interfering region requirements
1735 bool must_parallelism;
1736 MapperID map_id;
1737 MappingTagID tag;
1738 UntypedBuffer map_arg;
1739 public:
1740 // If the predicate is set to anything other than
1741 // Predicate::TRUE_PRED, then the application must
1742 // specify a value for the future in the case that
1743 // the predicate resolves to false. UntypedBuffer(NULL,0)
1744 // can be used if the task's return type is void.
1745 Future predicate_false_future;
1746 UntypedBuffer predicate_false_result;
1747 public:
1748 // Provenance string for the runtime and tools to use
1749 std::string provenance;
1750 public:
1751 // Inform the runtime about any static dependences
1752 // These will be ignored outside of static traces
1753 const std::vector<StaticDependence> *static_dependences;
1754 public:
1755 // Users can tell the runtime this task is eligible
1756 // for inlining by the mapper. This will invoke the
1757 // select_task_options call inline as part of the launch
1758 // logic for this task to allow the mapper to decide
1759 // whether to inline the task or not. Note that if the
1760 // mapper pre-empts during execution then resuming it
1761 // may take a long time if another long running task
1762 // gets scheduled on the processor that launched this task.
1763 bool enable_inlining;
1764 public:
1765 // Users can inform the runtime that all region requirements
1766 // are independent of each other in this task. Independent
1767 // means that either field sets are independent or region
1768 // requirements are disjoint based on the region tree.
1769 bool independent_requirements;
1770 public:
1771 bool silence_warnings;
1772 public:
1773 // Instruct the runtime that it does not need to produce
1774 // a future or future map result for this index task
1775 bool elide_future_return;
1776 // Provide an optional future return size. In general you
1777 // shouldn't need to use this and should prefer specifying
1778 // the future return size when you register a task variant.
1779 std::optional<size_t> future_return_size;
1780 public:
1781 // Initial value for reduction
1782 Future initial_value;
1783 };
1784
1794 public:
1795 InlineLauncher(void);
1797 MapperID id = 0,
1798 MappingTagID tag = 0,
1799 LayoutConstraintID layout_id = 0,
1800 UntypedBuffer map_arg = UntypedBuffer(),
1801 const char *provenance = "");
1802 public:
1803 inline void add_field(FieldID fid, bool inst = true);
1804 public:
1805 inline void add_grant(Grant g);
1806 inline void add_wait_barrier(PhaseBarrier bar);
1807 inline void add_arrival_barrier(PhaseBarrier bar);
1808 inline void add_wait_handshake(LegionHandshake handshake);
1809 inline void add_arrival_handshake(LegionHandshake handshake);
1810 public:
1811 RegionRequirement requirement;
1812 std::vector<Grant> grants;
1813 std::vector<PhaseBarrier> wait_barriers;
1814 std::vector<PhaseBarrier> arrive_barriers;
1815 MapperID map_id;
1816 MappingTagID tag;
1817 UntypedBuffer map_arg;
1818 public:
1819 LayoutConstraintID layout_constraint_id;
1820 public:
1821 // Provenance string for the runtime and tools to use
1822 std::string provenance;
1823 public:
1824 // Inform the runtime about any static dependences
1825 // These will be ignored outside of static traces
1826 const std::vector<StaticDependence> *static_dependences;
1827 };
1828
1854 public:
1855 CopyLauncher(Predicate pred = Predicate::TRUE_PRED,
1856 MapperID id = 0, MappingTagID tag = 0,
1857 UntypedBuffer map_arg = UntypedBuffer(),
1858 const char *provenance = "");
1859 public:
1860 inline unsigned add_copy_requirements(const RegionRequirement &src,
1861 const RegionRequirement &dst);
1862 inline void add_src_field(unsigned idx, FieldID fid, bool inst = true);
1863 inline void add_dst_field(unsigned idx, FieldID fid, bool inst = true);
1864 public:
1865 // Specify src/dst indirect requirements (must have exactly 1 field)
1866 inline void add_src_indirect_field(FieldID src_idx_fid,
1867 const RegionRequirement &src_idx_req,
1868 bool is_range_indirection = false,
1869 bool inst = true);
1870 inline void add_dst_indirect_field(FieldID dst_idx_fid,
1871 const RegionRequirement &dst_idx_req,
1872 bool is_range_indirection = false,
1873 bool inst = true);
1874 inline RegionRequirement& add_src_indirect_field(
1875 const RegionRequirement &src_idx_req,
1876 bool is_range_indirection = false);
1877 inline RegionRequirement& add_dst_indirect_field(
1878 const RegionRequirement &dst_idx_req,
1879 bool is_range_indirection = false);
1880 public:
1881 inline void add_grant(Grant g);
1882 inline void add_wait_barrier(PhaseBarrier bar);
1883 inline void add_arrival_barrier(PhaseBarrier bar);
1884 inline void add_wait_handshake(LegionHandshake handshake);
1885 inline void add_arrival_handshake(LegionHandshake handshake);
1886 public:
1887 std::vector<RegionRequirement> src_requirements;
1888 std::vector<RegionRequirement> dst_requirements;
1889 std::vector<RegionRequirement> src_indirect_requirements;
1890 std::vector<RegionRequirement> dst_indirect_requirements;
1891 std::vector<bool> src_indirect_is_range;
1892 std::vector<bool> dst_indirect_is_range;
1893 std::vector<Grant> grants;
1894 std::vector<PhaseBarrier> wait_barriers;
1895 std::vector<PhaseBarrier> arrive_barriers;
1896 Predicate predicate;
1897 MapperID map_id;
1898 MappingTagID tag;
1899 UntypedBuffer map_arg;
1900 DomainPoint point;
1901 // Only used in control replication contexts for
1902 // doing sharding. If left unspecified the runtime
1903 // will use an index space of size 1 containing 'point'
1904 IndexSpace sharding_space;
1905 public:
1906 // Provenance string for the runtime and tools to use
1907 std::string provenance;
1908 public:
1909 // Inform the runtime about any static dependences
1910 // These will be ignored outside of static traces
1911 const std::vector<StaticDependence> *static_dependences;
1912 public:
1913 // Whether the source and destination indirections can lead
1914 // to out-of-range access into the instances to skip
1915 bool possible_src_indirect_out_of_range;
1916 bool possible_dst_indirect_out_of_range;
1917 // Whether the destination indirection can lead to aliasing
1918 // in the destination instances requiring synchronization
1919 bool possible_dst_indirect_aliasing;
1920 public:
1921 bool silence_warnings;
1922 };
1923
1935 public:
1936 IndexCopyLauncher(void);
1937 IndexCopyLauncher(Domain domain, Predicate pred = Predicate::TRUE_PRED,
1938 MapperID id = 0, MappingTagID tag = 0,
1939 UntypedBuffer map_arg = UntypedBuffer(),
1940 const char *provenance = "");
1941 IndexCopyLauncher(IndexSpace space, Predicate pred = Predicate::TRUE_PRED,
1942 MapperID id = 0, MappingTagID tag = 0,
1943 UntypedBuffer map_arg = UntypedBuffer(),
1944 const char *provenance = "");
1945 public:
1946 inline unsigned add_copy_requirements(const RegionRequirement &src,
1947 const RegionRequirement &dst);
1948 inline void add_src_field(unsigned idx, FieldID fid, bool inst = true);
1949 inline void add_dst_field(unsigned idx, FieldID fid, bool inst = true);
1950 public:
1951 // Specify src/dst indirect requirements (must have exactly 1 field)
1952 inline void add_src_indirect_field(FieldID src_idx_fid,
1953 const RegionRequirement &src_idx_req,
1954 bool is_range_indirection = false,
1955 bool inst = true);
1956 inline void add_dst_indirect_field(FieldID dst_idx_fid,
1957 const RegionRequirement &dst_idx_req,
1958 bool is_range_indirection = false,
1959 bool inst = true);
1960 inline RegionRequirement& add_src_indirect_field(
1961 const RegionRequirement &src_idx_req,
1962 bool is_range_indirection = false);
1963 inline RegionRequirement& add_dst_indirect_field(
1964 const RegionRequirement &dst_idx_req,
1965 bool is_range_indirection = false);
1966 public:
1967 inline void add_grant(Grant g);
1968 inline void add_wait_barrier(PhaseBarrier bar);
1969 inline void add_arrival_barrier(PhaseBarrier bar);
1970 inline void add_wait_handshake(LegionHandshake handshake);
1971 inline void add_arrival_handshake(LegionHandshake handshake);
1972 public:
1973 std::vector<RegionRequirement> src_requirements;
1974 std::vector<RegionRequirement> dst_requirements;
1975 std::vector<RegionRequirement> src_indirect_requirements;
1976 std::vector<RegionRequirement> dst_indirect_requirements;
1977 std::vector<bool> src_indirect_is_range;
1978 std::vector<bool> dst_indirect_is_range;
1979 std::vector<Grant> grants;
1980 std::vector<PhaseBarrier> wait_barriers;
1981 std::vector<PhaseBarrier> arrive_barriers;
1982 Domain launch_domain;
1983 IndexSpace launch_space;
1984 // Will only be used in control replication context. If left
1985 // unset the runtime will use launch_domain/launch_space
1986 IndexSpace sharding_space;
1987 Predicate predicate;
1988 MapperID map_id;
1989 MappingTagID tag;
1990 UntypedBuffer map_arg;
1991 public:
1992 // Provenance string for the runtime and tools to use
1993 std::string provenance;
1994 public:
1995 // Inform the runtime about any static dependences
1996 // These will be ignored outside of static traces
1997 const std::vector<StaticDependence> *static_dependences;
1998 public:
1999 // Whether the source and destination indirections can lead
2000 // to out-of-range access into the instances to skip
2001 bool possible_src_indirect_out_of_range;
2002 bool possible_dst_indirect_out_of_range;
2003 // Whether the destination indirection can lead to aliasing
2004 // in the destination instances requiring synchronization
2005 bool possible_dst_indirect_aliasing;
2006 // Whether the individual point copies should operate collectively
2007 // together in the case of indirect copies (e.g. allow indirections
2008 // to refer to instances from other points). These settings have
2009 // no effect in the case of copies without indirections.
2010 bool collective_src_indirect_points;
2011 bool collective_dst_indirect_points;
2012 public:
2013 bool silence_warnings;
2014 };
2015
2023 public:
2024 FillLauncher(void);
2026 UntypedBuffer arg, Predicate pred = Predicate::TRUE_PRED,
2027 MapperID id = 0, MappingTagID tag = 0,
2028 UntypedBuffer map_arg = UntypedBuffer(),
2029 const char *provenance = "");
2031 Future f, Predicate pred = Predicate::TRUE_PRED,
2032 MapperID id = 0, MappingTagID tag = 0,
2033 UntypedBuffer map_arg = UntypedBuffer(),
2034 const char *provenance = "");
2035 public:
2036 inline void set_argument(UntypedBuffer arg);
2037 inline void set_future(Future f);
2038 inline void add_field(FieldID fid);
2039 inline void add_grant(Grant g);
2040 inline void add_wait_barrier(PhaseBarrier bar);
2041 inline void add_arrival_barrier(PhaseBarrier bar);
2042 inline void add_wait_handshake(LegionHandshake handshake);
2043 inline void add_arrival_handshake(LegionHandshake handshake);
2044 public:
2045 LogicalRegion handle;
2046 LogicalRegion parent;
2047 UntypedBuffer argument;
2048 Future future;
2049 Predicate predicate;
2050 std::set<FieldID> fields;
2051 std::vector<Grant> grants;
2052 std::vector<PhaseBarrier> wait_barriers;
2053 std::vector<PhaseBarrier> arrive_barriers;
2054 MapperID map_id;
2055 MappingTagID tag;
2056 UntypedBuffer map_arg;
2057 DomainPoint point;
2058 // Only used in control replication contexts for
2059 // doing sharding. If left unspecified the runtime
2060 // will use an index space of size 1 containing 'point'
2061 IndexSpace sharding_space;
2062 public:
2063 // Provenance string for the runtime and tools to use
2064 std::string provenance;
2065 public:
2066 // Inform the runtime about any static dependences
2067 // These will be ignored outside of static traces
2068 const std::vector<StaticDependence> *static_dependences;
2069 public:
2070 bool silence_warnings;
2071 };
2072
2083 public:
2084 IndexFillLauncher(void);
2085 // Region projection
2086 IndexFillLauncher(Domain domain, LogicalRegion handle,
2087 LogicalRegion parent, UntypedBuffer arg,
2088 ProjectionID projection = 0,
2089 Predicate pred = Predicate::TRUE_PRED,
2090 MapperID id = 0, MappingTagID tag = 0,
2091 UntypedBuffer map_arg = UntypedBuffer(),
2092 const char *provenance = "");
2093 IndexFillLauncher(Domain domain, LogicalRegion handle,
2094 LogicalRegion parent, Future f,
2095 ProjectionID projection = 0,
2096 Predicate pred = Predicate::TRUE_PRED,
2097 MapperID id = 0, MappingTagID tag = 0,
2098 UntypedBuffer map_arg = UntypedBuffer(),
2099 const char *provenance = "");
2101 LogicalRegion parent, UntypedBuffer arg,
2102 ProjectionID projection = 0,
2103 Predicate pred = Predicate::TRUE_PRED,
2104 MapperID id = 0, MappingTagID tag = 0,
2105 UntypedBuffer map_arg = UntypedBuffer(),
2106 const char *provenance = "");
2108 LogicalRegion parent, Future f,
2109 ProjectionID projection = 0,
2110 Predicate pred = Predicate::TRUE_PRED,
2111 MapperID id = 0, MappingTagID tag = 0,
2112 UntypedBuffer map_arg = UntypedBuffer(),
2113 const char *provenance = "");
2114 // Partition projection
2116 LogicalRegion parent, UntypedBuffer arg,
2117 ProjectionID projection = 0,
2118 Predicate pred = Predicate::TRUE_PRED,
2119 MapperID id = 0, MappingTagID tag = 0,
2120 UntypedBuffer map_arg = UntypedBuffer(),
2121 const char *provenance = "");
2123 LogicalRegion parent, Future f,
2124 ProjectionID projection = 0,
2125 Predicate pred = Predicate::TRUE_PRED,
2126 MapperID id = 0, MappingTagID tag = 0,
2127 UntypedBuffer map_arg = UntypedBuffer(),
2128 const char *provenance = "");
2130 LogicalRegion parent, UntypedBuffer arg,
2131 ProjectionID projection = 0,
2132 Predicate pred = Predicate::TRUE_PRED,
2133 MapperID id = 0, MappingTagID tag = 0,
2134 UntypedBuffer map_arg = UntypedBuffer(),
2135 const char *provenance = "");
2137 LogicalRegion parent, Future f,
2138 ProjectionID projection = 0,
2139 Predicate pred = Predicate::TRUE_PRED,
2140 MapperID id = 0, MappingTagID tag = 0,
2141 UntypedBuffer map_arg = UntypedBuffer(),
2142 const char *provenance = "");
2143 public:
2144 inline void set_argument(UntypedBuffer arg);
2145 inline void set_future(Future f);
2146 inline void add_field(FieldID fid);
2147 inline void add_grant(Grant g);
2148 inline void add_wait_barrier(PhaseBarrier bar);
2149 inline void add_arrival_barrier(PhaseBarrier bar);
2150 inline void add_wait_handshake(LegionHandshake handshake);
2151 inline void add_arrival_handshake(LegionHandshake handshake);
2152 public:
2153 Domain launch_domain;
2154 IndexSpace launch_space;
2155 // Will only be used in control replication context. If left
2156 // unset the runtime will use launch_domain/launch_space
2157 IndexSpace sharding_space;
2158 LogicalRegion region;
2159 LogicalPartition partition;
2160 LogicalRegion parent;
2161 ProjectionID projection;
2162 UntypedBuffer argument;
2163 Future future;
2164 Predicate predicate;
2165 std::set<FieldID> fields;
2166 std::vector<Grant> grants;
2167 std::vector<PhaseBarrier> wait_barriers;
2168 std::vector<PhaseBarrier> arrive_barriers;
2169 MapperID map_id;
2170 MappingTagID tag;
2171 UntypedBuffer map_arg;
2172 public:
2173 // Provenance string for the runtime and tools to use
2174 std::string provenance;
2175 public:
2176 // Inform the runtime about any static dependences
2177 // These will be ignored outside of static traces
2178 const std::vector<StaticDependence> *static_dependences;
2179 public:
2180 bool silence_warnings;
2181 };
2182
2190 public:
2192 public:
2193 inline void add_field(FieldID fid);
2194 public:
2195 LogicalRegion handle;
2196 LogicalRegion parent;
2197 std::set<FieldID> fields;
2198 public:
2199 // Provenance string for the runtime and tools to use
2200 std::string provenance;
2201 public:
2202 // Inform the runtime about any static dependences
2203 // These will be ignored outside of static traces
2204 const std::vector<StaticDependence> *static_dependences;
2205 public:
2206 bool silence_warnings;
2207 };
2208
2231 public:
2232 AttachLauncher(ExternalResource resource,
2233 LogicalRegion handle, LogicalRegion parent,
2234 const bool restricted = true,
2235 const bool mapped = true);
2236 // Declared here to avoid superfluous compiler warnings
2237 // Can be remove after deprecated members are removed
2238 ~AttachLauncher(void);
2239 public:
2240 inline void initialize_constraints(bool column_major, bool soa,
2241 const std::vector<FieldID> &fields,
2242 const std::map<FieldID,size_t> *alignments = NULL);
2243 LEGION_DEPRECATED("Use Realm::ExternalFileResource instead")
2244 inline void attach_file(const char *file_name,
2245 const std::vector<FieldID> &fields,
2246 LegionFileMode mode);
2247 LEGION_DEPRECATED("Use Realm::ExternalHDF5Resource instead")
2248 inline void attach_hdf5(const char *file_name,
2249 const std::map<FieldID,const char*> &field_map,
2250 LegionFileMode mode);
2251 // Helper methods for AOS and SOA arrays, but it is totally
2252 // acceptable to fill in the layout constraint set manually
2253 LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2254 inline void attach_array_aos(void *base, bool column_major,
2255 const std::vector<FieldID> &fields,
2256 Memory memory = Memory::NO_MEMORY,
2257 const std::map<FieldID,size_t> *alignments = NULL);
2258 LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2259 inline void attach_array_soa(void *base, bool column_major,
2260 const std::vector<FieldID> &fields,
2261 Memory memory = Memory::NO_MEMORY,
2262 const std::map<FieldID,size_t> *alignments = NULL);
2263 public:
2264 ExternalResource resource;
2265 LogicalRegion parent;
2266 LogicalRegion handle;
2267 std::set<FieldID> privilege_fields;
2268 public:
2269 // This will be cloned each time you perform an attach with this launcher
2270 const Realm::ExternalInstanceResource* external_resource;
2271 public:
2272 LayoutConstraintSet constraints;
2273 public:
2274 // Whether this instance will be restricted when attached
2275 bool restricted /*= true*/;
2276 // Whether this region should be mapped by the calling task
2277 bool mapped; /*= true*/
2278 // Only matters for control replicated parent tasks
2279 // Indicate whether all the shards are providing the same data
2280 // or whether they are each providing different data
2281 // Collective means that each shard provides its own copy of the
2282 // data and non-collective means every shard provides the same data
2283 // Defaults to 'true' for external instances and 'false' for files
2284 bool collective;
2285 // For collective cases, indicate whether the runtime should
2286 // deduplicate data across shards in the same process
2287 // This is useful for cases where there is one file or external
2288 // instance per process but multiple shards per process
2289 bool deduplicate_across_shards;
2290 public:
2291 // Provenance string for the runtime and tools to use
2292 std::string provenance;
2293 public:
2294 // Data for files
2295 LEGION_DEPRECATED("file_name is deprecated, use external_resource")
2296 const char *file_name;
2297 LEGION_DEPRECATED("mode is deprecated, use external_resource")
2298 LegionFileMode mode;
2299 LEGION_DEPRECATED("file_fields is deprecated, use external_resource")
2300 std::vector<FieldID> file_fields; // normal files
2301 // This member must still be populated if you're attaching to an HDF5 file
2302 std::map<FieldID,/*file name*/const char*> field_files; // hdf5 files
2303 public:
2304 // Optional footprint of the instance in memory in bytes
2305 size_t footprint;
2306 public:
2307 // Inform the runtime about any static dependences
2308 // These will be ignored outside of static traces
2309 const std::vector<StaticDependence> *static_dependences;
2310 };
2311
2323 public:
2324 IndexAttachLauncher(ExternalResource resource,
2325 LogicalRegion parent,
2326 const bool restricted = true);
2327 // Declared here to avoid superfluous compiler warnings
2328 // Can be remove after deprecated members are removed
2330 public:
2331 inline void initialize_constraints(bool column_major, bool soa,
2332 const std::vector<FieldID> &fields,
2333 const std::map<FieldID,size_t> *alignments = NULL);
2334 inline void add_external_resource(LogicalRegion handle,
2335 const Realm::ExternalInstanceResource *resource);
2336 LEGION_DEPRECATED("Use Realm::ExternalFileResource instead")
2337 inline void attach_file(LogicalRegion handle,
2338 const char *file_name,
2339 const std::vector<FieldID> &fields,
2340 LegionFileMode mode);
2341 LEGION_DEPRECATED("Use Realm::ExternalHDF5Resource instead")
2342 inline void attach_hdf5(LogicalRegion handle,
2343 const char *file_name,
2344 const std::map<FieldID,const char*> &field_map,
2345 LegionFileMode mode);
2346 // Helper methods for AOS and SOA arrays, but it is totally
2347 // acceptable to fill in the layout constraint set manually
2348 LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2349 inline void attach_array_aos(LogicalRegion handle,
2350 void *base, bool column_major,
2351 const std::vector<FieldID> &fields,
2352 Memory memory = Memory::NO_MEMORY,
2353 const std::map<FieldID,size_t> *alignments = NULL);
2354 LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
2355 inline void attach_array_soa(LogicalRegion handle,
2356 void *base, bool column_major,
2357 const std::vector<FieldID> &fields,
2358 Memory memory = Memory::NO_MEMORY,
2359 const std::map<FieldID,size_t> *alignments = NULL);
2360 public:
2361 ExternalResource resource;
2362 LogicalRegion parent;
2363 std::set<FieldID> privilege_fields;
2364 std::vector<LogicalRegion> handles;
2365 // This is the vector external resource objects that are going to
2366 // attached to the vector of logical region handles
2367 // These will be cloned each time you perform an attach with this launcher
2368 std::vector<const Realm::ExternalInstanceResource*> external_resources;
2369 public:
2370 LayoutConstraintSet constraints;
2371 public:
2372 // Whether these instances will be restricted when attached
2373 bool restricted /*= true*/;
2374 // Whether the runtime should check for duplicate resources across
2375 // the shards in a control replicated context, it is illegal to pass
2376 // in the same resource to different shards if this is set to false
2377 bool deduplicate_across_shards;
2378 public:
2379 // Provenance string for the runtime and tools to use
2380 std::string provenance;
2381 public:
2382 // Data for files
2383 LEGION_DEPRECATED("mode is deprecated, use external_resources")
2384 LegionFileMode mode;
2385 LEGION_DEPRECATED("file_names is deprecated, use external_resources")
2386 std::vector<const char*> file_names;
2387 LEGION_DEPRECATED("file_fields is deprecated, use external_resources")
2388 std::vector<FieldID> file_fields; // normal files
2389 // This data structure must still be filled in for using HDF5 files
2390 std::map<FieldID,
2391 std::vector</*file name*/const char*> > field_files; // hdf5 files
2392 public:
2393 // Data for external instances
2394 LEGION_DEPRECATED("pointers is deprecated, use external_resources")
2395 std::vector<PointerConstraint> pointers;
2396 public:
2397 // Optional footprint of the instance in memory in bytes
2398 // You only need to fill this in when using depcreated fields
2399 std::vector<size_t> footprint;
2400 public:
2401 // Inform the runtime about any static dependences
2402 // These will be ignored outside of static traces
2403 const std::vector<StaticDependence> *static_dependences;
2404 };
2405
2413 public:
2414 explicit PredicateLauncher(bool and_op = true);
2415 public:
2416 inline void add_predicate(const Predicate &pred);
2417 public:
2418 bool and_op; // if not 'and' then 'or'
2419 std::vector<Predicate> predicates;
2420 std::string provenance;
2421 };
2422
2429 public:
2430 TimingLauncher(TimingMeasurement measurement);
2431 public:
2432 inline void add_precondition(const Future &f);
2433 public:
2434 TimingMeasurement measurement;
2435 std::set<Future> preconditions;
2436 public:
2437 // Provenance string for the runtime and tools to use
2438 std::string provenance;
2439 };
2440
2447 public:
2448 TunableLauncher(TunableID tid,
2449 MapperID mapper = 0,
2450 MappingTagID tag = 0,
2451 size_t return_type_size = SIZE_MAX);
2452 public:
2453 TunableID tunable;
2454 MapperID mapper;
2455 MappingTagID tag;
2456 UntypedBuffer arg;
2457 std::vector<Future> futures;
2458 size_t return_type_size;
2459 public:
2460 // Provenance string for the runtime and tools to use
2461 std::string provenance;
2462 };
2463
2464 //==========================================================================
2465 // Task Variant Registrars
2466 //==========================================================================
2467
2479 public:
2482 const char *layout_name = NULL);
2483 public:
2485 add_constraint(const SpecializedConstraint &constraint);
2487 add_constraint(const MemoryConstraint &constraint);
2489 add_constraint(const OrderingConstraint &constraint);
2491 add_constraint(const TilingConstraint &constraint);
2493 add_constraint(const FieldConstraint &constraint);
2495 add_constraint(const DimensionConstraint &constraint);
2497 add_constraint(const AlignmentConstraint &constraint);
2499 add_constraint(const OffsetConstraint &constraint);
2501 add_constraint(const PointerConstraint &constraint);
2503 add_constraint(const PaddingConstraint &constraint);
2504 public:
2505 FieldSpace handle;
2506 LayoutConstraintSet layout_constraints;
2507 const char* layout_name;
2508 };
2509
2515 struct PoolBounds {
2516 public:
2517 PoolBounds(UnboundPoolScope u, size_t s = 0)
2518 : size(s), alignment(0), scope(u) { }
2519 PoolBounds(size_t s = 0, uint32_t a = 16)
2520 : size(s), alignment(a), scope(LEGION_BOUNDED_POOL) { }
2521 PoolBounds(const PoolBounds&) = default;
2522 PoolBounds(PoolBounds&&) = default;
2523 PoolBounds& operator=(const PoolBounds&) = default;
2524 PoolBounds& operator=(PoolBounds&&) = default;
2525 inline bool is_bounded(void) const
2526 { return (scope == LEGION_BOUNDED_POOL); }
2527 public:
2528 // If this is a bounded pool then size is the number of bytes in the pool
2529 // If it is an unbounded pool then size is how many free bytes the pool
2530 // is allowed to keep locally from freed instances without returning
2531 // them back to the Realm allocator, zero means that all freed instances
2532 // are immediately sent back to the Realm allocator
2533 size_t size; // upper bound of the pool in bytes
2534 uint32_t alignment; // maximum alignment supported
2535 UnboundPoolScope scope; // scope for unbound pools
2536 };
2537
2547 public:
2549 TaskVariantRegistrar(TaskID task_id, bool global = true,
2550 const char *variant_name = NULL);
2551 TaskVariantRegistrar(TaskID task_id, const char *variant_name,
2552 bool global = true);
2553 public: // Add execution constraints
2554 inline TaskVariantRegistrar&
2555 add_constraint(const ISAConstraint &constraint);
2556 inline TaskVariantRegistrar&
2557 add_constraint(const ProcessorConstraint &constraint);
2558 inline TaskVariantRegistrar&
2559 add_constraint(const ResourceConstraint &constraint);
2560 inline TaskVariantRegistrar&
2561 add_constraint(const LaunchConstraint &constraint);
2562 inline TaskVariantRegistrar&
2563 add_constraint(const ColocationConstraint &constraint);
2564 public: // Add layout constraint sets
2565 inline TaskVariantRegistrar&
2566 add_layout_constraint_set(unsigned index, LayoutConstraintID desc);
2567 public: // Set properties
2568 inline void set_leaf(bool is_leaf = true);
2569 inline void set_inner(bool is_inner = true);
2570 inline void set_idempotent(bool is_idempotent = true);
2571 inline void set_replicable(bool is_replicable = true);
2572 inline void set_concurrent(bool is_concurrent = true);
2573 inline void set_concurrent_barrier(bool needs_barrier = true);
2574 public: // Generator Task IDs
2575 inline void add_generator_task(TaskID tid);
2576 public:
2577 TaskID task_id;
2578 bool global_registration;
2579 const char* task_variant_name;
2580 public: // constraints
2581 ExecutionConstraintSet execution_constraints;
2582 TaskLayoutConstraintSet layout_constraints;
2583 public:
2584 // If this is a leaf task variant then the application can
2585 // request that the runtime preserve a pool in the memory of
2586 // the corresponding kind with the closest affinity to the target
2587 // processor for handling dynamic memory allocations during the
2588 // execution of the task. Pool bounds can also be set to request
2589 // an unbounded pool allocation. Note that requesting an unbound
2590 // memory allocation will likely result in severe performance degradation.
2591 std::map<Memory::Kind,PoolBounds> leaf_pool_bounds;
2592 public:
2593 // TaskIDs for which this variant can serve as a generator
2594 std::set<TaskID> generator_tasks;
2595 public: // properties
2596 bool leaf_variant;
2597 bool inner_variant;
2598 bool idempotent_variant;
2599 bool replicable_variant;
2600 bool concurrent_variant;
2601 bool concurrent_barrier;
2602 };
2603
2604 //==========================================================================
2605 // Physical Data Classes
2606 //==========================================================================
2607
2616 class PhysicalRegion : public Unserializable<PhysicalRegion> {
2617 public:
2618 PhysicalRegion(void);
2619 PhysicalRegion(const PhysicalRegion &rhs);
2620 PhysicalRegion(PhysicalRegion &&rhs) noexcept;
2621 ~PhysicalRegion(void);
2622 private:
2623 Internal::PhysicalRegionImpl *impl;
2624 protected:
2625 FRIEND_ALL_RUNTIME_CLASSES
2626 explicit PhysicalRegion(Internal::PhysicalRegionImpl *impl);
2627 public:
2628 PhysicalRegion& operator=(const PhysicalRegion &rhs);
2629 PhysicalRegion& operator=(PhysicalRegion &&rhs) noexcept;
2630 inline bool exists(void) const { return (impl != NULL); }
2631 inline bool operator==(const PhysicalRegion &reg) const
2632 { return (impl == reg.impl); }
2633 inline bool operator<(const PhysicalRegion &reg) const
2634 { return (impl < reg.impl); }
2635 std::size_t hash(void) const;
2636 public:
2640 bool is_mapped(void) const;
2648 void wait_until_valid(bool silence_warnings = false,
2649 const char *warning_string = NULL);
2656 bool is_valid(void) const;
2664 PrivilegeMode get_privilege(void) const;
2668 void get_memories(std::set<Memory>& memories,
2669 bool silence_warnings = false,
2670 const char *warning_string = NULL) const;
2674 void get_fields(std::vector<FieldID>& fields) const;
2675 public:
2676 template<int DIM, typename COORD_T>
2677 DomainT<DIM,COORD_T> get_bounds(void) const;
2678 // We'll also allow this to implicitly cast to a realm index space
2679 // so that users can easily iterate over the points
2680 template<int DIM, typename COORD_T>
2681 operator DomainT<DIM,COORD_T>(void) const;
2682 // They can implicitly cast to a rectangle if there is no
2683 // sparsity map, runtime will check for this
2684 template<int DIM, typename COORD_T>
2685 operator Rect<DIM,COORD_T>(void) const;
2686 protected:
2687 // These methods can only be accessed by accessor classes
2688 template<PrivilegeMode, typename, int, typename, typename, bool>
2689 friend class FieldAccessor;
2690 template<typename, bool, int, typename, typename, bool>
2691 friend class ReductionAccessor;
2692 template<typename, int, typename, typename, bool, bool, int>
2693 friend class MultiRegionAccessor;
2694 template<typename, int, typename, typename, bool>
2695 friend class PaddingAccessor;
2696 template<typename, int, typename, typename>
2697 friend class UnsafeFieldAccessor;
2698 template<typename, PrivilegeMode>
2699 friend class ArraySyntax::AccessorRefHelper;
2700 template<typename>
2701 friend class ArraySyntax::AffineRefHelper;
2702 friend class PieceIterator;
2703 template<PrivilegeMode, typename, int, typename>
2704 friend class SpanIterator;
2705 template<typename, int, typename>
2706 friend class UnsafeSpanIterator;
2707 Realm::RegionInstance get_instance_info(PrivilegeMode mode,
2708 FieldID fid, size_t field_size,
2709 void *realm_is, TypeTag type_tag,
2710 const char *warning_string,
2711 bool silence_warnings,
2712 bool generic_accessor,
2713 bool check_field_size,
2714 ReductionOpID redop = 0) const;
2715 Realm::RegionInstance get_instance_info(PrivilegeMode mode,
2716 const std::vector<PhysicalRegion> &other_regions,
2717 FieldID fid, size_t field_size,
2718 void *realm_is, TypeTag type_tag,
2719 const char *warning_string,
2720 bool silence_warnings,
2721 bool generic_accessor,
2722 bool check_field_size,
2723 bool need_bounds,
2724 ReductionOpID redop = 0) const;
2725 Realm::RegionInstance get_padding_info(FieldID fid, size_t field_size,
2726 Domain *inner, Domain &outer,
2727 const char *warning_string,
2728 bool silence_warnings,
2729 bool generic_accessor,
2730 bool check_field_size) const;
2731 void report_incompatible_accessor(const char *accessor_kind,
2732 Realm::RegionInstance instance, FieldID fid) const;
2733 void report_incompatible_multi_accessor(unsigned index, FieldID fid,
2734 Realm::RegionInstance inst1,
2735 Realm::RegionInstance inst2) const;
2736 void report_colocation_violation(const char *accessor_kind, FieldID fid,
2737 Realm::RegionInstance inst1,
2738 Realm::RegionInstance inst2,
2739 const PhysicalRegion &other,
2740 bool reduction = false) const;
2741 static void empty_colocation_regions(const char *accessor_kind,
2742 FieldID fid, bool reduction = false);
2743 static void fail_bounds_check(DomainPoint p, FieldID fid,
2744 PrivilegeMode mode, bool multi = false);
2745 static void fail_bounds_check(Domain d, FieldID fid,
2746 PrivilegeMode mode, bool multi = false);
2747 static void fail_privilege_check(DomainPoint p, FieldID fid,
2748 PrivilegeMode mode);
2749 static void fail_privilege_check(Domain d, FieldID fid,
2750 PrivilegeMode mode);
2751 static void fail_padding_check(DomainPoint p, FieldID fid);
2752 protected:
2753 void get_bounds(void *realm_is, TypeTag type_tag) const;
2754 };
2755
2763 class ExternalResources : public Unserializable<ExternalResources> {
2764 public:
2765 ExternalResources(void);
2767 ExternalResources(ExternalResources &&rhs) noexcept;
2768 ~ExternalResources(void);
2769 private:
2770 Internal::ExternalResourcesImpl *impl;
2771 protected:
2772 FRIEND_ALL_RUNTIME_CLASSES
2773 explicit ExternalResources(Internal::ExternalResourcesImpl *impl);
2774 public:
2775 ExternalResources& operator=(const ExternalResources &rhs);
2776 ExternalResources& operator=(ExternalResources &&rhs) noexcept;
2777 inline bool exists(void) const { return (impl != NULL); }
2778 inline bool operator==(const ExternalResources &reg) const
2779 { return (impl == reg.impl); }
2780 inline bool operator<(const ExternalResources &reg) const
2781 { return (impl < reg.impl); }
2782 public:
2783 size_t size(void) const;
2784 PhysicalRegion operator[](unsigned index) const;
2785 };
2786
2824 template<PrivilegeMode MODE, typename FT, int N, typename COORD_T = coord_t,
2825 typename A = Realm::GenericAccessor<FT,N,COORD_T>,
2826#ifdef LEGION_BOUNDS_CHECKS
2827 bool CHECK_BOUNDS = true>
2828#else
2829 bool CHECK_BOUNDS = false>
2830#endif
2832 private:
2833 static_assert(N > 0, "N must be positive");
2834 static_assert(std::is_integral<COORD_T>::value, "must be integral type");
2835 public:
2836 FieldAccessor(void) { }
2837 FieldAccessor(const PhysicalRegion &region, FieldID fid,
2838 // The actual field size in case it is different from the
2839 // one being used in FT and we still want to check it
2840 size_t actual_field_size = sizeof(FT),
2841#ifdef DEBUG_LEGION
2842 bool check_field_size = true,
2843#else
2844 bool check_field_size = false,
2845#endif
2846 bool silence_warnings = false,
2847 const char *warning_string = NULL,
2848 size_t subfield_offset = 0) { }
2849 // For Realm::AffineAccessor specializations there are additional
2850 // methods for creating accessors with limited bounding boxes and
2851 // affine transformations for using alternative coordinates spaces
2852 // Specify a specific bounds rectangle to use for the accessor
2853 FieldAccessor(const PhysicalRegion &region, FieldID fid,
2854 const Rect<N,COORD_T> bounds,
2855 // The actual field size in case it is different from the
2856 // one being used in FT and we still want to check it
2857 size_t actual_field_size = sizeof(FT),
2858#ifdef DEBUG_LEGION
2859 bool check_field_size = true,
2860#else
2861 bool check_field_size = false,
2862#endif
2863 bool silence_warnings = false,
2864 const char *warning_string = NULL,
2865 size_t subfield_offset = 0) { }
2866 // Specify a specific Affine transform to use for interpreting points
2867 // Not avalable for Realm::MultiAffineAccessor specializations
2868 template<int M>
2869 FieldAccessor(const PhysicalRegion &region, FieldID fid,
2870 const AffineTransform<M,N,COORD_T> transform,
2871 // The actual field size in case it is different from the
2872 // one being used in FT and we still want to check it
2873 size_t actual_field_size = sizeof(FT),
2874#ifdef DEBUG_LEGION
2875 bool check_field_size = true,
2876#else
2877 bool check_field_size = false,
2878#endif
2879 bool silence_warnings = false,
2880 const char *warning_string = NULL,
2881 size_t subfield_offset = 0) { }
2882 // Specify both a transform and a bounds to use
2883 // Not avalable for Realm::MultiAffineAccessor specializations
2884 template<int M>
2885 FieldAccessor(const PhysicalRegion &region, FieldID fid,
2886 const AffineTransform<M,N,COORD_T> transform,
2887 const Rect<N,COORD_T> bounds,
2888 // The actual field size in case it is different from the
2889 // one being used in FT and we still want to check it
2890 size_t actual_field_size = sizeof(FT),
2891#ifdef DEBUG_LEGION
2892 bool check_field_size = true,
2893#else
2894 bool check_field_size = false,
2895#endif
2896 bool silence_warnings = false,
2897 const char *warning_string = NULL,
2898 size_t subfield_offset = 0) { }
2899 // Create a field accessor for a Future
2900 // (only with READ-ONLY privileges and AffineAccessors)
2901 FieldAccessor(const Future &future,
2902 Memory::Kind kind = Memory::NO_MEMKIND,
2903 // The actual field size in case it is different from the
2904 // one being used in FT and we still want to check it
2905 size_t actual_field_size = sizeof(FT),
2906#ifdef DEBUG_LEGION
2907 bool check_field_size = true,
2908#else
2909 bool check_field_size = false,
2910#endif
2911 bool silence_warnings = false,
2912 const char *warning_string = NULL,
2913 size_t subfield_offset = 0) { }
2914 // Create a field accessor for a Future
2915 // (only with READ-ONLY privileges and AffineAccessors)
2916 FieldAccessor(const Future &future,
2917 const Rect<N,COORD_T> bounds,
2918 Memory::Kind kind = Memory::NO_MEMKIND,
2919 // The actual field size in case it is different from the
2920 // one being used in FT and we still want to check it
2921 size_t actual_field_size = sizeof(FT),
2922#ifdef DEBUG_LEGION
2923 bool check_field_size = true,
2924#else
2925 bool check_field_size = false,
2926#endif
2927 bool silence_warnings = false,
2928 const char *warning_string = NULL,
2929 size_t subfield_offset = 0) { }
2930 public:
2931 // Variations of the above four methods but with multiple physical
2932 // regions specified using input iterators for colocation regions
2933 // Colocation regions from [start, stop)
2934 template<typename InputIterator>
2935 FieldAccessor(InputIterator start_region,
2936 InputIterator stop_region, FieldID fid,
2937 // The actual field size in case it is different from the
2938 // one being used in FT and we still want to check it
2939 size_t actual_field_size = sizeof(FT),
2940#ifdef DEBUG_LEGION
2941 bool check_field_size = true,
2942#else
2943 bool check_field_size = false,
2944#endif
2945 bool silence_warnings = false,
2946 const char *warning_string = NULL,
2947 size_t subfield_offset = 0) { }
2948 // For Realm::AffineAccessor specializations there are additional
2949 // methods for creating accessors with limited bounding boxes and
2950 // affine transformations for using alternative coordinates spaces
2951 // Specify a specific bounds rectangle to use for the accessor
2952 // Colocation regions from [start, stop)
2953 template<typename InputIterator>
2954 FieldAccessor(InputIterator start_region,
2955 InputIterator stop_region, FieldID fid,
2956 const Rect<N,COORD_T> bounds,
2957 // The actual field size in case it is different from the
2958 // one being used in FT and we still want to check it
2959 size_t actual_field_size = sizeof(FT),
2960#ifdef DEBUG_LEGION
2961 bool check_field_size = true,
2962#else
2963 bool check_field_size = false,
2964#endif
2965 bool silence_warnings = false,
2966 const char *warning_string = NULL,
2967 size_t subfield_offset = 0) { }
2968 // Specify a specific Affine transform to use for interpreting points
2969 // Not avalable for Realm::MultiAffineAccessor specializations
2970 // Colocation regions from [start, stop)
2971 template<typename InputIterator, int M>
2972 FieldAccessor(InputIterator start_region,
2973 InputIterator stop_region, FieldID fid,
2974 const AffineTransform<M,N,COORD_T> transform,
2975 // The actual field size in case it is different from the
2976 // one being used in FT and we still want to check it
2977 size_t actual_field_size = sizeof(FT),
2978#ifdef DEBUG_LEGION
2979 bool check_field_size = true,
2980#else
2981 bool check_field_size = false,
2982#endif
2983 bool silence_warnings = false,
2984 const char *warning_string = NULL,
2985 size_t subfield_offset = 0) { }
2986 // Specify both a transform and a bounds to use
2987 // Not avalable for Realm::MultiAffineAccessor specializations
2988 // Colocation regions from [start, stop)
2989 template<typename InputIterator, int M>
2990 FieldAccessor(InputIterator start_region,
2991 InputIterator stop_region, FieldID fid,
2992 const AffineTransform<M,N,COORD_T> transform,
2993 const Rect<N,COORD_T> bounds,
2994 // The actual field size in case it is different from the
2995 // one being used in FT and we still want to check it
2996 size_t actual_field_size = sizeof(FT),
2997#ifdef DEBUG_LEGION
2998 bool check_field_size = true,
2999#else
3000 bool check_field_size = false,
3001#endif
3002 bool silence_warnings = false,
3003 const char *warning_string = NULL,
3004 size_t subfield_offset = 0) { }
3005 public:
3006 // Create a FieldAccessor for an UntypedDeferredValue
3007 // (only with AffineAccessors)
3009 // The actual field size in case it is different from the
3010 // one being used in FT and we still want to check it
3011 size_t actual_field_size = sizeof(FT),
3012#ifdef DEBUG_LEGION
3013 bool check_field_size = true,
3014#else
3015 bool check_field_size = false,
3016#endif
3017 bool silence_warnings = false,
3018 const char *warning_string = NULL,
3019 size_t subfield_offset = 0) { }
3020 // Create a FieldAccessor for an UntypedDeferredValue
3021 // Specify a specific bounds rectangle to use for the accessor
3022 // (only with AffineAccessors)
3024 const Rect<N,COORD_T> &bounds,
3025 // The actual field size in case it is different from the
3026 // one being used in FT and we still want to check it
3027 size_t actual_field_size = sizeof(FT),
3028#ifdef DEBUG_LEGION
3029 bool check_field_size = true,
3030#else
3031 bool check_field_size = false,
3032#endif
3033 bool silence_warnings = false,
3034 const char *warning_string = NULL,
3035 size_t subfield_offset = 0) { }
3036 public:
3037 // Create a FieldAccessor for UntypedDeferredBuffer
3038 // (only with AffineAccessors)
3039 FieldAccessor(const UntypedDeferredBuffer<COORD_T> &buffer,
3040 // The actual field size in case it is different from the
3041 // one being used in FT and we still want to check it
3042 size_t actual_field_size = sizeof(FT),
3043#ifdef DEBUG_LEGION
3044 bool check_field_size = true,
3045#else
3046 bool check_field_size = false,
3047#endif
3048 bool silence_warnings = false,
3049 const char *warning_string = NULL,
3050 size_t subfield_offset = 0) { }
3051 // Create a FieldAccessor for UntypedDeferredBuffer
3052 // Specify a specific bounds rectangle to use for the accessor
3053 // (only with AffineAccessors)
3054 FieldAccessor(const UntypedDeferredBuffer<COORD_T> &buffer,
3055 const Rect<N,COORD_T> &bounds,
3056 // The actual field size in case it is different from the
3057 // one being used in FT and we still want to check it
3058 size_t actual_field_size = sizeof(FT),
3059#ifdef DEBUG_LEGION
3060 bool check_field_size = true,
3061#else
3062 bool check_field_size = false,
3063#endif
3064 bool silence_warnings = false,
3065 const char *warning_string = NULL,
3066 size_t subfield_offset = 0) { }
3067 // Create a FieldAccessor for UntypedDeferredBuffer
3068 // Specify a specific Affine transform to use for interpreting points
3069 // (only with AffineAccessors)
3070 template<int M>
3071 FieldAccessor(const UntypedDeferredBuffer<COORD_T> &buffer,
3072 const AffineTransform<M,N,COORD_T> &transform,
3073 // The actual field size in case it is different from the
3074 // one being used in FT and we still want to check it
3075 size_t actual_field_size = sizeof(FT),
3076#ifdef DEBUG_LEGION
3077 bool check_field_size = true,
3078#else
3079 bool check_field_size = false,
3080#endif
3081 bool silence_warnings = false,
3082 const char *warning_string = NULL,
3083 size_t subfield_offset = 0) { }
3084 // Create a FieldAccessor for UntypedDeferredBuffer
3085 // Specify both a transform and a bounds to use
3086 // (only with AffineAccessors)
3087 template<int M>
3088 FieldAccessor(const UntypedDeferredBuffer<COORD_T> &buffer,
3089 const AffineTransform<M,N,COORD_T> &transform,
3090 const Rect<N,COORD_T> &bounds,
3091 // The actual field size in case it is different from the
3092 // one being used in FT and we still want to check it
3093 size_t actual_field_size = sizeof(FT),
3094#ifdef DEBUG_LEGION
3095 bool check_field_size = true,
3096#else
3097 bool check_field_size = false,
3098#endif
3099 bool silence_warnings = false,
3100 const char *warning_string = NULL,
3101 size_t subfield_offset = 0) { }
3102 public:
3103 typedef FT value_type;
3104 typedef FT& reference;
3105 typedef const FT& const_reference;
3106 static const int dim = N;
3107 };
3108
3121 template<typename REDOP, bool EXCLUSIVE, int N, typename COORD_T = coord_t,
3122 typename A = Realm::GenericAccessor<typename REDOP::RHS,N,COORD_T>,
3123#ifdef LEGION_BOUNDS_CHECKS
3124 bool CHECK_BOUNDS = true>
3125#else
3126 bool CHECK_BOUNDS = false>
3127#endif
3129 private:
3130 static_assert(N > 0, "N must be positive");
3131 static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3132 public:
3133 ReductionAccessor(void) { }
3134 ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3135 ReductionOpID redop, bool silence_warnings = false,
3136 const char *warning_string = NULL,
3137 size_t subfield_offset = 0,
3138 size_t actual_field_size = sizeof(typename REDOP::RHS),
3139#ifdef DEBUG_LEGION
3140 bool check_field_size = true
3141#else
3142 bool check_field_size = false
3143#endif
3144 ) { }
3145 // For Realm::AffineAccessor specializations there are additional
3146 // methods for creating accessors with limited bounding boxes and
3147 // affine transformations for using alternative coordinates spaces
3148 // Specify a specific bounds rectangle to use for the accessor
3149 ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3150 ReductionOpID redop,
3151 const Rect<N,COORD_T> bounds,
3152 bool silence_warnings = false,
3153 const char *warning_string = NULL,
3154 size_t subfield_offset = 0,
3155 size_t actual_field_size = sizeof(typename REDOP::RHS),
3156#ifdef DEBUG_LEGION
3157 bool check_field_size = true
3158#else
3159 bool check_field_size = false
3160#endif
3161 ) { }
3162 // Specify a specific Affine transform to use for interpreting points
3163 // Not available for Realm::MultiAffineAccessor specializations
3164 template<int M>
3165 ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3166 ReductionOpID redop,
3167 const AffineTransform<M,N,COORD_T> transform,
3168 bool silence_warnings = false,
3169 const char *warning_string = NULL,
3170 size_t subfield_offset = 0,
3171 size_t actual_field_size = sizeof(typename REDOP::RHS),
3172#ifdef DEBUG_LEGION
3173 bool check_field_size = true
3174#else
3175 bool check_field_size = false
3176#endif
3177 ) { }
3178 // Specify both a transform and a bounds to use
3179 // Not available for Realm::MultiAffineAccessor specializations
3180 template<int M>
3181 ReductionAccessor(const PhysicalRegion &region, FieldID fid,
3182 ReductionOpID redop,
3183 const AffineTransform<M,N,COORD_T> transform,
3184 const Rect<N,COORD_T> bounds,
3185 bool silence_warnings = false,
3186 const char *warning_string = NULL,
3187 size_t subfield_offset = 0,
3188 size_t actual_field_size = sizeof(typename REDOP::RHS),
3189#ifdef DEBUG_LEGION
3190 bool check_field_size = true
3191#else
3192 bool check_field_size = false
3193#endif
3194 ) { }
3195 public:
3196 // Variations of the same four methods above but with multiple
3197 // physical regions specified using input iterators for colocation regions
3198 // Colocation regions from [start, stop)
3199 template<typename InputIterator>
3200 ReductionAccessor(InputIterator start_region,
3201 InputIterator stop_region, FieldID fid,
3202 ReductionOpID redop, bool silence_warnings = false,
3203 const char *warning_string = NULL,
3204 size_t subfield_offset = 0,
3205 size_t actual_field_size = sizeof(typename REDOP::RHS),
3206#ifdef DEBUG_LEGION
3207 bool check_field_size = true
3208#else
3209 bool check_field_size = false
3210#endif
3211 ) { }
3212 // For Realm::AffineAccessor specializations there are additional
3213 // methods for creating accessors with limited bounding boxes and
3214 // affine transformations for using alternative coordinates spaces
3215 // Specify a specific bounds rectangle to use for the accessor
3216 // Colocation regions from [start, stop)
3217 template<typename InputIterator>
3218 ReductionAccessor(InputIterator start_region,
3219 InputIterator stop_region, FieldID fid,
3220 ReductionOpID redop,
3221 const Rect<N,COORD_T> bounds,
3222 bool silence_warnings = false,
3223 const char *warning_string = NULL,
3224 size_t subfield_offset = 0,
3225 size_t actual_field_size = sizeof(typename REDOP::RHS),
3226#ifdef DEBUG_LEGION
3227 bool check_field_size = true
3228#else
3229 bool check_field_size = false
3230#endif
3231 ) { }
3232 // Specify a specific Affine transform to use for interpreting points
3233 // Not available for Realm::MultiAffineAccessor specializations
3234 // Colocation regions from [start, stop)
3235 template<typename InputIterator, int M>
3236 ReductionAccessor(InputIterator start_region,
3237 InputIterator stop_region, FieldID fid,
3238 ReductionOpID redop,
3239 const AffineTransform<M,N,COORD_T> transform,
3240 bool silence_warnings = false,
3241 const char *warning_string = NULL,
3242 size_t subfield_offset = 0,
3243 size_t actual_field_size = sizeof(typename REDOP::RHS),
3244#ifdef DEBUG_LEGION
3245 bool check_field_size = true
3246#else
3247 bool check_field_size = false
3248#endif
3249 ) { }
3250 // Specify both a transform and a bounds to use
3251 // Not available for Realm::MultiAffineAccessor specializations
3252 // Colocation regions from [start, stop)
3253 template<typename InputIterator, int M>
3254 ReductionAccessor(InputIterator start_region,
3255 InputIterator stop_region, FieldID fid,
3256 ReductionOpID redop,
3257 const AffineTransform<M,N,COORD_T> transform,
3258 const Rect<N,COORD_T> bounds,
3259 bool silence_warnings = false,
3260 const char *warning_string = NULL,
3261 size_t subfield_offset = 0,
3262 size_t actual_field_size = sizeof(typename REDOP::RHS),
3263#ifdef DEBUG_LEGION
3264 bool check_field_size = true
3265#else
3266 bool check_field_size = false
3267#endif
3268 ) { }
3269 public:
3270 // Create a ReductionAccessor for an UntypedDeferredValue
3271 // (only with AffineAccessors)
3273 bool silence_warnings = false,
3274 const char *warning_string = NULL,
3275 size_t subfield_offset = 0,
3276 size_t actual_field_size = sizeof(typename REDOP::RHS),
3277#ifdef DEBUG_LEGION
3278 bool check_field_size = true
3279#else
3280 bool check_field_size = false
3281#endif
3282 ) { }
3283 // Create a ReductionAccessor for an UntypedDeferredValue
3284 // Specify a specific bounds rectangle to use for the accessor
3285 // (only with AffineAccessors)
3287 const Rect<N,COORD_T> &bounds,
3288 bool silence_warnings = false,
3289 const char *warning_string = NULL,
3290 size_t subfield_offset = 0,
3291 size_t actual_field_size = sizeof(typename REDOP::RHS),
3292#ifdef DEBUG_LEGION
3293 bool check_field_size = true
3294#else
3295 bool check_field_size = false
3296#endif
3297 ) { }
3298 public:
3299 // Create a ReductionAccessor for an UntypedDeferredBuffer
3300 // (only with AffineAccessors)
3301 ReductionAccessor(const UntypedDeferredBuffer<COORD_T> &buffer,
3302 bool silence_warnings = false,
3303 const char *warning_string = NULL,
3304 size_t subfield_offset = 0,
3305 size_t actual_field_size = sizeof(typename REDOP::RHS),
3306#ifdef DEBUG_LEGION
3307 bool check_field_size = true
3308#else
3309 bool check_field_size = false
3310#endif
3311 ) { }
3312 // Create a ReductionAccessor for an UntypedDeferredBuffer
3313 // Specify a specific bounds rectangle to use for the accessor
3314 // (only with AffineAccessors)
3315 ReductionAccessor(const UntypedDeferredBuffer<COORD_T> &buffer,
3316 const Rect<N,COORD_T> &bounds,
3317 bool silence_warnings = false,
3318 const char *warning_string = NULL,
3319 size_t subfield_offset = 0,
3320 size_t actual_field_size = sizeof(typename REDOP::RHS),
3321#ifdef DEBUG_LEGION
3322 bool check_field_size = true
3323#else
3324 bool check_field_size = false
3325#endif
3326 ) { }
3327 // Create a ReductionAccessor for an UntypedDeferredBuffer
3328 // Specify a specific Affine transform to use for interpreting points
3329 // (only with AffineAccessors)
3330 template<int M>
3331 ReductionAccessor(const UntypedDeferredBuffer<COORD_T> &buffer,
3332 const AffineTransform<M,N,COORD_T> &transform,
3333 bool silence_warnings = false,
3334 const char *warning_string = NULL,
3335 size_t subfield_offset = 0,
3336 size_t actual_field_size = sizeof(typename REDOP::RHS),
3337#ifdef DEBUG_LEGION
3338 bool check_field_size = true
3339#else
3340 bool check_field_size = false
3341#endif
3342 ) { }
3343 // Create a ReductionAccessor for an UntypedDeferredBuffer
3344 // Specify both a transform and a bounds to use
3345 // (only with AffineAccessors)
3346 template<int M>
3347 ReductionAccessor(const UntypedDeferredBuffer<COORD_T> &buffer,
3348 const AffineTransform<M,N,COORD_T> &transform,
3349 const Rect<N,COORD_T> &bounds,
3350 bool silence_warnings = false,
3351 const char *warning_string = NULL,
3352 size_t subfield_offset = 0,
3353 size_t actual_field_size = sizeof(typename REDOP::RHS),
3354#ifdef DEBUG_LEGION
3355 bool check_field_size = true
3356#else
3357 bool check_field_size = false
3358#endif
3359 ) { }
3360 public:
3361 typedef typename REDOP::RHS value_type;
3362 typedef typename REDOP::RHS& reference;
3363 typedef const typename REDOP::RHS& const_reference;
3364 static const int dim = N;
3365 };
3366
3389 template<typename FT, int N, typename COORD_T = coord_t,
3390 typename A = Realm::GenericAccessor<FT,N,COORD_T>,
3391#ifdef LEGION_BOUNDS_CHECKS
3392 bool CHECK_BOUNDS = true>
3393#else
3394 bool CHECK_BOUNDS = false>
3395#endif
3397 public:
3398 PaddingAccessor(void) { }
3399 PaddingAccessor(const PhysicalRegion &region, FieldID fid,
3400 // The actual field size in case it is different from the
3401 // one being used in FT and we still want to check it
3402 size_t actual_field_size = sizeof(FT),
3403#ifdef DEBUG_LEGION
3404 bool check_field_size = true,
3405#else
3406 bool check_field_size = false,
3407#endif
3408 bool silence_warnings = false,
3409 const char *warning_string = NULL,
3410 size_t subfield_offset = 0) { }
3411 };
3412
3413#ifdef LEGION_MULTI_REGION_ACCESSOR
3414 // Multi-Region Accessors are a provisional feature now and are likely
3415 // to be deprecated and removed in the near future. Instead of multi-region
3416 // accessors you should be able to use the new colocation constructors
3417 // on the traditional Field Accessors.
3447 template<typename FT, int N, typename COORD_T = coord_t,
3448 typename A = Realm::GenericAccessor<FT,N,COORD_T>,
3449#ifdef LEGION_BOUNDS_CHECKS
3450 bool CHECK_BOUNDS = true,
3451#else
3452 bool CHECK_BOUNDS = false,
3453#endif
3454#ifdef LEGION_PRIVILEGE_CHECKS
3455 bool CHECK_PRIVILEGES = true,
3456#else
3457 bool CHECK_PRIVILEGES = false,
3458#endif
3459 // Only used if bounds/privilege checks enabled
3460 // Can safely over-approximate, but may cost space
3461 // Especially GPU parameter space
3462 int MAX_REGIONS = 4>
3463 class MultiRegionAccessor {
3464 private:
3465 static_assert(N > 0, "N must be positive");
3466 static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3467 public:
3468 MultiRegionAccessor(void) { }
3469 public: // iterator based construction of the multi-region accessors
3470 template<typename InputIterator>
3471 MultiRegionAccessor(InputIterator start, InputIterator stop,
3472 // The actual field size in case it is different from
3473 // the one being used in FT and we still want to check
3474 FieldID fid, size_t actual_field_size = sizeof(FT),
3475#ifdef DEBUG_LEGION
3476 bool check_field_size = true,
3477#else
3478 bool check_field_size = false,
3479#endif
3480 bool silence_warnings = false,
3481 const char *warning_string = NULL,
3482 size_t subfield_offset = 0) { }
3483 // Specify a specific bounds rectangle to use for the accessor
3484 template<typename InputIterator>
3485 MultiRegionAccessor(InputIterator start, InputIterator stop,
3486 const Rect<N,COORD_T> bounds, FieldID fid,
3487 // The actual field size in case it is different from
3488 // the one being used in FT and we still want to check
3489 size_t actual_field_size = sizeof(FT),
3490#ifdef DEBUG_LEGION
3491 bool check_field_size = true,
3492#else
3493 bool check_field_size = false,
3494#endif
3495 bool silence_warnings = false,
3496 const char *warning_string = NULL,
3497 size_t subfield_offset = 0) { }
3498 // Specify a specific Affine transform to use for interpreting points
3499 template<int M, typename InputIterator>
3500 MultiRegionAccessor(InputIterator start, InputIterator stop,
3501 const AffineTransform<M,N,COORD_T> transform,
3502 // The actual field size in case it is different from
3503 // the one being used in FT and we still want to check
3504 FieldID fid, size_t actual_field_size = sizeof(FT),
3505#ifdef DEBUG_LEGION
3506 bool check_field_size = true,
3507#else
3508 bool check_field_size = false,
3509#endif
3510 bool silence_warnings = false,
3511 const char *warning_string = NULL,
3512 size_t subfield_offset = 0) { }
3513 // Specify both a transform and a bounds to use
3514 template<int M, typename InputIterator>
3515 MultiRegionAccessor(InputIterator start, InputIterator stop,
3516 const AffineTransform<M,N,COORD_T> transform,
3517 const Rect<N,COORD_T> bounds, FieldID fid,
3518 // The actual field size in case it is different from the
3519 // one being used in FT and we still want to check it
3520 size_t actual_field_size = sizeof(FT),
3521#ifdef DEBUG_LEGION
3522 bool check_field_size = true,
3523#else
3524 bool check_field_size = false,
3525#endif
3526 bool silence_warnings = false,
3527 const char *warning_string = NULL,
3528 size_t subfield_offset = 0) { }
3529 public: // explicit data structure versions of the implicit iterators above
3530 MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3531 // The actual field size in case it is different from
3532 // the one being used in FT and we still want to check
3533 FieldID fid, size_t actual_field_size = sizeof(FT),
3534#ifdef DEBUG_LEGION
3535 bool check_field_size = true,
3536#else
3537 bool check_field_size = false,
3538#endif
3539 bool silence_warnings = false,
3540 const char *warning_string = NULL,
3541 size_t subfield_offset = 0) { }
3542 // Specify a specific bounds rectangle to use for the accessor
3543 MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3544 const Rect<N,COORD_T> bounds, FieldID fid,
3545 // The actual field size in case it is different from
3546 // the one being used in FT and we still want to check
3547 size_t actual_field_size = sizeof(FT),
3548#ifdef DEBUG_LEGION
3549 bool check_field_size = true,
3550#else
3551 bool check_field_size = false,
3552#endif
3553 bool silence_warnings = false,
3554 const char *warning_string = NULL,
3555 size_t subfield_offset = 0) { }
3556 // Specify a specific Affine transform to use for interpreting points
3557 template<int M>
3558 MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3559 const AffineTransform<M,N,COORD_T> transform,
3560 // The actual field size in case it is different from
3561 // the one being used in FT and we still want to check
3562 FieldID fid, size_t actual_field_size = sizeof(FT),
3563#ifdef DEBUG_LEGION
3564 bool check_field_size = true,
3565#else
3566 bool check_field_size = false,
3567#endif
3568 bool silence_warnings = false,
3569 const char *warning_string = NULL,
3570 size_t subfield_offset = 0) { }
3571 // Specify both a transform and a bounds to use
3572 template<int M>
3573 MultiRegionAccessor(const std::vector<PhysicalRegion> &regions,
3574 const AffineTransform<M,N,COORD_T> transform,
3575 const Rect<N,COORD_T> bounds, FieldID fid,
3576 // The actual field size in case it is different from the
3577 // one being used in FT and we still want to check it
3578 size_t actual_field_size = sizeof(FT),
3579#ifdef DEBUG_LEGION
3580 bool check_field_size = true,
3581#else
3582 bool check_field_size = false,
3583#endif
3584 bool silence_warnings = false,
3585 const char *warning_string = NULL,
3586 size_t subfield_offset = 0) { }
3587 public:
3588 typedef FT value_type;
3589 typedef FT& reference;
3590 typedef const FT& const_reference;
3591 static const int dim = N;
3592 };
3593#endif // LEGION_MULTI_REGION_ACCESSOR
3594
3619 public:
3620 PieceIterator(void);
3621 PieceIterator(const PieceIterator &rhs);
3622 PieceIterator(PieceIterator &&rhs) noexcept;
3623 PieceIterator(const PhysicalRegion &region, FieldID fid,
3624 bool privilege_only = true,
3625 bool silence_warnings = false,
3626 const char *warning_string = NULL);
3627 ~PieceIterator(void);
3628 public:
3629 PieceIterator& operator=(const PieceIterator &rhs);
3630 PieceIterator& operator=(PieceIterator &&rhs) noexcept;
3631 public:
3632 inline bool valid(void) const;
3633 bool step(void);
3634 public:
3635 inline operator bool(void) const;
3636 inline bool operator()(void) const;
3637 inline const Domain& operator*(void) const;
3638 inline const Domain* operator->(void) const;
3639 inline PieceIterator& operator++(void);
3640 inline PieceIterator operator++(int/*postfix*/);
3641 public:
3642 bool operator<(const PieceIterator &rhs) const;
3643 bool operator==(const PieceIterator &rhs) const;
3644 bool operator!=(const PieceIterator &rhs) const;
3645 private:
3646 Internal::PieceIteratorImpl *impl;
3647 int index;
3648 protected:
3649 Domain current_piece;
3650 };
3651
3657 template<int DIM, typename COORD_T = coord_t>
3659 private:
3660 static_assert(DIM > 0, "DIM must be positive");
3661 static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3662 public:
3663 PieceIteratorT(void);
3664 PieceIteratorT(const PieceIteratorT &rhs);
3665 PieceIteratorT(PieceIteratorT &&rhs) noexcept;
3666 PieceIteratorT(const PhysicalRegion &region, FieldID fid,
3667 bool privilege_only,
3668 bool silence_warnings = false,
3669 const char *warning_string = NULL);
3670 public:
3671 PieceIteratorT<DIM,COORD_T>& operator=(const PieceIteratorT &rhs);
3672 PieceIteratorT<DIM,COORD_T>& operator=(PieceIteratorT &&rhs) noexcept;
3673 public:
3674 inline bool step(void);
3675 inline const Rect<DIM,COORD_T>& operator*(void) const;
3676 inline const Rect<DIM,COORD_T>* operator->(void) const;
3677 inline PieceIteratorT<DIM,COORD_T>& operator++(void);
3678 inline PieceIteratorT<DIM,COORD_T> operator++(int/*postfix*/);
3679 protected:
3680 Rect<DIM,COORD_T> current_rect;
3681 };
3682
3692 template<PrivilegeMode PM, typename FT, int DIM, typename COORD_T = coord_t>
3694 private:
3695 static_assert(DIM > 0, "DIM must be positive");
3696 static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3697 public:
3698 SpanIterator(void) { }
3699 SpanIterator(const PhysicalRegion &region, FieldID fid,
3700 // The actual field size in case it is different from the
3701 // one being used in FT and we still want to check it
3702 size_t actual_field_size = sizeof(FT),
3703#ifdef DEBUG_LEGION
3704 bool check_field_size = true,
3705#else
3706 bool check_field_size = false,
3707#endif
3708 // Iterate only the spans that we have privileges on
3709 bool privileges_only = true,
3710 bool silence_warnings = false,
3711 const char *warning_string = NULL);
3712 public:
3713 inline bool valid(void) const;
3714 inline bool step(void);
3715 public:
3716 inline operator bool(void) const;
3717 inline bool operator()(void) const;
3718 inline const Span<FT,PM>& operator*(void) const;
3719 inline const Span<FT,PM>* operator->(void) const;
3720 inline SpanIterator<PM,FT,DIM,COORD_T>& operator++(void);
3721 inline SpanIterator<PM,FT,DIM,COORD_T> operator++(int);
3722 private:
3723 PieceIteratorT<DIM,COORD_T> piece_iterator;
3724 Realm::MultiAffineAccessor<FT,DIM,COORD_T> accessor;
3725 Span<FT,PM> current;
3726 Point<DIM,COORD_T> partial_step_point;
3727 int dim_order[DIM];
3728 int partial_step_dim;
3729 bool partial_piece;
3730 };
3731
3737 public:
3739 UntypedDeferredValue(size_t field_size, Memory target_memory,
3740 const void *initial_value = NULL,
3741 size_t alignment = 16);
3742 UntypedDeferredValue(size_t field_size,
3743 Memory::Kind memory_kind = Memory::Z_COPY_MEM,
3744 const void *initial_value = NULL,
3745 size_t alignment = 16);
3747 public:
3748 template<typename T>
3749 inline operator DeferredValue<T>(void) const;
3750 template<typename REDOP, bool EXCLUSIVE>
3751 inline operator DeferredReduction<REDOP,EXCLUSIVE>(void) const;
3752 inline size_t field_size(void) const;
3753 public:
3754 void finalize(Context ctx) const;
3755 Realm::RegionInstance get_instance(void) const;
3756 protected:
3757 Realm::RegionInstance instance;
3758 protected:
3759 // Helper methods for DeferredValues and DeferredBuffers
3760 static Memory get_memory_from_kind(Memory::Kind kind, bool value);
3761 static Realm::RegionInstance allocate_instance(Memory memory,
3762 Realm::InstanceLayoutGeneric *layout);
3763 static void destroy_instance(Realm::RegionInstance,
3764 Realm::Event precondition);
3765 static Domain get_index_space_bounds(IndexSpace space);
3766 template<PrivilegeMode,typename,int,typename,typename,bool>
3767 friend class FieldAccessor;
3768 template<typename,bool,int,typename,typename,bool>
3769 friend class ReductionAccessor;
3770 template<typename>
3771 friend class UntypedDeferredBuffer;
3772 template<typename,int,typename,bool>
3773 friend class DeferredBuffer;
3774 };
3775
3789 template<typename T>
3791 public:
3792 DeferredValue(T initial_value,
3793 size_t alignment = std::alignment_of<T>());
3794 public:
3795 __CUDA_HD__
3796 inline T read(void) const;
3797 __CUDA_HD__
3798 inline void write(T value) const;
3799 __CUDA_HD__
3800 inline T* ptr(void) const;
3801 __CUDA_HD__
3802 inline T& ref(void) const;
3803 __CUDA_HD__
3804 inline operator T(void) const;
3805 __CUDA_HD__
3806 inline DeferredValue<T>& operator=(T value);
3807 public:
3808 typedef T value_type;
3809 typedef T& reference;
3810 typedef const T& const_reference;
3811 protected:
3812 friend class UntypedDeferredValue;
3813 DeferredValue(void);
3814 Realm::AffineAccessor<T,1,coord_t> accessor;
3815 };
3816
3826 template<typename REDOP, bool EXCLUSIVE=false>
3827 class DeferredReduction: public DeferredValue<typename REDOP::RHS> {
3828 public:
3830 size_t alignment = std::alignment_of<typename REDOP::RHS>());
3831 public:
3832 __CUDA_HD__
3833 inline void reduce(typename REDOP::RHS val) const;
3834 __CUDA_HD__
3835 inline void operator<<=(typename REDOP::RHS val) const;
3836 public:
3837 typedef typename REDOP::RHS value_type;
3838 typedef typename REDOP::RHS& reference;
3839 typedef const typename REDOP::RHS& const_reference;
3840 };
3841
3859 template<typename T, int DIM, typename COORD_T = coord_t,
3860#ifdef LEGION_BOUNDS_CHECKS
3861 bool CHECK_BOUNDS = true>
3862#else
3863 bool CHECK_BOUNDS = false>
3864#endif
3866 private:
3867 static_assert(DIM > 0, "DIM must be positive");
3868 static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3869 public:
3870 DeferredBuffer(void);
3871 public: // Constructors specifying a generic memory kind
3872 DeferredBuffer(Memory::Kind kind,
3873 const Domain &bounds,
3874 const T *initial_value = NULL,
3875 size_t alignment = std::alignment_of<T>(),
3876 bool fortran_order_dims = false);
3877 DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3878 Memory::Kind kind,
3879 const T *initial_value = NULL,
3880 size_t alignment = std::alignment_of<T>(),
3881 bool fortran_order_dims = false);
3882 public: // Constructors specifying a specific memory
3883 DeferredBuffer(Memory memory,
3884 const Domain &bounds,
3885 const T *initial_value = NULL,
3886 size_t alignment = std::alignment_of<T>(),
3887 bool fortran_order_dims = false);
3888 DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3889 Memory memory,
3890 const T *initial_value = NULL,
3891 size_t alignment = std::alignment_of<T>(),
3892 bool fortran_order_dims = false);
3893 public: // Constructors specifying a specific ordering
3894 DeferredBuffer(Memory::Kind kind,
3895 const Domain &bounds,
3896 std::array<DimensionKind,DIM> ordering,
3897 const T *initial_value = NULL,
3898 size_t alignment = std::alignment_of<T>());
3899 DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3900 Memory::Kind kind,
3901 std::array<DimensionKind,DIM> ordering,
3902 const T *initial_value = NULL,
3903 size_t alignment = std::alignment_of<T>());
3904 DeferredBuffer(Memory memory,
3905 const Domain &bounds,
3906 std::array<DimensionKind,DIM> ordering,
3907 const T *initial_value = NULL,
3908 size_t alignment = std::alignment_of<T>());
3909 DeferredBuffer(const Rect<DIM,COORD_T> &bounds,
3910 Memory memory,
3911 std::array<DimensionKind,DIM> ordering,
3912 const T *initial_value = NULL,
3913 size_t alignment = std::alignment_of<T>());
3914 protected:
3915 inline void initialize_layout(size_t alignment, bool fortran_order_dims);
3916 inline void initialize(Memory memory,
3917 DomainT<DIM,COORD_T> bounds,
3918 const T *initial_value);
3919 public:
3920 __CUDA_HD__
3921 inline T read(const Point<DIM,COORD_T> &p) const;
3922 __CUDA_HD__
3923 inline void write(const Point<DIM,COORD_T> &p, T value) const;
3924 __CUDA_HD__
3925 inline T* ptr(const Point<DIM,COORD_T> &p) const;
3926 __CUDA_HD__
3927 inline T* ptr(const Rect<DIM,COORD_T> &r) const; // must be dense
3928 __CUDA_HD__
3929 inline T* ptr(const Rect<DIM,COORD_T> &r, size_t strides[DIM]) const;
3930 __CUDA_HD__
3931 inline T& operator[](const Point<DIM,COORD_T> &p) const;
3932 public:
3933 inline void destroy(Realm::Event precondition = Realm::Event::NO_EVENT);
3934 __CUDA_HD__
3935 inline Realm::RegionInstance get_instance(void) const;
3936 __CUDA_HD__
3937 inline Rect<DIM,COORD_T> get_bounds(void) const;
3938 public:
3939 typedef T value_type;
3940 typedef T& reference;
3941 typedef const T& const_reference;
3942 protected:
3943 friend class OutputRegion;
3944 friend class UntypedDeferredBuffer<COORD_T>;
3945 Realm::RegionInstance instance;
3946 Realm::AffineAccessor<T,DIM,COORD_T> accessor;
3947 std::array<DimensionKind,DIM> ordering;
3948 Rect<DIM,COORD_T> bounds;
3949 size_t alignment;
3950 };
3951
3958 template<typename COORD_T = coord_t>
3960 private:
3961 static_assert(std::is_integral<COORD_T>::value, "must be integral type");
3962 public:
3964 public: // Constructors specifying a generic memory kind
3965 UntypedDeferredBuffer(size_t field_size, int dims,
3966 Memory::Kind kind,
3967 const Domain &bounds,
3968 const void *initial_value = NULL,
3969 size_t alignment = 16,
3970 bool fortran_order_dims = false);
3971 UntypedDeferredBuffer(size_t field_size, int dims,
3972 Memory::Kind kind,
3973 IndexSpace bounds,
3974 const void *initial_value = NULL,
3975 size_t alignment = 16,
3976 bool fortran_order_dims = false);
3977 public: // Constructors specifying a specific memory
3978 UntypedDeferredBuffer(size_t field_size, int dims,
3979 Memory memory,
3980 const Domain &bounds,
3981 const void *initial_value = NULL,
3982 size_t alignment = 16,
3983 bool fortran_order_dims = false);
3984 UntypedDeferredBuffer(size_t field_size, int dims,
3985 Memory memory,
3986 IndexSpace bounds,
3987 const void *initial_value = NULL,
3988 size_t alignment = 16,
3989 bool fortran_order_dims = false);
3990 public:
3991 template<typename T, int DIM>
3992 UntypedDeferredBuffer(const DeferredBuffer<T,DIM,COORD_T> &rhs);
3993 public:
3994 template<typename T, int DIM, bool BC>
3995 inline operator DeferredBuffer<T,DIM,COORD_T,BC>(void) const;
3996 public:
3997 inline void destroy(Realm::Event precondition = Realm::Event::NO_EVENT);
3998 inline Realm::RegionInstance get_instance(void) const { return instance; }
3999 private:
4000 template<PrivilegeMode,typename,int,typename,typename,bool>
4001 friend class FieldAccessor;
4002 template<typename,bool,int,typename,typename,bool>
4003 friend class ReductionAccessor;
4004 Realm::RegionInstance instance;
4005 size_t field_size;
4006 int dims;
4007 };
4008
4015 class OutputRegion : public Unserializable<OutputRegion> {
4016 public:
4017 OutputRegion(void);
4018 OutputRegion(const OutputRegion &rhs);
4019 ~OutputRegion(void);
4020 private:
4021 Internal::OutputRegionImpl *impl;
4022 protected:
4023 FRIEND_ALL_RUNTIME_CLASSES
4024 explicit OutputRegion(Internal::OutputRegionImpl *impl);
4025 public:
4026 OutputRegion& operator=(const OutputRegion &rhs);
4027 public:
4028 Memory target_memory(void) const;
4029 // Returns the logical region of this output region.
4030 // The call is legal only when the output region is valid and
4031 // will raise an error otherwise.
4032 LogicalRegion get_logical_region(void) const;
4033 bool is_valid_output_region(void) const;
4034 public:
4035 // Returns a deferred buffer that satisfies the layout constraints of
4036 // this output region. The caller still needs to pass this buffer to
4037 // a return_data call if the buffer needs to be bound to this output
4038 // region. The caller can optionally choose to bind the returned buffer
4039 // to the output region; such a call cannot be made more than once.
4040 template<typename T,
4041 int DIM,
4042 typename COORD_T = coord_t,
4043#ifdef LEGION_BOUNDS_CHECKS
4044 bool CHECK_BOUNDS = true>
4045#else
4046 bool CHECK_BOUNDS = false>
4047#endif
4048 DeferredBuffer<T,DIM,COORD_T,CHECK_BOUNDS>
4049 create_buffer(const Point<DIM, COORD_T> &extents,
4050 FieldID field_id,
4051 const T *initial_value = NULL,
4052 bool return_buffer = false);
4053 private:
4054 void check_type_tag(TypeTag type_tag) const;
4055 void check_field_size(FieldID field_id, size_t field_size) const;
4056 void get_layout(FieldID field_id,
4057 std::vector<DimensionKind> &ordering,
4058 size_t &alignment) const;
4059 public:
4060 template<typename T,
4061 int DIM,
4062 typename COORD_T = coord_t,
4063#ifdef LEGION_BOUNDS_CHECKS
4064 bool CHECK_BOUNDS = true>
4065#else
4066 bool CHECK_BOUNDS = false>
4067#endif
4068 void return_data(const Point<DIM,COORD_T> &extents,
4069 FieldID field_id,
4070 DeferredBuffer<T,DIM,COORD_T,CHECK_BOUNDS> &buffer);
4071 void return_data(const DomainPoint &extents,
4072 FieldID field_id,
4073 Realm::RegionInstance instance,
4074 bool check_constraints = true);
4075 private:
4076 void return_data(const DomainPoint &extents,
4077 FieldID field_id,
4078 Realm::RegionInstance instance,
4079 const LayoutConstraintSet *constraints,
4080 bool check_constraints);
4081 };
4082
4083 //==========================================================================
4084 // Software Coherence Classes
4085 //==========================================================================
4086
4099 public:
4100 AcquireLauncher(LogicalRegion logical_region,
4101 LogicalRegion parent_region,
4102 PhysicalRegion physical_region = PhysicalRegion(),
4103 Predicate pred = Predicate::TRUE_PRED,
4104 MapperID id = 0, MappingTagID tag = 0,
4105 UntypedBuffer map_arg = UntypedBuffer(),
4106 const char *provenance = "");
4107 public:
4108 inline void add_field(FieldID f);
4109 inline void add_grant(Grant g);
4110 inline void add_wait_barrier(PhaseBarrier pb);
4111 inline void add_arrival_barrier(PhaseBarrier pb);
4112 inline void add_wait_handshake(LegionHandshake handshake);
4113 inline void add_arrival_handshake(LegionHandshake handshake);
4114 public:
4115 LogicalRegion logical_region;
4116 LogicalRegion parent_region;
4117 std::set<FieldID> fields;
4118 public:
4119 // This field is now optional (but required with control replication)
4120 PhysicalRegion physical_region;
4121 public:
4122 std::vector<Grant> grants;
4123 std::vector<PhaseBarrier> wait_barriers;
4124 std::vector<PhaseBarrier> arrive_barriers;
4125 Predicate predicate;
4126 MapperID map_id;
4127 MappingTagID tag;
4128 UntypedBuffer map_arg;
4129 public:
4130 // Provenance string for the runtime and tools to use
4131 std::string provenance;
4132 public:
4133 // Inform the runtime about any static dependences
4134 // These will be ignored outside of static traces
4135 const std::vector<StaticDependence> *static_dependences;
4136 public:
4137 bool silence_warnings;
4138 };
4139
4147 public:
4148 ReleaseLauncher(LogicalRegion logical_region,
4149 LogicalRegion parent_region,
4150 PhysicalRegion physical_region = PhysicalRegion(),
4151 Predicate pred = Predicate::TRUE_PRED,
4152 MapperID id = 0, MappingTagID tag = 0,
4153 UntypedBuffer map_arg = UntypedBuffer(),
4154 const char *provenance = "");
4155 public:
4156 inline void add_field(FieldID f);
4157 inline void add_grant(Grant g);
4158 inline void add_wait_barrier(PhaseBarrier pb);
4159 inline void add_arrival_barrier(PhaseBarrier pb);
4160 inline void add_wait_handshake(LegionHandshake handshake);
4161 inline void add_arrival_handshake(LegionHandshake handshake);
4162 public:
4163 LogicalRegion logical_region;
4164 LogicalRegion parent_region;
4165 std::set<FieldID> fields;
4166 public:
4167 // This field is now optional (but required with control replication)
4168 PhysicalRegion physical_region;
4169 public:
4170 std::vector<Grant> grants;
4171 std::vector<PhaseBarrier> wait_barriers;
4172 std::vector<PhaseBarrier> arrive_barriers;
4173 Predicate predicate;
4174 MapperID map_id;
4175 MappingTagID tag;
4176 UntypedBuffer map_arg;
4177 public:
4178 // Provenance string for the runtime and tools to use
4179 std::string provenance;
4180 public:
4181 // Inform the runtime about any static dependences
4182 // These will be ignored outside of static traces
4183 const std::vector<StaticDependence> *static_dependences;
4184 public:
4185 bool silence_warnings;
4186 };
4187
4188 //==========================================================================
4189 // Must Parallelism Classes
4190 //==========================================================================
4191
4206 public:
4207 MustEpochLauncher(MapperID id = 0, MappingTagID tag = 0);
4208 public:
4209 inline void add_single_task(const DomainPoint &point,
4210 const TaskLauncher &launcher);
4211 inline void add_index_task(const IndexTaskLauncher &launcher);
4212 public:
4213 MapperID map_id;
4214 MappingTagID mapping_tag;
4215 std::vector<TaskLauncher> single_tasks;
4216 std::vector<IndexTaskLauncher> index_tasks;
4217 public:
4218 Domain launch_domain;
4219 IndexSpace launch_space;
4220 // Will only be used in control replication context. If left
4221 // unset the runtime will use launch_space/launch_domain
4222 IndexSpace sharding_space;
4223 public:
4224 // Provenance string for the runtime and tools to use
4225 std::string provenance;
4226 public:
4227 bool silence_warnings;
4228 };
4229
4230 //==========================================================================
4231 // Interoperability Classes
4232 //==========================================================================
4233
4244 class LegionHandshake : public Unserializable<LegionHandshake> {
4245 public:
4246 LegionHandshake(void);
4247 LegionHandshake(const LegionHandshake &rhs);
4248 ~LegionHandshake(void);
4249 protected:
4250 Internal::LegionHandshakeImpl *impl;
4251 protected:
4252 // Only the runtime should be able to make these
4253 FRIEND_ALL_RUNTIME_CLASSES
4254 explicit LegionHandshake(Internal::LegionHandshakeImpl *impl);
4255 public:
4256 bool operator==(const LegionHandshake &h) const
4257 { return impl == h.impl; }
4258 bool operator<(const LegionHandshake &h) const
4259 { return impl < h.impl; }
4260 LegionHandshake& operator=(const LegionHandshake &rhs);
4261 public:
4266 void ext_handoff_to_legion(void) const;
4272 void ext_wait_on_legion(void) const;
4273 public:
4278 void legion_handoff_to_ext(void) const;
4283 void legion_wait_on_ext(void) const;
4284 public:
4285 /*
4286 * For asynchronous Legion execution, you can use these
4287 * methods to get a phase barrier associated with the
4288 * handshake object instead of blocking on the legion side
4289 */
4302 };
4303
4310 public:
4311 MPILegionHandshake(void);
4313 ~MPILegionHandshake(void);
4314 protected:
4315 // Only the runtime should be able to make these
4316 FRIEND_ALL_RUNTIME_CLASSES
4317 explicit MPILegionHandshake(Internal::LegionHandshakeImpl *impl);
4318 public:
4319 bool operator==(const MPILegionHandshake &h) const
4320 { return impl == h.impl; }
4321 bool operator<(const MPILegionHandshake &h) const
4322 { return impl < h.impl; }
4323 MPILegionHandshake& operator=(const MPILegionHandshake &rhs);
4324 public:
4329 inline void mpi_handoff_to_legion(void) const { ext_handoff_to_legion(); }
4334 inline void mpi_wait_on_legion(void) const { ext_wait_on_legion(); }
4335 public:
4340 inline void legion_handoff_to_mpi(void) const { legion_handoff_to_ext(); }
4345 inline void legion_wait_on_mpi(void) const { legion_wait_on_ext(); }
4346 };
4347
4348 //==========================================================================
4349 // Operation Classes
4350 //==========================================================================
4351
4358 class Mappable {
4359 public:
4360 Mappable(void);
4361 public:
4362 // Return a globally unique ID for this operation
4363 virtual UniqueID get_unique_id(void) const = 0;
4364 // Return the number of operations that came before
4365 // this operation in the same context (close operations
4366 // return number of previous close operations)
4367 virtual uint64_t get_context_index(void) const = 0;
4368 // Return the depth of this operation in the task tree
4369 virtual int get_depth(void) const = 0;
4370 // Get the parent task associated with this mappable
4371 virtual const Task* get_parent_task(void) const = 0;
4372 // Get the provenance string for this mappable
4373 // By default we return the human readable component but
4374 // you can also get the machine component as well
4375 virtual const std::string_view& get_provenance_string(
4376 bool human = true) const = 0;
4377 public:
4378 virtual MappableType get_mappable_type(void) const = 0;
4379 virtual const Task* as_task(void) const { return NULL; }
4380 virtual const Copy* as_copy(void) const { return NULL; }
4381 virtual const InlineMapping* as_inline(void) const { return NULL; }
4382 virtual const Acquire* as_acquire(void) const { return NULL; }
4383 virtual const Release* as_release(void) const { return NULL; }
4384 virtual const Close* as_close(void) const { return NULL; }
4385 virtual const Fill* as_fill(void) const { return NULL; }
4386 virtual const Partition* as_partition(void) const { return NULL; }
4387 virtual const MustEpoch* as_must_epoch(void) const { return NULL; }
4388 public:
4389 MapperID map_id;
4390 MappingTagID tag;
4391 public:
4392 // The 'parent_task' member is here for backwards compatibility
4393 // It's better to use the 'get_parent_task' method
4394 // as this may be NULL until that method is called
4395 mutable const Task* parent_task;
4396 public:
4397 // Mapper annotated data
4398 void* mapper_data;
4399 size_t mapper_data_size;
4400 public:
4401 // These are here for backwards compatibility from a time when
4402 // the MappableType enum was inside of this class
4403#ifndef __GNUC__
4404 // GCC doesn't like this line even though it's just creating a
4405 // type alias, who knows what their problem is
4406 typedef Legion::MappableType MappableType;
4407#endif
4408 static const MappableType TASK_MAPPABLE = ::LEGION_TASK_MAPPABLE;
4409 static const MappableType COPY_MAPPABLE = ::LEGION_COPY_MAPPABLE;
4410 static const MappableType INLINE_MAPPABLE = ::LEGION_INLINE_MAPPABLE;
4411 static const MappableType ACQUIRE_MAPPABLE = ::LEGION_ACQUIRE_MAPPABLE;
4412 static const MappableType RELEASE_MAPPABLE = ::LEGION_RELEASE_MAPPABLE;
4413 static const MappableType CLOSE_MAPPABLE = ::LEGION_CLOSE_MAPPABLE;
4414 static const MappableType FILL_MAPPABLE = ::LEGION_FILL_MAPPABLE;
4415 static const MappableType PARTITION_MAPPABLE =
4416 ::LEGION_PARTITION_MAPPABLE;
4417 static const MappableType MUST_EPOCH_MAPPABLE =
4418 ::LEGION_MUST_EPOCH_MAPPABLE;
4419 };
4420
4429 class Task : public Mappable {
4430 public:
4431 Task(void);
4432 public:
4433 // Check whether this task has a parent task.
4434 virtual bool has_parent_task(void) const = 0;
4435 // Return the name of the task.
4436 virtual const char* get_task_name(void) const = 0;
4437 // Returns the current slice of the index domain that this
4438 // task is operating over. This method will only return a
4439 // valid domain if this is part of an index space task.
4440 virtual Domain get_slice_domain(void) const = 0;
4441 //------------------------------------------------------------------------
4442 // Control Replication methods
4443 // In general SPMD-style programming in Legion is wrong. If you find
4444 // yourself writing SPMD-style code for large fractions of your program
4445 // then you're probably doing something wrong. There are a few exceptions:
4446 // 1. index attach/detach operations are collective and may need
4447 // to do per-shard work
4448 // 2. I/O in general often needs to do per-shard work
4449 // 3. interaction with collective frameworks like MPI and NCCL
4450 // 4. others?
4451 // For these reasons we allow users to get access to sharding information
4452 // Please, please, please be careful with how you use it
4453 //------------------------------------------------------------------------
4454 virtual ShardID get_shard_id(void) const = 0;
4455 virtual size_t get_total_shards(void) const = 0;
4456 virtual DomainPoint get_shard_point(void) const = 0;
4457 virtual Domain get_shard_domain(void) const = 0;
4458 public:
4459 virtual MappableType get_mappable_type(void) const
4460 { return LEGION_TASK_MAPPABLE; }
4461 virtual const Task* as_task(void) const { return this; }
4462 public:
4463 // Task argument information
4464 TaskID task_id;
4465 std::vector<IndexSpaceRequirement> indexes;
4466 std::vector<RegionRequirement> regions;
4467 std::vector<OutputRequirement> output_regions;
4468 std::vector<Future> futures;
4469 std::vector<Grant> grants;
4470 std::vector<PhaseBarrier> wait_barriers;
4471 std::vector<PhaseBarrier> arrive_barriers;
4472 void* args;
4473 size_t arglen;
4474 public:
4475 // Index task argument information
4476 bool is_index_space;
4477 bool concurrent_task;
4478 bool must_epoch_task;
4479 Domain index_domain;
4480 DomainPoint index_point;
4481 IndexSpace sharding_space;
4482 void* local_args;
4483 size_t local_arglen;
4484 public:
4485 // Meta data information from the runtime
4486 Processor orig_proc;
4487 Processor current_proc;
4488 Processor target_proc;
4489 unsigned steal_count;
4490 bool stealable;
4491 bool speculated;
4492 bool local_function;
4493 };
4494
4500 class Copy : public Mappable {
4501 public:
4502 Copy(void);
4503 public:
4504 virtual MappableType get_mappable_type(void) const
4505 { return LEGION_COPY_MAPPABLE; }
4506 virtual const Copy* as_copy(void) const { return this; }
4507 public:
4508 // Copy Launcher arguments
4509 std::vector<RegionRequirement> src_requirements;
4510 std::vector<RegionRequirement> dst_requirements;
4511 std::vector<RegionRequirement> src_indirect_requirements;
4512 std::vector<RegionRequirement> dst_indirect_requirements;
4513 std::vector<Grant> grants;
4514 std::vector<PhaseBarrier> wait_barriers;
4515 std::vector<PhaseBarrier> arrive_barriers;
4516 public:
4517 // Index copy argument information
4518 bool is_index_space;
4519 Domain index_domain;
4520 DomainPoint index_point;
4521 IndexSpace sharding_space;
4522 };
4523
4529 class InlineMapping : public Mappable {
4530 public:
4531 InlineMapping(void);
4532 public:
4533 virtual MappableType get_mappable_type(void) const
4534 { return LEGION_INLINE_MAPPABLE; }
4535 virtual const InlineMapping* as_inline(void) const { return this; }
4536 virtual ShardID get_parent_shard(void) const { return 0; }
4537 public:
4538 // Inline Launcher arguments
4539 RegionRequirement requirement;
4540 std::vector<Grant> grants;
4541 std::vector<PhaseBarrier> wait_barriers;
4542 std::vector<PhaseBarrier> arrive_barriers;
4543 LayoutConstraintID layout_constraint_id;
4544 };
4545
4551 class Acquire : public Mappable {
4552 public:
4553 Acquire(void);
4554 public:
4555 virtual MappableType get_mappable_type(void) const
4556 { return LEGION_ACQUIRE_MAPPABLE; }
4557 virtual const Acquire* as_acquire(void) const { return this; }
4558 public:
4559 // Acquire Launcher arguments
4560 LogicalRegion logical_region;
4561 LogicalRegion parent_region;
4562 std::set<FieldID> fields;
4563 std::vector<Grant> grants;
4564 std::vector<PhaseBarrier> wait_barriers;
4565 std::vector<PhaseBarrier> arrive_barriers;
4566 };
4567
4573 class Release : public Mappable {
4574 public:
4575 Release(void);
4576 public:
4577 virtual MappableType get_mappable_type(void) const
4578 { return LEGION_RELEASE_MAPPABLE; }
4579 virtual const Release* as_release(void) const { return this; }
4580 public:
4581 // Release Launcher arguments
4582 LogicalRegion logical_region;
4583 LogicalRegion parent_region;
4584 std::set<FieldID> fields;
4585 std::vector<Grant> grants;
4586 std::vector<PhaseBarrier> wait_barriers;
4587 std::vector<PhaseBarrier> arrive_barriers;
4588 };
4589
4599 class Close : public Mappable {
4600 public:
4601 Close(void);
4602 public:
4603 virtual MappableType get_mappable_type(void) const
4604 { return LEGION_CLOSE_MAPPABLE; }
4605 virtual const Close* as_close(void) const { return this; }
4606 public:
4607 // Synthesized region requirement
4608 RegionRequirement requirement;
4609 };
4610
4617 class Fill : public Mappable {
4618 public:
4619 Fill(void);
4620 public:
4621 virtual MappableType get_mappable_type(void) const
4622 { return LEGION_FILL_MAPPABLE; }
4623 virtual const Fill* as_fill(void) const { return this; }
4624 public:
4625 // Synthesized region requirement
4626 RegionRequirement requirement;
4627 std::vector<Grant> grants;
4628 std::vector<PhaseBarrier> wait_barriers;
4629 std::vector<PhaseBarrier> arrive_barriers;
4630 public:
4631 // Index fill argument information
4632 bool is_index_space;
4633 Domain index_domain;
4634 DomainPoint index_point;
4635 IndexSpace sharding_space;
4636 };
4637
4645 class Partition : public Mappable {
4646 public:
4647 Partition(void);
4648 public:
4649 virtual MappableType get_mappable_type(void) const
4650 { return LEGION_PARTITION_MAPPABLE; }
4651 virtual const Partition* as_partition(void) const { return this; }
4652 public:
4653 enum PartitionKind {
4654 BY_FIELD, // create partition by field
4655 BY_IMAGE, // create partition by image
4656 BY_IMAGE_RANGE, // create partition by image range
4657 BY_PREIMAGE, // create partition by preimage
4658 BY_PREIMAGE_RANGE, // create partition by preimage range
4659 BY_ASSOCIATION, // create partition by association
4660 };
4661 virtual PartitionKind get_partition_kind(void) const = 0;
4662 public:
4663 // Synthesized region requirement
4664 RegionRequirement requirement;
4665 public:
4666 // Index partition argument information
4667 bool is_index_space;
4668 Domain index_domain;
4669 DomainPoint index_point;
4670 };
4671
4678 class MustEpoch : public Mappable {
4679 public:
4680 MustEpoch(void);
4681 public:
4682 virtual MappableType get_mappable_type(void) const
4683 { return LEGION_MUST_EPOCH_MAPPABLE; }
4684 virtual const MustEpoch* as_must_epoch(void) const { return this; }
4685 public:
4686 std::vector<const Task*> individual_tasks;
4687 std::vector<const Task*> index_space_tasks;
4688 public:
4689 // Index space of points for the must epoch operation
4690 Domain launch_domain;
4691 IndexSpace sharding_space;
4692 };
4693
4694 //==========================================================================
4695 // Runtime Classes
4696 //==========================================================================
4697
4703 struct InputArgs {
4704 public:
4705 char **argv;
4706 int argc;
4707 };
4708
4714 Machine machine;
4715 Runtime *runtime;
4716 std::set<Processor> local_procs;
4717 UntypedBuffer buffer;
4718 };
4719
4733 public:
4734 TaskConfigOptions(bool leaf = false,
4735 bool inner = false,
4736 bool idempotent = false);
4737 public:
4738 bool leaf;
4739 bool inner;
4740 bool idempotent;
4741 };
4742
4761 public:
4762 ProjectionFunctor(void);
4764 virtual ~ProjectionFunctor(void);
4765 public:
4782 virtual LogicalRegion project(const Mappable *mappable, unsigned index,
4783 LogicalRegion upper_bound,
4784 const DomainPoint &point);
4793 virtual LogicalRegion project(const Mappable *mappable, unsigned index,
4794 LogicalPartition upper_bound,
4795 const DomainPoint &point);
4796
4808 const DomainPoint &point,
4809 const Domain &launch_domain);
4810
4822 const DomainPoint &point,
4823 const Domain &launch_domain);
4824
4838 const DomainPoint &point,
4839 const Domain &launch_domain,
4840 const void *args, size_t size);
4841
4855 const DomainPoint &point,
4856 const Domain &launch_domain,
4857 const void *args, size_t size);
4858
4870 LEGION_DEPRECATED("The interface for projection functors has been "
4871 "updated. Please use the new 'project' methods.")
4872 virtual LogicalRegion project(Context ctx, Task *task,
4873 unsigned index,
4874 LogicalRegion upper_bound,
4875 const DomainPoint &point);
4887 LEGION_DEPRECATED("The interface for projection functors has been "
4888 "updated. Please use the new 'project' methods.")
4889 virtual LogicalRegion project(Context ctx, Task *task,
4890 unsigned index,
4891 LogicalPartition upper_bound,
4892 const DomainPoint &point);
4894
4905 virtual void invert(LogicalRegion region, LogicalRegion upper_bound,
4906 const Domain &launch_domain,
4907 std::vector<DomainPoint> &ordered_points);
4908 virtual void invert(LogicalRegion region, LogicalPartition upper_bound,
4909 const Domain &launch_domain,
4910 std::vector<DomainPoint> &ordered_points);
4912
4914
4934 virtual bool is_complete(LogicalRegion upper_bound,
4935 const Domain &launch_domain);
4936 virtual bool is_complete(LogicalPartition upper_bound,
4937 const Domain &launch_domain);
4938 virtual bool is_complete(Mappable *mappable, unsigned index,
4939 LogicalRegion upper_bound, const Domain &launch_domain);
4940 virtual bool is_complete(Mappable *mappable, unsigned index,
4941 LogicalPartition upper_bound, const Domain &launch_domain);
4943
4950 virtual bool is_exclusive(void) const { return false; }
4951
4952 /*
4953 * Indicate whether this is a functional projection
4954 * functor or whether it depends on the operation being
4955 * launched. This will determine which project method
4956 * is invoked by the runtime.
4957 */
4958 virtual bool is_functional(void) const { return false; }
4959
4965 virtual bool is_invertible(void) const { return false; }
4966
4978 virtual unsigned get_depth(void) const = 0;
4979 private:
4980 friend class Internal::Runtime;
4981 // For pre-registered projection functors the runtime will
4982 // use this to initialize the runtime pointer
4983 inline void set_runtime(Runtime *rt) { runtime = rt; }
4984 protected:
4985 Runtime *runtime;
4986 };
4987
5002 public:
5003 ShardingFunctor(void);
5004 virtual ~ShardingFunctor(void);
5005 public:
5006 // Indicate whether this functor wants to use the ShardID or
5007 // DomainPoint versions of these methods
5008 virtual bool use_points(void) const { return false; }
5009 public:
5010 // The ShardID version of this method
5011 virtual ShardID shard(const DomainPoint &index_point,
5012 const Domain &index_domain,
5013 const size_t total_shards);
5014 // The DomainPoint version of this method
5015 virtual DomainPoint shard_points(const DomainPoint &index_point,
5016 const Domain &index_domain,
5017 const std::vector<DomainPoint> &shard_points,
5018 const Domain &shard_domain);
5019 public:
5020 virtual bool is_invertible(void) const { return false; }
5021 // The ShardID version of this method
5022 virtual void invert(ShardID shard,
5023 const Domain &sharding_domain,
5024 const Domain &index_domain,
5025 const size_t total_shards,
5026 std::vector<DomainPoint> &points);
5027 // The DomainPoint version of this method
5028 virtual void invert_points(const DomainPoint &shard_point,
5029 const std::vector<DomainPoint> &shard_points,
5030 const Domain &shard_domain,
5031 const Domain &index_domain,
5032 const Domain &sharding_domain,
5033 std::vector<DomainPoint> &index_points);
5034 };
5035
5046 public:
5048 virtual ~ConcurrentColoringFunctor(void);
5049 public:
5050 virtual Color color(const DomainPoint &index_point,
5051 const Domain &index_domain) = 0;
5052 public:
5053 // You can optionally implement these methods for better performance,
5054 // but they are not required for correctness. If 'has_max_color'
5055 // returns 'true' then you must implement the 'max_color' method.
5056 virtual bool supports_max_color(void) { return false; }
5057 virtual Color max_color(const Domain &index_domain)
5058 { return std::numeric_limits<Color>::max(); }
5059 };
5060
5077 public:
5078 virtual ~FutureFunctor(void) { }
5079 public:
5080 virtual const void* callback_get_future(size_t &size, bool &owned,
5081 const Realm::ExternalInstanceResource *&resource,
5082 void (*&freefunc)(const Realm::ExternalInstanceResource&),
5083 const void *&metadata, size_t &metasize) = 0;
5084 virtual void callback_release_future(void) = 0;
5085 };
5086
5096 public:
5097 virtual ~PointTransformFunctor(void) { }
5098 public:
5099 virtual bool is_invertible(void) const { return false; }
5100 // Transform a point from the domain into a point in the range
5101 virtual DomainPoint transform_point(const DomainPoint &point,
5102 const Domain &domain,
5103 const Domain &range) = 0;
5104 // Invert a point from range and convert it into a point in the domain
5105 // This is only called if is_invertible returns true
5106 virtual DomainPoint invert_point(const DomainPoint &point,
5107 const Domain &domain,
5108 const Domain &range)
5109 { return DomainPoint(); }
5110 };
5111
5135 class Runtime {
5136 protected:
5137 // The Runtime bootstraps itself and should
5138 // never need to be explicitly created.
5139 friend class Internal::Runtime;
5140 friend class Future;
5141 Runtime(Internal::Runtime *rt);
5142 public:
5143 //------------------------------------------------------------------------
5144 // Index Space Operations
5145 //------------------------------------------------------------------------
5147
5161 IndexSpace create_index_space(Context ctx, const Domain &bounds,
5162 TypeTag type_tag = 0,
5163 const char *provenance = NULL,
5164 const bool take_ownership = false);
5165 // Template version
5166 template<int DIM, typename COORD_T>
5167 IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5168 const Rect<DIM,COORD_T> &bounds,
5169 const char *provenance = NULL);
5170 template<int DIM, typename COORD_T>
5171 IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5172 const DomainT<DIM,COORD_T> &bounds,
5173 const char *provenance = NULL,
5174 const bool take_ownership = false);
5177
5190 IndexSpace create_index_space(Context ctx, size_t dimensions,
5191 const Future &f, TypeTag type_tag = 0,
5192 const char *provenance = NULL);
5193 template<int DIM, typename COORD_T>
5194 IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx, const Future &f,
5195 const char *provenance = NULL);
5198
5207 const std::vector<DomainPoint> &points,
5208 const char *provenance = NULL);
5209 // Template version
5210 template<int DIM, typename COORD_T>
5211 IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5212 const std::vector<Point<DIM,COORD_T> > &points,
5213 const char *provenance = NULL);
5216
5225 const std::vector<Domain> &rects,
5226 const char *provenance = NULL);
5227 // Template version
5228 template<int DIM, typename COORD_T>
5229 IndexSpaceT<DIM,COORD_T> create_index_space(Context ctx,
5230 const std::vector<Rect<DIM,COORD_T> > &rects,
5231 const char *provenance = NULL);
5234
5244 const std::vector<IndexSpace> &spaces,
5245 const char *provenance = NULL);
5246 // Template version
5247 template<int DIM, typename COORD_T>
5248 IndexSpaceT<DIM,COORD_T> union_index_spaces(Context ctx,
5249 const std::vector<IndexSpaceT<DIM,COORD_T> > &spaces,
5250 const char *provenance = NULL);
5253
5263 const std::vector<IndexSpace> &spaces,
5264 const char *provenance = NULL);
5265 // Template version
5266 template<int DIM, typename COORD_T>
5267 IndexSpaceT<DIM,COORD_T> intersect_index_spaces(Context ctx,
5268 const std::vector<IndexSpaceT<DIM,COORD_T> > &spaces,
5269 const char *provenance = NULL);
5272
5279 IndexSpace left, IndexSpace right,
5280 const char *provenance = NULL);
5281 // Template version
5282 template<int DIM, typename COORD_T>
5283 IndexSpaceT<DIM,COORD_T> subtract_index_spaces(Context ctx,
5284 IndexSpaceT<DIM,COORD_T> left, IndexSpaceT<DIM,COORD_T> right,
5285 const char *provenance = NULL);
5287
5294 LEGION_DEPRECATED("Use the new index space creation routines with a "
5295 "single domain or rectangle.")
5296 IndexSpace create_index_space(Context ctx, size_t max_num_elmts);
5304 LEGION_DEPRECATED("Use the new index space creation routines with a "
5305 "single domain or rectangle.")
5306 IndexSpace create_index_space(Context ctx,
5307 const std::set<Domain> &domains);
5318 void create_shared_ownership(Context ctx, IndexSpace handle);
5329 void destroy_index_space(Context ctx, IndexSpace handle,
5330 const bool unordered = false,
5331 const bool recurse = true,
5332 const char *provenance = NULL);
5333 public:
5344 void create_shared_ownership(Context ctx, IndexPartition handle);
5355 void destroy_index_partition(Context ctx, IndexPartition handle,
5356 const bool unordered = false,
5357 const bool recurse = true,
5358 const char *provenance = NULL);
5359 public:
5360 //------------------------------------------------------------------------
5361 // Dependent Partitioning Operations
5362 //------------------------------------------------------------------------
5364
5384 IndexPartition create_equal_partition(Context ctx, IndexSpace parent,
5385 IndexSpace color_space,
5386 size_t granularity = 1,
5387 Color color =
5388 LEGION_AUTO_GENERATE_ID,
5389 const char *provenance = NULL);
5390 template<int DIM, typename COORD_T,
5391 int COLOR_DIM, typename COLOR_COORD_T>
5392 IndexPartitionT<DIM,COORD_T> create_equal_partition(Context ctx,
5393 IndexSpaceT<DIM,COORD_T> parent,
5394 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5395 size_t granularity = 1,
5396 Color color = LEGION_AUTO_GENERATE_ID,
5397 const char *provenance = NULL);
5400
5417 IndexPartition create_partition_by_weights(Context ctx, IndexSpace parent,
5418 const std::map<DomainPoint,int> &weights,
5419 IndexSpace color_space,
5420 size_t granularity = 1,
5421 Color color = LEGION_AUTO_GENERATE_ID,
5422 const char *provenance = NULL);
5423 template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5424 IndexPartitionT<DIM,COORD_T> create_partition_by_weights(Context ctx,
5425 IndexSpaceT<DIM,COORD_T> parent,
5426 const std::map<Point<COLOR_DIM,COLOR_COORD_T>,int> &weights,
5427 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5428 size_t granularity = 1,
5429 Color color = LEGION_AUTO_GENERATE_ID,
5430 const char *provenance = NULL);
5431 // 64-bit versions
5432 IndexPartition create_partition_by_weights(Context ctx, IndexSpace parent,
5433 const std::map<DomainPoint,size_t> &weights,
5434 IndexSpace color_space,
5435 size_t granularity = 1,
5436 Color color = LEGION_AUTO_GENERATE_ID,
5437 const char *provenance = NULL);
5438 template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5439 IndexPartitionT<DIM,COORD_T> create_partition_by_weights(Context ctx,
5440 IndexSpaceT<DIM,COORD_T> parent,
5441 const std::map<Point<COLOR_DIM,COLOR_COORD_T>,size_t> &weights,
5442 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5443 size_t granularity = 1, Color color = LEGION_AUTO_GENERATE_ID,
5444 const char *provenance = NULL);
5445 // Alternate versions of the above method that take a future map where
5446 // the values in the future map will be interpretted as integer weights
5447 // You can use this method with both 32 and 64 bit weights
5448 IndexPartition create_partition_by_weights(Context ctx, IndexSpace parent,
5449 const FutureMap &weights,
5450 IndexSpace color_space,
5451 size_t granularity = 1,
5452 Color color =
5453 LEGION_AUTO_GENERATE_ID,
5454 const char *provenance = NULL);
5455 template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5456 IndexPartitionT<DIM,COORD_T> create_partition_by_weights(Context ctx,
5457 IndexSpaceT<DIM,COORD_T> parent,
5458 const FutureMap &weights,
5459 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5460 size_t granularity = 1,
5461 Color color = LEGION_AUTO_GENERATE_ID,
5462 const char *provenance = NULL);
5465
5489 IndexPartition create_partition_by_union(Context ctx,
5490 IndexSpace parent,
5491 IndexPartition handle1,
5492 IndexPartition handle2,
5493 IndexSpace color_space,
5494 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5495 Color color = LEGION_AUTO_GENERATE_ID,
5496 const char *provenance = NULL);
5497 template<int DIM, typename COORD_T,
5498 int COLOR_DIM, typename COLOR_COORD_T>
5499 IndexPartitionT<DIM,COORD_T> create_partition_by_union(Context ctx,
5500 IndexSpaceT<DIM,COORD_T> parent,
5501 IndexPartitionT<DIM,COORD_T> handle1,
5502 IndexPartitionT<DIM,COORD_T> handle2,
5503 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5504 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5505 Color color = LEGION_AUTO_GENERATE_ID,
5506 const char *provenance = NULL);
5509
5534 IndexPartition create_partition_by_intersection(Context ctx,
5535 IndexSpace parent,
5536 IndexPartition handle1,
5537 IndexPartition handle2,
5538 IndexSpace color_space,
5539 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5540 Color color = LEGION_AUTO_GENERATE_ID,
5541 const char *provenance = NULL);
5542 template<int DIM, typename COORD_T,
5543 int COLOR_DIM, typename COLOR_COORD_T>
5544 IndexPartitionT<DIM,COORD_T> create_partition_by_intersection(
5545 Context ctx,
5546 IndexSpaceT<DIM,COORD_T> parent,
5547 IndexPartitionT<DIM,COORD_T> handle1,
5548 IndexPartitionT<DIM,COORD_T> handle2,
5549 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5550 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5551 Color color = LEGION_AUTO_GENERATE_ID,
5552 const char *provenance = NULL);
5555
5575 IndexPartition create_partition_by_intersection(Context ctx,
5576 IndexSpace parent,
5577 IndexPartition partition,
5578 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5579 Color color = LEGION_AUTO_GENERATE_ID,
5580 bool dominates = false,
5581 const char *provenance = NULL);
5582 template<int DIM, typename COORD_T>
5583 IndexPartitionT<DIM,COORD_T> create_partition_by_intersection(Context ctx,
5584 IndexSpaceT<DIM,COORD_T> parent,
5585 IndexPartitionT<DIM,COORD_T> partition,
5586 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5587 Color color = LEGION_AUTO_GENERATE_ID,
5588 bool dominates = false,
5589 const char *provenance = NULL);
5592
5617 IndexPartition create_partition_by_difference(Context ctx,
5618 IndexSpace parent,
5619 IndexPartition handle1,
5620 IndexPartition handle2,
5621 IndexSpace color_space,
5622 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5623 Color color = LEGION_AUTO_GENERATE_ID,
5624 const char *provenance = NULL);
5625 template<int DIM, typename COORD_T,
5626 int COLOR_DIM, typename COLOR_COORD_T>
5627 IndexPartitionT<DIM,COORD_T> create_partition_by_difference(Context ctx,
5628 IndexSpaceT<DIM,COORD_T> parent,
5629 IndexPartitionT<DIM,COORD_T> handle1,
5630 IndexPartitionT<DIM,COORD_T> handle2,
5631 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
5632 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5633 Color color = LEGION_AUTO_GENERATE_ID,
5634 const char *provenance = NULL);
5637
5662 Color create_cross_product_partitions(Context ctx,
5663 IndexPartition handle1,
5664 IndexPartition handle2,
5665 std::map<IndexSpace,IndexPartition> &handles,
5666 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5667 Color color = LEGION_AUTO_GENERATE_ID,
5668 const char *provenance = NULL);
5669 template<int DIM, typename COORD_T,
5670 int COLOR_DIM, typename COLOR_COORD_T>
5671 Color create_cross_product_partitions(Context ctx,
5672 IndexPartitionT<DIM,COORD_T> handle1,
5673 IndexPartitionT<DIM,COORD_T> handle2,
5674 typename std::map<
5675 IndexSpaceT<DIM,COORD_T>,
5676 IndexPartitionT<DIM,COORD_T> > &handles,
5677 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5678 Color color = LEGION_AUTO_GENERATE_ID,
5679 const char *provenance = NULL);
5682
5706 void create_association(Context ctx,
5707 LogicalRegion domain,
5708 LogicalRegion domain_parent,
5709 FieldID domain_fid,
5710 IndexSpace range,
5711 MapperID id = 0,
5712 MappingTagID tag = 0,
5713 UntypedBuffer map_arg = UntypedBuffer(),
5714 const char *provenance = NULL);
5715 void create_bidirectional_association(Context ctx,
5716 LogicalRegion domain,
5717 LogicalRegion domain_parent,
5718 FieldID domain_fid,
5719 LogicalRegion range,
5720 LogicalRegion range_parent,
5721 FieldID range_fid,
5722 MapperID id = 0,
5723 MappingTagID tag = 0,
5724 UntypedBuffer map_arg =
5725 UntypedBuffer(),
5726 const char *provenance = NULL);
5727 // Template versions
5728 template<int DIM1, typename COORD_T1, int DIM2, typename COORD_T2>
5729 void create_association(Context ctx,
5730 LogicalRegionT<DIM1,COORD_T1> domain,
5731 LogicalRegionT<DIM1,COORD_T1> domain_parent,
5732 FieldID domain_fid, // type: Point<DIM2,COORD_T2>
5733 IndexSpaceT<DIM2,COORD_T2> range,
5734 MapperID id = 0,
5735 MappingTagID tag = 0,
5736 UntypedBuffer map_arg = UntypedBuffer(),
5737 const char *provenance = NULL);
5738 template<int DIM1, typename COORD_T1, int DIM2, typename COORD_T2>
5739 void create_bidirectional_association(Context ctx,
5740 LogicalRegionT<DIM1,COORD_T1> domain,
5741 LogicalRegionT<DIM1,COORD_T1> domain_parent,
5742 FieldID domain_fid, // type: Point<DIM2,COORD_T2>
5743 LogicalRegionT<DIM2,COORD_T2> range,
5744 LogicalRegionT<DIM2,COORD_T2> range_parent,
5745 FieldID range_fid, // type: Point<DIM1,COORD_T1>
5746 MapperID id = 0,
5747 MappingTagID tag = 0,
5748 UntypedBuffer map_arg = UntypedBuffer(),
5749 const char *provenance = NULL);
5752
5777 IndexPartition create_partition_by_restriction(Context ctx,
5778 IndexSpace parent,
5779 IndexSpace color_space,
5780 DomainTransform transform,
5781 Domain extent,
5782 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5783 Color color = LEGION_AUTO_GENERATE_ID,
5784 const char *provenance = NULL);
5785 // Template version
5786 template<int DIM, int COLOR_DIM, typename COORD_T>
5787 IndexPartitionT<DIM,COORD_T> create_partition_by_restriction(Context ctx,
5788 IndexSpaceT<DIM,COORD_T> parent,
5789 IndexSpaceT<COLOR_DIM,COORD_T> color_space,
5790 Transform<DIM,COLOR_DIM,COORD_T> transform,
5791 Rect<DIM,COORD_T> extent,
5792 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5793 Color color = LEGION_AUTO_GENERATE_ID,
5794 const char *provenance = NULL);
5797
5812 IndexPartition create_partition_by_blockify(Context ctx,
5813 IndexSpace parent,
5814 DomainPoint blocking_factor,
5815 Color color = LEGION_AUTO_GENERATE_ID,
5816 const char *provenance = NULL);
5817 // Template version
5818 template<int DIM, typename COORD_T>
5819 IndexPartitionT<DIM,COORD_T> create_partition_by_blockify(Context ctx,
5820 IndexSpaceT<DIM,COORD_T> parent,
5821 Point<DIM,COORD_T> blocking_factor,
5822 Color color = LEGION_AUTO_GENERATE_ID,
5823 const char *provenance = NULL);
5836 IndexPartition create_partition_by_blockify(Context ctx,
5837 IndexSpace parent,
5838 DomainPoint blockify_factor,
5839 DomainPoint origin,
5840 Color color = LEGION_AUTO_GENERATE_ID,
5841 const char *provenance = NULL);
5842 // Template version
5843 template<int DIM, typename COORD_T>
5844 IndexPartitionT<DIM,COORD_T> create_partition_by_blockify(Context ctx,
5845 IndexSpaceT<DIM,COORD_T> parent,
5846 Point<DIM,COORD_T> blocking_factor,
5847 Point<DIM,COORD_T> origin,
5848 Color color = LEGION_AUTO_GENERATE_ID,
5849 const char *provenance = NULL);
5852
5874 IndexPartition create_partition_by_domain(Context ctx,
5875 IndexSpace parent,
5876 const std::map<DomainPoint,Domain> &domains,
5877 IndexSpace color_space,
5878 bool perform_intersections = true,
5879 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5880 Color color = LEGION_AUTO_GENERATE_ID,
5881 const char *provenance = NULL,
5882 bool take_ownership = false);
5883 template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5884 IndexPartitionT<DIM,COORD_T> create_partition_by_domain(Context ctx,
5885 IndexSpaceT<DIM,COORD_T> parent,
5886 const std::map<
5887 Point<COLOR_DIM,COLOR_COORD_T>,
5888 DomainT<DIM,COORD_T> > &domains,
5889 IndexSpaceT<COLOR_DIM,
5890 COLOR_COORD_T> color_space,
5891 bool perform_intersections = true,
5892 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5893 Color color = LEGION_AUTO_GENERATE_ID,
5894 const char *provenance = NULL,
5895 bool take_ownership = false);
5913 IndexPartition create_partition_by_domain(Context ctx,
5914 IndexSpace parent,
5915 const FutureMap &domain_future_map,
5916 IndexSpace color_space,
5917 bool perform_intersections = true,
5918 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5919 Color color = LEGION_AUTO_GENERATE_ID,
5920 const char *provenance = NULL);
5921 template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5922 IndexPartitionT<DIM,COORD_T> create_partition_by_domain(Context ctx,
5923 IndexSpaceT<DIM,COORD_T> parent,
5924 const FutureMap &domain_future_map,
5925 IndexSpaceT<COLOR_DIM,
5926 COLOR_COORD_T> color_space,
5927 bool perform_intersections = true,
5928 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5929 Color color = LEGION_AUTO_GENERATE_ID,
5930 const char *provenance = NULL);
5933
5950 template<int DIM, typename COORD_T, int COLOR_DIM, typename COLOR_COORD_T>
5951 IndexPartitionT<DIM,COORD_T> create_partition_by_rectangles(Context ctx,
5952 IndexSpaceT<DIM,COORD_T> parent,
5953 const std::map<Point<COLOR_DIM,COLOR_COORD_T>,
5954 std::vector<Rect<DIM,COORD_T> > > &rectangles,
5955 IndexSpaceT<COLOR_DIM,
5956 COLOR_COORD_T> color_space,
5957 bool perform_intersections = true,
5958 PartitionKind part_kind = LEGION_COMPUTE_KIND,
5959 Color color = LEGION_AUTO_GENERATE_ID,
5960 const char *provenance = NULL,
5961 bool collective = false);
5964
5992 IndexPartition create_partition_by_field(Context ctx,
5993 LogicalRegion handle,
5994 LogicalRegion parent,
5995 FieldID fid,
5996 IndexSpace color_space,
5997 Color color =
5998 LEGION_AUTO_GENERATE_ID,
5999 MapperID id = 0,
6000 MappingTagID tag = 0,
6001 PartitionKind part_kind =
6002 LEGION_DISJOINT_KIND,
6003 UntypedBuffer map_arg =
6004 UntypedBuffer(),
6005 const char *provenance = NULL);
6006 template<int DIM, typename COORD_T,
6007 int COLOR_DIM, typename COLOR_COORD_T>
6008 IndexPartitionT<DIM,COORD_T> create_partition_by_field(Context ctx,
6009 LogicalRegionT<DIM,COORD_T> handle,
6010 LogicalRegionT<DIM,COORD_T> parent,
6011 FieldID fid, // type: Point<COLOR_DIM,COLOR_COORD_T>
6012 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6013 Color color = LEGION_AUTO_GENERATE_ID,
6014 MapperID id = 0, MappingTagID tag = 0,
6015 PartitionKind part_kind = LEGION_DISJOINT_KIND,
6016 UntypedBuffer map_arg = UntypedBuffer(),
6017 const char *provenance = NULL);
6020
6053 IndexPartition create_partition_by_image(Context ctx,
6054 IndexSpace handle,
6055 LogicalPartition projection,
6056 LogicalRegion parent,
6057 FieldID fid,
6058 IndexSpace color_space,
6059 PartitionKind part_kind = LEGION_COMPUTE_KIND,
6060 Color color = LEGION_AUTO_GENERATE_ID,
6061 MapperID id = 0, MappingTagID tag = 0,
6062 UntypedBuffer map_arg = UntypedBuffer(),
6063 const char *provenance = NULL);
6064 template<int DIM1, typename COORD_T1,
6065 int DIM2, typename COORD_T2,
6066 int COLOR_DIM, typename COLOR_COORD_T>
6067 IndexPartitionT<DIM2,COORD_T2> create_partition_by_image(Context ctx,
6068 IndexSpaceT<DIM2,COORD_T2> handle,
6069 LogicalPartitionT<DIM1,COORD_T1> projection,
6070 LogicalRegionT<DIM1,COORD_T1> parent,
6071 FieldID fid, // type: Point<DIM2,COORD_T2>
6072 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6073 PartitionKind part_kind = LEGION_COMPUTE_KIND,
6074 Color color = LEGION_AUTO_GENERATE_ID,
6075 MapperID id = 0, MappingTagID tag = 0,
6076 UntypedBuffer map_arg = UntypedBuffer(),
6077 const char *provenance = NULL);
6078 // Range versions of image
6079 IndexPartition create_partition_by_image_range(Context ctx,
6080 IndexSpace handle,
6081 LogicalPartition projection,
6082 LogicalRegion parent,
6083 FieldID fid,
6084 IndexSpace color_space,
6085 PartitionKind part_kind = LEGION_COMPUTE_KIND,
6086 Color color = LEGION_AUTO_GENERATE_ID,
6087 MapperID id = 0, MappingTagID tag = 0,
6088 UntypedBuffer map_arg = UntypedBuffer(),
6089 const char *provenance = NULL);
6090 template<int DIM1, typename COORD_T1,
6091 int DIM2, typename COORD_T2,
6092 int COLOR_DIM, typename COLOR_COORD_T>
6093 IndexPartitionT<DIM2,COORD_T2> create_partition_by_image_range(
6094 Context ctx,
6095 IndexSpaceT<DIM2,COORD_T2> handle,
6096 LogicalPartitionT<DIM1,COORD_T1> projection,
6097 LogicalRegionT<DIM1,COORD_T1> parent,
6098 FieldID fid, // type: Rect<DIM2,COORD_T2>
6099 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6100 PartitionKind part_kind = LEGION_COMPUTE_KIND,
6101 Color color = LEGION_AUTO_GENERATE_ID,
6102 MapperID id = 0, MappingTagID tag = 0,
6103 UntypedBuffer map_arg = UntypedBuffer(),
6104 const char *provenance = NULL);
6107
6137 IndexPartition create_partition_by_preimage(Context ctx,
6138 IndexPartition projection,
6139 LogicalRegion handle,
6140 LogicalRegion parent,
6141 FieldID fid,
6142 IndexSpace color_space,
6143 PartitionKind part_kind = LEGION_COMPUTE_KIND,
6144 Color color = LEGION_AUTO_GENERATE_ID,
6145 MapperID id = 0, MappingTagID tag = 0,
6146 UntypedBuffer map_arg = UntypedBuffer(),
6147 const char *provenance = NULL);
6148 template<int DIM1, typename COORD_T1,
6149 int DIM2, typename COORD_T2,
6150 int COLOR_DIM, typename COLOR_COORD_T>
6151 IndexPartitionT<DIM1,COORD_T1> create_partition_by_preimage(Context ctx,
6152 IndexPartitionT<DIM2,COORD_T2> projection,
6153 LogicalRegionT<DIM1,COORD_T1> handle,
6154 LogicalRegionT<DIM1,COORD_T1> parent,
6155 FieldID fid, // type: Point<DIM2,COORD_T2>
6156 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6157 PartitionKind part_kind = LEGION_COMPUTE_KIND,
6158 Color color = LEGION_AUTO_GENERATE_ID,
6159 MapperID id = 0, MappingTagID tag = 0,
6160 UntypedBuffer map_arg = UntypedBuffer(),
6161 const char *provenance = NULL);
6162 // Range versions of preimage
6163 IndexPartition create_partition_by_preimage_range(Context ctx,
6164 IndexPartition projection,
6165 LogicalRegion handle,
6166 LogicalRegion parent,
6167 FieldID fid,
6168 IndexSpace color_space,
6169 PartitionKind part_kind = LEGION_COMPUTE_KIND,
6170 Color color = LEGION_AUTO_GENERATE_ID,
6171 MapperID id = 0, MappingTagID tag = 0,
6172 UntypedBuffer map_arg = UntypedBuffer(),
6173 const char *provenance = NULL);
6174 template<int DIM1, typename COORD_T1,
6175 int DIM2, typename COORD_T2,
6176 int COLOR_DIM, typename COLOR_COORD_T>
6177 IndexPartitionT<DIM1,COORD_T1> create_partition_by_preimage_range(
6178 Context ctx,
6179 IndexPartitionT<DIM2,COORD_T2> projection,
6180 LogicalRegionT<DIM1,COORD_T1> handle,
6181 LogicalRegionT<DIM1,COORD_T1> parent,
6182 FieldID fid, // type: Rect<DIM2,COORD_T2>
6183 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6184 PartitionKind part_kind = LEGION_COMPUTE_KIND,
6185 Color color = LEGION_AUTO_GENERATE_ID,
6186 MapperID id = 0, MappingTagID tag = 0,
6187 UntypedBuffer map_arg = UntypedBuffer(),
6188 const char *provenance = NULL);
6190 public:
6191 //------------------------------------------------------------------------
6192 // Computed Index Spaces and Partitions
6193 //------------------------------------------------------------------------
6195
6221 IndexPartition create_pending_partition(Context ctx,
6222 IndexSpace parent,
6223 IndexSpace color_space,
6224 PartitionKind part_kind = LEGION_COMPUTE_KIND,
6225 Color color = LEGION_AUTO_GENERATE_ID,
6226 const char *provenance = NULL);
6227 template<int DIM, typename COORD_T,
6228 int COLOR_DIM, typename COLOR_COORD_T>
6229 IndexPartitionT<DIM,COORD_T> create_pending_partition(Context ctx,
6230 IndexSpaceT<DIM,COORD_T> parent,
6231 IndexSpaceT<COLOR_DIM,COLOR_COORD_T> color_space,
6232 PartitionKind part_kind = LEGION_COMPUTE_KIND,
6233 Color color = LEGION_AUTO_GENERATE_ID,
6234 const char *provenance = NULL);
6237
6253 IndexSpace create_index_space_union(Context ctx, IndexPartition parent,
6254 const DomainPoint &color,
6255 const std::vector<IndexSpace> &handles,
6256 const char *provenance = NULL);
6257 template<int DIM, typename COORD_T,
6258 int COLOR_DIM, typename COLOR_COORD_T>
6259 IndexSpaceT<DIM,COORD_T> create_index_space_union(Context ctx,
6260 IndexPartitionT<DIM,COORD_T> parent,
6261 Point<COLOR_DIM,COLOR_COORD_T> color,
6262 const typename std::vector<
6263 IndexSpaceT<DIM,COORD_T> > &handles,
6264 const char *provenance = NULL);
6267
6280 IndexSpace create_index_space_union(Context ctx, IndexPartition parent,
6281 const DomainPoint &color,
6282 IndexPartition handle,
6283 const char *provenance = NULL);
6284 template<int DIM, typename COORD_T,
6285 int COLOR_DIM, typename COLOR_COORD_T>
6286 IndexSpaceT<DIM,COORD_T> create_index_space_union(Context ctx,
6287 IndexPartitionT<DIM,COORD_T> parent,
6288 Point<COLOR_DIM,COLOR_COORD_T> color,
6289 IndexPartitionT<DIM,COORD_T> handle,
6290 const char *provenance = NULL);
6293
6309 IndexSpace create_index_space_intersection(Context ctx,
6310 IndexPartition parent,
6311 const DomainPoint &color,
6312 const std::vector<IndexSpace> &handles,
6313 const char *provenance = NULL);
6314 template<int DIM, typename COORD_T,
6315 int COLOR_DIM, typename COLOR_COORD_T>
6316 IndexSpaceT<DIM,COORD_T> create_index_space_intersection(Context ctx,
6317 IndexPartitionT<DIM,COORD_T> parent,
6318 Point<COLOR_DIM,COLOR_COORD_T> color,
6319 const typename std::vector<
6320 IndexSpaceT<DIM,COORD_T> > &handles,
6321 const char *provenance = NULL);
6324
6337 IndexSpace create_index_space_intersection(Context ctx,
6338 IndexPartition parent,
6339 const DomainPoint &color,
6340 IndexPartition handle,
6341 const char *provenannce=NULL);
6342 template<int DIM, typename COORD_T,
6343 int COLOR_DIM, typename COLOR_COORD_T>
6344 IndexSpaceT<DIM,COORD_T> create_index_space_intersection(Context ctx,
6345 IndexPartitionT<DIM,COORD_T> parent,
6346 Point<COLOR_DIM,COLOR_COORD_T> color,
6347 IndexPartitionT<DIM,COORD_T> handle,
6348 const char *provenance = NULL);
6351
6372 IndexSpace create_index_space_difference(Context ctx,
6373 IndexPartition parent,
6374 const DomainPoint &color,
6375 IndexSpace initial,
6376 const std::vector<IndexSpace> &handles,
6377 const char *provenancne = NULL);
6378 template<int DIM, typename COORD_T,
6379 int COLOR_DIM, typename COLOR_COORD_T>
6380 IndexSpaceT<DIM,COORD_T> create_index_space_difference(Context ctx,
6381 IndexPartitionT<DIM,COORD_T> parent,
6382 Point<COLOR_DIM,COLOR_COORD_T> color,
6383 IndexSpaceT<DIM,COORD_T> initial,
6384 const typename std::vector<
6385 IndexSpaceT<DIM,COORD_T> > &handles,
6386 const char *provenance = NULL);
6388 public:
6389 //------------------------------------------------------------------------
6390 // Index Tree Traversal Operations
6391 //------------------------------------------------------------------------
6393
6401 IndexPartition get_index_partition(Context ctx, IndexSpace parent,
6402 Color color);
6403 IndexPartition get_index_partition(Context ctx, IndexSpace parent,
6404 const DomainPoint &color);
6405 // Context free versions
6406 IndexPartition get_index_partition(IndexSpace parent, Color color);
6407 IndexPartition get_index_partition(IndexSpace parent,
6408 const DomainPoint &color);
6409 // Template version
6410 template<int DIM, typename COORD_T>
6411 IndexPartitionT<DIM,COORD_T> get_index_partition(
6412 IndexSpaceT<DIM,COORD_T> parent, Color color);
6413
6415
6417
6425 bool has_index_partition(Context ctx, IndexSpace parent, Color color);
6426 bool has_index_partition(Context ctx, IndexSpace parent,
6427 const DomainPoint &color);
6428 // Context free
6429 bool has_index_partition(IndexSpace parent, Color color);
6430 bool has_index_partition(IndexSpace parent,
6431 const DomainPoint &color);
6432 // Template version
6433 template<int DIM, typename COORD_T>
6434 bool has_index_partition(IndexSpaceT<DIM,COORD_T> parent, Color color);
6436
6438
6446 IndexSpace get_index_subspace(Context ctx, IndexPartition p,
6447 Color color);
6448 IndexSpace get_index_subspace(Context ctx, IndexPartition p,
6449 const DomainPoint &color);
6450 // Context free versions
6451 IndexSpace get_index_subspace(IndexPartition p, Color color);
6452 IndexSpace get_index_subspace(IndexPartition p,
6453 const DomainPoint &color);
6454 // Template version
6455 template<int DIM, typename COORD_T,
6456 int COLOR_DIM, typename COLOR_COORD_T>
6457 IndexSpaceT<DIM,COORD_T> get_index_subspace(
6458 IndexPartitionT<DIM,COORD_T> p,
6459 Point<COLOR_DIM,COLOR_COORD_T> color);
6461
6463
6471 bool has_index_subspace(Context ctx, IndexPartition p,
6472 const DomainPoint &color);
6473 // Context free
6474 bool has_index_subspace(IndexPartition p,
6475 const DomainPoint &color);
6476 // Template version
6477 template<int DIM, typename COORD_T,
6478 int COLOR_DIM, typename COLOR_COORD_T>
6479 bool has_index_subspace(IndexPartitionT<DIM,COORD_T> p,
6480 Point<COLOR_DIM,COLOR_COORD_T> color);
6482
6484
6494 LEGION_DEPRECATED("Multiple domains are no longer supported.")
6495 bool has_multiple_domains(Context ctx, IndexSpace handle);
6496 // Context free
6497 LEGION_DEPRECATED("Multiple domains are no longer supported.")
6498 bool has_multiple_domains(IndexSpace handle);
6500
6502
6509 Domain get_index_space_domain(Context ctx, IndexSpace handle);
6510 // Context free
6511 Domain get_index_space_domain(IndexSpace handle);
6512 // Template version
6513 template<int DIM, typename COORD_T>
6514 DomainT<DIM,COORD_T> get_index_space_domain(
6515 IndexSpaceT<DIM,COORD_T> handle);
6517
6519
6529 LEGION_DEPRECATED("Multiple domains are no longer supported.")
6530 void get_index_space_domains(Context ctx, IndexSpace handle,
6531 std::vector<Domain> &domains);
6532 // Context free
6533 LEGION_DEPRECATED("Multiple domains are no longer supported.")
6534 void get_index_space_domains(IndexSpace handle,
6535 std::vector<Domain> &domains);
6537
6539
6546 Domain get_index_partition_color_space(Context ctx, IndexPartition p);
6547 // Context free
6548 Domain get_index_partition_color_space(IndexPartition p);
6549 // Template version
6550 template<int DIM, typename COORD_T,
6551 int COLOR_DIM, typename COLOR_COORD_T>
6552 DomainT<COLOR_DIM,COLOR_COORD_T>
6553 get_index_partition_color_space(IndexPartitionT<DIM,COORD_T> p);
6555
6557
6563 IndexSpace get_index_partition_color_space_name(Context ctx,
6564 IndexPartition p);
6565 // Context free
6566 IndexSpace get_index_partition_color_space_name(IndexPartition p);
6567 // Template version
6568 template<int DIM, typename COORD_T,
6569 int COLOR_DIM, typename COLOR_COORD_T>
6570 IndexSpaceT<COLOR_DIM,COLOR_COORD_T>
6571 get_index_partition_color_space_name(IndexPartitionT<DIM,COORD_T> p);
6573
6575
6584 void get_index_space_partition_colors(Context ctx, IndexSpace sp,
6585 std::set<Color> &colors);
6586 void get_index_space_partition_colors(Context ctx, IndexSpace sp,
6587 std::set<DomainPoint> &colors);
6588 // Context free versions
6589 void get_index_space_partition_colors(IndexSpace sp,
6590 std::set<Color> &colors);
6591 void get_index_space_partition_colors(IndexSpace sp,
6592 std::set<DomainPoint> &colors);
6594
6596
6602 bool is_index_partition_disjoint(Context ctx, IndexPartition p);
6603 // Context free
6604 bool is_index_partition_disjoint(IndexPartition p);
6606
6608
6614 bool is_index_partition_complete(Context ctx, IndexPartition p);
6615 // Context free
6616 bool is_index_partition_complete(IndexPartition p);
6618
6620
6628 Color get_index_space_color(Context ctx, IndexSpace handle);
6629 DomainPoint get_index_space_color_point(Context ctx, IndexSpace handle);
6630 // Context free
6631 Color get_index_space_color(IndexSpace handle);
6632 DomainPoint get_index_space_color_point(IndexSpace handle);
6633 // Template version
6634 template<int DIM, typename COORD_T,
6635 int COLOR_DIM, typename COLOR_COORD_T>
6636 Point<COLOR_DIM,COLOR_COORD_T>
6637 get_index_space_color(IndexSpaceT<DIM,COORD_T> handle);
6639
6641
6648 Color get_index_partition_color(Context ctx, IndexPartition handle);
6649 DomainPoint get_index_partition_color_point(Context ctx,
6650 IndexPartition handle);
6651 // Context free
6652 Color get_index_partition_color(IndexPartition handle);
6653 DomainPoint get_index_partition_color_point(IndexPartition handle);
6655
6657
6663 IndexSpace get_parent_index_space(Context ctx, IndexPartition handle);
6664 // Context free
6665 IndexSpace get_parent_index_space(IndexPartition handle);
6666 // Template version
6667 template<int DIM, typename COORD_T>
6668 IndexSpaceT<DIM,COORD_T> get_parent_index_space(
6669 IndexPartitionT<DIM,COORD_T> handle);
6671
6673
6679 bool has_parent_index_partition(Context ctx, IndexSpace handle);
6680 // Context free
6681 bool has_parent_index_partition(IndexSpace handle);
6683
6685
6692 IndexPartition get_parent_index_partition(Context ctx, IndexSpace handle);
6693 // Context free
6694 IndexPartition get_parent_index_partition(IndexSpace handle);
6695 // Template version
6696 template<int DIM, typename COORD_T>
6697 IndexPartitionT<DIM,COORD_T> get_parent_index_partition(
6698 IndexSpaceT<DIM,COORD_T> handle);
6700
6702
6708 unsigned get_index_space_depth(Context ctx, IndexSpace handle);
6709 // Context free
6710 unsigned get_index_space_depth(IndexSpace handle);
6712
6714
6720 unsigned get_index_partition_depth(Context ctx, IndexPartition handle);
6721 // Context free
6722 unsigned get_index_partition_depth(IndexPartition handle);
6724 public:
6725 //------------------------------------------------------------------------
6726 // Safe Cast Operations
6727 //------------------------------------------------------------------------
6737 DomainPoint safe_cast(Context ctx, DomainPoint point,
6738 LogicalRegion region);
6739
6748 template<int DIM, typename COORD_T>
6749 bool safe_cast(Context ctx,
6750 Point<DIM,COORD_T> point,
6751 LogicalRegionT<DIM,COORD_T> region);
6752 public:
6753 //------------------------------------------------------------------------
6754 // Field Space Operations
6755 //------------------------------------------------------------------------
6763 FieldSpace create_field_space(Context ctx, const char *provenance = NULL);
6775 FieldSpace create_field_space(Context ctx,
6776 const std::vector<size_t> &field_sizes,
6777 std::vector<FieldID> &resulting_fields,
6778 CustomSerdezID serdez_id = 0,
6779 const char *provenance = NULL);
6791 FieldSpace create_field_space(Context ctx,
6792 const std::vector<Future> &field_sizes,
6793 std::vector<FieldID> &resulting_fields,
6794 CustomSerdezID serdez_id = 0,
6795 const char *provenance = NULL);
6806 void create_shared_ownership(Context ctx, FieldSpace handle);
6816 void destroy_field_space(Context ctx, FieldSpace handle,
6817 const bool unordered = false,
6818 const char *provenance = NULL);
6819
6821
6828 size_t get_field_size(Context ctx, FieldSpace handle, FieldID fid);
6829 // Context free
6830 size_t get_field_size(FieldSpace handle, FieldID fid);
6832
6834
6840 void get_field_space_fields(Context ctx, FieldSpace handle,
6841 std::vector<FieldID> &fields);
6842 // Context free
6843 void get_field_space_fields(FieldSpace handle,
6844 std::vector<FieldID> &fields);
6846
6848
6854 void get_field_space_fields(Context ctx, FieldSpace handle,
6855 std::set<FieldID> &fields);
6856 // Context free
6857 void get_field_space_fields(FieldSpace handle,
6858 std::set<FieldID> &fields);
6860 public:
6861 //------------------------------------------------------------------------
6862 // Logical Region Operations
6863 //------------------------------------------------------------------------
6877 LogicalRegion create_logical_region(Context ctx, IndexSpace index,
6878 FieldSpace fields,
6879 bool task_local = false,
6880 const char *provenance = NULL);
6881 // Template version
6882 template<int DIM, typename COORD_T>
6883 LogicalRegionT<DIM,COORD_T> create_logical_region(Context ctx,
6884 IndexSpaceT<DIM,COORD_T> index,
6885 FieldSpace fields,
6886 bool task_local = false,
6887 const char *provenance = NULL);
6898 void create_shared_ownership(Context ctx, LogicalRegion handle);
6908 void destroy_logical_region(Context ctx, LogicalRegion handle,
6909 const bool unordered = false,
6910 const char *provenance = NULL);
6911
6919 LEGION_DEPRECATED("Destruction of logical partitions are no-ops now."
6920 "Logical partitions are automatically destroyed when their root "
6921 "logical region or their index spartition are destroyed.")
6922 void destroy_logical_partition(Context ctx, LogicalPartition handle,
6923 const bool unordered = false);
6924
6943 void reset_equivalence_sets(Context ctx, LogicalRegion parent,
6944 LogicalRegion region,
6945 const std::set<FieldID> &fields);
6946 public:
6947 //------------------------------------------------------------------------
6948 // Logical Region Tree Traversal Operations
6949 //------------------------------------------------------------------------
6951
6960 LogicalPartition get_logical_partition(Context ctx, LogicalRegion parent,
6961 IndexPartition handle);
6962 // Context free
6963 LogicalPartition get_logical_partition(LogicalRegion parent,
6964 IndexPartition handle);
6965 // Template version
6966 template<int DIM, typename COORD_T>
6967 LogicalPartitionT<DIM,COORD_T> get_logical_partition(
6968 LogicalRegionT<DIM,COORD_T> parent,
6969 IndexPartitionT<DIM,COORD_T> handle);
6971
6973
6981 LogicalPartition get_logical_partition_by_color(Context ctx,
6982 LogicalRegion parent,
6983 Color c);
6984 LogicalPartition get_logical_partition_by_color(Context ctx,
6985 LogicalRegion parent,
6986 const DomainPoint &c);
6987 // Context free
6988 LogicalPartition get_logical_partition_by_color(LogicalRegion parent,
6989 Color c);
6990 LogicalPartition get_logical_partition_by_color(LogicalRegion parent,
6991 const DomainPoint &c);
6992 // Template version
6993 template<int DIM, typename COORD_T>
6994 LogicalPartitionT<DIM,COORD_T> get_logical_partition_by_color(
6995 LogicalRegionT<DIM,COORD_T> parent,
6996 Color c);
6998
7000
7008 bool has_logical_partition_by_color(Context ctx,
7009 LogicalRegion parent,
7010 const DomainPoint &c);
7011 // Context free
7012 bool has_logical_partition_by_color(LogicalRegion parent,
7013 const DomainPoint &c);
7015
7017
7026 LogicalPartition get_logical_partition_by_tree(Context ctx,
7027 IndexPartition handle,
7028 FieldSpace fspace,
7029 RegionTreeID tid);
7030 // Context free
7031 LogicalPartition get_logical_partition_by_tree(IndexPartition handle,
7032 FieldSpace fspace,
7033 RegionTreeID tid);
7034 // Template version
7035 template<int DIM, typename COORD_T>
7036 LogicalPartitionT<DIM,COORD_T> get_logical_partition_by_tree(
7037 IndexPartitionT<DIM,COORD_T> handle,
7038 FieldSpace fspace, RegionTreeID tid);
7040
7042
7051 LogicalRegion get_logical_subregion(Context ctx, LogicalPartition parent,
7052 IndexSpace handle);
7053 // Context free
7054 LogicalRegion get_logical_subregion(LogicalPartition parent,
7055 IndexSpace handle);
7056 // Template version
7057 template<int DIM, typename COORD_T>
7058 LogicalRegionT<DIM,COORD_T> get_logical_subregion(
7059 LogicalPartitionT<DIM,COORD_T> parent,
7060 IndexSpaceT<DIM,COORD_T> handle);
7062
7064
7072 LogicalRegion get_logical_subregion_by_color(Context ctx,
7073 LogicalPartition parent,
7074 Color c);
7075 LogicalRegion get_logical_subregion_by_color(Context ctx,
7076 LogicalPartition parent,
7077 const DomainPoint &c);
7078 // Context free
7079 LogicalRegion get_logical_subregion_by_color(LogicalPartition parent,
7080 Color c);
7081 LogicalRegion get_logical_subregion_by_color(LogicalPartition parent,
7082 const DomainPoint &c);
7083 // Template version
7084 template<int DIM, typename COORD_T,
7085 int COLOR_DIM, typename COLOR_COORD_T>
7086 LogicalRegionT<DIM,COORD_T> get_logical_subregion_by_color(
7087 LogicalPartitionT<DIM,COORD_T> parent,
7088 Point<COLOR_DIM,COLOR_COORD_T> color);
7090
7092
7100 bool has_logical_subregion_by_color(Context ctx,
7101 LogicalPartition parent,
7102 const DomainPoint &c);
7103 // Context free
7104 bool has_logical_subregion_by_color(LogicalPartition parent,
7105 const DomainPoint &c);
7106 // Template version
7107 template<int DIM, typename COORD_T,
7108 int COLOR_DIM, typename COLOR_COORD_T>
7109 bool has_logical_subregion_by_color(LogicalPartitionT<DIM,COORD_T> parent,
7110 Point<COLOR_DIM,COLOR_COORD_T> color);
7112
7114
7123 LogicalRegion get_logical_subregion_by_tree(Context ctx,
7124 IndexSpace handle,
7125 FieldSpace fspace,
7126 RegionTreeID tid);
7127 // Context free
7128 LogicalRegion get_logical_subregion_by_tree(IndexSpace handle,
7129 FieldSpace fspace,
7130 RegionTreeID tid);
7131 // Template version
7132 template<int DIM, typename COORD_T>
7133 LogicalRegionT<DIM,COORD_T> get_logical_subregion_by_tree(
7134 IndexSpaceT<DIM,COORD_T> handle,
7135 FieldSpace space, RegionTreeID tid);
7137
7139
7147 Color get_logical_region_color(Context ctx, LogicalRegion handle);
7148 DomainPoint get_logical_region_color_point(Context ctx,
7149 LogicalRegion handle);
7150 // Context free versions
7151 Color get_logical_region_color(LogicalRegion handle);
7152 DomainPoint get_logical_region_color_point(LogicalRegion handle);
7153 // Template version
7154 template<int DIM, typename COORD_T,
7155 int COLOR_DIM, typename COLOR_COORD_T>
7156 Point<COLOR_DIM,COLOR_COORD_T>
7157 get_logical_region_color_point(LogicalRegionT<DIM,COORD_T> handle);
7159
7161
7168 Color get_logical_partition_color(Context ctx, LogicalPartition handle);
7169 DomainPoint get_logical_partition_color_point(Context ctx,
7170 LogicalPartition handle);
7171 // Context free versions
7172 Color get_logical_partition_color(LogicalPartition handle);
7173 DomainPoint get_logical_partition_color_point(LogicalPartition handle);
7175
7177
7183 LogicalRegion get_parent_logical_region(Context ctx,
7184 LogicalPartition handle);
7185 // Context free
7186 LogicalRegion get_parent_logical_region(LogicalPartition handle);
7187 // Template version
7188 template<int DIM, typename COORD_T>
7189 LogicalRegionT<DIM,COORD_T> get_parent_logical_region(
7190 LogicalPartitionT<DIM,COORD_T> handle);
7192
7194
7200 bool has_parent_logical_partition(Context ctx, LogicalRegion handle);
7201 // Context free
7202 bool has_parent_logical_partition(LogicalRegion handle);
7204
7206
7212 LogicalPartition get_parent_logical_partition(Context ctx,
7213 LogicalRegion handle);
7214 // Context free
7215 LogicalPartition get_parent_logical_partition(LogicalRegion handle);
7216 // Template version
7217 template<int DIM, typename COORD_T>
7218 LogicalPartitionT<DIM,COORD_T> get_parent_logical_partition(
7219 LogicalRegionT<DIM,COORD_T> handle);
7221 public:
7222 //------------------------------------------------------------------------
7223 // Allocator and Argument Map Operations
7224 //------------------------------------------------------------------------
7231 FieldAllocator create_field_allocator(Context ctx, FieldSpace handle);
7232
7241 LEGION_DEPRECATED("ArgumentMap can be constructed directly.")
7242 ArgumentMap create_argument_map(Context ctx);
7243 public:
7244 //------------------------------------------------------------------------
7245 // Task Launch Operations
7246 //------------------------------------------------------------------------
7256 Future execute_task(Context ctx,
7257 const TaskLauncher &launcher,
7258 std::vector<OutputRequirement> *outputs = NULL);
7259
7270 FutureMap execute_index_space(
7271 Context ctx, const IndexTaskLauncher &launcher,
7272 std::vector<OutputRequirement> *outputs = NULL);
7273
7296 Future execute_index_space(
7297 Context ctx, const IndexTaskLauncher &launcher,
7298 ReductionOpID redop, bool ordered = true,
7299 std::vector<OutputRequirement> *outputs = NULL);
7300
7324 Future reduce_future_map(Context ctx, const FutureMap &future_map,
7325 ReductionOpID redop, bool ordered = true,
7326 MapperID map_id = 0, MappingTagID tag = 0,
7327 const char *provenance = NULL,
7328 Future initial_value = Future());
7329
7357 FutureMap construct_future_map(Context ctx, IndexSpace domain,
7358 const std::map<DomainPoint,UntypedBuffer> &data,
7359 bool collective = false, ShardingID sid = 0,
7360 bool implicit_sharding = false,
7361 const char *provenance = NULL);
7362 LEGION_DEPRECATED("Use the version that takes an IndexSpace instead")
7363 FutureMap construct_future_map(Context ctx, const Domain &domain,
7364 const std::map<DomainPoint,UntypedBuffer> &data,
7365 bool collective = false, ShardingID sid = 0,
7366 bool implicit_sharding = false);
7367
7391 FutureMap construct_future_map(Context ctx, IndexSpace domain,
7392 const std::map<DomainPoint,Future> &futures,
7393 bool collective = false, ShardingID sid = 0,
7394 bool implicit_sharding = false,
7395 const char *provenance = NULL);
7396 LEGION_DEPRECATED("Use the version that takes an IndexSpace instead")
7397 FutureMap construct_future_map(Context ctx, const Domain &domain,
7398 const std::map<DomainPoint,Future> &futures,
7399 bool collective = false, ShardingID sid = 0,
7400 bool implicit_sharding = false);
7401
7419 typedef DomainPoint (*PointTransformFnptr)(const DomainPoint &point,
7420 const Domain &domain,
7421 const Domain &range);
7422 FutureMap transform_future_map(Context ctx, const FutureMap &fm,
7423 IndexSpace new_domain,
7424 PointTransformFnptr fnptr,
7425 const char *provenance = NULL);
7443 FutureMap transform_future_map(Context ctx, const FutureMap &fm,
7444 IndexSpace new_domain,
7445 PointTransformFunctor *functor,
7446 bool take_ownership = false,
7447 const char *provenance = NULL);
7448
7464 LEGION_DEPRECATED("Launching tasks should be done with the new task "
7465 "launcher interface.")
7466 Future execute_task(Context ctx, TaskID task_id,
7467 const std::vector<IndexSpaceRequirement> &indexes,
7468 const std::vector<FieldSpaceRequirement> &fields,
7469 const std::vector<RegionRequirement> &regions,
7470 const UntypedBuffer &arg,
7471 const Predicate &predicate = Predicate::TRUE_PRED,
7472 MapperID id = 0,
7473 MappingTagID tag = 0);
7474
7493 LEGION_DEPRECATED("Launching tasks should be done with the new task "
7494 "launcher interface.")
7495 FutureMap execute_index_space(Context ctx, TaskID task_id,
7496 const Domain domain,
7497 const std::vector<IndexSpaceRequirement> &indexes,
7498 const std::vector<FieldSpaceRequirement> &fields,
7499 const std::vector<RegionRequirement> &regions,
7500 const UntypedBuffer &global_arg,
7501 const ArgumentMap &arg_map,
7502 const Predicate &predicate = Predicate::TRUE_PRED,
7503 bool must_paralleism = false,
7504 MapperID id = 0,
7505 MappingTagID tag = 0);
7506
7528 LEGION_DEPRECATED("Launching tasks should be done with the new task "
7529 "launcher interface.")
7530 Future execute_index_space(Context ctx, TaskID task_id,
7531 const Domain domain,
7532 const std::vector<IndexSpaceRequirement> &indexes,
7533 const std::vector<FieldSpaceRequirement> &fields,
7534 const std::vector<RegionRequirement> &regions,
7535 const UntypedBuffer &global_arg,
7536 const ArgumentMap &arg_map,
7537 ReductionOpID reduction,
7538 const UntypedBuffer &initial_value,
7539 const Predicate &predicate = Predicate::TRUE_PRED,
7540 bool must_parallelism = false,
7541 MapperID id = 0,
7542 MappingTagID tag = 0);
7543 public:
7544 //------------------------------------------------------------------------
7545 // Inline Mapping Operations
7546 //------------------------------------------------------------------------
7556 PhysicalRegion map_region(Context ctx, const InlineLauncher &launcher);
7557
7571 PhysicalRegion map_region(Context ctx, const RegionRequirement &req,
7572 MapperID id = 0, MappingTagID tag = 0,
7573 const char *provenance = NULL);
7574
7586 PhysicalRegion map_region(Context ctx, unsigned idx,
7587 MapperID id = 0, MappingTagID tag = 0,
7588 const char *provenance = NULL);
7589
7599 void remap_region(Context ctx, PhysicalRegion region,
7600 const char *provenance = NULL);
7601
7609 void unmap_region(Context ctx, PhysicalRegion region);
7610
7618 void unmap_all_regions(Context ctx);
7619 public:
7620 //------------------------------------------------------------------------
7621 // Output Region Operations
7622 //------------------------------------------------------------------------
7628 OutputRegion get_output_region(Context ctx, unsigned index);
7629
7635 void get_output_regions(Context ctx, std::vector<OutputRegion> &regions);
7636 public:
7637 //------------------------------------------------------------------------
7638 // Fill Field Operations
7639 //------------------------------------------------------------------------
7654 template<typename T>
7655 void fill_field(Context ctx, LogicalRegion handle, LogicalRegion parent,
7656 FieldID fid, const T &value,
7657 Predicate pred = Predicate::TRUE_PRED);
7658
7672 void fill_field(Context ctx, LogicalRegion handle, LogicalRegion parent,
7673 FieldID fid, const void *value, size_t value_size,
7674 Predicate pred = Predicate::TRUE_PRED);
7675
7688 void fill_field(Context ctx, LogicalRegion handle, LogicalRegion parent,
7689 FieldID fid, Future f,
7690 Predicate pred = Predicate::TRUE_PRED);
7691
7702 template<typename T>
7703 void fill_fields(Context ctx, LogicalRegion handle, LogicalRegion parent,
7704 const std::set<FieldID> &fields, const T &value,
7705 Predicate pred = Predicate::TRUE_PRED);
7706
7719 void fill_fields(Context ctx, LogicalRegion handle, LogicalRegion parent,
7720 const std::set<FieldID> &fields,
7721 const void *value, size_t value_size,
7722 Predicate pred = Predicate::TRUE_PRED);
7723
7734 void fill_fields(Context ctx, LogicalRegion handle, LogicalRegion parent,
7735 const std::set<FieldID> &fields,
7736 Future f, Predicate pred = Predicate::TRUE_PRED);
7737
7744 void fill_fields(Context ctx, const FillLauncher &launcher);
7745
7752 void fill_fields(Context ctx, const IndexFillLauncher &launcher);
7753
7759 void discard_fields(Context ctx, const DiscardLauncher &launcher);
7760 public:
7761 //------------------------------------------------------------------------
7762 // Attach Operations
7763 //------------------------------------------------------------------------
7764
7771 PhysicalRegion attach_external_resource(Context ctx,
7772 const AttachLauncher &launcher);
7773
7785 Future detach_external_resource(Context ctx, PhysicalRegion region,
7786 const bool flush = true,
7787 const bool unordered = false,
7788 const char *provenance = NULL);
7789
7807 ExternalResources attach_external_resources(Context ctx,
7808 const IndexAttachLauncher &launcher);
7809
7822 Future detach_external_resources(Context ctx, ExternalResources external,
7823 const bool flush = true,
7824 const bool unordered = false,
7825 const char *provenance = NULL);
7826
7833 void progress_unordered_operations(Context ctx);
7834
7865 LEGION_DEPRECATED("Attaching specific HDF5 file type is deprecated "
7866 "in favor of generic attach launcher interface.")
7867 PhysicalRegion attach_hdf5(Context ctx, const char *file_name,
7868 LogicalRegion handle, LogicalRegion parent,
7869 const std::map<FieldID,const char*> &field_map,
7870 LegionFileMode mode);
7871
7888 LEGION_DEPRECATED("Detaching specific HDF5 file type is deprecated "
7889 "in favor of generic detach interface.")
7890 void detach_hdf5(Context ctx, PhysicalRegion region);
7891
7898 LEGION_DEPRECATED("Attaching generic file type is deprecated "
7899 "in favor of generic attach launcher interface.")
7900 PhysicalRegion attach_file(Context ctx, const char *file_name,
7901 LogicalRegion handle, LogicalRegion parent,
7902 const std::vector<FieldID> &field_vec,
7903 LegionFileMode mode);
7904
7910 LEGION_DEPRECATED("Detaching generic file type is deprecated "
7911 "in favor of generic detach interface.")
7912 void detach_file(Context ctx, PhysicalRegion region);
7913 public:
7914 //------------------------------------------------------------------------
7915 // Copy Operations
7916 //------------------------------------------------------------------------
7924 void issue_copy_operation(Context ctx, const CopyLauncher &launcher);
7925
7933 void issue_copy_operation(Context ctx, const IndexCopyLauncher &launcher);
7934 public:
7935 //------------------------------------------------------------------------
7936 // Predicate Operations
7937 //------------------------------------------------------------------------
7947 Predicate create_predicate(Context ctx, const Future &f,
7948 const char *provenance = NULL);
7949
7959 Predicate predicate_not(Context ctx, const Predicate &p,
7960 const char *provenance = NULL);
7961
7972 Predicate predicate_and(Context ctx,
7973 const Predicate &p1, const Predicate &p2,
7974 const char *provenance = NULL);
7975
7986 Predicate predicate_or(Context ctx,
7987 const Predicate &p1, const Predicate &p2,
7988 const char *provenance = NULL);
7989
7996 Predicate create_predicate(Context ctx,const PredicateLauncher &launcher);
7997
8006 Future get_predicate_future(Context ctx, const Predicate &p,
8007 const char *provenance = NULL);
8008 public:
8009 //------------------------------------------------------------------------
8010 // Lock Operations
8011 //------------------------------------------------------------------------
8017 Lock create_lock(Context ctx);
8018
8029 void destroy_lock(Context ctx, Lock l);
8030
8043 Grant acquire_grant(Context ctx,
8044 const std::vector<LockRequest> &requests);
8045
8055 void release_grant(Context ctx, Grant grant);
8056 public:
8057 //------------------------------------------------------------------------
8058 // Phase Barrier operations
8059 //------------------------------------------------------------------------
8069 PhaseBarrier create_phase_barrier(Context ctx, unsigned arrivals);
8070
8081 void destroy_phase_barrier(Context ctx, PhaseBarrier pb);
8082
8098 PhaseBarrier advance_phase_barrier(Context ctx, PhaseBarrier pb);
8099 public:
8100 //------------------------------------------------------------------------
8101 // Dynamic Collective operations
8102 //------------------------------------------------------------------------
8117 DynamicCollective create_dynamic_collective(Context ctx,
8118 unsigned arrivals,
8119 ReductionOpID redop,
8120 const void *init_value,
8121 size_t init_size);
8122
8129 void destroy_dynamic_collective(Context ctx, DynamicCollective dc);
8130
8140 void arrive_dynamic_collective(Context ctx,
8142 const void *buffer,
8143 size_t size, unsigned count = 1);
8144
8154 void defer_dynamic_collective_arrival(Context ctx,
8156 const Future &f,
8157 unsigned count = 1);
8158
8169 Future get_dynamic_collective_result(Context ctx, DynamicCollective dc,
8170 const char *provenance = NULL);
8171
8180 DynamicCollective advance_dynamic_collective(Context ctx,
8182 public:
8183 //------------------------------------------------------------------------
8184 // User-Managed Software Coherence
8185 //------------------------------------------------------------------------
8192 void issue_acquire(Context ctx, const AcquireLauncher &launcher);
8193
8200 void issue_release(Context ctx, const ReleaseLauncher &launcher);
8201 public:
8202 //------------------------------------------------------------------------
8203 // Fence Operations
8204 //------------------------------------------------------------------------
8213 Future issue_mapping_fence(Context ctx, const char *provenance = NULL);
8214
8224 Future issue_execution_fence(Context ctx, const char *provenance = NULL);
8225 public:
8226 //------------------------------------------------------------------------
8227 // Tracing Operations
8228 //------------------------------------------------------------------------
8258 void begin_trace(Context ctx, TraceID tid, bool logical_only = false,
8259 bool static_trace = false, const std::set<RegionTreeID> *managed = NULL,
8260 const char *provenance = NULL);
8264 void end_trace(Context ctx, TraceID tid, const char *provenance = NULL);
8279 LEGION_DEPRECATED("Use begin_trace with static_trace=true")
8280 void begin_static_trace(Context ctx,
8281 const std::set<RegionTreeID> *managed = NULL);
8286 LEGION_DEPRECATED("Use end_trace")
8287 void end_static_trace(Context ctx);
8288
8293 TraceID generate_dynamic_trace_id(void);
8294
8305 TraceID generate_library_trace_ids(const char *name, size_t count);
8306
8314 static TraceID generate_static_trace_id(void);
8315 public:
8316 //------------------------------------------------------------------------
8317 // Frame Operations
8318 //------------------------------------------------------------------------
8332 void complete_frame(Context ctx, const char *provenance = NULL);
8333 public:
8334 //------------------------------------------------------------------------
8335 // Must Parallelism
8336 //------------------------------------------------------------------------
8344 FutureMap execute_must_epoch(Context ctx,
8345 const MustEpochLauncher &launcher);
8346 public:
8347 //------------------------------------------------------------------------
8348 // Tunable Variables
8349 //------------------------------------------------------------------------
8350
8364 Future select_tunable_value(Context ctx, TunableID tid,
8365 MapperID mapper = 0, MappingTagID tag = 0,
8366 const void *args = NULL, size_t argsize = 0);
8367 Future select_tunable_value(Context ctx, const TunableLauncher &launcher);
8368
8375 LEGION_DEPRECATED("Tunable values should now be obtained via the "
8376 "generic interface that returns a future result.")
8377 int get_tunable_value(Context ctx, TunableID tid,
8378 MapperID mapper = 0, MappingTagID tag = 0);
8379 public:
8380 //------------------------------------------------------------------------
8381 // Task Local Interface
8382 //------------------------------------------------------------------------
8388 const Task* get_local_task(Context ctx);
8389
8397 void* get_local_task_variable_untyped(Context ctx, LocalVariableID id);
8398 template<typename T>
8399 T* get_local_task_variable(Context ctx, LocalVariableID id);
8400
8411 void set_local_task_variable_untyped(Context ctx, LocalVariableID id,
8412 const void *value, void (*destructor)(void*) = NULL);
8413 template<typename T>
8414 void set_local_task_variable(Context ctx, LocalVariableID id,
8415 const T* value, void (*destructor)(void*) = NULL);
8416 public:
8417 //------------------------------------------------------------------------
8418 // Timing Operations
8419 //------------------------------------------------------------------------
8428 Future get_current_time(Context ctx, Future precondition = Future());
8429
8438 Future get_current_time_in_microseconds(Context ctx,
8439 Future precondition = Future());
8440
8449 Future get_current_time_in_nanoseconds(Context ctx,
8450 Future precondition = Future());
8451
8458 Future issue_timing_measurement(Context ctx,
8459 const TimingLauncher &launcher);
8460
8467 static long long get_zero_time(void);
8468 public:
8469 //------------------------------------------------------------------------
8470 // Miscellaneous Operations
8471 //------------------------------------------------------------------------
8486 Mapping::Mapper* get_mapper(Context ctx, MapperID id,
8487 Processor target = Processor::NO_PROC);
8488
8502 Mapping::MapperContext begin_mapper_call(Context ctx, MapperID id,
8503 Processor target = Processor::NO_PROC);
8504
8510 void end_mapper_call(Mapping::MapperContext ctx);
8511
8518 Processor get_executing_processor(Context ctx);
8519
8526 const Task* get_current_task(Context ctx);
8527
8542 size_t query_available_memory(Context ctx, Memory target);
8543
8553 void release_memory_pool(Context ctx, Memory target);
8554
8571 void raise_region_exception(Context ctx, PhysicalRegion region,
8572 bool nuclear);
8573
8584 void yield(Context ctx);
8585
8623 void concurrent_task_barrier(Context ctx);
8624
8636 void start_profiling_range(Context ctx);
8637 void stop_profiling_range(Context ctx, const char *provenance);
8638 public:
8639 //------------------------------------------------------------------------
8640 // MPI Interoperability
8641 //------------------------------------------------------------------------
8645 bool is_MPI_interop_configured(void);
8646
8654 const std::map<int/*rank*/,AddressSpace>& find_forward_MPI_mapping(void);
8655
8663 const std::map<AddressSpace,int/*rank*/>& find_reverse_MPI_mapping(void);
8664
8668 int find_local_MPI_rank(void);
8669 public:
8670 //------------------------------------------------------------------------
8671 // Semantic Information
8672 //------------------------------------------------------------------------
8682 void attach_semantic_information(TaskID task_id, SemanticTag tag,
8683 const void *buffer, size_t size,
8684 bool is_mutable = false, bool local_only = false);
8685
8694 void attach_semantic_information(IndexSpace handle, SemanticTag tag,
8695 const void *buffer, size_t size, bool is_mutable = false);
8696
8705 void attach_semantic_information(IndexPartition handle, SemanticTag tag,
8706 const void *buffer, size_t size, bool is_mutable = false);
8707
8716 void attach_semantic_information(FieldSpace handle, SemanticTag tag,
8717 const void *buffer, size_t size, bool is_mutable = false);
8718
8728 void attach_semantic_information(FieldSpace handle, FieldID fid,
8729 SemanticTag tag, const void *buffer,
8730 size_t size, bool is_mutable = false);
8731
8740 void attach_semantic_information(LogicalRegion handle, SemanticTag tag,
8741 const void *buffer, size_t size, bool is_mutable = false);
8742
8751 void attach_semantic_information(LogicalPartition handle,
8752 SemanticTag tag, const void *buffer,
8753 size_t size, bool is_mutable = false);
8754
8762 void attach_name(TaskID task_id, const char *name,
8763 bool is_mutable = false,
8764 bool local_only = false);
8765
8772 void attach_name(IndexSpace handle, const char *name,
8773 bool is_mutable = false);
8774
8781 void attach_name(IndexPartition handle, const char *name,
8782 bool is_mutable = false);
8783
8790 void attach_name(FieldSpace handle, const char *name,
8791 bool is_mutable = false);
8792
8800 void attach_name(FieldSpace handle, FieldID fid,
8801 const char *name, bool is_mutable = false);
8802
8809 void attach_name(LogicalRegion handle, const char *name,
8810 bool is_mutable = false);
8811
8818 void attach_name(LogicalPartition handle, const char *name,
8819 bool is_mutable = false);
8820
8831 bool retrieve_semantic_information(TaskID task_id, SemanticTag tag,
8832 const void *&result, size_t &size,
8833 bool can_fail = false,
8834 bool wait_until_ready = false);
8835
8846 bool retrieve_semantic_information(IndexSpace handle, SemanticTag tag,
8847 const void *&result, size_t &size,
8848 bool can_fail = false,
8849 bool wait_until_ready = false);
8850
8861 bool retrieve_semantic_information(IndexPartition handle, SemanticTag tag,
8862 const void *&result, size_t &size,
8863 bool can_fail = false,
8864 bool wait_until_ready = false);
8865
8876 bool retrieve_semantic_information(FieldSpace handle, SemanticTag tag,
8877 const void *&result, size_t &size,
8878 bool can_fail = false,
8879 bool wait_until_ready = false);
8880
8892 bool retrieve_semantic_information(FieldSpace handle, FieldID fid,
8893 SemanticTag tag,
8894 const void *&result, size_t &size,
8895 bool can_fail = false,
8896 bool wait_until_ready = false);
8897
8908 bool retrieve_semantic_information(LogicalRegion handle, SemanticTag tag,
8909 const void *&result, size_t &size,
8910 bool can_fail = false,
8911 bool wait_until_ready = false);
8912
8923 bool retrieve_semantic_information(LogicalPartition handle,
8924 SemanticTag tag,
8925 const void *&result, size_t &size,
8926 bool can_fail = false,
8927 bool wait_until_ready = false);
8928
8934 void retrieve_name(TaskID task_id, const char *&result);
8935
8941 void retrieve_name(IndexSpace handle, const char *&result);
8942
8948 void retrieve_name(IndexPartition handle, const char *&result);
8949
8955 void retrieve_name(FieldSpace handle, const char *&result);
8956
8963 void retrieve_name(FieldSpace handle, FieldID fid, const char *&result);
8964
8970 void retrieve_name(LogicalRegion handle, const char *&result);
8971
8977 void retrieve_name(LogicalPartition handle, const char *&result);
8978
8979 public:
8980 //------------------------------------------------------------------------
8981 // Printing operations, these are useful for only generating output
8982 // from a single task if the task has been replicated (either directly
8983 // or as part of control replication).
8984 //------------------------------------------------------------------------
8992 void print_once(Context ctx, FILE *f, const char *message);
8993
9000 void log_once(Context ctx, Realm::LoggerMessage &message);
9001 public:
9002 //------------------------------------------------------------------------
9003 // Registration Callback Operations
9004 // All of these calls must be made while in the registration
9005 // function called before start-up. This function is specified
9006 // by calling the 'set_registration_callback' static method.
9007 //------------------------------------------------------------------------
9008
9013 Mapping::MapperRuntime* get_mapper_runtime(void);
9014
9019 MapperID generate_dynamic_mapper_id(void);
9020
9031 MapperID generate_library_mapper_ids(const char *name, size_t count);
9032
9040 static MapperID generate_static_mapper_id(void);
9041
9053 void add_mapper(MapperID map_id, Mapping::Mapper *mapper,
9054 Processor proc = Processor::NO_PROC);
9055
9067 void replace_default_mapper(Mapping::Mapper *mapper,
9068 Processor proc = Processor::NO_PROC);
9069
9070 public:
9075 ProjectionID generate_dynamic_projection_id(void);
9076
9087 ProjectionID generate_library_projection_ids(const char *name,
9088 size_t count);
9089
9097 static ProjectionID generate_static_projection_id(void);
9098
9112 void register_projection_functor(ProjectionID pid,
9113 ProjectionFunctor *functor,
9114 bool silence_warnings = false,
9115 const char *warning_string = NULL);
9116
9126 static void preregister_projection_functor(ProjectionID pid,
9127 ProjectionFunctor *functor);
9128
9135 static ProjectionFunctor* get_projection_functor(ProjectionID pid);
9136
9141 ShardingID generate_dynamic_sharding_id(void);
9142
9153 ShardingID generate_library_sharding_ids(const char *name, size_t count);
9154
9162 static ShardingID generate_static_sharding_id(void);
9163
9176 void register_sharding_functor(ShardingID sid,
9177 ShardingFunctor *functor,
9178 bool silence_warnings = false,
9179 const char *warning_string = NULL);
9180
9191 static void preregister_sharding_functor(ShardingID sid,
9192 ShardingFunctor *functor);
9193
9200 static ShardingFunctor* get_sharding_functor(ShardingID sid);
9201
9206 ConcurrentID generate_dynamic_concurrent_id(void);
9207
9218 ConcurrentID generate_library_concurrent_ids(const char *name,
9219 size_t count);
9220
9228 static ConcurrentID generate_static_concurrent_id(void);
9229
9243 void register_concurrent_coloring_functor(ConcurrentID cid,
9245 bool silence_warnings = false,
9246 const char *warning_string = NULL);
9247
9257 static void preregister_concurrent_coloring_functor(ConcurrentID cid,
9258 ConcurrentColoringFunctor *functor);
9259
9266 static ConcurrentColoringFunctor* get_concurrent_coloring_functor(
9267 ConcurrentID cid);
9268 public:
9273 ReductionOpID generate_dynamic_reduction_id(void);
9274
9285 ReductionOpID generate_library_reduction_ids(const char *name,
9286 size_t count);
9287
9295 static ReductionOpID generate_static_reduction_id(void);
9296
9311 template<typename REDOP>
9312 static void register_reduction_op(ReductionOpID redop_id,
9313 bool permit_duplicates = false);
9314
9335 static void register_reduction_op(ReductionOpID redop_id,
9336 ReductionOp *op,
9337 SerdezInitFnptr init_fnptr = NULL,
9338 SerdezFoldFnptr fold_fnptr = NULL,
9339 bool permit_duplicates = false);
9340
9346 static const ReductionOp* get_reduction_op(ReductionOpID redop_id);
9347
9348#ifdef LEGION_GPU_REDUCTIONS
9349 template<typename REDOP>
9350 LEGION_DEPRECATED("Use register_reduction_op instead")
9351 static void preregister_gpu_reduction_op(ReductionOpID redop_id);
9352#endif
9353 public:
9358 CustomSerdezID generate_dynamic_serdez_id(void);
9359
9370 CustomSerdezID generate_library_serdez_ids(const char *name,
9371 size_t count);
9372
9380 static CustomSerdezID generate_static_serdez_id(void);
9381
9395 template<typename SERDEZ>
9396 static void register_custom_serdez_op(CustomSerdezID serdez_id,
9397 bool permit_duplicates = false);
9398
9411 static void register_custom_serdez_op(CustomSerdezID serdez_id,
9412 SerdezOp *serdez_op,
9413 bool permit_duplicates = false);
9414
9420 static const SerdezOp* get_serdez_op(CustomSerdezID serdez_id);
9421 public:
9422 //------------------------------------------------------------------------
9423 // Start-up Operations
9424 // Everything below here is a static function that is used to configure
9425 // the runtime prior to calling the start method to begin execution.
9426 //------------------------------------------------------------------------
9427 public:
9433 static const char* get_legion_version(void);
9434
9641 static int start(int argc, char **argv, bool background = false,
9642 bool supply_default_mapper = true, bool filter = false);
9643
9659 static void initialize(int *argc, char ***argv,
9660 bool filter = false, bool parse = true);
9661
9667 static int wait_for_shutdown(void);
9668
9676 static void set_return_code(int return_code);
9677
9685 static void set_top_level_task_id(TaskID top_id);
9686
9693 static void set_top_level_task_mapper_id(MapperID mapper_id);
9694
9702
9721 Context begin_implicit_task(TaskID top_task_id,
9722 MapperID mapper_id,
9723 Processor::Kind proc_kind,
9724 const char *task_name = NULL,
9725 bool control_replicable = false,
9726 unsigned shard_per_address_space = 1,
9727 int shard_id = -1,
9728 DomainPoint shard_point = DomainPoint());
9729
9738
9746
9757 void finish_implicit_task(Context ctx,
9758 Realm::Event effects = Realm::Event::NO_EVENT);
9759
9765 static size_t get_maximum_dimension(void);
9766
9776 static void configure_MPI_interoperability(int rank);
9777
9791 static LegionHandshake create_external_handshake(bool init_in_ext = true,
9792 int ext_participants = 1,
9793 int legion_participants = 1);
9794
9806 static MPILegionHandshake create_handshake(bool init_in_MPI = true,
9807 int mpi_participants = 1,
9808 int legion_participants = 1);
9809
9820 template<LogicalRegion (*PROJ_PTR)(LogicalRegion, const DomainPoint&,
9821 Runtime*)>
9822 LEGION_DEPRECATED("Projection functions should now be specified "
9823 "using projection functor objects")
9824 static ProjectionID register_region_function(ProjectionID handle);
9825
9835 template<LogicalRegion (*PROJ_PTR)(LogicalPartition, const DomainPoint&,
9836 Runtime*)>
9837 LEGION_DEPRECATED("Projection functions should now be specified "
9838 "using projection functor objects")
9839 static ProjectionID register_partition_function(ProjectionID handle);
9840 public:
9857 static void add_registration_callback(RegistrationCallbackFnptr callback,
9858 bool dedup = true, size_t dedup_tag = 0);
9859 static void add_registration_callback(
9860 RegistrationWithArgsCallbackFnptr callback, const UntypedBuffer &buffer,
9861 bool dedup = true, size_t dedup_tag = 0);
9862
9888 RegistrationCallbackFnptr callback, bool global,
9889 bool deduplicate = true, size_t dedup_tag = 0);
9890 static void perform_registration_callback(
9891 RegistrationWithArgsCallbackFnptr callback,
9892 const UntypedBuffer &buffer, bool global,
9893 bool deduplicate = true , size_t dedup_tag = 0);
9894
9906 LEGION_DEPRECATED("Legion now supports multiple registration callbacks "
9907 "added via the add_registration_callback method.")
9908 static void set_registration_callback(RegistrationCallbackFnptr callback);
9909
9915 static const InputArgs& get_input_args(void);
9916 public:
9920 static void enable_profiling(void);
9924 static void disable_profiling(void);
9928 static void dump_profiling(void);
9929 public:
9930 //------------------------------------------------------------------------
9931 // Layout Registration Operations
9932 //------------------------------------------------------------------------
9941 LayoutConstraintID register_layout(
9942 const LayoutConstraintRegistrar &registrar);
9943
9949 void release_layout(LayoutConstraintID layout_id);
9950
9962 static LayoutConstraintID preregister_layout(
9963 const LayoutConstraintRegistrar &registrar,
9964 LayoutConstraintID layout_id =
9965 LEGION_AUTO_GENERATE_ID);
9966
9972 FieldSpace get_layout_constraint_field_space(
9973 LayoutConstraintID layout_id);
9974
9980 void get_layout_constraints(LayoutConstraintID layout_id,
9981 LayoutConstraintSet &layout_constraints);
9982
9988 const char* get_layout_constraints_name(LayoutConstraintID layout_id);
9989 public:
9990 //------------------------------------------------------------------------
9991 // Task Registration Operations
9992 //------------------------------------------------------------------------
9993
9998 TaskID generate_dynamic_task_id(void);
9999
10010 TaskID generate_library_task_ids(const char *name, size_t count);
10011
10019 static TaskID generate_static_task_id(void);
10020
10028 template<typename T,
10029 T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10030 Context, Runtime*)>
10031 VariantID register_task_variant(const TaskVariantRegistrar &registrar,
10032 VariantID vid = LEGION_AUTO_GENERATE_ID);
10033
10042 template<typename T, typename UDT,
10043 T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10044 Context, Runtime*, const UDT&)>
10045 VariantID register_task_variant(const TaskVariantRegistrar &registrar,
10046 const UDT &user_data,
10047 VariantID vid = LEGION_AUTO_GENERATE_ID);
10048
10056 template<
10057 void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10058 Context, Runtime*)>
10059 VariantID register_task_variant(const TaskVariantRegistrar &registrar,
10060 VariantID vid = LEGION_AUTO_GENERATE_ID);
10061
10070 template<typename UDT,
10071 void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10072 Context, Runtime*, const UDT&)>
10073 VariantID register_task_variant(const TaskVariantRegistrar &registrar,
10074 const UDT &user_data,
10075 VariantID vid = LEGION_AUTO_GENERATE_ID);
10076
10096 VariantID register_task_variant(const TaskVariantRegistrar &registrar,
10097 const CodeDescriptor &codedesc,
10098 const void *user_data = NULL,
10099 size_t user_len = 0,
10100 size_t return_type_size =
10101 LEGION_MAX_RETURN_SIZE,
10102 VariantID vid = LEGION_AUTO_GENERATE_ID,
10103 bool has_return_type_size = true);
10104
10115 template<typename T,
10116 T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10117 Context, Runtime*)>
10118 static VariantID preregister_task_variant(
10119 const TaskVariantRegistrar &registrar,
10120 const char *task_name = NULL,
10121 VariantID vid = LEGION_AUTO_GENERATE_ID);
10122
10134 template<typename T, typename UDT,
10135 T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10136 Context, Runtime*, const UDT&)>
10137 static VariantID preregister_task_variant(
10138 const TaskVariantRegistrar &registrar,
10139 const UDT &user_data,
10140 const char *task_name = NULL,
10141 VariantID vid = LEGION_AUTO_GENERATE_ID);
10142
10153 template<
10154 void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10155 Context, Runtime*)>
10156 static VariantID preregister_task_variant(
10157 const TaskVariantRegistrar &registrar,
10158 const char *task_name = NULL,
10159 VariantID vid = LEGION_AUTO_GENERATE_ID);
10160
10172 template<typename UDT,
10173 void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10174 Context, Runtime*, const UDT&)>
10175 static VariantID preregister_task_variant(
10176 const TaskVariantRegistrar &registrar, const UDT &user_data,
10177 const char *task_name = NULL,
10178 VariantID vid = LEGION_AUTO_GENERATE_ID);
10179
10201 static VariantID preregister_task_variant(
10202 const TaskVariantRegistrar &registrar,
10203 const CodeDescriptor &codedesc,
10204 const void *user_data = NULL,
10205 size_t user_len = 0,
10206 const char *task_name = NULL,
10207 VariantID vid = LEGION_AUTO_GENERATE_ID,
10208 size_t return_type_size = LEGION_MAX_RETURN_SIZE,
10209 bool has_return_type_size = true,
10210 bool check_task_id = true);
10211
10225 static void legion_task_preamble(const void *data, size_t datalen,
10226 Processor p, const Task *& task,
10227 const std::vector<PhysicalRegion> *& reg,
10228 Context& ctx, Runtime *& runtime);
10229
10247 static void legion_task_postamble(Context ctx,
10248 const void *retvalptr = NULL,
10249 size_t retvalsize = 0,
10250 bool owned = false,
10251 Realm::RegionInstance inst =
10252 Realm::RegionInstance::NO_INST,
10253 const void *metadataptr = NULL,
10254 size_t metadatasize = 0);
10255
10274 static void legion_task_postamble(Context ctx,
10275 const void *retvalptr, size_t retvalsize, bool owned,
10276 const Realm::ExternalInstanceResource &allocation,
10277 void (*freefunc)(const Realm::ExternalInstanceResource&) = NULL,
10278 const void *metadataptr = NULL, size_t metadatasize = 0);
10279
10289 static void legion_task_postamble(Context ctx,
10290 FutureFunctor *callback_functor,
10291 bool owned = false);
10292
10307 static void legion_task_postamble(Context ctx,
10308 const Domain &domain, bool take_ownership,
10309 const void *metadataptr = NULL, size_t metadatasize = 0);
10310 public:
10311 // ------------------ Deprecated task registration -----------------------
10325 template<typename T,
10326 T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10327 Context, Runtime*)>
10328 LEGION_DEPRECATED("Task registration should be done with "
10330 static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10331 bool single, bool index,
10332 VariantID vid =LEGION_AUTO_GENERATE_ID,
10334 const char *task_name = NULL);
10348 template<
10349 void (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10350 Context, Runtime*)>
10351 LEGION_DEPRECATED("Task registration should be done with "
10353 static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10354 bool single, bool index,
10355 VariantID vid =LEGION_AUTO_GENERATE_ID,
10357 const char *task_name = NULL);
10373 template<typename T, typename UDT,
10374 T (*TASK_PTR)(const Task*, const std::vector<PhysicalRegion>&,
10375 Context, Runtime*, const UDT&)>
10376 LEGION_DEPRECATED("Task registration should be done with "
10378 static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10379 bool single, bool index,
10380 const UDT &user_data,
10381 VariantID vid =LEGION_AUTO_GENERATE_ID,
10383 const char *task_name = NULL);
10399 template<typename UDT,
10400 void (*TASK_PTR)(const Task*,const std::vector<PhysicalRegion>&,
10401 Context, Runtime*, const UDT&)>
10402 LEGION_DEPRECATED("Task registration should be done with "
10404 static TaskID register_legion_task(TaskID id, Processor::Kind proc_kind,
10405 bool single, bool index,
10406 const UDT &user_data,
10407 VariantID vid =LEGION_AUTO_GENERATE_ID,
10409 const char *task_name = NULL);
10410 public:
10417 static bool has_runtime(void);
10418
10426 static Runtime* get_runtime(Processor p = Processor::NO_PROC);
10427
10434 static bool has_context(void);
10435
10442 static Context get_context(void);
10443
10449 static const Task* get_context_task(Context ctx);
10450 private:
10451 IndexPartition create_restricted_partition(Context ctx,
10452 IndexSpace parent,
10453 IndexSpace color_space,
10454 const void *transform,
10455 size_t transform_size,
10456 const void *extent,
10457 size_t extent_size,
10458 PartitionKind part_kind, Color color,
10459 const char *provenance);
10460 IndexSpace create_index_space_union_internal(Context ctx,
10461 IndexPartition parent,
10462 const void *realm_color,size_t color_size,
10463 TypeTag type_tag, const char *provenance,
10464 const std::vector<IndexSpace> &handles);
10465 IndexSpace create_index_space_union_internal(Context ctx,
10466 IndexPartition parent,
10467 const void *realm_color,size_t color_size,
10468 TypeTag type_tag, const char *provenance,
10469 IndexPartition handle);
10470 IndexSpace create_index_space_intersection_internal(Context ctx,
10471 IndexPartition parent,
10472 const void *realm_color,size_t color_size,
10473 TypeTag type_tag, const char *provenance,
10474 const std::vector<IndexSpace> &handles);
10475 IndexSpace create_index_space_intersection_internal(Context ctx,
10476 IndexPartition parent,
10477 const void *realm_color,size_t color_size,
10478 TypeTag type_tag, const char *provenance,
10479 IndexPartition handle);
10480 IndexSpace create_index_space_difference_internal(Context ctx,
10481 IndexPartition paretn,
10482 const void *realm_color, size_t color_size,
10483 TypeTag type_tag, const char *provenance,
10484 IndexSpace initial,
10485 const std::vector<IndexSpace> &handles);
10486 IndexSpace get_index_subspace_internal(IndexPartition handle,
10487 const void *realm_color,TypeTag type_tag);
10488 bool has_index_subspace_internal(IndexPartition handle,
10489 const void *realm_color,TypeTag type_tag);
10490 void get_index_partition_color_space_internal(IndexPartition handle,
10491 void *realm_is, TypeTag type_tag);
10492 void get_index_space_domain_internal(IndexSpace handle,
10493 void *realm_is, TypeTag type_tag);
10494 void get_index_space_color_internal(IndexSpace handle,
10495 void *realm_color, TypeTag type_tag);
10496 bool safe_cast_internal(Context ctx, LogicalRegion region,
10497 const void *realm_point,TypeTag type_tag);
10498 LogicalRegion get_logical_subregion_by_color_internal(
10499 LogicalPartition parent,
10500 const void *realm_color,TypeTag type_tag);
10501 bool has_logical_subregion_by_color_internal(
10502 LogicalPartition parent,
10503 const void *realm_color,TypeTag type_tag);
10504 private:
10505 // Methods for the wrapper functions to get information from the runtime
10506 friend class LegionTaskWrapper;
10507 friend class LegionSerialization;
10508 public:
10509 // This method is hidden down here and not publicly documented because
10510 // users shouldn't really need it for anything, however there are some
10511 // reasonable cases where it might be utilitized for things like doing
10512 // file I/O or printf that people might want it for so we've got it
10513 ShardID get_shard_id(Context ctx, bool I_know_what_I_am_doing = false);
10514 // We'll also allow users to get the total number of shards in the context
10515 // if they also ar willing to attest they know what they are doing
10516 size_t get_num_shards(Context ctx, bool I_know_what_I_am_doing = false);
10517 // This is another hidden method for control replication because it's
10518 // still somewhat experimental. In some cases there are unavoidable
10519 // sources of randomness that can mess with the needed invariants for
10520 // control replication (e.g. garbage collectors). This method will
10521 // allow the application to pass in an array of elements from each shard
10522 // and the runtime will fill in an output buffer with an ordered array of
10523 // elements that were passed in by every shard. Each shard will get the
10524 // same elements that were present in all the other shards in the same
10525 // order in the output array. The number of elements in the output buffer
10526 // is returned as a future (of type size_t) as the runtime will return
10527 // immediately and the application can continue running ahead. The
10528 // application must keep the input and output buffers allocated until
10529 // the future resolves. By definition the output buffer need be no bigger
10530 // than the input buffer since only elements that are in the input buffer
10531 // on any shard can appear in the output buffer. Note you can use this
10532 // method safely in contexts that are not control replicated as well:
10533 // the input will just be mem-copied to the output and num_elements
10534 // returned as the future result.
10535 Future consensus_match(Context ctx, const void *input, void *output,
10536 size_t num_elements, size_t element_size, const char *provenance = NULL);
10537 private:
10538 friend class Mapper;
10539 Internal::Runtime *runtime;
10540 };
10541
10542}; // namespace Legion
10543
10544#include "legion/legion.inl"
10545
10546// Include this here so we get the mapper interface in the header file
10547// We have to put it here though since the mapper interface depends
10548// on the rest of the legion interface
10549#include "legion/legion_mapping.h"
10550
10551#endif // __LEGION_RUNTIME_H__
10552#endif // defined LEGION_ENABLE_CXX_BINDINGS
10553
10554// EOF
Definition legion.h:4551
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:4599
Definition legion.h:5045
Definition legion.h:4500
Definition legion.h:3865
Definition legion.h:3827
Definition legion.h:3790
Definition legion_domain.h:253
Definition legion_domain.h:132
Definition legion_domain.h:633
Definition legion.h:843
Definition legion.h:2763
Definition legion.h:2831
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:4617
Definition legion.h:5076
Definition legion.h:1185
void get_memories(std::set< Memory > &memories, 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
Span< T, PM > get_span(Memory::Kind memory, 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
bool is_empty(bool block=false, bool silence_warnings=false, const char *warning_string=NULL) const
bool is_ready(bool subscribe=false) const
Definition legion.h:1406
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:4529
Definition legion_types.h:2988
Definition legion.h:4244
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:4309
void legion_handoff_to_mpi(void) const
Definition legion.h:4340
void mpi_handoff_to_legion(void) const
Definition legion.h:4329
void legion_wait_on_mpi(void) const
Definition legion.h:4345
void mpi_wait_on_legion(void) const
Definition legion.h:4334
Definition legion.h:4358
Definition legion.h:4678
Definition legion.h:4015
Definition legion.h:3396
Definition legion.h:4645
Definition legion.h:807
Definition legion.h:2616
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:3618
Definition legion.h:3658
Definition legion.h:5095
Definition legion.h:656
Definition legion.h:4760
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:4965
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:3128
Definition legion.h:4573
Definition legion.h:5135
static const SerdezOp * get_serdez_op(CustomSerdezID serdez_id)
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 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)
static const char * get_legion_version(void)
IndexSpace subtract_index_spaces(Context ctx, IndexSpace left, IndexSpace right, 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 void initialize(int *argc, char ***argv, bool filter=false, bool parse=true)
static size_t get_maximum_dimension(void)
IndexSpace create_index_space(Context ctx, const Domain &bounds, TypeTag type_tag=0, const char *provenance=NULL, const bool take_ownership=false)
static void add_registration_callback(RegistrationCallbackFnptr callback, bool dedup=true, size_t dedup_tag=0)
Definition legion.h:5001
Definition legion_domain.h:757
Definition legion.h:3693
Definition legion.h:4429
Definition legion_types.h:207
Definition legion_types.h:3512
Definition legion.h:524
Definition legion.h:3959
Definition legion.h:3736
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:4098
Definition legion.h:2230
Definition legion.h:1853
Definition legion.h:2189
Definition legion.h:1148
Definition legion.h:2022
Definition legion.h:2322
Definition legion.h:1934
Definition legion.h:2082
Definition legion.h:1120
Definition legion.h:1663
Definition legion.h:1793
Definition legion.h:4703
Definition legion.h:2478
Definition legion.h:739
Definition legion.h:4205
Definition legion.h:1080
IndexSpace color_space
Definition legion.h:1110
FieldSpace field_space
Definition legion.h:1107
bool global_indexing
Definition legion.h:1108
bool valid_requirement
Definition legion.h:1109
Definition legion.h:2515
Definition legion.h:2412
Definition legion.h:875
ProjectionType handle_type
Definition legion.h:1005
std::set< FieldID > privilege_fields
Definition legion.h:996
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:1006
LogicalRegion parent
Definition legion.h:1000
void * projection_args
Definition legion.h:1008
std::vector< FieldID > instance_fields
Definition legion.h:997
LogicalPartition partition
Definition legion.h:995
RegionRequirement & add_field(FieldID fid, bool instance=true)
MappingTagID tag
Definition legion.h:1002
CoherenceProperty prop
Definition legion.h:999
ReductionOpID redop
Definition legion.h:1001
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:998
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:1009
RegionFlags flags
Definition legion.h:1003
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:994
Definition legion.h:4713
Definition legion.h:4146
Definition legion.h:1518
Definition legion.h:4732
Definition legion.h:1556
Definition legion.h:2546
Definition legion.h:2428
Definition legion.h:2446