Commit 6f44fa29 authored by Shucai Xiao's avatar Shucai Xiao
Browse files

change to make the program::compile function to call the run_pass function.

parent d4459ad6
......@@ -21,8 +21,6 @@ void run_passes(program& prog, const std::vector<pass>& passes, tracer trace)
if(enabled(MIGRAPHX_TRACE_COMPILE{}))
trace = tracer{std::cout};
trace(prog);
trace();
for(auto& p : passes)
{
trace("Pass: ", p.name());
......
......@@ -7,6 +7,7 @@
#include <migraphx/ranges.hpp>
#include <migraphx/time.hpp>
#include <migraphx/iterator_for.hpp>
#include <migraphx/pass_manager.hpp>
#include <iostream>
#include <sstream>
#include <algorithm>
......@@ -291,23 +292,8 @@ void program::compile(const target& t, tracer trace)
trace = tracer{std::cout};
trace(*this);
trace();
for(auto&& p : t.get_passes(this->impl->ctx))
{
trace("Pass: ", p.name());
p.apply(*this);
trace(*this);
#ifndef NDEBUG
trace("Validate ...");
auto invalid = this->validate();
if(invalid != impl->instructions.end())
{
auto index = std::distance(impl->instructions.begin(), invalid);
MIGRAPHX_THROW(p.name() + " pass produces invalid program at instruction " +
std::to_string(index) + ": " + invalid->name());
}
trace();
#endif
}
auto vec_passes = t.get_passes(this->impl->ctx);
run_passes(*this, vec_passes, trace);
auto invalid = this->validate();
if(invalid != impl->instructions.end())
{
......
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