"src/git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "44a12304f7bcb87acdedea51943a435dd322bb27"
Commit 883312be authored by umangyadav's avatar umangyadav
Browse files

formatting

parent d0fec7fd
...@@ -26,23 +26,21 @@ struct tracer ...@@ -26,23 +26,21 @@ struct tracer
} }
fs::create_directories(dir_path); fs::create_directories(dir_path);
} }
// file_stream // file_stream
bool fs_enabled() const { return !dump_dir.empty() && !os_enabled(); } bool fs_enabled() const { return !dump_dir.empty() && !os_enabled(); }
// output_stream // output_stream
bool os_enabled() const { return (os != nullptr) && !fs_enabled();} bool os_enabled() const { return (os != nullptr) && !fs_enabled(); }
bool enabled() const {return fs_enabled() or os_enabled();}; bool enabled() const { return fs_enabled() or os_enabled(); };
/* /*
Dump any string to ostream, used for debug build or debugging purposes. Dump any string to ostream, used for debug build or debugging purposes.
*/ */
void operator()(const std::string& s="") const { void operator()(const std::string& s = "") const { std::cout << s << std::endl; }
std::cout << s << std::endl;
}
/* /*
Based on user's envrionment flags, either dump IR passes' output to a file or ostream i.e. cout or cerr, Based on user's envrionment flags, either dump IR passes' output to a file or ostream i.e. cout
:param pass_file_name : file_name to be used when dumping IR pass to a file, this param is not used when IR is or cerr, :param pass_file_name : file_name to be used when dumping IR pass to a file, this param
dumped to ostream. is not used when IR is dumped to ostream.
*/ */
template <class... Ts, MIGRAPHX_REQUIRES((sizeof...(Ts) > 0))> template <class... Ts, MIGRAPHX_REQUIRES((sizeof...(Ts) > 0))>
void operator()(const std::string& pass_file_name, const Ts&... xs) void operator()(const std::string& pass_file_name, const Ts&... xs)
...@@ -55,7 +53,9 @@ struct tracer ...@@ -55,7 +53,9 @@ struct tracer
swallow{ofs << xs...}; swallow{ofs << xs...};
ofs << std::endl; ofs << std::endl;
ofs.close(); ofs.close();
} else if (os_enabled()) { }
else if(os_enabled())
{
swallow{*os << xs...}; swallow{*os << xs...};
*os << std::endl; *os << std::endl;
} }
...@@ -64,8 +64,8 @@ struct tracer ...@@ -64,8 +64,8 @@ struct tracer
std::string dump_dir = ""; std::string dump_dir = "";
private: private:
uint counter = 0; uint counter = 0;
std::ostream* os = nullptr; std::ostream* os = nullptr;
fs::path dir_path = ""; fs::path dir_path = "";
}; };
......
...@@ -131,7 +131,7 @@ void run_passes(program& prog, const std::vector<pass>& passes, tracer trace) ...@@ -131,7 +131,7 @@ void run_passes(program& prog, const std::vector<pass>& passes, tracer trace)
{ {
module_tracer_map[mod->name()] = module_tracer_map[mod->name()] =
// cppcheck-suppress stlFindInsert // cppcheck-suppress stlFindInsert
trace.fs_enabled() ? tracer{trace.dump_dir + "/" + mod->name()} : trace; trace.fs_enabled() ? tracer{trace.dump_dir + "/" + mod->name()} : trace;
} }
if(mod->bypass()) if(mod->bypass())
continue; continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment