Legion Runtime
Loading...
Searching...
No Matches
output_region.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_OUTPUT_REGION_H__
17#define __LEGION_OUTPUT_REGION_H__
18
19#include "legion/api/constraints.h"
20
21namespace Legion {
22
30 public:
31 OutputRegion(void);
32 OutputRegion(const OutputRegion& rhs);
33 ~OutputRegion(void);
34 private:
35 Internal::OutputRegionImpl* impl;
36 protected:
37 FRIEND_ALL_RUNTIME_CLASSES
38 explicit OutputRegion(Internal::OutputRegionImpl* impl);
39 public:
40 OutputRegion& operator=(const OutputRegion& rhs);
41 public:
42 Memory target_memory(void) const;
43 // Returns the logical region of this output region.
44 // The call is legal only when the output region is valid and
45 // will raise an error otherwise.
46 LogicalRegion get_logical_region(void) const;
47 bool is_bounded_output_region(void) const;
48 public:
49 // Returns a deferred buffer that satisfies the layout constraints of
50 // this output region. The caller still needs to pass this buffer to
51 // a return_data call if the buffer needs to be bound to this output
52 // region. The caller can optionally choose to bind the returned buffer
53 // to the output region; such a call cannot be made more than once.
54 template<
55 typename T, int DIM, typename COORD_T = coord_t,
56#ifdef LEGION_BOUNDS_CHECKS
57 bool CHECK_BOUNDS = true>
58#else
59 bool CHECK_BOUNDS = false>
60#endif
61 DeferredBuffer<T, DIM, COORD_T, CHECK_BOUNDS> create_buffer(
62 const Point<DIM, COORD_T>& extents, FieldID field_id,
63 const T* initial_value = nullptr, bool return_buffer = false);
64 private:
65 void check_type_tag(TypeTag type_tag) const;
66 void check_field_size(FieldID field_id, size_t field_size) const;
67 void get_layout(
68 FieldID field_id, std::vector<DimensionKind>& ordering,
69 size_t& alignment) const;
70 public:
71 template<
72 typename T, int DIM, typename COORD_T = coord_t,
73#ifdef LEGION_BOUNDS_CHECKS
74 bool CHECK_BOUNDS = true>
75#else
76 bool CHECK_BOUNDS = false>
77#endif
78 void return_data(
79 const Point<DIM, COORD_T>& extents, FieldID field_id,
80 DeferredBuffer<T, DIM, COORD_T, CHECK_BOUNDS>& buffer);
81 void return_data(
82 const DomainPoint& extents, FieldID field_id,
83 Realm::RegionInstance instance, bool check_constraints = true);
84 private:
85 void return_data(
86 const DomainPoint& extents, FieldID field_id,
87 Realm::RegionInstance instance, const LayoutConstraintSet* constraints,
88 bool check_constraints);
89 };
90
91} // namespace Legion
92
93#include "legion/api/output_region.inl"
94
95#endif // __LEGION_OUTPUT_REGION_H__
Definition geometry.h:29
Definition constraints.h:881
Definition data.h:184
Definition output_region.h:29
Definition types.h:334