18 #include <flecsi-config.h> 20 #if !defined(__FLECSI_PRIVATE__) 21 #error Do not include this file directly! 37 #if !defined(FLECSI_ENABLE_LEGION) 38 #error FLECSI_ENABLE_LEGION not defined! This file depends on Legion! 45 inline log::devel_tag task_prologue_tag(
"task_prologue");
69 std::vector<Legion::RegionRequirement>
const & region_requirements()
const {
73 std::vector<Legion::Future> && futures() && {
74 return std::move(futures_);
77 std::vector<Legion::FutureMap>
const & future_maps()
const {
104 template<
class P,
class... AA>
105 void walk(
const AA &... aa) {
106 walk(static_cast<P *>(
nullptr), aa...);
117 topo::index_space_t<Topo> Space>
120 visit(get_null_base(null_p), ref.template cast<data::dense>());
127 template<
typename DATA_TYPE,
size_t PRIVILEGES>
131 field_reference<DATA_TYPE, data::dense, topo::global, topo::elements> &
133 Legion::LogicalRegion region = ref.topology().get().logical_region;
136 "global topology accessor type only takes one privilege");
140 if(priv > partition_privilege_t::ro)
142 "global can only be modified from within single launch task");
144 Legion::RegionRequirement rr(region,
145 priv > partition_privilege_t::ro ?
privilege_mode(priv) : READ_ONLY,
149 rr.add_field(ref.fid());
150 region_reqs_.push_back(rr);
153 template<
typename DATA_TYPE,
156 topo::index_space_t<Topo> Space,
157 class = std::enable_if_t<topo::privilege_count<Topo, Space> == 1>>
161 auto & instance_data = ref.topology().get().template get_partition<Space>();
164 "attempting to pass field with " 165 << instance_data.colors()
166 <<
" partitions into task with launch domain of size " << domain_);
169 "accessors for this topology type take only one privilege");
171 Legion::RegionRequirement rr(instance_data.logical_partition,
175 Legion::Runtime::get_runtime()->get_parent_logical_region(
176 instance_data.logical_partition));
178 rr.add_field(ref.fid());
179 region_reqs_.push_back(rr);
182 template<
class Topo, std::
size_t Priv>
185 Topo::core::fields([&](
auto & f) {
186 visit(
static_cast<data::field_accessor<decltype(f), Priv> *
>(
nullptr),
194 template<
typename DATA_TYPE>
196 futures_.push_back(f.legion_future_);
199 template<
typename DATA_TYPE>
201 future_maps_.push_back(f.legion_future_);
208 template<
typename DATA_TYPE>
209 static void visit(DATA_TYPE &) {
210 static_assert(!std::is_base_of_v<data::convert_tag, DATA_TYPE>,
211 "Unknown task argument type");
214 flog_devel(info) <<
"Skipping argument with type " 215 << util::type<DATA_TYPE>() << std::endl;
221 template<
class P,
typename DATA_TYPE>
222 void visit(P *, DATA_TYPE & x) {
226 template<
class... PP,
class... AA>
227 void walk(std::tuple<PP...> * ,
const AA &... aa) {
228 (visit(
static_cast<std::decay_t<PP> *
>(
nullptr), aa), ...);
233 std::vector<Legion::RegionRequirement> region_reqs_;
234 std::vector<Legion::Future> futures_;
235 std::vector<Legion::FutureMap> future_maps_;
static Legion::PrivilegeMode privilege_mode(size_t mode)
Definition: task_prologue.hh:87
Definition: topology_accessor.hh:39
task_prologue_t(const size_t &domain)
Definition: task_prologue.hh:67
#define flog_assert(test, message)
Definition: flog.hh:411
constexpr partition_privilege_t get_privilege(std::size_t i, std::size_t pack)
Definition: privilege.hh:88
Definition: topology_slot.hh:30
#define flog_fatal(message)
Definition: flog.hh:358
Definition: task_prologue.hh:58
constexpr size_t privilege_count(std::size_t PACK)
Definition: privilege.hh:76
Definition: control.hh:31