Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
addrsplit_channel.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#ifndef ADDRESS_SPLIT_CHANNEL_H
19#define ADDRESS_SPLIT_CHANNEL_H
20
21#include "realm/indexspace.h"
23
24namespace Realm {
25
26 class XferDes;
27 class AddressList;
28
29 class AddressSplitChannel;
30
32 protected:
33 AddressSplitXferDesBase(uintptr_t dma_op, Channel *_channel, NodeID _launch_node,
34 XferDesID _guid,
35 const std::vector<XferDesPortInfo> &inputs_info,
36 const std::vector<XferDesPortInfo> &outputs_info,
37 int _priority);
38
39 public:
40 virtual bool progress_xd(AddressSplitChannel *channel, TimeLimit work_until) = 0;
41
42 long get_requests(Request **requests, long nr);
45 void flush();
46 };
47
49 : public SingleXDQChannel<AddressSplitChannel, AddressSplitXferDesBase> {
50 public:
52 virtual ~AddressSplitChannel() = default;
53
54 // do as many of these concurrently as we like
55 static constexpr bool is_ordered = false;
56
62
63 // override this to make sure it's never called
64 virtual XferDes *create_xfer_des(uintptr_t dma_op, NodeID launch_node, XferDesID guid,
65 const std::vector<XferDesPortInfo> &inputs_info,
66 const std::vector<XferDesPortInfo> &outputs_info,
67 int priority, XferDesRedopInfo redop_info,
68 const void *fill_data, size_t fill_size,
69 size_t fill_total);
70
71 virtual long submit(Request **requests, long nr);
72 };
73
74 template <int N, typename T>
76 public:
77 static void handle_message(NodeID sender,
79 const void *msgdata, size_t msglen);
80 };
81
82 template <int N, typename T>
84 public:
85 virtual ~AddressSplitCommunicator() = default;
86 virtual void create(NodeID target_node, NodeID launch_node, XferDesID guid,
87 uintptr_t dma_op, const void *msgdata, size_t msglen);
88 };
89
90 template <int N, typename T>
92 public:
93 AddressSplitXferDesFactory(size_t _bytes_per_element,
94 const std::vector<IndexSpace<N, T>> &_spaces,
95 AddressSplitChannel *_addrsplit_channel);
96
97 AddressSplitXferDesFactory(size_t _bytes_per_element,
98 const std::vector<IndexSpace<N, T>> &_spaces,
99 AddressSplitChannel *_addrsplit_channel,
101
102 virtual ~AddressSplitXferDesFactory() = default;
103
104 public:
105 virtual bool needs_release();
106
107 virtual void create_xfer_des(uintptr_t dma_op, NodeID launch_node, NodeID target_node,
108 XferDesID guid,
109 const std::vector<XferDesPortInfo> &inputs_info,
110 const std::vector<XferDesPortInfo> &outputs_info,
111 int priority, XferDesRedopInfo redop_info,
112 const void *fill_data, size_t fill_size,
113 size_t fill_total);
114
116
117 protected:
119 std::vector<IndexSpace<N, T>> spaces;
121 std::unique_ptr<AddressSplitCommunicator<N, T>> comm{nullptr};
122 };
123
124 template <int N, typename T>
126 public:
127 AddressSplitXferDes(uintptr_t _dma_op, Channel *_channel, NodeID _launch_node,
128 XferDesID _guid, const std::vector<XferDesPortInfo> &inputs_info,
129 const std::vector<XferDesPortInfo> &outputs_info, int _priority,
130 size_t _element_size,
131 const std::vector<IndexSpace<N, T>> &_spaces);
132
134
136
138
139 protected:
140 int find_point_in_spaces(Point<N, T> p, int guess_idx) const;
141
142 std::vector<IndexSpace<N, T>> spaces;
144 static constexpr size_t MAX_POINTS = 64;
148 unsigned output_count;
150 };
151
152}; // namespace Realm
153
154#include "realm/transfer/addrsplit_channel.inl"
155
156#endif // ifndef ADDRESS_SPLIT_CHANNEL_H
Definition activemsg.h:303
Definition addrsplit_channel.h:49
virtual XferDes * create_xfer_des(uintptr_t dma_op, NodeID launch_node, XferDesID guid, const std::vector< XferDesPortInfo > &inputs_info, const std::vector< XferDesPortInfo > &outputs_info, int priority, XferDesRedopInfo redop_info, const void *fill_data, size_t fill_size, size_t fill_total)
virtual void enqueue_ready_xd(XferDes *xd)
Definition addrsplit_channel.h:57
static constexpr bool is_ordered
Definition addrsplit_channel.h:55
virtual long submit(Request **requests, long nr)
virtual ~AddressSplitChannel()=default
AddressSplitChannel(BackgroundWorkManager *bgwork)
Definition addrsplit_channel.h:83
virtual ~AddressSplitCommunicator()=default
virtual void create(NodeID target_node, NodeID launch_node, XferDesID guid, uintptr_t dma_op, const void *msgdata, size_t msglen)
Definition addrsplit_channel.h:31
void notify_request_read_done(Request *req)
virtual bool progress_xd(AddressSplitChannel *channel, TimeLimit work_until)=0
long get_requests(Request **requests, long nr)
AddressSplitXferDesBase(uintptr_t dma_op, Channel *_channel, NodeID _launch_node, XferDesID _guid, const std::vector< XferDesPortInfo > &inputs_info, const std::vector< XferDesPortInfo > &outputs_info, int _priority)
void notify_request_write_done(Request *req)
Definition addrsplit_channel.h:91
std::vector< IndexSpace< N, T > > spaces
Definition addrsplit_channel.h:119
size_t bytes_per_element
Definition addrsplit_channel.h:118
static ActiveMessageHandlerReg< AddressSplitXferDesCreateMessage< N, T > > areg
Definition addrsplit_channel.h:115
AddressSplitChannel * addrsplit_channel
Definition addrsplit_channel.h:120
virtual ~AddressSplitXferDesFactory()=default
AddressSplitXferDesFactory(size_t _bytes_per_element, const std::vector< IndexSpace< N, T > > &_spaces, AddressSplitChannel *_addrsplit_channel)
virtual void create_xfer_des(uintptr_t dma_op, NodeID launch_node, NodeID target_node, XferDesID guid, const std::vector< XferDesPortInfo > &inputs_info, const std::vector< XferDesPortInfo > &outputs_info, int priority, XferDesRedopInfo redop_info, const void *fill_data, size_t fill_size, size_t fill_total)
std::unique_ptr< AddressSplitCommunicator< N, T > > comm
Definition addrsplit_channel.h:121
AddressSplitXferDesFactory(size_t _bytes_per_element, const std::vector< IndexSpace< N, T > > &_spaces, AddressSplitChannel *_addrsplit_channel, AddressSplitCommunicator< N, T > *_comm)
Definition addrsplit_channel.h:125
int find_point_in_spaces(Point< N, T > p, int guess_idx) const
size_t point_count
Definition addrsplit_channel.h:145
Point< N, T > points[MAX_POINTS]
Definition addrsplit_channel.h:146
static constexpr size_t MAX_POINTS
Definition addrsplit_channel.h:144
size_t point_index
Definition addrsplit_channel.h:145
virtual Event request_metadata()
virtual bool progress_xd(AddressSplitChannel *channel, TimeLimit work_until)
AddressSplitXferDes(uintptr_t _dma_op, Channel *_channel, NodeID _launch_node, XferDesID _guid, const std::vector< XferDesPortInfo > &inputs_info, const std::vector< XferDesPortInfo > &outputs_info, int _priority, size_t _element_size, const std::vector< IndexSpace< N, T > > &_spaces)
unsigned output_count
Definition addrsplit_channel.h:148
size_t element_size
Definition addrsplit_channel.h:143
ControlPort::Encoder ctrl_encoder
Definition addrsplit_channel.h:149
int output_space_id
Definition addrsplit_channel.h:147
std::vector< IndexSpace< N, T > > spaces
Definition addrsplit_channel.h:142
Definition bgwork.h:36
Definition channel.h:713
Definition channel.h:244
Definition event.h:50
Definition channel.h:103
Definition channel.h:1014
virtual void enqueue_ready_xd(XferDes *xd)
Definition timers.h:129
Definition channel.h:633
Definition channel.h:286
Channel * channel
Definition channel.h:343
uintptr_t dma_op
Definition channel.h:289
Definition activemsg.h:38
int NodeID
Definition nodeset.h:40
unsigned long long XferDesID
Definition channel.h:57
Definition addrsplit_channel.h:75
static void handle_message(NodeID sender, const AddressSplitXferDesCreateMessage< N, T > &args, const void *msgdata, size_t msglen)
Definition indexspace.h:323
Definition point.h:55
Definition channel.h:647
Definition channel.h:210