"test/vscode:/vscode.git/clone" did not exist on "e64b773f22c91a4ff0c692d82be23455481888d8"
Commit 632b5f9b authored by Paul's avatar Paul
Browse files

Rewrite add splits

parent a91071cf
......@@ -773,6 +773,37 @@ struct find_split_concat
}
};
struct find_add_split
{
auto matcher() const
{
auto add = [](auto... ms) {
return match::name("add")(match::either_arg(0, 1)(ms...));
};
auto slice = match::name("slice").bind("slice");
auto constant = match::is_constant().bind("a");
auto any = match::any().bind("x");
auto slice_a_x = add(slice, add(constant, any));
auto a_slice_x = add(constant, add(slice, any));
return match::any_of(
slice_a_x,
a_slice_x
);
}
void apply(module& m, const match::matcher_result& r) const
{
auto ins = r.result;
auto slice = r.instructions["slice"];
auto a = r.instructions["a"];
auto x = r.instructions["x"];
auto slice_add = m.insert_instruction(ins, migraphx::make_op("add"), slice, a);
m.replace_instruction(ins, migraphx::make_op("add"), slice_add, x);
}
};
bool axis_equal(const std::vector<std::size_t>& x,
const std::vector<std::size_t>& y,
std::size_t axis)
......@@ -1235,6 +1266,7 @@ void simplify_algebra::apply(module& m) const
find_div_const{},
find_sub_const{},
find_rsqrt{},
find_add_split{},
find_concat_op{},
find_split_concat{},
find_splits{},
......
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