Legion Runtime
Loading...
Searching...
No Matches
constraints.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_CONSTRAINT_H__
17#define __LEGION_CONSTRAINT_H__
18
23#include "legion/api/types.h"
24#include "legion/api/geometry.h"
25
26// clang-format off
27#define LEGION_EXECUTION_CONSTRAINT_KINDS(__op__) \
28 __op__(LEGION_ISA_CONSTRAINT, "ISA") \
29 __op__(LEGION_PROCESSOR_CONSTRAINT, "Processor") \
30 __op__(LEGION_RESOURCE_CONSTRAINT, "Resource") \
31 __op__(LEGION_LAUNCH_CONSTRAINT, "Launch") \
32 __op__(LEGION_COLOCATION_CONSTRAINT, "Co-Location")
33
34#define LEGION_LAYOUT_CONSTRAINT_KINDS(__op__) \
35 __op__(LEGION_SPECIALIZED_CONSTRAINT, "Specialized") \
36 __op__(LEGION_MEMORY_CONSTRAINT, "Memory") \
37 __op__(LEGION_FIELD_CONSTRAINT, "Field") \
38 __op__(LEGION_ORDERING_CONSTRAINT, "Ordering") \
39 __op__(LEGION_TILING_CONSTRAINT, "Tiling") \
40 __op__(LEGION_DIMENSION_CONSTRAINT, "Dimension") \
41 __op__(LEGION_ALIGNMENT_CONSTRAINT, "Alignment") \
42 __op__(LEGION_OFFSET_CONSTRAINT, "Offset") \
43 __op__(LEGION_POINTER_CONSTRAINT, "Pointer") \
44 __op__(LEGION_PADDING_CONSTRAINT, "Padding")
45// clang-format on
46
47namespace Legion {
48
62 public:
63 static const ExecutionConstraintKind constraint_kind =
64 LEGION_ISA_CONSTRAINT;
65 public:
66 ISAConstraint(uint64_t prop = 0);
67 public:
68 inline bool operator==(const ISAConstraint& other) const
69 {
70 return isa_prop == other.isa_prop;
71 }
72 inline bool operator!=(const ISAConstraint& other) const
73 {
74 return !(*this == other);
75 }
76 public:
77 bool entails(const ISAConstraint& other) const;
78 bool conflicts(const ISAConstraint& other) const;
79 public:
80 void swap(ISAConstraint& rhs);
81 void serialize(Serializer& rez) const;
82 void deserialize(Deserializer& derez);
83 public:
84 uint64_t isa_prop;
85 };
86
96 public:
97 static const ExecutionConstraintKind constraint_kind =
98 LEGION_PROCESSOR_CONSTRAINT;
99 public:
100 ProcessorConstraint(Processor::Kind kind = Processor::NO_KIND);
101 public:
102 inline bool operator==(const ProcessorConstraint& other) const
103 {
104 return valid_kinds == other.valid_kinds;
105 }
106 inline bool operator!=(const ProcessorConstraint& other) const
107 {
108 return !(*this == other);
109 }
110 public:
111 inline bool is_valid(void) const { return !valid_kinds.empty(); }
112 void add_kind(Processor::Kind kind);
113 bool can_use(Processor::Kind kind) const;
114 public:
115 bool entails(const ProcessorConstraint& other) const;
116 bool conflicts(const ProcessorConstraint& other) const;
117 public:
118 void swap(ProcessorConstraint& rhs);
119 void serialize(Serializer& rez) const;
120 void deserialize(Deserializer& derez);
121 public:
122 std::vector<Processor::Kind> valid_kinds;
123 };
124
133 public:
134 static const ExecutionConstraintKind constraint_kind =
135 LEGION_RESOURCE_CONSTRAINT;
136 public:
137 ResourceConstraint(void);
139 ResourceKind resource_kind, EqualityKind eq_kind, size_t value);
140 public:
141 bool operator==(const ResourceConstraint& other) const;
142 inline bool operator!=(const ResourceConstraint& other) const
143 {
144 return !(*this == other);
145 }
146 public:
147 bool entails(const ResourceConstraint& other) const;
148 bool conflicts(const ResourceConstraint& other) const;
149 public:
150 void swap(ResourceConstraint& rhs);
151 void serialize(Serializer& rez) const;
152 void deserialize(Deserializer& derez);
153 public:
154 ResourceKind resource_kind;
155 EqualityKind equality_kind;
156 size_t value;
157 };
158
168 public:
169 static const ExecutionConstraintKind constraint_kind =
170 LEGION_LAUNCH_CONSTRAINT;
171 public:
172 LaunchConstraint(void);
173 LaunchConstraint(LaunchKind kind, size_t value);
174 LaunchConstraint(LaunchKind kind, const size_t* value, int dims);
175 public:
176 bool operator==(const LaunchConstraint& other) const;
177 inline bool operator!=(const LaunchConstraint& other) const
178 {
179 return !(*this == other);
180 }
181 public:
182 bool entails(const LaunchConstraint& other) const;
183 bool conflicts(const LaunchConstraint& other) const;
184 public:
185 void swap(LaunchConstraint& rhs);
186 void serialize(Serializer& rez) const;
187 void deserialize(Deserializer& derez);
188 public:
189 LaunchKind launch_kind;
190 size_t values[3];
191 int dims;
192 };
193
203 public:
204 static const ExecutionConstraintKind constraint_kind =
205 LEGION_COLOCATION_CONSTRAINT;
206 public:
208 ColocationConstraint(unsigned index1, unsigned index2);
209 ColocationConstraint(unsigned index1, unsigned index2, FieldID fid);
211 unsigned index1, unsigned index2, const std::set<FieldID>& fields);
213 const std::vector<unsigned>& indexes, const std::set<FieldID>& fields);
214 public:
215 inline bool operator==(const ColocationConstraint& o) const
216 {
217 return fields == o.fields && indexes == o.indexes;
218 }
219 inline bool operator!=(const ColocationConstraint& other) const
220 {
221 return !(*this == other);
222 }
223 public:
224 bool entails(const ColocationConstraint& other) const;
225 bool conflicts(const ColocationConstraint& other) const;
226 public:
227 void swap(ColocationConstraint& rhs);
228 void serialize(Serializer& rez) const;
229 void deserialize(Deserializer& derez);
230 public:
231 std::set<FieldID> fields;
232 std::set<unsigned> indexes;
233 };
234
241 public:
242 // Make sure these methods return ourself so we
243 // can easily chain together adding constraints
244 ExecutionConstraintSet& add_constraint(const ISAConstraint& constraint);
245 ExecutionConstraintSet& add_constraint(
246 const ProcessorConstraint& constraint);
247 ExecutionConstraintSet& add_constraint(
248 const ResourceConstraint& constraint);
249 ExecutionConstraintSet& add_constraint(const LaunchConstraint& constraint);
250 ExecutionConstraintSet& add_constraint(
251 const ColocationConstraint& constraint);
252 public:
253 bool operator==(const ExecutionConstraintSet& other) const;
254 inline bool operator!=(const ExecutionConstraintSet& other) const
255 {
256 return !(*this == other);
257 }
258 public:
259 void swap(ExecutionConstraintSet& rhs);
260 void serialize(Serializer& rez) const;
261 void deserialize(Deserializer& derez);
262 public:
263 ISAConstraint isa_constraint;
264 ProcessorConstraint processor_constraint;
265 std::vector<ResourceConstraint> resource_constraints;
266 std::vector<LaunchConstraint> launch_constraints;
267 std::vector<ColocationConstraint> colocation_constraints;
268 };
269
276 public:
277 virtual ~LayoutConstraint(void) { }
278 public:
279 virtual LayoutConstraintKind get_constraint_kind(void) const = 0;
280 public:
281 virtual SpecializedConstraint* as_specialized_constraint(void)
282 {
283 return nullptr;
284 }
285 virtual MemoryConstraint* as_memory_constraint(void) { return nullptr; }
286 virtual FieldConstraint* as_field_constraint(void) { return nullptr; }
287 virtual OrderingConstraint* as_ordering_constraint(void) { return nullptr; }
288 virtual TilingConstraint* as_tiling_constraint(void) { return nullptr; }
289 virtual DimensionConstraint* as_dimension_constraint(void)
290 {
291 return nullptr;
292 }
293 virtual AlignmentConstraint* as_alignment_constraint(void)
294 {
295 return nullptr;
296 }
297 virtual OffsetConstraint* as_offset_constraint(void) { return nullptr; }
298 virtual PointerConstraint* as_pointer_constraint(void) { return nullptr; }
299 virtual PaddingConstraint* as_padding_constraint(void) { return nullptr; }
300 public:
301 virtual const SpecializedConstraint* as_specialized_constraint(void) const
302 {
303 return nullptr;
304 }
305 virtual const MemoryConstraint* as_memory_constraint(void) const
306 {
307 return nullptr;
308 }
309 virtual const FieldConstraint* as_field_constraint(void) const
310 {
311 return nullptr;
312 }
313 virtual const OrderingConstraint* as_ordering_constraint(void) const
314 {
315 return nullptr;
316 }
317 virtual const TilingConstraint* as_tiling_constraint(void) const
318 {
319 return nullptr;
320 }
321 virtual const DimensionConstraint* as_dimension_constraint(void) const
322 {
323 return nullptr;
324 }
325 virtual const AlignmentConstraint* as_alignment_constraint(void) const
326 {
327 return nullptr;
328 }
329 virtual const OffsetConstraint* as_offset_constraint(void) const
330 {
331 return nullptr;
332 }
333 virtual const PointerConstraint* as_pointer_constraint(void) const
334 {
335 return nullptr;
336 }
337 virtual const PaddingConstraint* as_padding_constraint(void) const
338 {
339 return nullptr;
340 }
341 };
342
358 public:
359 static const LayoutConstraintKind constraint_kind =
360 LEGION_SPECIALIZED_CONSTRAINT;
361 public:
363 SpecializedKind kind = LEGION_AFFINE_SPECIALIZE,
364 ReductionOpID redop = 0, bool no_access = false, bool exact = false,
365 size_t max_pieces = SIZE_MAX, int max_overhead = 0);
366 public:
367 bool operator==(const SpecializedConstraint& other) const;
368 inline bool operator!=(const SpecializedConstraint& other) const
369 {
370 return !(*this == other);
371 }
372 public:
373 virtual LayoutConstraintKind get_constraint_kind(void) const override
374 {
375 return constraint_kind;
376 }
377 virtual SpecializedConstraint* as_specialized_constraint(void) override
378 {
379 return this;
380 }
381 virtual const SpecializedConstraint* as_specialized_constraint(
382 void) const override
383 {
384 return this;
385 }
386 public:
387 bool entails(const SpecializedConstraint& other) const;
388 bool conflicts(const SpecializedConstraint& other) const;
389 public:
390 inline SpecializedKind get_kind(void) const { return kind; }
391 inline ReductionOpID get_reduction_op(void) const { return redop; }
392 public:
393 void swap(SpecializedConstraint& rhs);
394 void serialize(Serializer& rez) const;
395 void deserialize(Deserializer& derez);
396 public:
397 bool is_affine(void) const;
398 bool is_compact(void) const;
399 bool is_virtual(void) const;
400 bool is_reduction(void) const;
401 bool is_file(void) const;
402 inline bool is_no_access(void) const { return no_access; }
403 inline bool is_exact(void) const { return exact; }
404 // For backwards compatibility
405 bool is_normal(void) const;
406 public:
407 SpecializedKind kind;
408 ReductionOpID redop;
409 size_t max_pieces;
410 int max_overhead;
411 bool no_access;
412 bool exact;
413 };
414
423 public:
424 static const LayoutConstraintKind constraint_kind =
425 LEGION_MEMORY_CONSTRAINT;
426 public:
427 MemoryConstraint(void);
428 MemoryConstraint(Memory::Kind kind);
429 public:
430 inline bool operator==(const MemoryConstraint& other) const
431 {
432 return kind == other.kind && has_kind == other.has_kind;
433 }
434 inline bool operator!=(const MemoryConstraint& other) const
435 {
436 return !(*this == other);
437 }
438 public:
439 virtual LayoutConstraintKind get_constraint_kind(void) const override
440 {
441 return constraint_kind;
442 }
443 virtual MemoryConstraint* as_memory_constraint(void) override
444 {
445 return this;
446 }
447 virtual const MemoryConstraint* as_memory_constraint(void) const override
448 {
449 return this;
450 }
451 public:
452 inline bool is_valid(void) const { return has_kind; }
453 inline Memory::Kind get_kind(void) const { return kind; }
454 public:
455 bool entails(const MemoryConstraint& other) const;
456 bool conflicts(const MemoryConstraint& other) const;
457 public:
458 void swap(MemoryConstraint& rhs);
459 void serialize(Serializer& rez) const;
460 void deserialize(Deserializer& derez);
461 public:
462 Memory::Kind kind;
463 bool has_kind;
464 };
465
476 public:
477 static const LayoutConstraintKind constraint_kind = LEGION_FIELD_CONSTRAINT;
478 public:
479 FieldConstraint(bool contiguous = false, bool inorder = false);
481 const std::vector<FieldID>& field_set, bool contiguous,
482 bool inorder = true);
484 const std::set<FieldID>& field_set, bool contiguous,
485 bool inorder = true);
486 public:
487 bool operator==(const FieldConstraint& other) const;
488 inline bool operator!=(const FieldConstraint& other) const
489 {
490 return !(*this == other);
491 }
492 public:
493 virtual LayoutConstraintKind get_constraint_kind(void) const override
494 {
495 return constraint_kind;
496 }
497 virtual FieldConstraint* as_field_constraint(void) override { return this; }
498 virtual const FieldConstraint* as_field_constraint(void) const override
499 {
500 return this;
501 }
502 public:
503 inline bool is_contiguous(void) const { return contiguous; }
504 inline bool is_inorder(void) const { return inorder; }
505 inline const std::vector<FieldID>& get_field_set(void) const
506 {
507 return field_set;
508 }
509 public:
510 bool entails(const FieldConstraint& other) const;
511 bool conflicts(const FieldConstraint& other) const;
512 public:
513 void swap(FieldConstraint& rhs);
514 void serialize(Serializer& rez) const;
515 void deserialize(Deserializer& derez);
516 public:
517 std::vector<FieldID> field_set;
518 bool contiguous;
519 bool inorder;
520 };
521
539 public:
540 static const LayoutConstraintKind constraint_kind =
541 LEGION_ORDERING_CONSTRAINT;
542 public:
543 OrderingConstraint(bool contiguous = false);
545 const std::vector<DimensionKind>& ordering, bool contiguous);
546 public:
547 inline bool operator==(const OrderingConstraint& other) const
548 {
549 return ordering == other.ordering && contiguous == other.contiguous;
550 }
551 inline bool operator!=(const OrderingConstraint& other) const
552 {
553 return !(*this == other);
554 }
555 public:
556 virtual LayoutConstraintKind get_constraint_kind(void) const override
557 {
558 return constraint_kind;
559 }
560 virtual OrderingConstraint* as_ordering_constraint(void) override
561 {
562 return this;
563 }
564 virtual const OrderingConstraint* as_ordering_constraint(
565 void) const override
566 {
567 return this;
568 }
569 public:
570 bool entails(const OrderingConstraint& other, unsigned total_dims) const;
571 bool conflicts(const OrderingConstraint& other, unsigned total_dims) const;
572 public:
573 void swap(OrderingConstraint& rhs);
574 void serialize(Serializer& rez) const;
575 void deserialize(Deserializer& derez);
576 public:
577 static bool is_skip_dimension(DimensionKind dim, unsigned total_dims);
578 public:
579 std::vector<DimensionKind> ordering;
580 bool contiguous;
581 };
582
593 public:
594 static const LayoutConstraintKind constraint_kind =
595 LEGION_TILING_CONSTRAINT;
596 public:
597 TilingConstraint(void);
598 TilingConstraint(DimensionKind dim); // tiles
599 TilingConstraint(DimensionKind dim, size_t value, bool tiles = false);
600 public:
601 inline bool operator==(const TilingConstraint& o) const
602 {
603 return dim == o.dim && value == o.value && tiles == o.tiles;
604 }
605 inline bool operator!=(const TilingConstraint& other) const
606 {
607 return !(*this == other);
608 }
609 public:
610 virtual LayoutConstraintKind get_constraint_kind(void) const override
611 {
612 return constraint_kind;
613 }
614 virtual TilingConstraint* as_tiling_constraint(void) override
615 {
616 return this;
617 }
618 virtual const TilingConstraint* as_tiling_constraint(void) const override
619 {
620 return this;
621 }
622 public:
623 bool entails(const TilingConstraint& other) const;
624 bool conflicts(const TilingConstraint& other) const;
625 public:
626 void swap(TilingConstraint& rhs);
627 void serialize(Serializer& rez) const;
628 void deserialize(Deserializer& derez);
629 public:
630 DimensionKind dim;
631 size_t value;
632 bool tiles;
633 };
634
641 public:
642 static const LayoutConstraintKind constraint_kind =
643 LEGION_DIMENSION_CONSTRAINT;
644 public:
646 DimensionConstraint(DimensionKind dim, EqualityKind eq, size_t value);
647 public:
648 inline bool operator==(const DimensionConstraint& o) const
649 {
650 return kind == o.kind && eqk == o.eqk && value == o.value;
651 }
652 inline bool operator!=(const DimensionConstraint& other) const
653 {
654 return !(*this == other);
655 }
656 public:
657 virtual LayoutConstraintKind get_constraint_kind(void) const override
658 {
659 return constraint_kind;
660 }
661 virtual DimensionConstraint* as_dimension_constraint(void) override
662 {
663 return this;
664 }
665 virtual const DimensionConstraint* as_dimension_constraint(
666 void) const override
667 {
668 return this;
669 }
670 public:
671 bool entails(const DimensionConstraint& other) const;
672 bool conflicts(const DimensionConstraint& other) const;
673 public:
674 void swap(DimensionConstraint& rhs);
675 void serialize(Serializer& rez) const;
676 void deserialize(Deserializer& derez);
677 public:
678 DimensionKind kind;
679 EqualityKind eqk;
680 size_t value;
681 };
682
690 public:
691 static const LayoutConstraintKind constraint_kind =
692 LEGION_ALIGNMENT_CONSTRAINT;
693 public:
695 AlignmentConstraint(FieldID fid, EqualityKind kind, size_t byte_boundary);
696 public:
697 inline bool operator==(const AlignmentConstraint& o) const
698 {
699 return fid == o.fid && eqk == o.eqk && alignment == o.alignment;
700 }
701 inline bool operator!=(const AlignmentConstraint& other) const
702 {
703 return !(*this == other);
704 }
705 public:
706 virtual LayoutConstraintKind get_constraint_kind(void) const override
707 {
708 return constraint_kind;
709 }
710 virtual AlignmentConstraint* as_alignment_constraint(void) override
711 {
712 return this;
713 }
714 virtual const AlignmentConstraint* as_alignment_constraint(
715 void) const override
716 {
717 return this;
718 }
719 public:
720 bool entails(const AlignmentConstraint& other) const;
721 bool conflicts(const AlignmentConstraint& other) const;
722 public:
723 void swap(AlignmentConstraint& rhs);
724 void serialize(Serializer& rez) const;
725 void deserialize(Deserializer& derez);
726 public:
727 FieldID fid;
728 EqualityKind eqk;
729 size_t alignment;
730 };
731
738 public:
739 static const LayoutConstraintKind constraint_kind =
740 LEGION_OFFSET_CONSTRAINT;
741 public:
742 OffsetConstraint(void);
743 OffsetConstraint(FieldID fid, size_t offset);
744 public:
745 inline bool operator==(const OffsetConstraint& o) const
746 {
747 return fid == o.fid && offset == o.offset;
748 }
749 inline bool operator!=(const OffsetConstraint& other) const
750 {
751 return !(*this == other);
752 }
753 public:
754 virtual LayoutConstraintKind get_constraint_kind(void) const override
755 {
756 return constraint_kind;
757 }
758 virtual OffsetConstraint* as_offset_constraint(void) override
759 {
760 return this;
761 }
762 virtual const OffsetConstraint* as_offset_constraint(void) const override
763 {
764 return this;
765 }
766 public:
767 bool entails(const OffsetConstraint& other) const;
768 bool conflicts(const OffsetConstraint& other) const;
769 public:
770 void swap(OffsetConstraint& rhs);
771 void serialize(Serializer& rez) const;
772 void deserialize(Deserializer& derez);
773 public:
774 FieldID fid;
775 off_t offset;
776 };
777
784 public:
785 static const LayoutConstraintKind constraint_kind =
786 LEGION_POINTER_CONSTRAINT;
787 public:
788 PointerConstraint(void);
789 PointerConstraint(Memory memory, uintptr_t ptr);
790 public:
791 inline bool operator==(const PointerConstraint& o) const
792 {
793 return is_valid == o.is_valid && memory == o.memory && ptr == o.ptr;
794 }
795 inline bool operator!=(const PointerConstraint& other) const
796 {
797 return !(*this == other);
798 }
799 public:
800 virtual LayoutConstraintKind get_constraint_kind(void) const override
801 {
802 return constraint_kind;
803 }
804 virtual PointerConstraint* as_pointer_constraint(void) override
805 {
806 return this;
807 }
808 virtual const PointerConstraint* as_pointer_constraint(void) const override
809 {
810 return this;
811 }
812 public:
813 bool entails(const PointerConstraint& other) const;
814 bool conflicts(const PointerConstraint& other) const;
815 public:
816 void swap(PointerConstraint& rhs);
817 void serialize(Serializer& rez) const;
818 void deserialize(Deserializer& derez);
819 public:
820 bool is_valid;
821 Memory memory;
822 uintptr_t ptr;
823 };
824
831 public:
832 static const LayoutConstraintKind constraint_kind =
833 LEGION_PADDING_CONSTRAINT;
834 public:
835 PaddingConstraint(void) = default;
836 PaddingConstraint(const Domain& delta);
837 PaddingConstraint(const DomainPoint& lower, const DomainPoint& upper);
838 public:
839 inline bool operator==(const PaddingConstraint& rhs) const
840 {
841 return (delta == rhs.delta);
842 }
843 inline bool operator!=(const PaddingConstraint& other) const
844 {
845 return !(*this == other);
846 }
847 public:
848 virtual LayoutConstraintKind get_constraint_kind(void) const override
849 {
850 return constraint_kind;
851 }
852 virtual PaddingConstraint* as_padding_constraint(void) override
853 {
854 return this;
855 }
856 virtual const PaddingConstraint* as_padding_constraint(void) const override
857 {
858 return this;
859 }
860 public:
861 bool entails(const PaddingConstraint& other) const;
862 bool conflicts(const PaddingConstraint& other) const;
863 public:
864 void swap(PaddingConstraint& rhs);
865 void serialize(Serializer& rez) const;
866 void deserialize(Deserializer& derez);
867 public:
868 // Positive integers mean you must have that much padding
869 // Zero means that there should never be any padding
870 // Any negative integers will be interpreted as meaning that
871 // you don't care whether there is any padding or not
872 Domain delta;
873 };
874
882 public:
883 LayoutConstraintSet(void) { } // provided for dumb c++ compilers
884 public:
885 LayoutConstraintSet& add_constraint(
886 const SpecializedConstraint& constraint);
887 LayoutConstraintSet& add_constraint(const FieldConstraint& constraint);
888 LayoutConstraintSet& add_constraint(const MemoryConstraint& constraint);
889 LayoutConstraintSet& add_constraint(const OrderingConstraint& constraint);
890 LayoutConstraintSet& add_constraint(const TilingConstraint& constraint);
891 LayoutConstraintSet& add_constraint(const DimensionConstraint& constraint);
892 LayoutConstraintSet& add_constraint(const AlignmentConstraint& constraint);
893 LayoutConstraintSet& add_constraint(const OffsetConstraint& constraint);
894 LayoutConstraintSet& add_constraint(const PointerConstraint& constraint);
895 LayoutConstraintSet& add_constraint(const PaddingConstraint& constraint);
896 public:
897 bool operator==(const LayoutConstraintSet& other) const;
898 bool operator!=(const LayoutConstraintSet& other) const;
899 bool equals(
900 const LayoutConstraintSet& other,
901 LayoutConstraintKind* bad_kind = nullptr,
902 size_t* bad_index = nullptr) const;
903 public:
904 // failed_constraint will be the one from 'other' that wasn't entailed
905 bool entails(
906 const LayoutConstraintSet& other, unsigned total_dims = 0,
907 const LayoutConstraint** failed_constraint = nullptr,
908 bool test_pointer = true) const;
909 // conflict_constraint will be the one from 'this' that conficted
910 // with a constraint from 'other'
911 bool conflicts(
912 const LayoutConstraintSet& other, unsigned total_dims = 0,
913 const LayoutConstraint** conflict_constraint = nullptr) const;
914 const LayoutConstraint* convert_unsatisfied(
915 LayoutConstraintKind kind, unsigned index) const;
916 public:
917 void swap(LayoutConstraintSet& rhs);
918 void serialize(Serializer& rez) const;
919 void deserialize(Deserializer& derez);
920 public:
921 SpecializedConstraint specialized_constraint;
922 FieldConstraint field_constraint;
923 MemoryConstraint memory_constraint;
924 PointerConstraint pointer_constraint;
925 PaddingConstraint padding_constraint;
926 OrderingConstraint ordering_constraint;
927 std::vector<TilingConstraint> tiling_constraints;
928 std::vector<DimensionConstraint> dimension_constraints;
929 std::vector<AlignmentConstraint> alignment_constraints;
930 std::vector<OffsetConstraint> offset_constraints;
931 };
932
943 public:
944 TaskLayoutConstraintSet& add_layout_constraint(
945 unsigned idx, LayoutConstraintID desc);
946 public:
947 void swap(TaskLayoutConstraintSet& rhs);
948 void serialize(Serializer& rez) const;
949 void deserialize(Deserializer& derez);
950 public:
951 std::multimap<unsigned, LayoutConstraintID> layouts;
952 };
953
954 inline std::ostream& operator<<(
955 std::ostream& os, ExecutionConstraintKind kind)
956 {
957#define CONSTRAINT_NAMES(name, desc) \
958 case name: \
959 return os << desc;
960 switch (kind)
961 {
962 LEGION_EXECUTION_CONSTRAINT_KINDS(CONSTRAINT_NAMES)
963 }
964#undef CONSTRAINT_NAMES
965 std::abort();
966 }
967
968 inline std::ostream& operator<<(std::ostream& os, LayoutConstraintKind kind)
969 {
970#define CONSTRAINT_NAMES(name, desc) \
971 case name: \
972 return os << desc;
973 switch (kind)
974 {
975 LEGION_LAYOUT_CONSTRAINT_KINDS(CONSTRAINT_NAMES)
976 }
977#undef CONSTRAINT_NAMES
978 std::abort();
979 }
980
981} // namespace Legion
982
983#endif // __LEGION_CONSTRAINT_H__
Definition constraints.h:689
Definition constraints.h:202
Definition constraints.h:640
Definition geometry.h:154
Definition geometry.h:29
Definition constraints.h:240
Definition constraints.h:475
Definition constraints.h:61
Definition constraints.h:167
Definition constraints.h:275
Definition constraints.h:881
Definition constraints.h:422
Definition constraints.h:737
Definition constraints.h:538
Definition constraints.h:830
Definition constraints.h:783
Definition constraints.h:95
Definition constraints.h:132
Definition constraints.h:357
Definition constraints.h:942
Definition constraints.h:592