16#ifndef __LEGION_TYPES_H__
17#define __LEGION_TYPES_H__
26#include "realm/dynamic_templates.h"
31 REALM_MAX_DIM == LEGION_MAX_DIM,
32 "LEGION_MAX_DIM and REALM_MAX_DIM must be the same");
34#ifdef LEGION_REDOP_COMPLEX
35#ifdef LEGION_REDOP_HALF
38#include "mathtypes/complex.h"
41#ifdef LEGION_REDOP_HALF
42#include "mathtypes/half.h"
45#ifndef LEGION_DEPRECATED
47#define LEGION_DEPRECATED(x) [[deprecated(x)]]
54#define LEGION_DISABLE_DEPRECATED_WARNINGS \
55 _Pragma("warning (push)") \
56 _Pragma("diag_suppress 1445")
57#define LEGION_REENABLE_DEPRECATED_WARNINGS \
58 _Pragma("warning (pop)")
59#elif defined(__GNUC__)
60#define LEGION_DISABLE_DEPRECATED_WARNINGS \
61 _Pragma("GCC diagnostic push") \
62 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
63#define LEGION_REENABLE_DEPRECATED_WARNINGS \
64 _Pragma("GCC diagnostic pop")
65#elif defined(__clang__)
66#define LEGION_DISABLE_DEPRECATED_WARNINGS \
67 _Pragma("clang diagnostic push") \
68 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
69#define LEGION_REENABLE_DEPRECATED_WARNINGS \
70 _Pragma("clang diagnostic pop")
71#elif defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)
72#define LEGION_DISABLE_DEPRECATED_WARNINGS \
73 _Pragma("warning push") \
74 _Pragma("warning disable 1478")
75#define LEGION_REENABLE_DEPRECATED_WARNINGS \
76 _Pragma("warning pop")
78#warning "Don't know how to suppress deprecated warnings for this compiler"
79#define LEGION_DISABLE_DEPRECATED_WARNINGS
80#define LEGION_REENABLE_DEPRECATED_WARNINGS
85#define legion_assert(expr) assert(expr)
87#define legion_no_skip_assert(expr) assert(expr)
90 "Why are you trying to build a debug version of Legion while also defining NDEBUG?"
92template<
typename T1,
typename T2>
93inline T1 legion_safe_cast(T2* ptr)
95 T1 result =
dynamic_cast<T1
>(ptr);
96 legion_assert(result !=
nullptr);
100#define legion_assert(expr) ((void)0)
101#define legion_no_skip_assert(expr) ((void)(expr))
102template<
typename T1,
typename T2>
103inline T1 legion_safe_cast(T2* ptr)
105 return static_cast<T1
>(ptr);
112 typedef ::realm_id_t IDType;
113 typedef ::legion_privilege_mode_t PrivilegeMode;
114 typedef ::legion_allocate_mode_t AllocateMode;
115 typedef ::legion_coherence_property_t CoherenceProperty;
116 typedef ::legion_region_flags_t RegionFlags;
117 typedef ::legion_projection_type_t ProjectionType;
118 typedef ::legion_partition_kind_t PartitionKind;
119 typedef ::legion_external_resource_t ExternalResource;
120 typedef ::legion_timing_measurement_t TimingMeasurement;
121 typedef ::legion_dependence_type_t DependenceType;
122 typedef ::legion_mappable_type_id_t MappableType;
123 typedef ::legion_file_mode_t LegionFileMode;
124 typedef ::legion_execution_constraint_t ExecutionConstraintKind;
125 typedef ::legion_layout_constraint_t LayoutConstraintKind;
126 typedef ::legion_equality_kind_t EqualityKind;
127 typedef ::legion_dimension_kind_t DimensionKind;
128 typedef ::legion_isa_kind_t ISAKind;
129 typedef ::legion_resource_constraint_t ResourceKind;
130 typedef ::legion_launch_constraint_t LaunchKind;
131 typedef ::legion_specialized_constraint_t SpecializedKind;
132 typedef ::legion_unbounded_pool_scope_t UnboundPoolScope;
133 typedef ::legion_projection_type_t HandleType;
134 typedef ::legion_address_space_t AddressSpace;
135 typedef ::legion_task_priority_t TaskPriority;
136 typedef ::legion_task_priority_t RealmPriority;
137 typedef ::legion_garbage_collection_priority_t GCPriority;
138 typedef ::legion_color_t Color;
139 typedef ::legion_field_id_t FieldID;
140 typedef ::legion_trace_id_t TraceID;
141 typedef ::legion_mapper_id_t MapperID;
142 typedef ::legion_context_id_t ContextID;
143 typedef ::legion_instance_id_t InstanceID;
144 typedef ::legion_index_tree_id_t IndexTreeID;
145 typedef ::legion_generation_id_t GenerationID;
146 typedef ::legion_type_handle TypeHandle;
147 typedef ::legion_projection_id_t ProjectionID;
148 typedef ::legion_sharding_id_t ShardingID;
149 typedef ::legion_concurrent_id_t ConcurrentID;
150 typedef ::legion_exception_handler_id_t ExceptionHandlerID;
151 typedef ::legion_region_tree_id_t RegionTreeID;
152 typedef ::legion_distributed_id_t DistributedID;
153 typedef ::legion_address_space_t AddressSpaceID;
154 typedef ::legion_tunable_id_t TunableID;
155 typedef ::legion_local_variable_id_t LocalVariableID;
156 typedef ::legion_mapping_tag_id_t MappingTagID;
157 typedef ::legion_semantic_tag_t SemanticTag;
158 typedef ::legion_variant_id_t VariantID;
159 typedef ::legion_code_descriptor_id_t CodeDescriptorID;
160 typedef ::legion_unique_id_t UniqueID;
161 typedef ::legion_version_id_t VersionID;
162 typedef ::legion_projection_epoch_id_t ProjectionEpochID;
163 typedef ::legion_task_id_t TaskID;
164 typedef ::legion_layout_constraint_id_t LayoutConstraintID;
165 typedef ::legion_shard_id_t ShardID;
166 typedef ::legion_provenance_id_t ProvenanceID;
167 typedef ::legion_internal_color_t LegionColor;
168 typedef ::legion_reduction_op_id_t ReductionOpID;
169 typedef ::legion_custom_serdez_id_t CustomSerdezID;
170 typedef ::legion_coord_t coord_t;
173 typedef Realm::Runtime RealmRuntime;
174 typedef Realm::Machine Machine;
175 typedef Realm::Memory Memory;
176 typedef Realm::Processor Processor;
177 typedef Realm::ProcessorGroup ProcessorGroup;
178 typedef Realm::CodeDescriptor CodeDescriptor;
179 typedef Realm::Reservation Reservation;
180 typedef Realm::CompletionQueue CompletionQueue;
181 typedef Realm::ReductionOpUntyped ReductionOp;
182 typedef Realm::CustomSerdezUntyped SerdezOp;
183 typedef Realm::Machine::ProcessorMemoryAffinity ProcessorMemoryAffinity;
184 typedef Realm::Machine::MemoryMemoryAffinity MemoryMemoryAffinity;
185 typedef Realm::DynamicTemplates::TagType TypeTag;
186 typedef Realm::Logger Logger;
187 template<
int DIM,
typename T = coord_t>
188 using Point = Realm::Point<DIM, T>;
189 template<
int DIM,
typename T = coord_t>
190 using Rect = Realm::Rect<DIM, T>;
191 template<
int DIM,
typename T = coord_t>
192 using DomainT = Realm::IndexSpace<DIM, T>;
193 template<
int M,
int N,
typename T = coord_t>
194 using Transform = Realm::Matrix<M, N, T>;
198 template<
int DIM,
typename T>
200 class IndexPartition;
201 template<
int DIM,
typename T>
202 class IndexPartitionT;
205 template<
int DIM,
typename T>
206 class LogicalRegionT;
207 class LogicalPartition;
208 template<
int DIM,
typename T>
209 class LogicalPartitionT;
210 class IndexAllocator;
211 class FieldAllocator;
218 struct RegionRequirement;
219 struct OutputRequirement;
220 struct IndexSpaceRequirement;
221 struct FieldSpaceRequirement;
223 struct IndexTaskLauncher;
224 typedef IndexTaskLauncher IndexLauncher;
225 struct InlineLauncher;
227 struct AcquireLauncher;
228 struct ReleaseLauncher;
230 struct LayoutConstraintRegistrar;
231 struct TaskVariantRegistrar;
236 class PhysicalRegion;
238 class ExternalResources;
239 class UntypedDeferredValue;
242 template<
typename,
bool>
243 class DeferredReduction;
244 template<
typename,
int,
typename,
bool>
245 class DeferredBuffer;
246 template<
typename COORD_T>
247 class UntypedDeferredBuffer;
248 template<PrivilegeMode,
typename,
int,
typename,
typename,
bool>
250 template<
typename,
bool,
int,
typename,
typename,
bool>
251 class ReductionAccessor;
252 template<
typename,
int,
typename,
typename,
bool>
253 class PaddingAccessor;
254#ifdef LEGION_MULTI_REGION_ACCESSOR
255 template<
typename,
int,
typename,
typename,
bool,
bool,
int>
256 class MultiRegionAccessor;
258 template<
typename,
int,
typename,
typename>
260 namespace ArraySyntax {
261 template<
typename, PrivilegeMode>
267 template<
int,
typename>
269 template<PrivilegeMode,
typename,
int,
typename>
290 struct SerdezRedopFns;
292 template<
typename FT,
int N,
typename T = ::legion_coord_t>
293 using GenericAccessor = Realm::GenericAccessor<FT, N, T>;
294 template<
typename FT,
int N,
typename T = ::legion_coord_t>
295 using AffineAccessor = Realm::AffineAccessor<FT, N, T>;
296 template<
typename FT,
int N,
typename T = ::legion_coord_t>
297 using MultiAffineAccessor = Realm::MultiAffineAccessor<FT, N, T>;
298 class LegionTaskWrapper;
299 class LegionSerialization;
300 class CObjectWrapper;
339 typedef std::map<CustomSerdezID, const Realm::CustomSerdezUntyped*>
341 typedef std::map<Realm::ReductionOpID, Realm::ReductionOpUntyped*>
343 typedef void (*SerdezInitFnptr)(
const ReductionOp*,
void*&,
size_t&);
344 typedef void (*SerdezFoldFnptr)(
345 const ReductionOp*,
void*&,
size_t&,
const void*);
346 using SerdezInitFunc =
347 std::function<void(
const ReductionOp*,
void*&,
size_t&)>;
348 using SerdezFoldFunc =
349 std::function<void(
const ReductionOp*,
void*&,
size_t&,
const void*)>;
350 typedef std::map<Realm::ReductionOpID, SerdezRedopFns> SerdezRedopTable;
352 typedef void (*RegistrationCallbackFnptr)(
353 Machine machine,
Runtime* rt,
const std::set<Processor>& local_procs);
354 using RegistrationCallback =
355 std::function<void(Machine,
Runtime*,
const std::set<Processor>&)>;
356 typedef void (*RegistrationWithArgsCallbackFnptr)(
358 using RegistrationWithArgsCallback =
367 class PhysicalInstance;
368 class CollectiveView;
370 class ProfilingRequestSet;
382 enum ProfilingMeasurementID {
383 PMID_LEGION_FIRST = Realm::PMID_REALM_LAST,
384 PMID_RUNTIME_OVERHEAD,
402 class FieldAllocatorImpl;
403 class ArgumentMapImpl;
404 class FutureCreateInstanceRequest;
405 class FutureMapFutureRequest;
407 class FutureInstance;
409 class ReplFutureMapImpl;
410 class PhysicalRegionImpl;
411 class OutputRegionImpl;
412 class ExternalResourcesImpl;
413 class PieceIteratorImpl;
417 typedef HandshakeImpl LegionHandshakeImpl;
418 class MessageManager;
419 class ShutdownManager;
420 class ProcessorManager;
423 class VirtualChannel;
424 class MessageManager;
425 class ShutdownManager;
428 class LayoutConstraints;
429 class ProjectionFunction;
430 class ShardingFunction;
453 class DynamicCollectiveOp;
459 class PendingPartitionOp;
460 class DependentPartitionOp;
461 class PointDepPartOp;
478 class ExternalMappable;
483 class RemoteAcquireOp;
484 class RemoteReleaseOp;
486 class RemotePartitionOp;
487 class RemoteReplayOp;
488 class RemoteSummaryOp;
489 template<
typename OP>
491 template<
typename OP>
493 struct PointwiseDependence;
500 class IndividualTask;
509 class TopLevelContext;
510 class ReplicateContext;
516 class TraceRecurrentOp;
517 class TraceCompleteOp;
520 class TraceConditionSet;
521 class PhysicalTemplate;
522 class ShardedPhysicalTemplate;
526 class CreateApUserEvent;
529 class AssignFenceCompletion;
533 class GetOpTermEvent;
534 class SetOpSyncEvent;
536 class CompleteReplay;
539 class BarrierArrival;
540 class BarrierAdvance;
541 class TraceRecognizer;
542 class TraceHashRecorder;
544 class CopyAcrossExecutor;
545 class CopyAcrossUnstructured;
546 class IndexSpaceExpression;
547 class IndexSpaceOperation;
548 template<
int DIM,
typename T>
550 template<
int DIM,
typename T>
552 template<
int DIM,
typename T>
554 template<
int DIM,
typename T>
556 class ExpressionTrieNode;
558 class IndexSpaceNode;
559 template<
int DIM,
typename T>
562 template<
int DIM,
typename T>
564 class FieldSpaceNode;
565 class RegionTreeNode;
568 class ColorSpaceIterator;
569 template<
int DIM,
typename T>
572 template<
int DIM,
typename T,
typename RT =
void>
575 template<
int DIM,
typename T>
578 class RegionTreePath;
583 class LogicalAnalysis;
584 class PhysicalAnalysis;
585 class ValidInstAnalysis;
586 class InvalidInstAnalysis;
587 class AntivalidInstAnalysis;
588 class RegistrationAnalysis;
589 class CollectiveAnalysis;
590 class UpdateAnalysis;
591 class CopyAcrossAnalysis;
592 class AcquireAnalysis;
593 class ReleaseAnalysis;
594 class OverwriteAnalysis;
595 class FilterAnalysis;
596 class EquivalenceSet;
598 class VersionManager;
600 class ProjectionNode;
601 class ProjectionRegion;
602 class ProjectionPartition;
603 class RefinementTracker;
604 class RegionRefinementTracker;
605 class PartitionRefinementTracker;
607 class CopyFillAggregator;
610 class ImplicitReferenceTracker;
611 class DistributedCollectable;
612 class LayoutDescription;
613 class InstanceManager;
614 class CopyAcrossHelper;
618 class CollectableView;
619 class IndividualView;
623 class CollectiveView;
624 class MaterializedView;
625 class ReplicatedView;
635 class VirtualManager;
636 class PhysicalManager;
637 class InstanceBuilder;
639 class RegionAnalyzer;
644 struct LogicalTraceInfo;
646 struct PhysicalTraceInfo;
651 struct FieldDataDescriptor;
652 class ProjectionSummary;
653 class ProjectionInfo;
655 class LegionProfiler;
656 class LegionProfInstance;
658 class MappingCallInfo;
660 class SerializingManager;
661 class ConcurrentManager;
663 class ShardedMapping;
664 class ReplIndividualTask;
666 class ReplMergeCloseOp;
667 class ReplRefinementOp;
670 class ReplIndexFillOp;
673 class ReplIndexCopyOp;
674 class ReplDeletionOp;
675 class ReplPendingPartitionOp;
676 class ReplDependentPartitionOp;
677 class ReplPredicateImpl;
678 class ReplMustEpochOp;
681 class ReplAllReduceOp;
685 class ReplIndexAttachOp;
687 class ReplIndexDetachOp;
691 class ReplTraceBeginOp;
692 class ReplTraceRecurrentOp;
693 class ReplTraceCompleteOp;
695 class CollectiveMapping;
697 class ImplicitShardManager;
698 class ShardCollective;
699 class GatherCollective;
706 template<
typename T,
bool>
708 class CrossProductCollective;
709 class ShardingGatherCollective;
710 class FieldDescriptorExchange;
711 class FieldDescriptorGather;
712 class FutureBroadcast;
713 class FutureExchange;
714 class FutureNameExchange;
715 class MustEpochMappingBroadcast;
716 class MustEpochMappingExchange;
717 class PredicateCollective;
718 class UnorderedExchange;
719 class ShardRendezvous;
720 class ProjectionTreeExchange;
721 class TimeoutMatchExchange;
722 class ConcurrentAllreduce;
723 class BufferBroadcast;
724 class CreateCollectiveFillView;
727 constexpr LegionColor INVALID_COLOR =
728 std::numeric_limits<LegionColor>::max();
730 typedef Realm::RegionInstance PhysicalInstance;
731 typedef Realm::CopySrcDstField CopySrcDstField;
732 typedef unsigned long long CollectiveID;
733 typedef unsigned long long IndexSpaceExprID;
734 typedef uint64_t LamportClock;
735 struct ContextCoordinate;
736 typedef ContextCoordinate TraceLocalID;
737 class TaskTreeCoordinates;
740 Realm::DIMCOUNTS, Realm::DIMTYPES> {
741 typedef Realm::DynamicTemplates::ListProduct2<
742 Realm::DIMCOUNTS, Realm::DIMTYPES>
745 template<
int N,
typename T>
746 __LEGION_CUDA_HD__
static inline constexpr TypeTag encode_tag(
void)
748 constexpr TypeTag type =
749 SUPER::template encode_tag<Realm::DynamicTemplates::Int<N>, T>();
750 static_assert(type != 0,
"All types should be non-zero for Legion");
753 template<
int N,
typename T>
754 static inline void check_type(
const TypeTag t)
756 legion_assert((encode_tag<N, T>() == t));
760 template<
typename N,
typename T>
761 static inline void demux(
int* result)
766 static inline int get_dim(
const TypeTag t)
769 SUPER::demux<DimHelper>(t, &result);
778 typedef Mapping::ProfilingMeasurementID ProfilingMeasurementID;
782 typedef Internal::TaskContext* Context;
785 typedef Internal::MappingCallInfo* MapperContext;
786 typedef Internal::InstanceManager* PhysicalInstanceImpl;
787 typedef Internal::CollectiveView* CollectiveViewImpl;
791 typedef Internal::LocalLock LocalLock;
802 static const LgEvent NO_LG_EVENT;
804 LgEvent(
void)
noexcept {
id = 0; }
806 explicit LgEvent(
const Realm::Event e) {
id = e.id; }
811 inline void wait(
void)
const;
812 inline void wait_faultaware(
bool& poisoned,
bool from_application)
const;
813 inline bool is_barrier(
void)
const;
815 void begin_wait(Context ctx,
bool from_application)
const;
816 void end_wait(Context ctx,
bool from_application)
const;
817 void begin_mapper_call_wait(MappingCallInfo* call)
const;
818 void record_event_wait(Realm::Backtrace& bt, ProvenanceID pid)
const;
819 void record_event_trigger(
LgEvent precondition)
const;
842 inline operator Realm::UserEvent()
const
852 static const ApEvent NO_AP_EVENT;
860 inline bool has_triggered_faultignorant(
void)
const
862 bool poisoned =
false;
863 return has_triggered_faultaware(poisoned);
865 inline void wait_faultaware(
bool& poisoned)
const
867 return LgEvent::wait_faultaware(poisoned,
true );
869 inline void wait_faultignorant(
void)
const
871 bool poisoned =
false;
872 LgEvent::wait_faultaware(poisoned,
true );
877 inline bool has_triggered(
void)
const {
return LgEvent::has_triggered(); }
878 inline void wait(
void)
const { LgEvent::wait(); }
890 inline operator Realm::UserEvent()
const
904 explicit ApBarrier(
const Realm::Barrier& b)
905 :
ApEvent(b), timestamp(b.timestamp)
909 inline operator Realm::Barrier()
const
913 b.timestamp = timestamp;
917 inline bool get_result(
void* value,
size_t value_size)
const
921 b.timestamp = timestamp;
922 return b.get_result(value, value_size);
924 inline void destroy_barrier(
void)
928 b.timestamp = timestamp;
932 Realm::Barrier::timestamp_t timestamp;
937 static const RtEvent NO_RT_EVENT;
956 inline operator Realm::UserEvent()
const
970 explicit RtBarrier(
const Realm::Barrier& b)
971 :
RtEvent(b), timestamp(b.timestamp)
975 inline operator Realm::Barrier()
const
979 b.timestamp = timestamp;
983 inline bool get_result(
void* value,
size_t value_size)
const
987 b.timestamp = timestamp;
988 return b.get_result(value, value_size);
990 inline RtBarrier get_previous_phase(
void)
994 return RtBarrier(b.get_previous_phase());
996 inline void destroy_barrier(
void)
1000 b.timestamp = timestamp;
1001 b.destroy_barrier();
1004 Realm::Barrier::timestamp_t timestamp;
1022 inline RtEvent wrlock(
void) {
return RtEvent(reservation.wrlock()); }
1023 inline RtEvent rdlock(
void) {
return RtEvent(reservation.rdlock()); }
1024 inline bool trylock(
void) {
return reservation.trylock(); }
1025 inline bool trywrlock(
void) {
return reservation.trywrlock(); }
1026 inline bool tryrdlock(
void) {
return reservation.tryrdlock(); }
1027 inline void unlock(
void) { reservation.unlock(); }
1029 inline void advise_sleep_entry(Realm::UserEvent guard)
1031 reservation.advise_sleep_entry(guard);
1033 inline void advise_sleep_exit(
void) { reservation.advise_sleep_exit(); }
1035 Realm::FastReservation reservation;
1042 inline Runtime* runtime =
nullptr;
1046 enum SpyLoggingLevel {
1053 inline SpyLoggingLevel spy_logging_level = HEAVY_SPY_LOGGING;
1055 inline SpyLoggingLevel spy_logging_level = NO_SPY_LOGGING;
1060 inline thread_local TaskContext* implicit_context =
nullptr;
1062 inline thread_local MappingCallInfo* implicit_mapper_call =
nullptr;
1064 inline thread_local LegionProfInstance* implicit_profiler =
nullptr;
1067 inline thread_local AutoLock* local_lock_list =
nullptr;
1070 inline thread_local DistributedID implicit_enclosing_context = 0;
1074 inline thread_local Operation* implicit_operation =
nullptr;
1078 inline thread_local ProvenanceID implicit_provenance = 0;
1082 inline thread_local ::legion_unique_id_t implicit_unique_op_id = 0;
1087 inline thread_local LgEvent implicit_fevent = {};
1090 enum RegistrationCallbackMode {
1091 NO_REGISTRATION_CALLBACK = 0,
1092 LOCAL_REGISTRATION_CALLBACK = 1,
1093 GLOBAL_REGISTRATION_CALLBACK = 2,
1095 inline thread_local RegistrationCallbackMode inside_registration_callback =
1096 NO_REGISTRATION_CALLBACK;
1103 inline thread_local ImplicitReferenceTracker* implicit_reference_tracker =
1105#ifdef LEGION_DEBUG_CALLERS
1106 thread_local LgTaskID implicit_task_kind;
1107 thread_local LgTaskID implicit_task_caller;
1109 extern Realm::Logger log_legion;
1110 extern Realm::Logger log_allocation;
1111 extern Realm::Logger log_migration;
1112 extern Realm::Logger log_prof;
1113 extern Realm::Logger log_garbage;
1114 extern Realm::Logger log_spy;
1115 extern Realm::Logger log_shutdown;
1116 extern Realm::Logger log_tracing;
1117 extern Realm::Logger log_auto_trace;
1118 extern Realm::Logger log_registration;
1128 : local_lock(r), previous(local_lock_list), exclusive(excl), held(
true)
1130#ifdef LEGION_DEBUG_REENTRANT_LOCKS
1131 if (previous !=
nullptr)
1132 previous->check_for_reentrant_locks(&local_lock,
this);
1136 RtEvent ready = local_lock.wrlock();
1137 while (ready.exists())
1140 ready = local_lock.wrlock();
1145 RtEvent ready = local_lock.rdlock();
1146 while (ready.exists())
1149 ready = local_lock.rdlock();
1152 local_lock_list =
this;
1157 : local_lock(r), previous(local_lock_list), exclusive(excl), held(
false)
1159 local_lock_list =
this;
1160#ifdef LEGION_DEBUG_REENTRANT_LOCKS
1161 if (previous !=
nullptr)
1162 previous->check_for_reentrant_locks(&local_lock,
this);
1171 local_lock.unlock();
1172 legion_assert(local_lock_list ==
this);
1173 local_lock_list = previous;
1179 inline void release(
void)
1181 legion_assert(held);
1182 local_lock.unlock();
1185 inline void reacquire(
void)
1187 legion_assert(!held);
1188#ifdef LEGION_DEBUG_REENTRANT_LOCKS
1189 local_lock_list->check_for_reentrant_locks(&local_lock,
this);
1193 RtEvent ready = local_lock.wrlock();
1194 while (ready.exists())
1197 ready = local_lock.wrlock();
1202 RtEvent ready = local_lock.rdlock();
1203 while (ready.exists())
1206 ready = local_lock.rdlock();
1212 inline void advise_sleep_entry(Realm::UserEvent guard)
const
1215 local_lock.advise_sleep_entry(guard);
1216 if (previous !=
nullptr)
1217 previous->advise_sleep_entry(guard);
1219 inline void advise_sleep_exit(
void)
const
1222 local_lock.advise_sleep_exit();
1223 if (previous !=
nullptr)
1224 previous->advise_sleep_exit();
1226#ifdef LEGION_DEBUG_REENTRANT_LOCKS
1227 inline void check_for_reentrant_locks(
1230 legion_assert((to_acquire != &local_lock) || (
this == acquirer));
1231 if (previous !=
nullptr)
1232 previous->check_for_reentrant_locks(to_acquire, acquirer);
1238 const bool exclusive;
1248 ready = local_lock.wrlock();
1250 ready = local_lock.rdlock();
1251 held = !ready.exists();
1258 inline bool has_lock(
void)
const {
return held; }
1259 inline RtEvent try_next(
void)
const {
return ready; }
1265 inline void LgEvent::wait(
void)
const
1270#ifdef DEBUG_LEGION_CALLERS
1271 LgTaskID local_kind = implicit_task_kind;
1272 LgTaskID local_caller = implicit_task_caller;
1275 MappingCallInfo* local_call =
nullptr;
1276 std::swap(local_call, implicit_mapper_call);
1281 if (local_call != NULL)
1282 begin_mapper_call_wait(local_call);
1284 RegistrationCallbackMode local_callback = NO_REGISTRATION_CALLBACK;
1285 std::swap(local_callback, inside_registration_callback);
1287 ImplicitReferenceTracker* local_tracker =
nullptr;
1288 std::swap(local_tracker, implicit_reference_tracker);
1290 TaskContext* local_ctx =
nullptr;
1291 std::swap(local_ctx, implicit_context);
1293 Operation* local_op =
nullptr;
1294 std::swap(local_op, implicit_operation);
1296 ProvenanceID local_provenance = 0;
1297 std::swap(local_provenance, implicit_provenance);
1299 DistributedID local_did = 0;
1300 std::swap(local_did, implicit_enclosing_context);
1303 std::swap(local_fevent, implicit_fevent);
1305 UniqueID local_uid = 0;
1306 std::swap(local_uid, implicit_unique_op_id);
1308 if (local_lock_list !=
nullptr)
1311 AutoLock* local_lock_list_copy =
nullptr;
1312 std::swap(local_lock_list_copy, local_lock_list);
1314 const Realm::UserEvent done = Realm::UserEvent::create_user_event();
1315 local_lock_list_copy->advise_sleep_entry(done);
1316 begin_wait(local_ctx,
false );
1318 Realm::Event::wait();
1321 implicit_fevent = local_fevent;
1322 end_wait(local_ctx,
false );
1324 local_lock_list_copy->advise_sleep_exit();
1328 local_lock_list = local_lock_list_copy;
1332 if (implicit_profiler !=
nullptr)
1337 const LgEvent to_trigger(done);
1338 to_trigger.record_event_trigger(LgEvent::NO_LG_EVENT);
1340 Realm::Backtrace bt;
1341 bt.capture_backtrace();
1342 record_event_wait(bt, local_provenance);
1347 begin_wait(local_ctx,
false );
1349 Realm::Event::wait();
1352 implicit_fevent = local_fevent;
1353 end_wait(local_ctx,
false );
1354 if (implicit_profiler !=
nullptr)
1359 Realm::Backtrace bt;
1360 bt.capture_backtrace();
1361 record_event_wait(bt, local_provenance);
1365 implicit_context = local_ctx;
1367 implicit_mapper_call = local_call;
1369 implicit_operation = local_op;
1371 implicit_provenance = local_provenance;
1373 implicit_enclosing_context = local_did;
1375 implicit_unique_op_id = local_uid;
1376#ifdef DEBUG_LEGION_CALLERS
1377 implicit_task_kind = local_kind;
1378 implicit_task_caller = local_caller;
1381 inside_registration_callback = local_callback;
1383 assert(implicit_reference_tracker ==
nullptr);
1386 implicit_reference_tracker = local_tracker;
1390 inline void LgEvent::wait_faultaware(
bool& poisoned,
bool from_app)
const
1395 if (has_triggered_faultaware(poisoned))
1397#ifdef DEBUG_LEGION_CALLERS
1398 LgTaskID local_kind = implicit_task_kind;
1399 LgTaskID local_caller = implicit_task_caller;
1402 MappingCallInfo* local_call =
nullptr;
1403 std::swap(local_call, implicit_mapper_call);
1408 if (local_call != NULL)
1409 begin_mapper_call_wait(local_call);
1411 RegistrationCallbackMode local_callback = NO_REGISTRATION_CALLBACK;
1412 std::swap(local_callback, inside_registration_callback);
1414 ImplicitReferenceTracker* local_tracker =
nullptr;
1415 std::swap(local_tracker, implicit_reference_tracker);
1417 TaskContext* local_ctx =
nullptr;
1418 std::swap(local_ctx, implicit_context);
1420 Operation* local_op =
nullptr;
1421 std::swap(local_op, implicit_operation);
1423 ProvenanceID local_provenance = 0;
1424 std::swap(local_provenance, implicit_provenance);
1426 DistributedID local_did = 0;
1427 std::swap(local_did, implicit_enclosing_context);
1429 LgEvent local_fevent;
1430 std::swap(local_fevent, implicit_fevent);
1432 UniqueID local_uid = 0;
1433 std::swap(local_uid, implicit_unique_op_id);
1435 if (local_lock_list !=
nullptr)
1438 AutoLock* local_lock_list_copy =
nullptr;
1439 std::swap(local_lock_list_copy, local_lock_list);
1441 const Realm::UserEvent done = Realm::UserEvent::create_user_event();
1442 local_lock_list_copy->advise_sleep_entry(done);
1443 begin_wait(local_ctx, from_app);
1445 Realm::Event::wait_faultaware(poisoned);
1448 implicit_fevent = local_fevent;
1449 end_wait(local_ctx, from_app);
1451 local_lock_list_copy->advise_sleep_exit();
1455 local_lock_list = local_lock_list_copy;
1459 if (implicit_profiler !=
nullptr)
1464 const LgEvent to_trigger(done);
1465 to_trigger.record_event_trigger(LgEvent::NO_LG_EVENT);
1467 Realm::Backtrace bt;
1468 bt.capture_backtrace();
1469 record_event_wait(bt, local_provenance);
1474 begin_wait(local_ctx, from_app);
1476 Realm::Event::wait_faultaware(poisoned);
1479 implicit_fevent = local_fevent;
1480 end_wait(local_ctx, from_app);
1481 if (implicit_profiler !=
nullptr)
1486 Realm::Backtrace bt;
1487 bt.capture_backtrace();
1488 record_event_wait(bt, local_provenance);
1492 implicit_context = local_ctx;
1494 implicit_mapper_call = local_call;
1496 implicit_operation = local_op;
1498 implicit_provenance = local_provenance;
1500 implicit_enclosing_context = local_did;
1502 implicit_unique_op_id = local_uid;
1503#ifdef DEBUG_LEGION_CALLERS
1504 implicit_task_kind = local_kind;
1505 implicit_task_caller = local_caller;
1508 inside_registration_callback = local_callback;
1510 assert(implicit_reference_tracker ==
nullptr);
1513 implicit_reference_tracker = local_tracker;
1517 inline bool LgEvent::is_barrier(
void)
const
1520 const Realm::ID identity(
id);
1521 return identity.is_barrier();
1527#define FRIEND_ALL_RUNTIME_CLASSES \
1528 friend class Legion::Runtime; \
1529 friend class Legion::Mapping::MapperRuntime; \
1530 friend class Internal::Runtime; \
1531 friend class Internal::FutureCreateInstanceRequest; \
1532 friend class Internal::FutureMapFutureRequest; \
1533 friend class Internal::FutureImpl; \
1534 friend class Internal::FutureMapImpl; \
1535 friend class Internal::PhysicalRegionImpl; \
1536 friend class Internal::ExternalResourcesImpl; \
1537 friend class Internal::TaskImpl; \
1538 friend class Internal::VariantImpl; \
1539 friend class Internal::ProcessorManager; \
1540 friend class Internal::MemoryManager; \
1541 friend class Internal::Operation; \
1542 friend class Internal::PredicatedOp; \
1543 friend class Internal::MapOp; \
1544 friend class Internal::CopyOp; \
1545 friend class Internal::IndexCopyOp; \
1546 friend class Internal::PointCopyOp; \
1547 friend class Internal::FenceOp; \
1548 friend class Internal::DynamicCollectiveOp; \
1549 friend class Internal::FuturePredOp; \
1550 friend class Internal::CreationOp; \
1551 friend class Internal::DeletionOp; \
1552 friend class Internal::CloseOp; \
1553 friend class Internal::MergeCloseOp; \
1554 friend class Internal::PostCloseOp; \
1555 friend class Internal::RefinementOp; \
1556 friend class Internal::ResetOp; \
1557 friend class Internal::AcquireOp; \
1558 friend class Internal::ReleaseOp; \
1559 friend class Internal::PredicateImpl; \
1560 friend class Internal::NotPredOp; \
1561 friend class Internal::AndPredOp; \
1562 friend class Internal::OrPredOp; \
1563 friend class Internal::MustEpochOp; \
1564 friend class Internal::PendingPartitionOp; \
1565 friend class Internal::DependentPartitionOp; \
1566 friend class Internal::PointDepPartOp; \
1567 friend class Internal::FillOp; \
1568 friend class Internal::IndexFillOp; \
1569 friend class Internal::PointFillOp; \
1570 friend class Internal::DiscardOp; \
1571 friend class Internal::AttachOp; \
1572 friend class Internal::IndexAttachOp; \
1573 friend class Internal::ReplIndexAttachOp; \
1574 friend class Internal::PointAttachOp; \
1575 friend class Internal::DetachOp; \
1576 friend class Internal::IndexDetachOp; \
1577 friend class Internal::ReplIndexDetachOp; \
1578 friend class Internal::PointDetachOp; \
1579 friend class Internal::TimingOp; \
1580 friend class Internal::TunableOp; \
1581 friend class Internal::AllReduceOp; \
1582 friend class Internal::TraceRecurrentOp; \
1583 friend class Internal::ExternalMappable; \
1584 friend class Internal::ExternalTask; \
1585 friend class Internal::TaskOp; \
1586 friend class Internal::SingleTask; \
1587 friend class Internal::MultiTask; \
1588 friend class Internal::IndividualTask; \
1589 friend class Internal::PointTask; \
1590 friend class Internal::IndexTask; \
1591 friend class Internal::SliceTask; \
1592 friend class Internal::ReplIndividualTask; \
1593 friend class Internal::ReplIndexTask; \
1594 friend class Internal::ReplFillOp; \
1595 friend class Internal::ReplIndexFillOp; \
1596 friend class Internal::ReplDiscardOp; \
1597 friend class Internal::ReplCopyOp; \
1598 friend class Internal::ReplIndexCopyOp; \
1599 friend class Internal::ReplDeletionOp; \
1600 friend class Internal::ReplPendingPartitionOp; \
1601 friend class Internal::ReplDependentPartitionOp; \
1602 friend class Internal::ReplMustEpochOp; \
1603 friend class Internal::ReplMapOp; \
1604 friend class Internal::ReplTimingOp; \
1605 friend class Internal::ReplTunableOp; \
1606 friend class Internal::ReplAllReduceOp; \
1607 friend class Internal::ReplFenceOp; \
1608 friend class Internal::ReplAttachOp; \
1609 friend class Internal::ReplDetachOp; \
1610 friend class Internal::ReplAcquireOp; \
1611 friend class Internal::ReplReleaseOp; \
1612 friend class Internal::MemoizableOp; \
1613 template<typename OP> \
1614 friend class Internal::Memoizable; \
1615 friend class Internal::ShardManager; \
1616 friend class Internal::IndexSpaceNode; \
1617 template<int, typename> \
1618 friend class Internal::IndexSpaceNodeT; \
1619 friend class Internal::IndexPartNode; \
1620 friend class Internal::FieldSpaceNode; \
1621 friend class Internal::RegionTreeNode; \
1622 friend class Internal::RegionNode; \
1623 friend class Internal::PartitionNode; \
1624 friend class Internal::LogicalView; \
1625 friend class Internal::InstanceView; \
1626 friend class Internal::DeferredView; \
1627 friend class Internal::ReductionView; \
1628 friend class Internal::MaterializedView; \
1629 friend class Internal::FillView; \
1630 friend class Internal::LayoutDescription; \
1631 friend class Internal::InstanceManager; \
1632 friend class Internal::PhysicalManager; \
1633 friend class Internal::MapperManager; \
1634 friend class Internal::InstanceRef; \
1635 friend class Internal::HandshakeImpl; \
1636 friend class Internal::ArgumentMapImpl; \
1637 friend class Internal::FutureMapImpl; \
1638 friend class Internal::ReplFutureMapImpl; \
1639 friend class Internal::TaskContext; \
1640 friend class Internal::InnerContext; \
1641 friend class Internal::TopLevelContext; \
1642 friend class Internal::RemoteContext; \
1643 friend class Internal::LeafContext; \
1644 friend class Internal::ReplicateContext; \
1645 friend class Internal::InstanceBuilder; \
1646 friend class Internal::FutureNameExchange; \
1647 friend class Internal::MustEpochMappingExchange; \
1648 friend class Internal::MustEpochMappingBroadcast; \
1649 friend class Internal::MappingCallInfo; \
1650 friend class CObjectWrapper;
Definition constraints.h:689
Definition constraints.h:202
Definition constraints.h:640
Definition geometry.h:154
Definition exception.h:170
Definition constraints.h:240
Definition constraints.h:475
Definition constraints.h:61
Definition constraints.h:167
Definition constraints.h:881
Definition mapping.h:3087
Definition constraints.h:422
Definition constraints.h:737
Definition constraints.h:538
Definition constraints.h:830
Definition physical_region.h:231
Definition physical_region.h:270
Definition constraints.h:783
Definition constraints.h:95
Definition constraints.h:132
Definition functors.h:281
Definition physical_region.h:602
Definition constraints.h:357
Definition constraints.h:942
Definition constraints.h:592