ONE - On-device Neural Engine
Loading...
Searching...
No Matches
circle_planner::ExecutionPlanner Class Reference

#include <ExecutionPlanner.h>

Public Member Functions

 ExecutionPlanner ()=delete
 
 ExecutionPlanner (loco::Graph *graph)
 
 ExecutionPlanner (loco::Graph *graph, TargetPlatform target_platform, RuntimeType runtime_type, AllocatingMode allocating_mode)
 
void make_execution_plan ()
 
void change_planning_mode (bool is_allocate_consts, bool is_allocate_inputs, bool is_allocate_scratchpads)
 
void create_json_allocation_file (const std::string &json_path)
 

Detailed Description

Definition at line 64 of file ExecutionPlanner.h.

Constructor & Destructor Documentation

◆ ExecutionPlanner() [1/3]

circle_planner::ExecutionPlanner::ExecutionPlanner ( )
delete

◆ ExecutionPlanner() [2/3]

circle_planner::ExecutionPlanner::ExecutionPlanner ( loco::Graph graph)
inlineexplicit

Definition at line 68 of file ExecutionPlanner.h.

68 : _graph(graph)
69 {
70 _scratchpad_helper = std::make_unique<ScratchpadHelperLinux>();
71 }

◆ ExecutionPlanner() [3/3]

circle_planner::ExecutionPlanner::ExecutionPlanner ( loco::Graph graph,
TargetPlatform  target_platform,
RuntimeType  runtime_type,
AllocatingMode  allocating_mode 
)
inlineexplicit

Definition at line 73 of file ExecutionPlanner.h.

75 : _graph(graph), _runtime_type(runtime_type), _allocating_mode(allocating_mode)
76 {
77 switch (target_platform.platform_type)
78 {
79 case LINUX:
80 _scratchpad_helper = std::make_unique<ScratchpadHelperLinux>();
81 break;
82 case MCU:
83 _scratchpad_helper = std::make_unique<ScratchpadHelperMCU>();
84 break;
85 case CMSISNN:
86 _scratchpad_helper = std::make_unique<ScratchpadHelperCMSISNN>(target_platform.use_dsp);
87 break;
88 default:
89 assert(false && "Use unsupported platform");
90 }
91 };

References circle_planner::CMSISNN, circle_planner::LINUX, circle_planner::MCU, circle_planner::TargetPlatform::platform_type, and circle_planner::TargetPlatform::use_dsp.

Member Function Documentation

◆ change_planning_mode()

void circle_planner::ExecutionPlanner::change_planning_mode ( bool  is_allocate_consts,
bool  is_allocate_inputs,
bool  is_allocate_scratchpads 
)
inline

Definition at line 102 of file ExecutionPlanner.h.

104 {
105 _is_allocate_consts = is_allocate_consts;
106 _is_allocate_inputs = is_allocate_inputs;
107 _is_allocate_scratchpads = is_allocate_scratchpads;
108 };

Referenced by entry().

◆ create_json_allocation_file()

void circle_planner::ExecutionPlanner::create_json_allocation_file ( const std::string &  json_path)

Definition at line 279 of file ExecutionPlanner.cpp.

280{
281 Json::Value main_tree;
282 Json::Value segments_node;
283 Json::Value allocations_node;
284
285 uint32_t alive_till_max = 0;
286
287 // Find max dealloc value to assign to nodes with node_not_assigned value
288 for (const auto elem : _dealloc_node)
289 {
290 if (alive_till_max < elem and elem != node_not_assigned)
291 alive_till_max = elem;
292 }
293
294 for (auto &alloc_node_inform : _alloc_node_inform_vector)
295 {
296 const auto node_num = alloc_node_inform.node_num;
297 const auto circle_node = loco::must_cast<luci::CircleNode *>(_ordered_nodes[node_num]);
298
299 create_allocation_node(allocations_node, alloc_node_inform, alive_till_max, circle_node);
300 }
301
302 // Create segment part
303 Json::Value segment_node;
304 segment_node["name"] = "Segment1";
305 segment_node["allocations"] = allocations_node;
306 segments_node.append(segment_node);
307
308 main_tree["schema_version"] = 1;
309 main_tree["segments"] = segments_node;
310
311 Json::StreamWriterBuilder builder;
312 const std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter());
313
314 // Write to json file
315 std::ofstream out;
316 out.open(json_path);
317 if (out.is_open())
318 {
319 writer->write(main_tree, &out);
320 }
321}

Referenced by entry().

◆ make_execution_plan()

void circle_planner::ExecutionPlanner::make_execution_plan ( )

Definition at line 261 of file ExecutionPlanner.cpp.

262{
263 switch (_runtime_type)
264 {
265 case ONERT_MICRO:
266 make_execution_plan_onert_micro_base();
267 break;
268 case LUCI_INTERPRETER:
269 make_execution_plan_luci_interpreter();
270 break;
271 default:
272 throw std::runtime_error("Unsupported runtime platform\n");
273 }
274
275 auto settings = luci::UserSettings::settings();
277}
static UserSettings * settings()

References luci::UserSettings::ExecutionPlanGen, circle_planner::LUCI_INTERPRETER, circle_planner::ONERT_MICRO, and luci::UserSettings::settings().

Referenced by entry().


The documentation for this class was generated from the following files: