Commit 1f8aa24f authored by Paul's avatar Paul
Browse files

Format

parent 4d6a1a8b
...@@ -61,15 +61,16 @@ MIGRAPHX_REGISTER_OP(miopen_op); ...@@ -61,15 +61,16 @@ MIGRAPHX_REGISTER_OP(miopen_op);
void compile_miopen::apply(module& m) const void compile_miopen::apply(module& m) const
{ {
for(auto ins:iterator_for(m)) for(auto ins : iterator_for(m))
{ {
if (ins->name() != "gpu::miopen_op") if(ins->name() != "gpu::miopen_op")
continue; continue;
auto op = any_cast<miopen_op>(ins->get_operator()).op; auto op = any_cast<miopen_op>(ins->get_operator()).op;
auto v = op.compile(*ctx, ins->get_shape(), to_shapes(ins->inputs())); auto v = op.compile(*ctx, ins->get_shape(), to_shapes(ins->inputs()));
std::size_t ws = v.get("workspace", 0); std::size_t ws = v.get("workspace", 0);
auto inputs = ins->inputs(); auto inputs = ins->inputs();
auto alloc = m.insert_instruction(ins, make_op("allocate", {{"shape", to_value(shape{shape::int8_type, {ws}})}})); auto alloc = m.insert_instruction(
ins, make_op("allocate", {{"shape", to_value(shape{shape::int8_type, {ws}})}}));
inputs.insert(std::prev(inputs.end()), alloc); inputs.insert(std::prev(inputs.end()), alloc);
m.replace_instruction(ins, op, inputs); m.replace_instruction(ins, op, inputs);
......
...@@ -216,7 +216,9 @@ shape miopen_convolution::find(context& ctx, const shape& output_shape, std::vec ...@@ -216,7 +216,9 @@ shape miopen_convolution::find(context& ctx, const shape& output_shape, std::vec
#endif #endif
} }
value miopen_convolution::compile(context& ctx, const shape& output, const std::vector<shape>& input) value miopen_convolution::compile(context& ctx,
const shape& output,
const std::vector<shape>& input)
{ {
if(cd == nullptr) if(cd == nullptr)
cd = make_conv(op); cd = make_conv(op);
......
...@@ -240,9 +240,12 @@ struct miopen_apply ...@@ -240,9 +240,12 @@ struct miopen_apply
// TODO: Use make_op // TODO: Use make_op
operation conv = miopen_convolution{op}; operation conv = miopen_convolution{op};
auto output = insert_allocation(ins, ins->get_shape()); auto output = insert_allocation(ins, ins->get_shape());
return mod->replace_instruction( return mod->replace_instruction(ins,
ins, make_op("gpu::miopen_op", {{"op", to_value(conv)}}), ins->inputs().at(0), ins->inputs().at(1), output); make_op("gpu::miopen_op", {{"op", to_value(conv)}}),
ins->inputs().at(0),
ins->inputs().at(1),
output);
}); });
} }
......
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