Legion Runtime
Loading...
Searching...
No Matches
test_mapper.h
Go to the documentation of this file.
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
17#ifndef __TEST_MAPPER_H__
18#define __TEST_MAPPER_H__
19
25#include "legion.h"
27
28#include <stdlib.h>
29#include <assert.h>
30#include <algorithm>
31
32namespace Legion {
33 namespace Mapping {
34
43 class TestMapper : public DefaultMapper {
44 public:
45 TestMapper(MapperRuntime *rt, Machine machine, Processor local,
46 const char *mapper_name = NULL);
47 TestMapper(const TestMapper &rhs);
48 virtual ~TestMapper(void);
49 public:
50 TestMapper& operator=(const TestMapper &rhs);
51 public:
52 static const char* create_test_name(Processor p);
53 public: // Task mapping calls
54 void select_task_options(const MapperContext ctx,
55 const Task& task,
56 TaskOptions& output) override;
57 void slice_task(const MapperContext ctx,
58 const Task& task,
59 const SliceTaskInput& input,
60 SliceTaskOutput& output) override;
61 void map_task(const MapperContext ctx,
62 const Task& task,
63 const MapTaskInput& input,
64 MapTaskOutput& output) override;
65 void select_task_variant(const MapperContext ctx,
66 const Task& task,
67 const SelectVariantInput& input,
68 SelectVariantOutput& output) override;
69 void select_task_sources(const MapperContext ctx,
70 const Task& task,
71 const SelectTaskSrcInput& input,
72 SelectTaskSrcOutput& output) override;
73 public: // Inline mapping calls
74 void map_inline(const MapperContext ctx,
75 const InlineMapping& inline_op,
76 const MapInlineInput& input,
77 MapInlineOutput& output) override;
78 void select_inline_sources(const MapperContext ctx,
79 const InlineMapping& inline_op,
80 const SelectInlineSrcInput& input,
81 SelectInlineSrcOutput& output) override;
82 public: // Copy mapping calls
83 void map_copy(const MapperContext ctx,
84 const Copy& copy,
85 const MapCopyInput& input,
86 MapCopyOutput& output) override;
87 void select_copy_sources(const MapperContext ctx,
88 const Copy& copy,
89 const SelectCopySrcInput& input,
90 SelectCopySrcOutput& output) override;
91 public: // Close mapping calls
92 void select_close_sources(const MapperContext ctx,
93 const Close& close,
94 const SelectCloseSrcInput& input,
95 SelectCloseSrcOutput& output) override;
96 public: // Release mapping calls
97 void select_release_sources(const MapperContext ctx,
98 const Release& release,
99 const SelectReleaseSrcInput& input,
100 SelectReleaseSrcOutput& output) override;
101 public: // Mapping control and stealing
102 void select_tasks_to_map(const MapperContext ctx,
103 const SelectMappingInput& input,
104 SelectMappingOutput& output) override;
105 void select_steal_targets(const MapperContext ctx,
106 const SelectStealingInput& input,
107 SelectStealingOutput& output) override;
108 void permit_steal_request(const MapperContext ctx,
109 const StealRequestInput& intput,
110 StealRequestOutput& output) override;
111 protected:
112 Processor select_random_processor(Processor::Kind kind);
113 Processor::Kind select_random_processor_kind(MapperContext ctx,
114 TaskID task_id);
115 void find_task_processor_kinds(MapperContext ctx, TaskID task_id,
116 std::set<Processor::Kind> &kinds);
117 const std::map<VariantID,Processor::Kind>&
118 find_task_variants(MapperContext ctx, TaskID task_id);
119 void select_random_source_order(
120 const std::vector<PhysicalInstance> &sources,
121 std::deque<PhysicalInstance> &ranking);
122 protected:
123 void map_constrained_requirement(MapperContext ctx,
124 const RegionRequirement &req, MappingKind mapping_kind,
125 const std::vector<LayoutConstraintID> &constraints,
126 std::vector<PhysicalInstance> &chosen_instances,
127 Processor target_proc = Processor::NO_PROC);
128 void map_random_requirement(MapperContext ctx,
129 const RegionRequirement &req,
130 std::vector<PhysicalInstance> &chosen_instances,
131 Processor target_proc = Processor::NO_PROC);
132 protected:
133 long generate_random_integer(void) const
134 { return default_generate_random_integer(); }
135 double generate_random_real(void) const
136 { return default_generate_random_real(); }
137 protected:
138 std::map<TaskID,std::map<VariantID,
139 Processor::Kind> > variant_processor_kinds;
140 };
141
142 }; // namespace Mapping
143}; // namespace Legion
144
145#endif // _TEST_MAPPER_H___
146
Definition mapping.h:292
Definition mapping.h:185
Definition mapping.h:216
Definition default_mapper.h:45
Definition mapping.h:2458
Definition test_mapper.h:43
Definition mapping.h:264
Definition mapping.h:112
Definition accessors.h:29
Definition mapping.h:1403
Definition mapping.h:783
Definition requirements.h:42