2 * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "LinearExecutor.h"
19 #include "ruy/profiler/instrumentation.h"
30 char *seq_to_label(const onert::ir::OpSequence *op_seq, const onert::ir::Operations &operations)
32 auto node_name = operations.at(*op_seq->begin()).name();
33 char *cstr = new char[node_name.length() + 1];
34 std::strcpy(cstr, node_name.c_str());
40 void LinearExecutor::executeImpl()
42 auto profiling_subg_index = _tracing_ctx->getSubgraphIndex(&_graph);
44 _subject.notifySubgraphBegin(profiling_subg_index);
45 for (auto &&code : _code)
47 const auto op_seq = code.op_seq;
48 const auto backend = code.lower_info->backend();
49 // TODO : Move ruy profiler into ExecutionObserver
51 ruy::profiler::ScopeLabel label(seq_to_label(op_seq, _graph.operations()));
53 _subject.notifyJobBegin(this, profiling_subg_index, op_seq, backend);
55 auto &fn_seq = code.fn_seq;
57 fn_seq->initRunning();
59 bool handle_dynamic_tensor = op_seq->has_dynamic_tensor() || hasDynamicInput();
60 fn_seq->enableDynamicShapeInferer(handle_dynamic_tensor);
63 _subject.notifyJobEnd(this, profiling_subg_index, op_seq, backend);
65 _subject.notifySubgraphEnd(profiling_subg_index);