Commit 0d94f068 authored by Paul's avatar Paul
Browse files

Format

parent bb7f65d9
......@@ -615,7 +615,7 @@ inline auto var(std::string s)
[=, s = std::move(s)](const matcher_context& ctx,
instruction_ref) -> optional<instruction_ref> {
auto it = ctx.instructions.find(s);
if(it == ctx.instructions.end())
if(it == ctx.instructions.end())
return nullopt;
return it->second;
});
......
......@@ -92,9 +92,9 @@ struct find_layernorm
{
auto ins = r.result;
auto x_ins = r.instructions["x"];
float eps = 0;
float eps = 0;
if(contains(r.instructions, "eps"))
eps = r.instructions["eps"]->eval().at<float>();
eps = r.instructions["eps"]->eval().at<float>();
m.replace_instruction(ins, layernorm{eps}, x_ins);
}
......@@ -104,14 +104,15 @@ struct find_add_layernorm
{
auto matcher() const
{
return match::name("gpu::prelayernorm")(match::args(match::name("add")(match::used_once()).bind("add")));
return match::name("gpu::prelayernorm")(
match::args(match::name("add")(match::used_once()).bind("add")));
}
void apply(module& m, const match::matcher_result& r) const
{
auto ins = r.result;
auto add_ins = r.instructions["add"];
auto op = any_cast<layernorm>(ins->get_operator());
auto op = any_cast<layernorm>(ins->get_operator());
m.replace_instruction(ins, add_layernorm{op.epsilon}, add_ins->inputs());
}
......
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