Commit c87f5621 authored by Paul's avatar Paul
Browse files

Formatting

parent fa485ae6
......@@ -58,19 +58,20 @@ struct loader
auto last = std::prev(p.end(), trim);
p.remove_instructions(last, p.end());
}
if (optimize)
migraphx::run_passes(p, {
migraphx::eliminate_identity{},
migraphx::dead_code_elimination{},
migraphx::simplify_algebra{},
migraphx::dead_code_elimination{},
migraphx::simplify_reshapes{},
migraphx::dead_code_elimination{},
migraphx::propagate_constant{},
migraphx::dead_code_elimination{},
migraphx::eliminate_pad{},
migraphx::dead_code_elimination{},
});
if(optimize)
migraphx::run_passes(p,
{
migraphx::eliminate_identity{},
migraphx::dead_code_elimination{},
migraphx::simplify_algebra{},
migraphx::dead_code_elimination{},
migraphx::simplify_reshapes{},
migraphx::dead_code_elimination{},
migraphx::propagate_constant{},
migraphx::dead_code_elimination{},
migraphx::eliminate_pad{},
migraphx::dead_code_elimination{},
});
return p;
}
};
......
......@@ -190,7 +190,7 @@ auto pop_back_args(Ts&&... xs)
};
}
template<class T>
template <class T>
auto always(T x)
{
return [=](auto&&...) { return x; };
......
......@@ -242,7 +242,7 @@ void find_matches(program& p, Ms&&... ms)
struct lazy_and
{
template<class F, class G>
template <class F, class G>
bool operator()(F f, G g) const
{
return f() and g();
......@@ -251,7 +251,7 @@ struct lazy_and
struct lazy_or
{
template<class F, class G>
template <class F, class G>
bool operator()(F f, G g) const
{
return f() or g();
......@@ -266,12 +266,9 @@ struct folder
{
return make_bf_matcher([=](matcher_context& ctx, instruction_ref ins) {
Op op;
auto matched = [&](auto m) {
return [&]{ return ctx.matched(m, ins); };
};
bool matches = fold([&](auto x, auto y) {
return op(always(x), matched(y));
})(Start, ms...);
auto matched = [&](auto m) { return [&] { return ctx.matched(m, ins); }; };
bool matches =
fold([&](auto x, auto y) { return op(always(x), matched(y)); })(Start, ms...);
if(matches == Matches)
return ins;
return ctx.not_found();
......@@ -286,13 +283,10 @@ struct folder
Op op;
bool matches = Start;
select(start, [&](auto ins) {
auto matched = [&](auto m) {
return [&]{ return ctx.matched(m, ins); };
};
auto matched = [&](auto m) { return [&] { return ctx.matched(m, ins); }; };
auto fold_match = [&] {
return fold([&](auto x, auto y) {
return op(always(x), matched(y));
})(Start, ms...);
return fold([&](auto x, auto y) { return op(always(x), matched(y)); })(
Start, ms...);
};
matches = op(always(matches), fold_match);
});
......
......@@ -214,11 +214,7 @@ void simplify_reshapes::apply(program& p) const
// Skip possible dead instructions
if(ins->outputs().empty() and ins != end)
continue;
match::find_matches(p,
ins,
find_nop_reshapes{},
find_reshaper{},
find_transpose{}
match::find_matches(p, ins, find_nop_reshapes{}, find_reshaper{}, find_transpose{}
// find_concat_transpose{}
);
}
......
......@@ -232,10 +232,10 @@ struct find_triadd
void apply(program& p, match::matcher_result r) const
{
auto add_ins = r.instructions["add"];
auto input_ins = r.instructions["input"];
auto ins = r.result;
auto args = add_ins->inputs();
auto add_ins = r.instructions["add"];
auto input_ins = r.instructions["input"];
auto ins = r.result;
auto args = add_ins->inputs();
assert(add_ins != input_ins);
auto is_broadcasted = [](auto arg) { return arg->get_shape().broadcasted(); };
......
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