ONE - On-device Neural Engine
Loading...
Searching...
No Matches
ProgressReporter.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17#include "ProgressReporter.h"
18
19#include "luci/Log.h"
20#include "luci/LogHelper.h"
21
22#include <logo/Phase.h>
23#include <logo/Pass.h>
24
25#include <cassert>
26
27namespace
28{
29
30char to_char(bool b) { return b ? 'Y' : 'N'; }
31
32const char *to_str(logo::PhaseStrategy s)
33{
34 switch (s)
35 {
37 return "Saturate";
39 return "Restart";
40 }
41 assert(false);
42 return "";
43}
44
45} // namespace
46
47namespace luci
48{
49
51{
52 LOGGER(l);
53
54 VERBOSE(l, 4) << "==============================================================";
55 VERBOSE(l, 4) << "luci::PhaseRunner<" << to_str(strategy()) << ">";
56 VERBOSE(l, 4) << "Initial graph";
57 VERBOSE(l, 4) << fmt(graph());
58}
59
61{
62 LOGGER(l);
63
64 VERBOSE(l, 4) << "luci::PhaseRunner<" << to_str(strategy()) << "> - done";
65}
66
68{
69 LOGGER(l);
70
71 VERBOSE(l, 4) << "--------------------------------------------------------------";
72 VERBOSE(l, 4) << "Before " << logo::pass_name(info->pass());
73}
74
76{
77 LOGGER(l);
78
79 VERBOSE(l, 4) << "After " << logo::pass_name(info->pass())
80 << " (changed: " << to_char(info->changed()) << ")";
81 VERBOSE(l, 4) << fmt(graph());
82}
83
84} // namespace luci
#define LOGGER(name)
Definition Log.h:65
void notify(const logo::PhaseEventInfo< logo::PhaseEvent::PhaseBegin > *) override
logo::PhaseStrategy strategy(void) const
loco::Graph * graph(void) const
volatile const char info[]
#define VERBOSE(name, lv)
Definition Log.h:71
std::string pass_name(const Pass *)
Definition Pass.cpp:22
PhaseStrategy
Definition Phase.h:151
FormattedGraph fmt(loco::Graph *g)
Definition LogHelper.cpp:23