ONE - On-device Neural Engine
Loading...
Searching...
No Matches
ProgressReporter.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 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/Pass.h>
23#include <logo/Phase.h>
24
25namespace
26{
27
28char to_char(bool b) { return b ? 'Y' : 'N'; }
29
30const char *to_str(logo::PhaseStrategy s)
31{
32 switch (s)
33 {
35 return "Saturate";
37 return "Restart";
38 default:
39 throw std::runtime_error("Unsupported PhaseStrategy");
40 }
41}
42
43} // namespace
44
45namespace fme_apply
46{
47
49{
50 LOGGER(prime);
51
52 INFO(prime) << "==============================================================";
53 INFO(prime) << "PhaseRunner<" << to_str(strategy()) << ">";
54 INFO(prime) << "Initial graph";
55 INFO(prime) << luci::fmt(graph());
56}
57
59{
60 LOGGER(prime);
61
62 INFO(prime) << "PhaseRunner<" << to_str(strategy()) << "> - done";
63}
64
66{
67 LOGGER(prime);
68
69 INFO(prime) << "--------------------------------------------------------------";
70 INFO(prime) << "Before " << logo::pass_name(info->pass());
71}
72
74{
75 LOGGER(prime);
76
77 INFO(prime) << "After " << logo::pass_name(info->pass())
78 << " (changed: " << to_char(info->changed()) << ")";
79 INFO(prime) << luci::fmt(graph());
80}
81
82} // namespace fme_apply
#define LOGGER(name)
Definition Log.h:65
#define INFO(name)
Definition Log.h:68
loco::Graph * graph(void) const
void notify(const logo::PhaseEventInfo< logo::PhaseEvent::PhaseBegin > *) override
logo::PhaseStrategy strategy(void) const
volatile const char info[]
std::string pass_name(const Pass *)
Definition Pass.cpp:22
PhaseStrategy
Definition Phase.h:151
FormattedGraph fmt(loco::Graph *g)
Definition LogHelper.cpp:23