Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
preimage.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Stanford University, NVIDIA Corporation
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18// preimage operations for Realm dependent partitioning
19
20#ifndef REALM_DEPPART_PREIMAGE_H
21#define REALM_DEPPART_PREIMAGE_H
22
24
25namespace Realm {
26
27 template <int N, typename T, int N2, typename T2>
29 public:
30 static const int DIM = N;
31 typedef T IDXTYPE;
32 static const int DIM2 = N2;
33 typedef T2 IDXTYPE2;
34
36 RegionInstance _inst, size_t _field_offset, bool _is_ranged);
37 virtual ~PreimageMicroOp(void);
38
40
41 virtual void execute(void);
42
43 void dispatch(PartitioningOperation *op, bool inline_ok);
44
45 protected:
46 friend struct RemoteMicroOpMessage<PreimageMicroOp<N,T,N2,T2> >;
48
49 friend class PartitioningMicroOp;
50 template <typename S>
51 REALM_ATTR_WARN_UNUSED(bool serialize_params(S& s) const);
52
53 // construct from received packet
54 template <typename S>
55 PreimageMicroOp(NodeID _requestor, AsyncMicroOp *_async_microop, S& s);
56
57 template <typename BM>
58 void populate_bitmasks_ptrs(std::map<int, BM *>& bitmasks);
59
60 template <typename BM>
61 void populate_bitmasks_ranges(std::map<int, BM *>& bitmasks);
62
67 std::vector<IndexSpace<N2,T2> > targets;
68 std::vector<SparsityMap<N,T> > sparsity_outputs;
69 };
70
71 template <typename T>
73
74 template <int N, typename T, int N2, typename T2>
76 public:
77 static const int DIM = N;
78 typedef T IDXTYPE;
79 static const int DIM2 = N2;
80 typedef T2 IDXTYPE2;
81
83 const DomainTransform<N2, T2, N, T> &_domain_transform,
84 const ProfilingRequestSet &reqs,
85 GenEventImpl *_finish_event,
86 EventImpl::gen_t _finish_gen);
87
88 virtual ~PreimageOperation(void);
89
91
92 virtual void execute(void);
93
94 virtual void print(std::ostream& os) const;
95
96 virtual void set_overlap_tester(void *tester);
97
98 void provide_sparse_image(int index, const Rect<N2,T2> *rects, size_t count);
99
100 protected:
102
105 std::vector<IndexSpace<N2, T2> > targets;
106 std::vector<SparsityMap<N, T> > preimages;
109 std::map<int, std::vector<Rect<N2,T2> > > pending_sparse_images;
111 std::vector<atomic<int> > contrib_counts;
113 };
114
115 template <typename T>
119
120 static void handle_message(NodeID sender,
122 const void *data, size_t datalen);
123 };
124
125 template <int N, typename T, int N2, typename T2>
127 public:
128 static const int DIM = N;
129 typedef T IDXTYPE;
130 static const int DIM2 = N2;
131 typedef T2 IDXTYPE2;
132
134 IndexSpace<N, T> _parent_space);
135
137
139
140 virtual void execute(void);
141
142 void dispatch(PartitioningOperation *op, bool inline_ok);
143
144 protected:
145
146 template <typename BM>
147 void populate_bitmasks(std::map<int, BM *> &bitmasks);
148
151 std::vector<IndexSpace<N2, T2> > targets;
152 std::vector<SparsityMap<N, T> > sparsity_outputs;
153 };
154
155 }; // namespace Realm
156
157#endif // REALM_DEPPART_PREIMAGE_H
Definition activemsg.h:303
Definition partitions.h:85
Definition indexspace.h:214
unsigned gen_t
Definition event_impl.h:87
Definition event_impl.h:198
Definition partitions.h:45
Definition partitions.h:98
Definition partitions.h:153
Definition preimage.h:28
PreimageMicroOp(NodeID _requestor, AsyncMicroOp *_async_microop, S &s)
T IDXTYPE
Definition preimage.h:31
IndexSpace< N, T > parent_space
Definition preimage.h:63
std::vector< IndexSpace< N2, T2 > > targets
Definition preimage.h:67
RegionInstance inst
Definition preimage.h:64
bool is_ranged
Definition preimage.h:66
static const int DIM
Definition preimage.h:30
virtual ~PreimageMicroOp(void)
void add_sparsity_output(IndexSpace< N2, T2 > _target, SparsityMap< N, T > _sparsity)
std::vector< SparsityMap< N, T > > sparsity_outputs
Definition preimage.h:68
PreimageMicroOp(IndexSpace< N, T > _parent_space, IndexSpace< N, T > _inst_space, RegionInstance _inst, size_t _field_offset, bool _is_ranged)
IndexSpace< N, T > inst_space
Definition preimage.h:63
void populate_bitmasks_ranges(std::map< int, BM * > &bitmasks)
static ActiveMessageHandlerReg< RemoteMicroOpMessage< PreimageMicroOp< N, T, N2, T2 > > > areg
Definition preimage.h:47
REALM_ATTR_WARN_UNUSED(bool serialize_params(S &s) const)
void populate_bitmasks_ptrs(std::map< int, BM * > &bitmasks)
T2 IDXTYPE2
Definition preimage.h:33
void dispatch(PartitioningOperation *op, bool inline_ok)
static const int DIM2
Definition preimage.h:32
size_t field_offset
Definition preimage.h:65
virtual void execute(void)
Definition preimage.h:75
virtual ~PreimageOperation(void)
IndexSpace< N, T > parent
Definition preimage.h:103
PreimageOperation(const IndexSpace< N, T > &_parent, const DomainTransform< N2, T2, N, T > &_domain_transform, const ProfilingRequestSet &reqs, GenEventImpl *_finish_event, EventImpl::gen_t _finish_gen)
Mutex mutex
Definition preimage.h:107
T IDXTYPE
Definition preimage.h:78
std::vector< atomic< int > > contrib_counts
Definition preimage.h:111
virtual void print(std::ostream &os) const
std::vector< SparsityMap< N, T > > preimages
Definition preimage.h:106
IndexSpace< N, T > add_target(const IndexSpace< N2, T2 > &target)
std::vector< IndexSpace< N2, T2 > > targets
Definition preimage.h:105
static ActiveMessageHandlerReg< ApproxImageResponseMessage< PreimageOperation< N, T, N2, T2 > > > areg
Definition preimage.h:101
AsyncMicroOp * dummy_overlap_uop
Definition preimage.h:112
atomic< int > remaining_sparse_images
Definition preimage.h:110
T2 IDXTYPE2
Definition preimage.h:80
OverlapTester< N2, T2 > * overlap_tester
Definition preimage.h:108
static const int DIM
Definition preimage.h:77
void provide_sparse_image(int index, const Rect< N2, T2 > *rects, size_t count)
static const int DIM2
Definition preimage.h:79
std::map< int, std::vector< Rect< N2, T2 > > > pending_sparse_images
Definition preimage.h:109
virtual void set_overlap_tester(void *tester)
virtual void execute(void)
DomainTransform< N2, T2, N, T > domain_transform
Definition preimage.h:104
Definition profiling.h:363
Definition instance.h:66
Definition sparsity.h:65
Definition preimage.h:126
IndexSpace< N, T > parent_space
Definition preimage.h:150
void populate_bitmasks(std::map< int, BM * > &bitmasks)
static const int DIM
Definition preimage.h:128
StructuredPreimageMicroOp(const StructuredTransform< N2, T2, N, T > &_transform, IndexSpace< N, T > _parent_space)
void add_sparsity_output(IndexSpace< N2, T2 > _target, SparsityMap< N, T > _sparsity)
T2 IDXTYPE2
Definition preimage.h:131
static const int DIM2
Definition preimage.h:130
std::vector< IndexSpace< N2, T2 > > targets
Definition preimage.h:151
void dispatch(PartitioningOperation *op, bool inline_ok)
std::vector< SparsityMap< N, T > > sparsity_outputs
Definition preimage.h:152
StructuredTransform< N2, T2, N, T > transform
Definition preimage.h:149
T IDXTYPE
Definition preimage.h:129
virtual ~StructuredPreimageMicroOp(void)
Definition indexspace.h:176
Definition mutex.h:223
Definition atomics.h:31
Definition activemsg.h:38
int NodeID
Definition nodeset.h:40
Definition preimage.h:116
int approx_output_index
Definition preimage.h:118
static void handle_message(NodeID sender, const ApproxImageResponseMessage< T > &msg, const void *data, size_t datalen)
intptr_t approx_output_op
Definition preimage.h:117
Definition indexspace.h:323
Definition point.h:143
Definition partitions.h:230