47 enum DefaultTunables {
48 DEFAULT_TUNABLE_NODE_COUNT = 0,
49 DEFAULT_TUNABLE_LOCAL_CPUS = 1,
50 DEFAULT_TUNABLE_LOCAL_GPUS = 2,
51 DEFAULT_TUNABLE_LOCAL_IOS = 3,
52 DEFAULT_TUNABLE_LOCAL_OMPS = 4,
53 DEFAULT_TUNABLE_LOCAL_PYS = 5,
54 DEFAULT_TUNABLE_GLOBAL_CPUS = 6,
55 DEFAULT_TUNABLE_GLOBAL_GPUS = 7,
56 DEFAULT_TUNABLE_GLOBAL_IOS = 8,
57 DEFAULT_TUNABLE_GLOBAL_OMPS = 9,
58 DEFAULT_TUNABLE_GLOBAL_PYS = 10,
59 DEFAULT_TUNABLE_LAST = 11,
70 enum MapperMessageType
78 VIRTUAL_MAP = (1 << 0),
83 EXACT_REGION = (1 << 1),
87 SAME_ADDRESS_SPACE = (1 << 2),
90 PREFER_RDMA_MEMORY = (1 << 3),
94 PREFER_CPU_VARIANT = (1 << 4),
100 : variant(0), tight_bound(
false),
101 is_inner(
false), is_leaf(
false), is_replicable(
false) { }
104 Processor::Kind proc_kind;
110 enum CachedMappingPolicy
112 DEFAULT_CACHE_POLICY_ENABLE,
113 DEFAULT_CACHE_POLICY_DISABLE,
117 unsigned long long task_hash;
119 std::vector<std::vector<PhysicalInstance> > mapping;
120 std::vector<Memory> output_targets;
121 std::vector<LayoutConstraintSet> output_constraints;
125 MapperMsgHdr(
void) : magic(0xABCD), type(INVALID_MESSAGE) { }
126 bool is_valid_mapper_msg()
const
128 return magic == 0xABCD && type != INVALID_MESSAGE;
131 MapperMessageType type;
136 Processor::TaskFuncID task_id;
141 const char *mapper_name = NULL,
bool own_name =
false);
150 void select_task_options(
const MapperContext ctx,
153 void premap_task(
const MapperContext ctx,
157 void slice_task(
const MapperContext ctx,
161 void map_task(
const MapperContext ctx,
165 void replicate_task(MapperContext ctx,
169 LEGION_DEPRECATED(
"map_replicate_task is now deprecated, please switch to replicate_task")
170 virtual
void map_replicate_task(const MapperContext ctx,
175 void select_task_variant(const MapperContext ctx,
179 void postmap_task(const MapperContext ctx,
183 void select_task_sources(const MapperContext ctx,
187 void report_profiling(const MapperContext ctx,
190 void select_sharding_functor(
191 const MapperContext ctx,
196 void map_inline(const MapperContext ctx,
200 void select_inline_sources(const MapperContext ctx,
204 void report_profiling(const MapperContext ctx,
208 void map_copy(const MapperContext ctx,
212 void select_copy_sources(const MapperContext ctx,
216 void report_profiling(const MapperContext ctx,
219 void select_sharding_functor(
220 const MapperContext ctx,
225 void select_close_sources(const MapperContext ctx,
229 void report_profiling(const MapperContext ctx,
232 void select_sharding_functor(
233 const MapperContext ctx,
238 void map_acquire(const MapperContext ctx,
242 void report_profiling(const MapperContext ctx,
245 void select_sharding_functor(
246 const MapperContext ctx,
251 void map_release(const MapperContext ctx,
255 void select_release_sources(const MapperContext ctx,
259 void report_profiling(const MapperContext ctx,
262 void select_sharding_functor(
263 const MapperContext ctx,
268 void select_partition_projection(const MapperContext ctx,
272 void map_partition(const MapperContext ctx,
276 void select_partition_sources(
277 const MapperContext ctx,
281 void report_profiling(const MapperContext ctx,
284 void select_sharding_functor(
285 const MapperContext ctx,
290 void select_sharding_functor(
291 const MapperContext ctx,
296 void configure_context(const MapperContext ctx,
299 void select_tunable_value(const MapperContext ctx,
304 void select_sharding_functor(
305 const MapperContext ctx,
309 void map_must_epoch(const MapperContext ctx,
313 void map_dataflow_graph(const MapperContext ctx,
317 void memoize_operation(const MapperContext ctx,
322 void select_tasks_to_map(const MapperContext ctx,
325 void select_steal_targets(const MapperContext ctx,
328 void permit_steal_request(const MapperContext ctx,
332 void handle_message(const MapperContext ctx,
334 void handle_task_result(const MapperContext ctx,
340 virtual Processor default_policy_select_initial_processor(
341 MapperContext ctx, const
Task &task);
342 virtual
void default_policy_select_target_processors(
345 std::vector<Processor> &target_procs);
346 virtual TaskPriority default_policy_select_task_priority(
347 MapperContext ctx, const
Task &task);
348 virtual CachedMappingPolicy default_policy_select_task_cache_policy(
349 MapperContext ctx, const
Task &task);
350 virtual
bool default_policy_select_must_epoch_processors(
352 const std::vector<std::set<const
Task *> > &tasks,
353 Processor::Kind proc_kind,
354 std::map<const
Task *, Processor> &target_procs);
355 virtual
void default_policy_rank_processor_kinds(
356 MapperContext ctx, const
Task &task,
357 std::vector<Processor::Kind> &ranking);
358 virtual VariantID default_policy_select_best_variant(MapperContext ctx,
359 const
Task &task, Processor::Kind kind,
360 VariantID vid1, VariantID vid2,
365 virtual Memory default_policy_select_target_memory(MapperContext ctx,
366 Processor target_proc,
369 virtual Memory default_policy_select_output_target(MapperContext ctx,
370 Processor target_proc);
371 virtual LayoutConstraintID default_policy_select_layout_constraints(
372 MapperContext ctx, Memory target_memory,
374 MappingKind mapping_kind,
375 bool needs_field_constraint_check,
376 bool &force_new_instances);
377 virtual
void default_policy_select_constraints(MapperContext ctx,
379 Memory target_memory,
381 virtual
void default_policy_select_output_constraints(const
Task &task,
384 virtual Memory default_policy_select_constrained_instance_constraints(
386 const std::vector<const
Task *> &tasks,
387 const std::vector<
unsigned> &req_indexes,
388 const std::vector<Processor> &target_procs,
390 const std::set<FieldID> &needed_fields,
392 virtual
void default_policy_select_constraint_fields(
395 std::vector<FieldID> &fields);
397 MapperContext ctx, Memory target_memory,
400 bool force_new_instances,
401 bool meets_constraints);
402 virtual
void default_policy_select_instance_fields(
405 const std::set<FieldID> &needed_fields,
406 std::vector<FieldID> &fields);
407 virtual
int default_policy_select_garbage_collection_priority(
409 MappingKind kind, Memory memory,
411 bool meets_fill_constraints,
bool reduction);
412 virtual
void default_policy_select_sources(MapperContext,
416 virtual
bool default_policy_select_close_virtual(const MapperContext ctx,
418 virtual
bool default_policy_select_reduction_instance_reuse(const
422 long default_generate_random_integer(
void) const;
423 double default_generate_random_real(
void) const;
425 Processor default_select_random_processor(
426 const std::vector<Processor> &procs) const;
427 Processor default_get_next_local_cpu(
void);
428 Processor default_get_next_global_cpu(
void);
429 Processor default_get_next_local_gpu(
void);
430 Processor default_get_next_global_gpu(
void);
431 Processor default_get_next_local_io(
void);
432 Processor default_get_next_global_io(
void);
433 Processor default_get_next_local_py(
void);
434 Processor default_get_next_global_py(
void);
435 Processor default_get_next_local_procset(
void);
436 Processor default_get_next_global_procset(
void);
437 Processor default_get_next_local_omp(
void);
438 Processor default_get_next_global_omp(
void);
440 const
Task &task, MapperContext ctx,
441 bool needs_tight_bound,
bool cache = true,
442 Processor::Kind kind = Processor::NO_KIND);
443 void default_slice_task(const
Task &task,
444 const std::vector<Processor> &local_procs,
445 const std::vector<Processor> &remote_procs,
449 bool default_create_custom_instances(MapperContext ctx,
450 Processor target, Memory target_memory,
452 std::set<FieldID> &needed_fields,
454 bool needs_field_constraint_check,
456 size_t *footprint = NULL);
457 bool default_make_instance(MapperContext ctx, Memory target_memory,
460 bool force_new,
bool meets,
462 size_t *footprint = NULL);
463 void default_report_failed_instance_creation(const
Task &task,
464 unsigned index, Processor target_proc,
465 Memory target_memory,
size_t footprint = 0) const;
466 void default_remove_cached_task(MapperContext ctx, VariantID variant,
467 unsigned long long task_hash,
468 const std::pair<TaskID,Processor> &cache_key,
471 template<
bool IS_SRC>
472 void default_create_copy_instance(MapperContext ctx, const
Copy ©,
475 LogicalRegion default_find_common_ancestor(MapperContext ctx,
477 bool have_proc_kind_variant(const MapperContext ctx, TaskID
id,
478 Processor::Kind kind);
479 const std::vector<Processor>& local_procs_by_kind(Processor::Kind kind);
480 const std::vector<Processor>& remote_procs_by_kind(Processor::Kind kind);
482 const
Task& task, VariantID vid,
485 void partition_task_layout_constraint_sets(
486 const MapperContext ctx,
487 const
unsigned index,
488 std::set<FieldID> &needed_fields,
490 std::vector<std::vector<FieldID> >&field_arrays,
491 std::vector<std::vector<FieldID> >&leftover_fields,
492 std::vector<LayoutConstraintID> &field_layout_ids,
493 std::vector<LayoutConstraintID> &non_field_layout_ids);
494 bool create_instances_from_partitioned_task_layout_constraint_set(
495 const MapperContext ctx,
496 const Memory target_memory,
497 const std::vector<std::vector<FieldID> > &field_arrays,
498 const std::vector<LayoutConstraintID> &layout_ids,
499 const
unsigned int layout_ids_size,
502 const
bool force_new_instances,
504 const
bool is_field_constraints,
505 const
bool all_fields_opts=false);
506 void check_valid_task_layout_constraints(
507 const
Task &task, MapperContext ctx,
509 const Processor target_proc, const Memory target_memory,
513 static const
char* create_default_name(Processor p);
515 static
void default_decompose_points(
517 const std::vector<Processor> &targets,
518 const Point<DIM,coord_t> &blocking,
519 bool recurse,
bool stealable,
522 static Point<DIM,coord_t> default_select_num_blocks(
523 long long int factor,
524 const Rect<DIM,coord_t> &rect_to_factor);
525 static
unsigned long long compute_task_hash(const
Task &task);
526 static inline
bool physical_sort_func(
529 {
return (left.second < right.second); }
530 static inline bool point_sort_func(
const Task *t1,
const Task *t2)
531 {
return (t1->index_point < t2->index_point); }
533 const Processor local_proc;
534 const Processor::Kind local_kind;
535 const AddressSpace node_id;
536 const Machine machine;
537 const char *
const mapper_name;
539 mutable unsigned short random_number_generator[3];
543 unsigned total_nodes;
546 std::vector<Processor> local_gpus;
547 std::vector<Processor> local_cpus;
548 std::vector<Processor> local_ios;
549 std::vector<Processor> local_procsets;
550 std::vector<Processor> local_omps;
551 std::vector<Processor> local_pys;
552 std::vector<Processor> remote_gpus;
553 std::vector<Processor> remote_cpus;
554 std::vector<Processor> remote_ios;
555 std::vector<Processor> remote_procsets;
556 std::vector<Processor> remote_omps;
557 std::vector<Processor> remote_pys;
561 bool multipleNumaDomainsPresent =
false;
564 unsigned next_local_gpu, next_local_cpu, next_local_io,
565 next_local_procset, next_local_omp, next_local_py;
566 Processor next_global_gpu, next_global_cpu, next_global_io,
567 next_global_procset, next_global_omp, next_global_py;
568 Machine::ProcessorQuery *global_gpu_query, *global_cpu_query,
569 *global_io_query, *global_procset_query,
570 *global_omp_query, *global_py_query;
573 std::map<Domain,std::vector<TaskSlice> > gpu_slices_cache,
576 procset_slices_cache,
579 std::map<std::pair<TaskID,Processor::Kind>,
580 VariantInfo> preferred_variants;
581 std::map<std::pair<TaskID,Processor>,
582 std::list<CachedTaskMapping> > cached_task_mappings;
583 std::map<std::pair<Memory::Kind,FieldSpace>,
584 LayoutConstraintID> layout_constraint_cache;
585 std::map<std::pair<Memory::Kind,ReductionOpID>,
586 LayoutConstraintID> reduction_constraint_cache;
587 std::map<Processor,Memory> cached_target_memory,
588 cached_rdma_target_memory;
592 unsigned max_steals_per_theft;
595 unsigned max_steal_count;
598 bool breadth_first_traversal;
600 bool stealing_enabled;
602 unsigned max_schedule_count;
614 bool replication_enabled;
615 bool same_address_space;