16#ifndef __LEGION_TYPES_H__
17#define __LEGION_TYPES_H__
31#include "realm/dynamic_templates.h"
36 REALM_MAX_DIM == LEGION_MAX_DIM,
37 "LEGION_MAX_DIM and REALM_MAX_DIM must be the same");
39#ifdef LEGION_REDOP_COMPLEX
40#ifdef LEGION_REDOP_HALF
43#include "mathtypes/complex.h"
46#ifdef LEGION_REDOP_HALF
47#include "mathtypes/half.h"
50#ifndef LEGION_DEPRECATED
52#define LEGION_DEPRECATED(x) [[deprecated(x)]]
59#define LEGION_DISABLE_DEPRECATED_WARNINGS \
60 _Pragma("warning (push)") \
61 _Pragma("diag_suppress 1445")
62#define LEGION_REENABLE_DEPRECATED_WARNINGS \
63 _Pragma("warning (pop)")
64#elif defined(__GNUC__)
65#define LEGION_DISABLE_DEPRECATED_WARNINGS \
66 _Pragma("GCC diagnostic push") \
67 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
68#define LEGION_REENABLE_DEPRECATED_WARNINGS \
69 _Pragma("GCC diagnostic pop")
70#elif defined(__clang__)
71#define LEGION_DISABLE_DEPRECATED_WARNINGS \
72 _Pragma("clang diagnostic push") \
73 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
74#define LEGION_REENABLE_DEPRECATED_WARNINGS \
75 _Pragma("clang diagnostic pop")
76#elif defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)
77#define LEGION_DISABLE_DEPRECATED_WARNINGS \
78 _Pragma("warning push") \
79 _Pragma("warning disable 1478")
80#define LEGION_REENABLE_DEPRECATED_WARNINGS \
81 _Pragma("warning pop")
83#warning "Don't know how to suppress deprecated warnings for this compiler"
84#define LEGION_DISABLE_DEPRECATED_WARNINGS
85#define LEGION_REENABLE_DEPRECATED_WARNINGS
90#define legion_assert(expr) assert(expr)
92#define legion_no_skip_assert(expr) assert(expr)
95 "Why are you trying to build a debug version of Legion while also defining NDEBUG?"
97template<
typename T1,
typename T2>
98inline T1 legion_safe_cast(T2* ptr)
100 T1 result =
dynamic_cast<T1
>(ptr);
101 legion_assert(result !=
nullptr);
105#define legion_assert(expr) ((void)0)
106#define legion_no_skip_assert(expr) ((void)(expr))
107template<
typename T1,
typename T2>
108inline T1 legion_safe_cast(T2* ptr)
110 return static_cast<T1
>(ptr);
121 typedef ::realm_id_t IDType;
122 typedef ::legion_privilege_mode_t PrivilegeMode;
123 typedef ::legion_allocate_mode_t AllocateMode;
124 typedef ::legion_coherence_property_t CoherenceProperty;
125 typedef ::legion_region_flags_t RegionFlags;
126 typedef ::legion_projection_type_t ProjectionType;
127 typedef ::legion_partition_kind_t PartitionKind;
128 typedef ::legion_external_resource_t ExternalResource;
129 typedef ::legion_timing_measurement_t TimingMeasurement;
130 typedef ::legion_dependence_type_t DependenceType;
131 typedef ::legion_mappable_type_id_t MappableType;
132 typedef ::legion_file_mode_t LegionFileMode;
133 typedef ::legion_execution_constraint_t ExecutionConstraintKind;
134 typedef ::legion_layout_constraint_t LayoutConstraintKind;
135 typedef ::legion_equality_kind_t EqualityKind;
136 typedef ::legion_dimension_kind_t DimensionKind;
137 typedef ::legion_isa_kind_t ISAKind;
138 typedef ::legion_resource_constraint_t ResourceKind;
139 typedef ::legion_launch_constraint_t LaunchKind;
140 typedef ::legion_specialized_constraint_t SpecializedKind;
141 typedef ::legion_unbounded_pool_scope_t UnboundPoolScope;
142 typedef ::legion_projection_type_t HandleType;
143 typedef ::legion_address_space_t AddressSpace;
144 typedef ::legion_task_priority_t TaskPriority;
145 typedef ::legion_task_priority_t RealmPriority;
146 typedef ::legion_garbage_collection_priority_t GCPriority;
147 typedef ::legion_color_t Color;
148 typedef ::legion_field_id_t FieldID;
149 typedef ::legion_trace_id_t TraceID;
150 typedef ::legion_mapper_id_t MapperID;
151 typedef ::legion_context_id_t ContextID;
152 typedef ::legion_instance_id_t InstanceID;
153 typedef ::legion_index_tree_id_t IndexTreeID;
154 typedef ::legion_generation_id_t GenerationID;
155 typedef ::legion_type_handle TypeHandle;
156 typedef ::legion_projection_id_t ProjectionID;
157 typedef ::legion_sharding_id_t ShardingID;
158 typedef ::legion_concurrent_id_t ConcurrentID;
159 typedef ::legion_exception_handler_id_t ExceptionHandlerID;
160 typedef ::legion_region_tree_id_t RegionTreeID;
161 typedef ::legion_distributed_id_t DistributedID;
162 typedef ::legion_address_space_t AddressSpaceID;
163 typedef ::legion_tunable_id_t TunableID;
164 typedef ::legion_local_variable_id_t LocalVariableID;
165 typedef ::legion_mapping_tag_id_t MappingTagID;
166 typedef ::legion_semantic_tag_t SemanticTag;
167 typedef ::legion_variant_id_t VariantID;
168 typedef ::legion_code_descriptor_id_t CodeDescriptorID;
169 typedef ::legion_unique_id_t UniqueID;
170 typedef ::legion_version_id_t VersionID;
171 typedef ::legion_projection_epoch_id_t ProjectionEpochID;
172 typedef ::legion_task_id_t TaskID;
173 typedef ::legion_layout_constraint_id_t LayoutConstraintID;
174 typedef ::legion_shard_id_t ShardID;
175 typedef ::legion_provenance_id_t ProvenanceID;
176 typedef ::legion_internal_color_t LegionColor;
177 typedef ::legion_reduction_op_id_t ReductionOpID;
178 typedef ::legion_custom_serdez_id_t CustomSerdezID;
179 typedef ::legion_coord_t coord_t;
182 typedef Realm::Runtime RealmRuntime;
183 typedef Realm::Machine Machine;
184 typedef Realm::Memory Memory;
185 typedef Realm::Processor Processor;
186 typedef Realm::ProcessorGroup ProcessorGroup;
187 typedef Realm::CodeDescriptor CodeDescriptor;
188 typedef Realm::Reservation Reservation;
189 typedef Realm::CompletionQueue CompletionQueue;
190 typedef Realm::ReductionOpUntyped ReductionOp;
191 typedef Realm::CustomSerdezUntyped SerdezOp;
192 typedef Realm::Machine::ProcessorMemoryAffinity ProcessorMemoryAffinity;
193 typedef Realm::Machine::MemoryMemoryAffinity MemoryMemoryAffinity;
194 typedef Realm::DynamicTemplates::TagType TypeTag;
195 typedef Realm::Logger Logger;
196 template<
int DIM,
typename T = coord_t>
197 using Point = Realm::Point<DIM, T>;
198 template<
int DIM,
typename T = coord_t>
199 using Rect = Realm::Rect<DIM, T>;
200 template<
int DIM,
typename T = coord_t>
201 using DomainT = Realm::IndexSpace<DIM, T>;
202 template<
int M,
int N,
typename T = coord_t>
203 using Transform = Realm::Matrix<M, N, T>;
207 template<
int DIM,
typename T>
209 class IndexPartition;
210 template<
int DIM,
typename T>
211 class IndexPartitionT;
214 template<
int DIM,
typename T>
215 class LogicalRegionT;
216 class LogicalPartition;
217 template<
int DIM,
typename T>
218 class LogicalPartitionT;
219 class IndexAllocator;
220 class FieldAllocator;
227 struct RegionRequirement;
228 struct OutputRequirement;
229 struct IndexSpaceRequirement;
230 struct FieldSpaceRequirement;
232 struct IndexTaskLauncher;
233 typedef IndexTaskLauncher IndexLauncher;
234 struct InlineLauncher;
236 struct AcquireLauncher;
237 struct ReleaseLauncher;
239 struct LayoutConstraintRegistrar;
240 struct TaskVariantRegistrar;
245 class PhysicalRegion;
247 class ExternalResources;
248 class UntypedDeferredValue;
251 template<
typename,
bool>
252 class DeferredReduction;
253 template<
typename,
int,
typename,
bool>
254 class DeferredBuffer;
255 template<
typename COORD_T>
256 class UntypedDeferredBuffer;
257 template<PrivilegeMode,
typename,
int,
typename,
typename,
bool>
259 template<
typename,
bool,
int,
typename,
typename,
bool>
260 class ReductionAccessor;
261 template<
typename,
int,
typename,
typename,
bool>
262 class PaddingAccessor;
263#ifdef LEGION_MULTI_REGION_ACCESSOR
264 template<
typename,
int,
typename,
typename,
bool,
bool,
int>
265 class MultiRegionAccessor;
267 template<
typename,
int,
typename,
typename>
269 namespace ArraySyntax {
270 template<
typename, PrivilegeMode>
276 template<
int,
typename>
278 template<PrivilegeMode,
typename,
int,
typename>
299 struct SerdezRedopFns;
301 template<
typename FT,
int N,
typename T = ::legion_coord_t>
302 using GenericAccessor = Realm::GenericAccessor<FT, N, T>;
303 template<
typename FT,
int N,
typename T = ::legion_coord_t>
304 using AffineAccessor = Realm::AffineAccessor<FT, N, T>;
305 template<
typename FT,
int N,
typename T = ::legion_coord_t>
306 using MultiAffineAccessor = Realm::MultiAffineAccessor<FT, N, T>;
307 class LegionTaskWrapper;
308 class LegionSerialization;
309 class CObjectWrapper;
348 typedef std::map<CustomSerdezID, const Realm::CustomSerdezUntyped*>
350 typedef std::map<Realm::ReductionOpID, Realm::ReductionOpUntyped*>
352 typedef void (*SerdezInitFnptr)(
const ReductionOp*,
void*&,
size_t&);
353 typedef void (*SerdezFoldFnptr)(
354 const ReductionOp*,
void*&,
size_t&,
const void*);
355 using SerdezInitFunc =
356 std::function<void(
const ReductionOp*,
void*&,
size_t&)>;
357 using SerdezFoldFunc =
358 std::function<void(
const ReductionOp*,
void*&,
size_t&,
const void*)>;
359 typedef std::map<Realm::ReductionOpID, SerdezRedopFns> SerdezRedopTable;
361 typedef void (*RegistrationCallbackFnptr)(
362 Machine machine,
Runtime* rt,
const std::set<Processor>& local_procs);
363 using RegistrationCallback =
364 std::function<void(Machine,
Runtime*,
const std::set<Processor>&)>;
365 typedef void (*RegistrationWithArgsCallbackFnptr)(
367 using RegistrationWithArgsCallback =
376 class PhysicalInstance;
377 class CollectiveView;
379 class ProfilingRequestSet;
391 enum ProfilingMeasurementID {
392 PMID_LEGION_FIRST = Realm::PMID_REALM_LAST,
393 PMID_RUNTIME_OVERHEAD,
411 class FieldAllocatorImpl;
412 class ArgumentMapImpl;
413 class FutureCreateInstanceRequest;
414 class FutureMapFutureRequest;
416 class FutureInstance;
418 class ReplFutureMapImpl;
419 class PhysicalRegionImpl;
420 class OutputRegionImpl;
421 class ExternalResourcesImpl;
422 class PieceIteratorImpl;
426 typedef HandshakeImpl LegionHandshakeImpl;
427 class MessageManager;
428 class ShutdownManager;
429 class ProcessorManager;
432 class VirtualChannel;
433 class MessageManager;
434 class ShutdownManager;
437 class LayoutConstraints;
438 class ProjectionFunction;
439 class ShardingFunction;
462 class DynamicCollectiveOp;
468 class PendingPartitionOp;
469 class DependentPartitionOp;
470 class PointDepPartOp;
487 class ExternalMappable;
492 class RemoteAcquireOp;
493 class RemoteReleaseOp;
495 class RemotePartitionOp;
496 class RemoteReplayOp;
497 class RemoteSummaryOp;
498 template<
typename OP>
500 template<
typename OP>
502 struct PointwiseDependence;
509 class IndividualTask;
518 class TopLevelContext;
519 class ReplicateContext;
525 class TraceRecurrentOp;
526 class TraceCompleteOp;
529 class TraceConditionSet;
530 class PhysicalTemplate;
531 class ShardedPhysicalTemplate;
535 class CreateApUserEvent;
538 class AssignFenceCompletion;
542 class GetOpTermEvent;
543 class SetOpSyncEvent;
545 class CompleteReplay;
548 class BarrierArrival;
549 class BarrierAdvance;
550 class TraceRecognizer;
551 class TraceHashRecorder;
553 class CopyAcrossExecutor;
554 class CopyAcrossUnstructured;
555 class IndexSpaceExpression;
556 class IndexSpaceOperation;
557 template<
int DIM,
typename T>
559 template<
int DIM,
typename T>
561 template<
int DIM,
typename T>
563 template<
int DIM,
typename T>
565 class ExpressionTrieNode;
567 class IndexSpaceNode;
568 template<
int DIM,
typename T>
571 template<
int DIM,
typename T>
573 class FieldSpaceNode;
574 class RegionTreeNode;
577 class ColorSpaceIterator;
578 template<
int DIM,
typename T>
581 template<
int DIM,
typename T,
typename RT =
void>
584 template<
int DIM,
typename T>
587 class RegionTreePath;
592 class LogicalAnalysis;
593 class PhysicalAnalysis;
594 class ValidInstAnalysis;
595 class InvalidInstAnalysis;
596 class AntivalidInstAnalysis;
597 class RegistrationAnalysis;
598 class CollectiveAnalysis;
599 class UpdateAnalysis;
600 class CopyAcrossAnalysis;
601 class AcquireAnalysis;
602 class ReleaseAnalysis;
603 class OverwriteAnalysis;
604 class FilterAnalysis;
605 class EquivalenceSet;
607 class VersionManager;
609 class ProjectionNode;
610 class ProjectionRegion;
611 class ProjectionPartition;
612 class RefinementTracker;
613 class RegionRefinementTracker;
614 class PartitionRefinementTracker;
616 class CopyFillAggregator;
619 class ImplicitReferenceTracker;
620 class DistributedCollectable;
621 class LayoutDescription;
622 class InstanceManager;
623 class CopyAcrossHelper;
627 class CollectableView;
628 class IndividualView;
632 class CollectiveView;
633 class MaterializedView;
634 class ReplicatedView;
644 class VirtualManager;
645 class PhysicalManager;
646 class InstanceBuilder;
648 class RegionAnalyzer;
653 struct LogicalTraceInfo;
655 struct PhysicalTraceInfo;
660 struct FieldDataDescriptor;
661 class ProjectionSummary;
662 class ProjectionInfo;
664 class LegionProfiler;
665 class LegionProfInstance;
667 class MappingCallInfo;
669 class SerializingManager;
670 class ConcurrentManager;
672 class ShardedMapping;
673 class ReplIndividualTask;
675 class ReplMergeCloseOp;
676 class ReplRefinementOp;
679 class ReplIndexFillOp;
682 class ReplIndexCopyOp;
683 class ReplDeletionOp;
684 class ReplPendingPartitionOp;
685 class ReplDependentPartitionOp;
686 class ReplPredicateImpl;
687 class ReplMustEpochOp;
690 class ReplAllReduceOp;
694 class ReplIndexAttachOp;
696 class ReplIndexDetachOp;
700 class ReplTraceBeginOp;
701 class ReplTraceRecurrentOp;
702 class ReplTraceCompleteOp;
704 class CollectiveMapping;
706 class ImplicitShardManager;
707 class ShardCollective;
708 class GatherCollective;
715 template<
typename T,
bool>
717 class CrossProductCollective;
718 class ShardingGatherCollective;
719 class FieldDescriptorExchange;
720 class FieldDescriptorGather;
721 class FutureBroadcast;
722 class FutureExchange;
723 class FutureNameExchange;
724 class MustEpochMappingBroadcast;
725 class MustEpochMappingExchange;
726 class PredicateCollective;
727 class UnorderedExchange;
728 class ShardRendezvous;
729 class ProjectionTreeExchange;
730 class TimeoutMatchExchange;
731 class ConcurrentAllreduce;
732 class BufferBroadcast;
733 class CreateCollectiveFillView;
736 constexpr LegionColor INVALID_COLOR =
737 std::numeric_limits<LegionColor>::max();
739 typedef Realm::RegionInstance PhysicalInstance;
740 typedef Realm::CopySrcDstField CopySrcDstField;
741 typedef unsigned long long CollectiveID;
742 typedef unsigned long long IndexSpaceExprID;
743 typedef uint64_t LamportClock;
744 struct ContextCoordinate;
745 typedef ContextCoordinate TraceLocalID;
746 class TaskTreeCoordinates;
749 Realm::DIMCOUNTS, Realm::DIMTYPES> {
750 typedef Realm::DynamicTemplates::ListProduct2<
751 Realm::DIMCOUNTS, Realm::DIMTYPES>
754 template<
int N,
typename T>
755 __LEGION_CUDA_HD__
static inline constexpr TypeTag encode_tag(
void)
757 constexpr TypeTag type =
758 SUPER::template encode_tag<Realm::DynamicTemplates::Int<N>, T>();
759 static_assert(type != 0,
"All types should be non-zero for Legion");
762 template<
int N,
typename T>
763 static inline void check_type(
const TypeTag t)
765 legion_assert((encode_tag<N, T>() == t));
769 template<
typename N,
typename T>
770 static inline void demux(
int* result)
775 static inline int get_dim(
const TypeTag t)
778 SUPER::demux<DimHelper>(t, &result);
787 typedef Mapping::ProfilingMeasurementID ProfilingMeasurementID;
791 typedef Internal::TaskContext* Context;
794 typedef Internal::MappingCallInfo* MapperContext;
795 typedef Internal::InstanceManager* PhysicalInstanceImpl;
796 typedef Internal::CollectiveView* CollectiveViewImpl;
800 typedef Internal::LocalLock LocalLock;
811 static const LgEvent NO_LG_EVENT;
813 LgEvent(
void)
noexcept {
id = 0; }
815 explicit LgEvent(
const Realm::Event e) {
id = e.id; }
820 inline void wait(
void)
const;
821 inline void wait_faultaware(
bool& poisoned,
bool from_application)
const;
822 inline bool is_barrier(
void)
const;
824 void begin_wait(Context ctx,
bool from_application)
const;
825 void end_wait(Context ctx,
bool from_application)
const;
826 void begin_mapper_call_wait(MappingCallInfo* call)
const;
827 void record_event_wait(Realm::Backtrace& bt, ProvenanceID pid)
const;
828 void record_event_trigger(
LgEvent precondition)
const;
851 inline operator Realm::UserEvent()
const
861 static const ApEvent NO_AP_EVENT;
869 inline bool has_triggered_faultignorant(
void)
const
871 bool poisoned =
false;
872 return has_triggered_faultaware(poisoned);
874 inline void wait_faultaware(
bool& poisoned)
const
876 return LgEvent::wait_faultaware(poisoned,
true );
878 inline void wait_faultignorant(
void)
const
880 bool poisoned =
false;
881 LgEvent::wait_faultaware(poisoned,
true );
886 inline bool has_triggered(
void)
const {
return LgEvent::has_triggered(); }
887 inline void wait(
void)
const { LgEvent::wait(); }
899 inline operator Realm::UserEvent()
const
913 explicit ApBarrier(
const Realm::Barrier& b)
914 :
ApEvent(b), timestamp(b.timestamp)
918 inline operator Realm::Barrier()
const
922 b.timestamp = timestamp;
926 inline bool get_result(
void* value,
size_t value_size)
const
930 b.timestamp = timestamp;
931 return b.get_result(value, value_size);
933 inline void destroy_barrier(
void)
937 b.timestamp = timestamp;
941 Realm::Barrier::timestamp_t timestamp;
946 static const RtEvent NO_RT_EVENT;
965 inline operator Realm::UserEvent()
const
979 explicit RtBarrier(
const Realm::Barrier& b)
980 :
RtEvent(b), timestamp(b.timestamp)
984 inline operator Realm::Barrier()
const
988 b.timestamp = timestamp;
992 inline bool get_result(
void* value,
size_t value_size)
const
996 b.timestamp = timestamp;
997 return b.get_result(value, value_size);
999 inline RtBarrier get_previous_phase(
void)
1003 return RtBarrier(b.get_previous_phase());
1005 inline void destroy_barrier(
void)
1009 b.timestamp = timestamp;
1010 b.destroy_barrier();
1013 Realm::Barrier::timestamp_t timestamp;
1031 inline RtEvent wrlock(
void) {
return RtEvent(reservation.wrlock()); }
1032 inline RtEvent rdlock(
void) {
return RtEvent(reservation.rdlock()); }
1033 inline bool trylock(
void) {
return reservation.trylock(); }
1034 inline bool trywrlock(
void) {
return reservation.trywrlock(); }
1035 inline bool tryrdlock(
void) {
return reservation.tryrdlock(); }
1036 inline void unlock(
void) { reservation.unlock(); }
1038 inline void advise_sleep_entry(Realm::UserEvent guard)
1040 reservation.advise_sleep_entry(guard);
1042 inline void advise_sleep_exit(
void) { reservation.advise_sleep_exit(); }
1044 Realm::FastReservation reservation;
1051 inline Runtime* runtime =
nullptr;
1055 enum SpyLoggingLevel {
1062 inline SpyLoggingLevel spy_logging_level = HEAVY_SPY_LOGGING;
1064 inline SpyLoggingLevel spy_logging_level = NO_SPY_LOGGING;
1069 inline thread_local TaskContext* implicit_context =
nullptr;
1071 inline thread_local MappingCallInfo* implicit_mapper_call =
nullptr;
1073 inline thread_local LegionProfInstance* implicit_profiler =
nullptr;
1076 inline thread_local AutoLock* local_lock_list =
nullptr;
1079 inline thread_local DistributedID implicit_enclosing_context = 0;
1083 inline thread_local Operation* implicit_operation =
nullptr;
1087 inline thread_local ProvenanceID implicit_provenance = 0;
1091 inline thread_local ::legion_unique_id_t implicit_unique_op_id = 0;
1096 inline thread_local LgEvent implicit_fevent = {};
1099 enum RegistrationCallbackMode {
1100 NO_REGISTRATION_CALLBACK = 0,
1101 LOCAL_REGISTRATION_CALLBACK = 1,
1102 GLOBAL_REGISTRATION_CALLBACK = 2,
1104 inline thread_local RegistrationCallbackMode inside_registration_callback =
1105 NO_REGISTRATION_CALLBACK;
1112 inline thread_local ImplicitReferenceTracker* implicit_reference_tracker =
1114#ifdef LEGION_DEBUG_CALLERS
1115 thread_local LgTaskID implicit_task_kind;
1116 thread_local LgTaskID implicit_task_caller;
1118 extern Realm::Logger log_legion;
1119 extern Realm::Logger log_allocation;
1120 extern Realm::Logger log_migration;
1121 extern Realm::Logger log_prof;
1122 extern Realm::Logger log_garbage;
1123 extern Realm::Logger log_spy;
1124 extern Realm::Logger log_shutdown;
1125 extern Realm::Logger log_tracing;
1126 extern Realm::Logger log_auto_trace;
1127 extern Realm::Logger log_registration;
1137 : local_lock(r), previous(local_lock_list), exclusive(excl), held(
true)
1139#ifdef LEGION_DEBUG_REENTRANT_LOCKS
1140 if (previous !=
nullptr)
1141 previous->check_for_reentrant_locks(&local_lock,
this);
1145 RtEvent ready = local_lock.wrlock();
1146 while (ready.exists())
1149 ready = local_lock.wrlock();
1154 RtEvent ready = local_lock.rdlock();
1155 while (ready.exists())
1158 ready = local_lock.rdlock();
1161 local_lock_list =
this;
1166 : local_lock(r), previous(local_lock_list), exclusive(excl), held(
false)
1168 local_lock_list =
this;
1169#ifdef LEGION_DEBUG_REENTRANT_LOCKS
1170 if (previous !=
nullptr)
1171 previous->check_for_reentrant_locks(&local_lock,
this);
1180 local_lock.unlock();
1181 legion_assert(local_lock_list ==
this);
1182 local_lock_list = previous;
1188 inline void release(
void)
1190 legion_assert(held);
1191 local_lock.unlock();
1194 inline void reacquire(
void)
1196 legion_assert(!held);
1197#ifdef LEGION_DEBUG_REENTRANT_LOCKS
1198 local_lock_list->check_for_reentrant_locks(&local_lock,
this);
1202 RtEvent ready = local_lock.wrlock();
1203 while (ready.exists())
1206 ready = local_lock.wrlock();
1211 RtEvent ready = local_lock.rdlock();
1212 while (ready.exists())
1215 ready = local_lock.rdlock();
1221 inline void advise_sleep_entry(Realm::UserEvent guard)
const
1224 local_lock.advise_sleep_entry(guard);
1225 if (previous !=
nullptr)
1226 previous->advise_sleep_entry(guard);
1228 inline void advise_sleep_exit(
void)
const
1231 local_lock.advise_sleep_exit();
1232 if (previous !=
nullptr)
1233 previous->advise_sleep_exit();
1235#ifdef LEGION_DEBUG_REENTRANT_LOCKS
1236 inline void check_for_reentrant_locks(
1239 legion_assert((to_acquire != &local_lock) || (
this == acquirer));
1240 if (previous !=
nullptr)
1241 previous->check_for_reentrant_locks(to_acquire, acquirer);
1247 const bool exclusive;
1257 ready = local_lock.wrlock();
1259 ready = local_lock.rdlock();
1260 held = !ready.exists();
1267 inline bool has_lock(
void)
const {
return held; }
1268 inline RtEvent try_next(
void)
const {
return ready; }
1274 inline void LgEvent::wait(
void)
const
1279#ifdef DEBUG_LEGION_CALLERS
1280 LgTaskID local_kind = implicit_task_kind;
1281 LgTaskID local_caller = implicit_task_caller;
1284 MappingCallInfo* local_call =
nullptr;
1285 std::swap(local_call, implicit_mapper_call);
1290 if (local_call != NULL)
1291 begin_mapper_call_wait(local_call);
1293 RegistrationCallbackMode local_callback = NO_REGISTRATION_CALLBACK;
1294 std::swap(local_callback, inside_registration_callback);
1296 ImplicitReferenceTracker* local_tracker =
nullptr;
1297 std::swap(local_tracker, implicit_reference_tracker);
1299 TaskContext* local_ctx =
nullptr;
1300 std::swap(local_ctx, implicit_context);
1302 Operation* local_op =
nullptr;
1303 std::swap(local_op, implicit_operation);
1305 ProvenanceID local_provenance = 0;
1306 std::swap(local_provenance, implicit_provenance);
1308 DistributedID local_did = 0;
1309 std::swap(local_did, implicit_enclosing_context);
1312 std::swap(local_fevent, implicit_fevent);
1314 UniqueID local_uid = 0;
1315 std::swap(local_uid, implicit_unique_op_id);
1317 if (local_lock_list !=
nullptr)
1320 AutoLock* local_lock_list_copy =
nullptr;
1321 std::swap(local_lock_list_copy, local_lock_list);
1323 const Realm::UserEvent done = Realm::UserEvent::create_user_event();
1324 local_lock_list_copy->advise_sleep_entry(done);
1325 begin_wait(local_ctx,
false );
1327 Realm::Event::wait();
1330 implicit_fevent = local_fevent;
1331 end_wait(local_ctx,
false );
1333 local_lock_list_copy->advise_sleep_exit();
1337 local_lock_list = local_lock_list_copy;
1341 if (implicit_profiler !=
nullptr)
1346 const LgEvent to_trigger(done);
1347 to_trigger.record_event_trigger(LgEvent::NO_LG_EVENT);
1349 Realm::Backtrace bt;
1350 bt.capture_backtrace();
1351 record_event_wait(bt, local_provenance);
1356 begin_wait(local_ctx,
false );
1358 Realm::Event::wait();
1361 implicit_fevent = local_fevent;
1362 end_wait(local_ctx,
false );
1363 if (implicit_profiler !=
nullptr)
1368 Realm::Backtrace bt;
1369 bt.capture_backtrace();
1370 record_event_wait(bt, local_provenance);
1374 implicit_context = local_ctx;
1376 implicit_mapper_call = local_call;
1378 implicit_operation = local_op;
1380 implicit_provenance = local_provenance;
1382 implicit_enclosing_context = local_did;
1384 implicit_unique_op_id = local_uid;
1385#ifdef DEBUG_LEGION_CALLERS
1386 implicit_task_kind = local_kind;
1387 implicit_task_caller = local_caller;
1390 inside_registration_callback = local_callback;
1392 assert(implicit_reference_tracker ==
nullptr);
1395 implicit_reference_tracker = local_tracker;
1399 inline void LgEvent::wait_faultaware(
bool& poisoned,
bool from_app)
const
1404 if (has_triggered_faultaware(poisoned))
1406#ifdef DEBUG_LEGION_CALLERS
1407 LgTaskID local_kind = implicit_task_kind;
1408 LgTaskID local_caller = implicit_task_caller;
1411 MappingCallInfo* local_call =
nullptr;
1412 std::swap(local_call, implicit_mapper_call);
1417 if (local_call != NULL)
1418 begin_mapper_call_wait(local_call);
1420 RegistrationCallbackMode local_callback = NO_REGISTRATION_CALLBACK;
1421 std::swap(local_callback, inside_registration_callback);
1423 ImplicitReferenceTracker* local_tracker =
nullptr;
1424 std::swap(local_tracker, implicit_reference_tracker);
1426 TaskContext* local_ctx =
nullptr;
1427 std::swap(local_ctx, implicit_context);
1429 Operation* local_op =
nullptr;
1430 std::swap(local_op, implicit_operation);
1432 ProvenanceID local_provenance = 0;
1433 std::swap(local_provenance, implicit_provenance);
1435 DistributedID local_did = 0;
1436 std::swap(local_did, implicit_enclosing_context);
1438 LgEvent local_fevent;
1439 std::swap(local_fevent, implicit_fevent);
1441 UniqueID local_uid = 0;
1442 std::swap(local_uid, implicit_unique_op_id);
1444 if (local_lock_list !=
nullptr)
1447 AutoLock* local_lock_list_copy =
nullptr;
1448 std::swap(local_lock_list_copy, local_lock_list);
1450 const Realm::UserEvent done = Realm::UserEvent::create_user_event();
1451 local_lock_list_copy->advise_sleep_entry(done);
1452 begin_wait(local_ctx, from_app);
1454 Realm::Event::wait_faultaware(poisoned);
1457 implicit_fevent = local_fevent;
1458 end_wait(local_ctx, from_app);
1460 local_lock_list_copy->advise_sleep_exit();
1464 local_lock_list = local_lock_list_copy;
1468 if (implicit_profiler !=
nullptr)
1473 const LgEvent to_trigger(done);
1474 to_trigger.record_event_trigger(LgEvent::NO_LG_EVENT);
1476 Realm::Backtrace bt;
1477 bt.capture_backtrace();
1478 record_event_wait(bt, local_provenance);
1483 begin_wait(local_ctx, from_app);
1485 Realm::Event::wait_faultaware(poisoned);
1488 implicit_fevent = local_fevent;
1489 end_wait(local_ctx, from_app);
1490 if (implicit_profiler !=
nullptr)
1495 Realm::Backtrace bt;
1496 bt.capture_backtrace();
1497 record_event_wait(bt, local_provenance);
1501 implicit_context = local_ctx;
1503 implicit_mapper_call = local_call;
1505 implicit_operation = local_op;
1507 implicit_provenance = local_provenance;
1509 implicit_enclosing_context = local_did;
1511 implicit_unique_op_id = local_uid;
1512#ifdef DEBUG_LEGION_CALLERS
1513 implicit_task_kind = local_kind;
1514 implicit_task_caller = local_caller;
1517 inside_registration_callback = local_callback;
1519 assert(implicit_reference_tracker ==
nullptr);
1522 implicit_reference_tracker = local_tracker;
1526 inline bool LgEvent::is_barrier(
void)
const
1529 const Realm::ID identity(
id);
1530 return identity.is_barrier();
1536#define FRIEND_ALL_RUNTIME_CLASSES \
1537 friend class Legion::Runtime; \
1538 friend class Legion::Mapping::MapperRuntime; \
1539 friend class Internal::Runtime; \
1540 friend class Internal::FutureCreateInstanceRequest; \
1541 friend class Internal::FutureMapFutureRequest; \
1542 friend class Internal::FutureImpl; \
1543 friend class Internal::FutureMapImpl; \
1544 friend class Internal::PhysicalRegionImpl; \
1545 friend class Internal::ExternalResourcesImpl; \
1546 friend class Internal::TaskImpl; \
1547 friend class Internal::VariantImpl; \
1548 friend class Internal::ProcessorManager; \
1549 friend class Internal::MemoryManager; \
1550 friend class Internal::Operation; \
1551 friend class Internal::PredicatedOp; \
1552 friend class Internal::MapOp; \
1553 friend class Internal::CopyOp; \
1554 friend class Internal::IndexCopyOp; \
1555 friend class Internal::PointCopyOp; \
1556 friend class Internal::FenceOp; \
1557 friend class Internal::DynamicCollectiveOp; \
1558 friend class Internal::FuturePredOp; \
1559 friend class Internal::CreationOp; \
1560 friend class Internal::DeletionOp; \
1561 friend class Internal::CloseOp; \
1562 friend class Internal::MergeCloseOp; \
1563 friend class Internal::PostCloseOp; \
1564 friend class Internal::RefinementOp; \
1565 friend class Internal::ResetOp; \
1566 friend class Internal::AcquireOp; \
1567 friend class Internal::ReleaseOp; \
1568 friend class Internal::PredicateImpl; \
1569 friend class Internal::NotPredOp; \
1570 friend class Internal::AndPredOp; \
1571 friend class Internal::OrPredOp; \
1572 friend class Internal::MustEpochOp; \
1573 friend class Internal::PendingPartitionOp; \
1574 friend class Internal::DependentPartitionOp; \
1575 friend class Internal::PointDepPartOp; \
1576 friend class Internal::FillOp; \
1577 friend class Internal::IndexFillOp; \
1578 friend class Internal::PointFillOp; \
1579 friend class Internal::DiscardOp; \
1580 friend class Internal::AttachOp; \
1581 friend class Internal::IndexAttachOp; \
1582 friend class Internal::ReplIndexAttachOp; \
1583 friend class Internal::PointAttachOp; \
1584 friend class Internal::DetachOp; \
1585 friend class Internal::IndexDetachOp; \
1586 friend class Internal::ReplIndexDetachOp; \
1587 friend class Internal::PointDetachOp; \
1588 friend class Internal::TimingOp; \
1589 friend class Internal::TunableOp; \
1590 friend class Internal::AllReduceOp; \
1591 friend class Internal::TraceRecurrentOp; \
1592 friend class Internal::ExternalMappable; \
1593 friend class Internal::ExternalTask; \
1594 friend class Internal::TaskOp; \
1595 friend class Internal::SingleTask; \
1596 friend class Internal::MultiTask; \
1597 friend class Internal::IndividualTask; \
1598 friend class Internal::PointTask; \
1599 friend class Internal::IndexTask; \
1600 friend class Internal::SliceTask; \
1601 friend class Internal::ReplIndividualTask; \
1602 friend class Internal::ReplIndexTask; \
1603 friend class Internal::ReplFillOp; \
1604 friend class Internal::ReplIndexFillOp; \
1605 friend class Internal::ReplDiscardOp; \
1606 friend class Internal::ReplCopyOp; \
1607 friend class Internal::ReplIndexCopyOp; \
1608 friend class Internal::ReplDeletionOp; \
1609 friend class Internal::ReplPendingPartitionOp; \
1610 friend class Internal::ReplDependentPartitionOp; \
1611 friend class Internal::ReplMustEpochOp; \
1612 friend class Internal::ReplMapOp; \
1613 friend class Internal::ReplTimingOp; \
1614 friend class Internal::ReplTunableOp; \
1615 friend class Internal::ReplAllReduceOp; \
1616 friend class Internal::ReplFenceOp; \
1617 friend class Internal::ReplAttachOp; \
1618 friend class Internal::ReplDetachOp; \
1619 friend class Internal::ReplAcquireOp; \
1620 friend class Internal::ReplReleaseOp; \
1621 friend class Internal::MemoizableOp; \
1622 template<typename OP> \
1623 friend class Internal::Memoizable; \
1624 friend class Internal::ShardManager; \
1625 friend class Internal::IndexSpaceNode; \
1626 template<int, typename> \
1627 friend class Internal::IndexSpaceNodeT; \
1628 friend class Internal::IndexPartNode; \
1629 friend class Internal::FieldSpaceNode; \
1630 friend class Internal::RegionTreeNode; \
1631 friend class Internal::RegionNode; \
1632 friend class Internal::PartitionNode; \
1633 friend class Internal::LogicalView; \
1634 friend class Internal::InstanceView; \
1635 friend class Internal::DeferredView; \
1636 friend class Internal::ReductionView; \
1637 friend class Internal::MaterializedView; \
1638 friend class Internal::FillView; \
1639 friend class Internal::LayoutDescription; \
1640 friend class Internal::InstanceManager; \
1641 friend class Internal::PhysicalManager; \
1642 friend class Internal::MapperManager; \
1643 friend class Internal::InstanceRef; \
1644 friend class Internal::HandshakeImpl; \
1645 friend class Internal::ArgumentMapImpl; \
1646 friend class Internal::FutureMapImpl; \
1647 friend class Internal::ReplFutureMapImpl; \
1648 friend class Internal::TaskContext; \
1649 friend class Internal::InnerContext; \
1650 friend class Internal::TopLevelContext; \
1651 friend class Internal::RemoteContext; \
1652 friend class Internal::LeafContext; \
1653 friend class Internal::ReplicateContext; \
1654 friend class Internal::InstanceBuilder; \
1655 friend class Internal::FutureNameExchange; \
1656 friend class Internal::MustEpochMappingExchange; \
1657 friend class Internal::MustEpochMappingBroadcast; \
1658 friend class Internal::MappingCallInfo; \
1659 friend class CObjectWrapper;
Definition constraints.h:689
Definition constraints.h:202
Definition constraints.h:640
Definition geometry.h:159
Definition exception.h:175
Definition constraints.h:240
Definition constraints.h:475
Definition constraints.h:61
Definition constraints.h:167
Definition constraints.h:881
Definition mapping.h:3096
Definition constraints.h:422
Definition constraints.h:737
Definition constraints.h:538
Definition constraints.h:830
Definition physical_region.h:236
Definition physical_region.h:275
Definition constraints.h:783
Definition constraints.h:95
Definition constraints.h:132
Definition functors.h:286
Definition physical_region.h:607
Definition constraints.h:357
Definition constraints.h:942
Definition constraints.h:592
Definition accessors.h:29