Legion Runtime
Loading...
Searching...
No Matches
launchers.h
1/* Copyright 2026 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#ifndef __LEGION_LAUNCHERS_H__
17#define __LEGION_LAUNCHERS_H__
18
19#include "legion/api/argument_map.h"
20#include "legion/api/constraints.h"
21#include "legion/api/future_map.h"
22#include "legion/api/interop.h"
23#include "legion/api/predicate.h"
24#include "legion/api/requirements.h"
25#include "legion/api/sync.h"
26
27namespace Legion {
28
38 public:
39 StaticDependence(void);
41 unsigned previous_offset, unsigned previous_req_index,
42 unsigned current_req_index, DependenceType dtype,
43 bool validates = false, bool shard_only = false);
44 public:
45 inline void add_field(FieldID fid);
46 public:
47 // The relative offset from this operation to
48 // previous operation in the stream of operations
49 // (e.g. 1 is the operation launched immediately before)
50 unsigned previous_offset;
51 // Region requirement of the previous operation for the dependence
52 unsigned previous_req_index;
53 // Region requirement of the current operation for the dependence
54 unsigned current_req_index;
55 // The type of the dependence
56 DependenceType dependence_type;
57 // Whether this requirement validates the previous writer
58 bool validates;
59 // Whether this dependence is a shard-only dependence for
60 // control replication or it depends on all other copies
61 bool shard_only;
62 // Fields that have the dependence
63 std::set<FieldID> dependent_fields;
64 };
65
73 struct TaskLauncher {
74 public:
75 TaskLauncher(void);
77 TaskID tid, UntypedBuffer arg = UntypedBuffer(),
78 Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
79 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
80 const char* provenance = "");
81 public:
82 inline IndexSpaceRequirement& add_index_requirement(
83 const IndexSpaceRequirement& req);
84 inline RegionRequirement& add_region_requirement(
85 const RegionRequirement& req);
86 inline void add_field(unsigned idx, FieldID fid, bool inst = true);
87 public:
88 inline void add_future(Future f);
89 inline void add_grant(Grant g);
90 inline void add_wait_barrier(PhaseBarrier bar);
91 inline void add_arrival_barrier(PhaseBarrier bar);
92 inline void add_wait_handshake(LegionHandshake handshake);
93 inline void add_arrival_handshake(LegionHandshake handshake);
94 public:
95 inline void set_predicate_false_future(Future f);
96 inline void set_predicate_false_result(UntypedBuffer arg);
97 public:
98 inline void set_independent_requirements(bool independent);
99 public:
100 TaskID task_id;
101 std::vector<IndexSpaceRequirement> index_requirements;
102 std::vector<RegionRequirement> region_requirements;
103 std::vector<Future> futures;
104 std::vector<Grant> grants;
105 std::vector<PhaseBarrier> wait_barriers;
106 std::vector<PhaseBarrier> arrive_barriers;
107 UntypedBuffer argument;
108 Predicate predicate;
109 MapperID map_id;
110 MappingTagID tag;
111 UntypedBuffer map_arg;
112 DomainPoint point;
113 // Only used in control replication contexts for
114 // doing sharding. If left unspecified the runtime
115 // will use an index space of size 1 containing 'point'
116 IndexSpace sharding_space;
117 public:
118 // If the predicate is set to anything other than
119 // Predicate::TRUE_PRED, then the application must
120 // specify a value for the future in the case that
121 // the predicate resolves to false. UntypedBuffer(nullptr,0)
122 // can be used if the task's return type is void.
123 Future predicate_false_future;
124 UntypedBuffer predicate_false_result;
125 public:
126 // Provenance string for the runtime and tools to use
127 std::string provenance;
128 public:
129 // Inform the runtime about any static dependences
130 // These will be ignored outside of static traces
131 const std::vector<StaticDependence>* static_dependences;
132 public:
133 // Users can tell the runtime this task is eligible
134 // for inlining by the mapper. This will invoke the
135 // select_task_options call inline as part of the launch
136 // logic for this task to allow the mapper to decide
137 // whether to inline the task or not. Note that if the
138 // mapper pre-empts during execution then resuming it
139 // may take a long time if another long running task
140 // gets scheduled on the processor that launched this task.
141 bool enable_inlining;
142 public:
143 // In some cases users (most likely compilers) will want
144 // to run a light-weight function (e.g. a continuation)
145 // as a task that just depends on futures once those futures
146 // are ready on a local processor where the parent task
147 // is executing. We call this a local function task and it
148 // must not have any region requirements. It must als be a
149 // pure function with no side effects. This task will
150 // not have the option of being distributed to remote nodes.
151 bool local_function_task;
152 public:
153 // Users can inform the runtime that all region requirements
154 // are independent of each other in this task. Independent
155 // means that either field sets are independent or region
156 // requirements are disjoint based on the region tree.
157 bool independent_requirements;
158 public:
159 // Instruct the runtime that it does not need to produce
160 // a future or future map result for this index task
161 bool elide_future_return;
162 // Provide an optional future return size. In general you
163 // shouldn't need to use this and should prefer specifying
164 // the future return size when you register a task variant.
165 std::optional<size_t> future_return_size;
166 public:
167 bool silence_warnings;
168 };
169
179 public:
180 IndexTaskLauncher(void);
182 TaskID tid, Domain domain, UntypedBuffer global_arg = UntypedBuffer(),
183 ArgumentMap map = ArgumentMap(), Predicate pred = Predicate::TRUE_PRED,
184 bool must = false, MapperID id = 0, MappingTagID tag = 0,
185 UntypedBuffer map_arg = UntypedBuffer(), const char* provenance = "");
187 TaskID tid, IndexSpace launch_space,
188 UntypedBuffer global_arg = UntypedBuffer(),
189 ArgumentMap map = ArgumentMap(), Predicate pred = Predicate::TRUE_PRED,
190 bool must = false, MapperID id = 0, MappingTagID tag = 0,
191 UntypedBuffer map_arg = UntypedBuffer(), const char* provenance = "");
192 public:
193 inline IndexSpaceRequirement& add_index_requirement(
194 const IndexSpaceRequirement& req);
195 inline RegionRequirement& add_region_requirement(
196 const RegionRequirement& req);
197 inline void add_field(unsigned idx, FieldID fid, bool inst = true);
198 public:
199 inline void add_future(Future f);
200 inline void add_grant(Grant g);
201 inline void add_wait_barrier(PhaseBarrier bar);
202 inline void add_arrival_barrier(PhaseBarrier bar);
203 inline void add_wait_handshake(LegionHandshake handshake);
204 inline void add_arrival_handshake(LegionHandshake handshake);
205 public:
206 inline void set_predicate_false_future(Future f);
207 inline void set_predicate_false_result(UntypedBuffer arg);
208 public:
209 inline void set_independent_requirements(bool independent);
210 public:
211 TaskID task_id;
212 Domain launch_domain;
213 IndexSpace launch_space;
214 // Will only be used in control replication context. If left
215 // unset the runtime will use launch_domain/launch_space
216 IndexSpace sharding_space;
217 std::vector<IndexSpaceRequirement> index_requirements;
218 std::vector<RegionRequirement> region_requirements;
219 std::vector<Future> futures;
220 // These are appended to the futures for the point
221 // task after the futures sent to all points above
222 std::vector<ArgumentMap> point_futures;
223 std::vector<Grant> grants;
224 std::vector<PhaseBarrier> wait_barriers;
225 std::vector<PhaseBarrier> arrive_barriers;
226 UntypedBuffer global_arg;
227 ArgumentMap argument_map;
228 Predicate predicate;
229 // Specify that all the point tasks in this index launch be
230 // able to run concurrently, meaning they all must map to
231 // different processors and they cannot have interfering region
232 // requirements that might lead to dependences. Note that the
233 // runtime guarantees that concurrent index launches will not
234 // deadlock with other concurrent index launches which requires
235 // additional analysis. Currently concurrent index space launches
236 // will only be allowed to map to leaf task variants currently.
237 ConcurrentID concurrent_functor; // = 0
238 bool concurrent; // = false
239 // This will convert this index space launch into a must
240 // epoch launch which supports interfering region requirements
241 bool must_parallelism;
242 MapperID map_id;
243 MappingTagID tag;
244 UntypedBuffer map_arg;
245 public:
246 // If the predicate is set to anything other than
247 // Predicate::TRUE_PRED, then the application must
248 // specify a value for the future in the case that
249 // the predicate resolves to false. UntypedBuffer(nullptr,0)
250 // can be used if the task's return type is void.
251 Future predicate_false_future;
252 UntypedBuffer predicate_false_result;
253 public:
254 // Provenance string for the runtime and tools to use
255 std::string provenance;
256 public:
257 // Inform the runtime about any static dependences
258 // These will be ignored outside of static traces
259 const std::vector<StaticDependence>* static_dependences;
260 public:
261 // Users can tell the runtime this task is eligible
262 // for inlining by the mapper. This will invoke the
263 // select_task_options call inline as part of the launch
264 // logic for this task to allow the mapper to decide
265 // whether to inline the task or not. Note that if the
266 // mapper pre-empts during execution then resuming it
267 // may take a long time if another long running task
268 // gets scheduled on the processor that launched this task.
269 bool enable_inlining;
270 public:
271 // Users can inform the runtime that all region requirements
272 // are independent of each other in this task. Independent
273 // means that either field sets are independent or region
274 // requirements are disjoint based on the region tree.
275 bool independent_requirements;
276 public:
277 bool silence_warnings;
278 public:
279 // Instruct the runtime that it does not need to produce
280 // a future or future map result for this index task
281 bool elide_future_return;
282 // Provide an optional future return size. In general you
283 // shouldn't need to use this and should prefer specifying
284 // the future return size when you register a task variant.
285 std::optional<size_t> future_return_size;
286 public:
287 // Initial value for reduction
288 Future initial_value;
289 };
290
300 public:
301 InlineLauncher(void);
303 const RegionRequirement& req, MapperID id = 0, MappingTagID tag = 0,
304 LayoutConstraintID layout_id = 0,
305 UntypedBuffer map_arg = UntypedBuffer(), const char* provenance = "");
306 public:
307 inline void add_field(FieldID fid, bool inst = true);
308 public:
309 inline void add_grant(Grant g);
310 inline void add_wait_barrier(PhaseBarrier bar);
311 inline void add_arrival_barrier(PhaseBarrier bar);
312 inline void add_wait_handshake(LegionHandshake handshake);
313 inline void add_arrival_handshake(LegionHandshake handshake);
314 public:
315 RegionRequirement requirement;
316 std::vector<Grant> grants;
317 std::vector<PhaseBarrier> wait_barriers;
318 std::vector<PhaseBarrier> arrive_barriers;
319 MapperID map_id;
320 MappingTagID tag;
321 UntypedBuffer map_arg;
322 public:
323 LayoutConstraintID layout_constraint_id;
324 public:
325 // Provenance string for the runtime and tools to use
326 std::string provenance;
327 public:
328 // Inform the runtime about any static dependences
329 // These will be ignored outside of static traces
330 const std::vector<StaticDependence>* static_dependences;
331 };
332
358 public:
360 Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
361 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
362 const char* provenance = "");
363 public:
364 inline unsigned add_copy_requirements(
365 const RegionRequirement& src, const RegionRequirement& dst);
366 inline void add_src_field(unsigned idx, FieldID fid, bool inst = true);
367 inline void add_dst_field(unsigned idx, FieldID fid, bool inst = true);
368 public:
369 // Specify src/dst indirect requirements (must have exactly 1 field)
370 inline void add_src_indirect_field(
371 FieldID src_idx_fid, const RegionRequirement& src_idx_req,
372 bool is_range_indirection = false, bool inst = true);
373 inline void add_dst_indirect_field(
374 FieldID dst_idx_fid, const RegionRequirement& dst_idx_req,
375 bool is_range_indirection = false, bool inst = true);
376 inline RegionRequirement& add_src_indirect_field(
377 const RegionRequirement& src_idx_req,
378 bool is_range_indirection = false);
379 inline RegionRequirement& add_dst_indirect_field(
380 const RegionRequirement& dst_idx_req,
381 bool is_range_indirection = false);
382 public:
383 inline void add_grant(Grant g);
384 inline void add_wait_barrier(PhaseBarrier bar);
385 inline void add_arrival_barrier(PhaseBarrier bar);
386 inline void add_wait_handshake(LegionHandshake handshake);
387 inline void add_arrival_handshake(LegionHandshake handshake);
388 public:
389 std::vector<RegionRequirement> src_requirements;
390 std::vector<RegionRequirement> dst_requirements;
391 std::vector<RegionRequirement> src_indirect_requirements;
392 std::vector<RegionRequirement> dst_indirect_requirements;
393 std::vector<bool> src_indirect_is_range;
394 std::vector<bool> dst_indirect_is_range;
395 std::vector<Grant> grants;
396 std::vector<PhaseBarrier> wait_barriers;
397 std::vector<PhaseBarrier> arrive_barriers;
398 Predicate predicate;
399 MapperID map_id;
400 MappingTagID tag;
401 UntypedBuffer map_arg;
402 DomainPoint point;
403 // Only used in control replication contexts for
404 // doing sharding. If left unspecified the runtime
405 // will use an index space of size 1 containing 'point'
406 IndexSpace sharding_space;
407 public:
408 // Provenance string for the runtime and tools to use
409 std::string provenance;
410 public:
411 // Inform the runtime about any static dependences
412 // These will be ignored outside of static traces
413 const std::vector<StaticDependence>* static_dependences;
414 public:
415 // Whether the source and destination indirections can lead
416 // to out-of-range access into the instances to skip
417 bool possible_src_indirect_out_of_range;
418 bool possible_dst_indirect_out_of_range;
419 // Whether the destination indirection can lead to aliasing
420 // in the destination instances requiring synchronization
421 bool possible_dst_indirect_aliasing;
422 public:
423 bool silence_warnings;
424 };
425
437 public:
438 IndexCopyLauncher(void);
440 Domain domain, Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
441 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
442 const char* provenance = "");
444 IndexSpace space, Predicate pred = Predicate::TRUE_PRED,
445 MapperID id = 0, MappingTagID tag = 0,
446 UntypedBuffer map_arg = UntypedBuffer(), const char* provenance = "");
447 public:
448 inline unsigned add_copy_requirements(
449 const RegionRequirement& src, const RegionRequirement& dst);
450 inline void add_src_field(unsigned idx, FieldID fid, bool inst = true);
451 inline void add_dst_field(unsigned idx, FieldID fid, bool inst = true);
452 public:
453 // Specify src/dst indirect requirements (must have exactly 1 field)
454 inline void add_src_indirect_field(
455 FieldID src_idx_fid, const RegionRequirement& src_idx_req,
456 bool is_range_indirection = false, bool inst = true);
457 inline void add_dst_indirect_field(
458 FieldID dst_idx_fid, const RegionRequirement& dst_idx_req,
459 bool is_range_indirection = false, bool inst = true);
460 inline RegionRequirement& add_src_indirect_field(
461 const RegionRequirement& src_idx_req,
462 bool is_range_indirection = false);
463 inline RegionRequirement& add_dst_indirect_field(
464 const RegionRequirement& dst_idx_req,
465 bool is_range_indirection = false);
466 public:
467 inline void add_grant(Grant g);
468 inline void add_wait_barrier(PhaseBarrier bar);
469 inline void add_arrival_barrier(PhaseBarrier bar);
470 inline void add_wait_handshake(LegionHandshake handshake);
471 inline void add_arrival_handshake(LegionHandshake handshake);
472 public:
473 std::vector<RegionRequirement> src_requirements;
474 std::vector<RegionRequirement> dst_requirements;
475 std::vector<RegionRequirement> src_indirect_requirements;
476 std::vector<RegionRequirement> dst_indirect_requirements;
477 std::vector<bool> src_indirect_is_range;
478 std::vector<bool> dst_indirect_is_range;
479 std::vector<Grant> grants;
480 std::vector<PhaseBarrier> wait_barriers;
481 std::vector<PhaseBarrier> arrive_barriers;
482 Domain launch_domain;
483 IndexSpace launch_space;
484 // Will only be used in control replication context. If left
485 // unset the runtime will use launch_domain/launch_space
486 IndexSpace sharding_space;
487 Predicate predicate;
488 MapperID map_id;
489 MappingTagID tag;
490 UntypedBuffer map_arg;
491 public:
492 // Provenance string for the runtime and tools to use
493 std::string provenance;
494 public:
495 // Inform the runtime about any static dependences
496 // These will be ignored outside of static traces
497 const std::vector<StaticDependence>* static_dependences;
498 public:
499 // Whether the source and destination indirections can lead
500 // to out-of-range access into the instances to skip
501 bool possible_src_indirect_out_of_range;
502 bool possible_dst_indirect_out_of_range;
503 // Whether the destination indirection can lead to aliasing
504 // in the destination instances requiring synchronization
505 bool possible_dst_indirect_aliasing;
506 // Whether the individual point copies should operate collectively
507 // together in the case of indirect copies (e.g. allow indirections
508 // to refer to instances from other points). These settings have
509 // no effect in the case of copies without indirections.
510 bool collective_src_indirect_points;
511 bool collective_dst_indirect_points;
512 public:
513 bool silence_warnings;
514 };
515
523 public:
524 FillLauncher(void);
526 LogicalRegion handle, LogicalRegion parent, UntypedBuffer arg,
527 Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
528 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
529 const char* provenance = "");
531 LogicalRegion handle, LogicalRegion parent, Future f,
532 Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
533 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
534 const char* provenance = "");
535 public:
536 inline void set_argument(UntypedBuffer arg);
537 inline void set_future(Future f);
538 inline void add_field(FieldID fid);
539 inline void add_grant(Grant g);
540 inline void add_wait_barrier(PhaseBarrier bar);
541 inline void add_arrival_barrier(PhaseBarrier bar);
542 inline void add_wait_handshake(LegionHandshake handshake);
543 inline void add_arrival_handshake(LegionHandshake handshake);
544 public:
545 LogicalRegion handle;
546 LogicalRegion parent;
547 UntypedBuffer argument;
548 Future future;
549 Predicate predicate;
550 std::set<FieldID> fields;
551 std::vector<Grant> grants;
552 std::vector<PhaseBarrier> wait_barriers;
553 std::vector<PhaseBarrier> arrive_barriers;
554 MapperID map_id;
555 MappingTagID tag;
556 UntypedBuffer map_arg;
557 DomainPoint point;
558 // Only used in control replication contexts for
559 // doing sharding. If left unspecified the runtime
560 // will use an index space of size 1 containing 'point'
561 IndexSpace sharding_space;
562 public:
563 // Provenance string for the runtime and tools to use
564 std::string provenance;
565 public:
566 // Inform the runtime about any static dependences
567 // These will be ignored outside of static traces
568 const std::vector<StaticDependence>* static_dependences;
569 public:
570 bool silence_warnings;
571 };
572
583 public:
584 IndexFillLauncher(void);
585 // Region projection
587 Domain domain, LogicalRegion handle, LogicalRegion parent,
588 UntypedBuffer arg, ProjectionID projection = 0,
589 Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
590 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
591 const char* provenance = "");
593 Domain domain, LogicalRegion handle, LogicalRegion parent, Future f,
594 ProjectionID projection = 0, Predicate pred = Predicate::TRUE_PRED,
595 MapperID id = 0, MappingTagID tag = 0,
596 UntypedBuffer map_arg = UntypedBuffer(), const char* provenance = "");
598 IndexSpace space, LogicalRegion handle, LogicalRegion parent,
599 UntypedBuffer arg, ProjectionID projection = 0,
600 Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
601 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
602 const char* provenance = "");
604 IndexSpace space, LogicalRegion handle, LogicalRegion parent, Future f,
605 ProjectionID projection = 0, Predicate pred = Predicate::TRUE_PRED,
606 MapperID id = 0, MappingTagID tag = 0,
607 UntypedBuffer map_arg = UntypedBuffer(), const char* provenance = "");
608 // Partition projection
610 Domain domain, LogicalPartition handle, LogicalRegion parent,
611 UntypedBuffer arg, ProjectionID projection = 0,
612 Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
613 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
614 const char* provenance = "");
616 Domain domain, LogicalPartition handle, LogicalRegion parent, Future f,
617 ProjectionID projection = 0, Predicate pred = Predicate::TRUE_PRED,
618 MapperID id = 0, MappingTagID tag = 0,
619 UntypedBuffer map_arg = UntypedBuffer(), const char* provenance = "");
621 IndexSpace space, LogicalPartition handle, LogicalRegion parent,
622 UntypedBuffer arg, ProjectionID projection = 0,
623 Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
624 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
625 const char* provenance = "");
627 IndexSpace space, LogicalPartition handle, LogicalRegion parent,
628 Future f, ProjectionID projection = 0,
629 Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
630 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
631 const char* provenance = "");
632 public:
633 inline void set_argument(UntypedBuffer arg);
634 inline void set_future(Future f);
635 inline void add_field(FieldID fid);
636 inline void add_grant(Grant g);
637 inline void add_wait_barrier(PhaseBarrier bar);
638 inline void add_arrival_barrier(PhaseBarrier bar);
639 inline void add_wait_handshake(LegionHandshake handshake);
640 inline void add_arrival_handshake(LegionHandshake handshake);
641 public:
642 Domain launch_domain;
643 IndexSpace launch_space;
644 // Will only be used in control replication context. If left
645 // unset the runtime will use launch_domain/launch_space
646 IndexSpace sharding_space;
647 LogicalRegion region;
648 LogicalPartition partition;
649 LogicalRegion parent;
650 ProjectionID projection;
651 UntypedBuffer argument;
652 Future future;
653 Predicate predicate;
654 std::set<FieldID> fields;
655 std::vector<Grant> grants;
656 std::vector<PhaseBarrier> wait_barriers;
657 std::vector<PhaseBarrier> arrive_barriers;
658 MapperID map_id;
659 MappingTagID tag;
660 UntypedBuffer map_arg;
661 public:
662 // Provenance string for the runtime and tools to use
663 std::string provenance;
664 public:
665 // Inform the runtime about any static dependences
666 // These will be ignored outside of static traces
667 const std::vector<StaticDependence>* static_dependences;
668 public:
669 bool silence_warnings;
670 };
671
679 public:
681 public:
682 inline void add_field(FieldID fid);
683 public:
684 LogicalRegion handle;
685 LogicalRegion parent;
686 std::set<FieldID> fields;
687 public:
688 // Provenance string for the runtime and tools to use
689 std::string provenance;
690 public:
691 // Inform the runtime about any static dependences
692 // These will be ignored outside of static traces
693 const std::vector<StaticDependence>* static_dependences;
694 public:
695 bool silence_warnings;
696 };
697
722 public:
724 ExternalResource resource, LogicalRegion handle, LogicalRegion parent,
725 const bool restricted = true, const bool mapped = true);
726 // Declared here to avoid superfluous compiler warnings
727 // Can be remove after deprecated members are removed
728 ~AttachLauncher(void);
729 public:
730 inline void initialize_constraints(
731 bool column_major, bool soa, const std::vector<FieldID>& fields,
732 const std::map<FieldID, size_t>* alignments = nullptr);
733 LEGION_DEPRECATED("Use Realm::ExternalFileResource instead")
734 inline void attach_file(
735 const char* file_name, const std::vector<FieldID>& fields,
736 LegionFileMode mode);
737 LEGION_DEPRECATED("Use Realm::ExternalHDF5Resource instead")
738 inline void attach_hdf5(
739 const char* file_name, const std::map<FieldID, const char*>& field_map,
740 LegionFileMode mode);
741 // Helper methods for AOS and SOA arrays, but it is totally
742 // acceptable to fill in the layout constraint set manually
743 LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
744 inline void attach_array_aos(
745 void* base, bool column_major, const std::vector<FieldID>& fields,
746 Memory memory = Memory::NO_MEMORY,
747 const std::map<FieldID, size_t>* alignments = nullptr);
748 LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
749 inline void attach_array_soa(
750 void* base, bool column_major, const std::vector<FieldID>& fields,
751 Memory memory = Memory::NO_MEMORY,
752 const std::map<FieldID, size_t>* alignments = nullptr);
753 public:
754 ExternalResource resource;
755 LogicalRegion parent;
756 LogicalRegion handle;
757 std::set<FieldID> privilege_fields;
758 public:
759 // This will be cloned each time you perform an attach with this launcher
760 const Realm::ExternalInstanceResource* external_resource;
761 public:
762 LayoutConstraintSet constraints;
763 public:
764 // Whether this instance will be restricted when attached
765 bool restricted /*= true*/;
766 // Whether this region should be mapped by the calling task
767 bool mapped; /*= true*/
768 // Only matters for control replicated parent tasks
769 // Indicate whether all the shards are providing the same data
770 // or whether they are each providing different data
771 // Collective means that each shard provides its own copy of the
772 // data and non-collective means every shard provides the same data
773 // Defaults to 'true' for external instances and 'false' for files
774 bool collective;
775 // For collective cases, indicate whether the runtime should
776 // deduplicate data across shards in the same process
777 // This is useful for cases where there is one file or external
778 // instance per process but multiple shards per process
779 bool deduplicate_across_shards;
780 public:
781 // Provenance string for the runtime and tools to use
782 std::string provenance;
783 public:
784 // Data for files
785 LEGION_DEPRECATED("file_name is deprecated, use external_resource")
786 const char* file_name;
787 LEGION_DEPRECATED("mode is deprecated, use external_resource")
788 LegionFileMode mode;
789 LEGION_DEPRECATED("file_fields is deprecated, use external_resource")
790 std::vector<FieldID> file_fields; // normal files
791 // This member must still be populated if you're attaching to an HDF5 file
792 std::map<FieldID, /*file name*/ const char*> field_files; // hdf5 files
793 public:
794 // Optional footprint of the instance in memory in bytes
795 size_t footprint;
796 public:
797 // Inform the runtime about any static dependences
798 // These will be ignored outside of static traces
799 const std::vector<StaticDependence>* static_dependences;
800 };
801
813 public:
815 ExternalResource resource, LogicalRegion parent,
816 const bool restricted = true);
817 // Declared here to avoid superfluous compiler warnings
818 // Can be remove after deprecated members are removed
820 public:
821 inline void initialize_constraints(
822 bool column_major, bool soa, const std::vector<FieldID>& fields,
823 const std::map<FieldID, size_t>* alignments = nullptr);
824 inline void add_external_resource(
825 LogicalRegion handle, const Realm::ExternalInstanceResource* resource);
826 LEGION_DEPRECATED("Use Realm::ExternalFileResource instead")
827 inline void attach_file(
828 LogicalRegion handle, const char* file_name,
829 const std::vector<FieldID>& fields, LegionFileMode mode);
830 LEGION_DEPRECATED("Use Realm::ExternalHDF5Resource instead")
831 inline void attach_hdf5(
832 LogicalRegion handle, const char* file_name,
833 const std::map<FieldID, const char*>& field_map, LegionFileMode mode);
834 // Helper methods for AOS and SOA arrays, but it is totally
835 // acceptable to fill in the layout constraint set manually
836 LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
837 inline void attach_array_aos(
838 LogicalRegion handle, void* base, bool column_major,
839 const std::vector<FieldID>& fields, Memory memory = Memory::NO_MEMORY,
840 const std::map<FieldID, size_t>* alignments = nullptr);
841 LEGION_DEPRECATED("Use Realm::ExternalMemoryResource instead")
842 inline void attach_array_soa(
843 LogicalRegion handle, void* base, bool column_major,
844 const std::vector<FieldID>& fields, Memory memory = Memory::NO_MEMORY,
845 const std::map<FieldID, size_t>* alignments = nullptr);
846 public:
847 ExternalResource resource;
848 LogicalRegion parent;
849 std::set<FieldID> privilege_fields;
850 std::vector<LogicalRegion> handles;
851 // This is the vector external resource objects that are going to
852 // attached to the vector of logical region handles
853 // These will be cloned each time you perform an attach with this launcher
854 std::vector<const Realm::ExternalInstanceResource*> external_resources;
855 public:
856 LayoutConstraintSet constraints;
857 public:
858 // Whether these instances will be restricted when attached
859 bool restricted /*= true*/;
860 // Whether the runtime should check for duplicate resources across
861 // the shards in a control replicated context, it is illegal to pass
862 // in the same resource to different shards if this is set to false
863 bool deduplicate_across_shards;
864 public:
865 // Provenance string for the runtime and tools to use
866 std::string provenance;
867 public:
868 // Data for files
869 LEGION_DEPRECATED("mode is deprecated, use external_resources")
870 LegionFileMode mode;
871 LEGION_DEPRECATED("file_names is deprecated, use external_resources")
872 std::vector<const char*> file_names;
873 LEGION_DEPRECATED("file_fields is deprecated, use external_resources")
874 std::vector<FieldID> file_fields; // normal files
875 // This data structure must still be filled in for using HDF5 files
876 std::map<FieldID, std::vector</*file name*/ const char*> >
877 field_files; // hdf5 files
878 public:
879 // Data for external instances
880 LEGION_DEPRECATED("pointers is deprecated, use external_resources")
881 std::vector<PointerConstraint> pointers;
882 public:
883 // Optional footprint of the instance in memory in bytes
884 // You only need to fill this in when using depcreated fields
885 std::vector<size_t> footprint;
886 public:
887 // Inform the runtime about any static dependences
888 // These will be ignored outside of static traces
889 const std::vector<StaticDependence>* static_dependences;
890 };
891
899 public:
900 explicit PredicateLauncher(bool and_op = true);
901 public:
902 inline void add_predicate(const Predicate& pred);
903 public:
904 bool and_op; // if not 'and' then 'or'
905 std::vector<Predicate> predicates;
906 std::string provenance;
907 };
908
915 public:
916 TimingLauncher(TimingMeasurement measurement);
917 public:
918 inline void add_precondition(const Future& f);
919 public:
920 TimingMeasurement measurement;
921 std::set<Future> preconditions;
922 public:
923 // Provenance string for the runtime and tools to use
924 std::string provenance;
925 };
926
933 public:
935 TunableID tid, MapperID mapper = 0, MappingTagID tag = 0,
936 size_t return_type_size = SIZE_MAX);
937 public:
938 TunableID tunable;
939 MapperID mapper;
940 MappingTagID tag;
941 UntypedBuffer arg;
942 std::vector<Future> futures;
943 size_t return_type_size;
944 public:
945 // Provenance string for the runtime and tools to use
946 std::string provenance;
947 };
948
961 public:
963 LogicalRegion logical_region, LogicalRegion parent_region,
964 PhysicalRegion physical_region = PhysicalRegion(),
965 Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
966 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
967 const char* provenance = "");
968 public:
969 inline void add_field(FieldID f);
970 inline void add_grant(Grant g);
971 inline void add_wait_barrier(PhaseBarrier pb);
972 inline void add_arrival_barrier(PhaseBarrier pb);
973 inline void add_wait_handshake(LegionHandshake handshake);
974 inline void add_arrival_handshake(LegionHandshake handshake);
975 public:
976 LogicalRegion logical_region;
977 LogicalRegion parent_region;
978 std::set<FieldID> fields;
979 public:
980 // This field is now optional (but required with control replication)
981 PhysicalRegion physical_region;
982 public:
983 std::vector<Grant> grants;
984 std::vector<PhaseBarrier> wait_barriers;
985 std::vector<PhaseBarrier> arrive_barriers;
986 Predicate predicate;
987 MapperID map_id;
988 MappingTagID tag;
989 UntypedBuffer map_arg;
990 public:
991 // Provenance string for the runtime and tools to use
992 std::string provenance;
993 public:
994 // Inform the runtime about any static dependences
995 // These will be ignored outside of static traces
996 const std::vector<StaticDependence>* static_dependences;
997 public:
998 bool silence_warnings;
999 };
1000
1008 public:
1010 LogicalRegion logical_region, LogicalRegion parent_region,
1011 PhysicalRegion physical_region = PhysicalRegion(),
1012 Predicate pred = Predicate::TRUE_PRED, MapperID id = 0,
1013 MappingTagID tag = 0, UntypedBuffer map_arg = UntypedBuffer(),
1014 const char* provenance = "");
1015 public:
1016 inline void add_field(FieldID f);
1017 inline void add_grant(Grant g);
1018 inline void add_wait_barrier(PhaseBarrier pb);
1019 inline void add_arrival_barrier(PhaseBarrier pb);
1020 inline void add_wait_handshake(LegionHandshake handshake);
1021 inline void add_arrival_handshake(LegionHandshake handshake);
1022 public:
1023 LogicalRegion logical_region;
1024 LogicalRegion parent_region;
1025 std::set<FieldID> fields;
1026 public:
1027 // This field is now optional (but required with control replication)
1028 PhysicalRegion physical_region;
1029 public:
1030 std::vector<Grant> grants;
1031 std::vector<PhaseBarrier> wait_barriers;
1032 std::vector<PhaseBarrier> arrive_barriers;
1033 Predicate predicate;
1034 MapperID map_id;
1035 MappingTagID tag;
1036 UntypedBuffer map_arg;
1037 public:
1038 // Provenance string for the runtime and tools to use
1039 std::string provenance;
1040 public:
1041 // Inform the runtime about any static dependences
1042 // These will be ignored outside of static traces
1043 const std::vector<StaticDependence>* static_dependences;
1044 public:
1045 bool silence_warnings;
1046 };
1047
1062 public:
1063 MustEpochLauncher(MapperID id = 0, MappingTagID tag = 0);
1064 public:
1065 inline void add_single_task(
1066 const DomainPoint& point, const TaskLauncher& launcher);
1067 inline void add_index_task(const IndexTaskLauncher& launcher);
1068 public:
1069 MapperID map_id;
1070 MappingTagID mapping_tag;
1071 std::vector<TaskLauncher> single_tasks;
1072 std::vector<IndexTaskLauncher> index_tasks;
1073 public:
1074 Domain launch_domain;
1075 IndexSpace launch_space;
1076 // Will only be used in control replication context. If left
1077 // unset the runtime will use launch_space/launch_domain
1078 IndexSpace sharding_space;
1079 public:
1080 // Provenance string for the runtime and tools to use
1081 std::string provenance;
1082 public:
1083 bool silence_warnings;
1084 };
1085
1086} // namespace Legion
1087
1088#include "legion/api/launchers.inl"
1089
1090#endif // __LEGION_LAUNCHERS_H__
Definition argument_map.h:88
Definition geometry.h:154
Definition geometry.h:29
Definition future.h:45
Definition sync.h:97
Definition data.h:30
Definition constraints.h:881
Definition interop.h:33
Definition data.h:255
Definition data.h:184
Definition sync.h:142
Definition physical_region.h:33
Definition predicate.h:33
Definition types.h:334
Definition argument_map.h:35
Definition launchers.h:960
Definition launchers.h:721
Definition launchers.h:357
Definition launchers.h:678
Definition launchers.h:522
Definition launchers.h:812
Definition launchers.h:436
Definition launchers.h:582
Definition requirements.h:284
Definition launchers.h:178
Definition launchers.h:299
Definition launchers.h:1061
Definition launchers.h:898
Definition requirements.h:37
Definition launchers.h:1007
Definition launchers.h:37
Definition launchers.h:73
Definition launchers.h:914
Definition launchers.h:932