Commit 4272fff1 authored by Paul's avatar Paul
Browse files

Handle symetrical padding

parent e872b1b7
......@@ -421,6 +421,21 @@ struct mlir_program
return "migraphx." + ins->name();
}
static value get_operator_value(const operation& op)
{
auto v = op.to_value();
if (op.name() == "convolution")
{
// Adjust symetrical padding
if (v.at("padding").size() == v.at("stride").size())
{
auto padding = v.at("padding");
std::copy(padding.begin(), padding.end(), std::back_inserter(v.at("padding")));
}
}
return v;
}
static shape get_shape(instruction_ref ins)
{
if(ins->name() == "@return")
......@@ -442,7 +457,7 @@ struct mlir_program
continue;
auto name = get_name(ins);
auto ops = create_operation_state(name);
ops.add_attribute_value(ins->get_operator().to_value());
ops.add_attribute_value(get_operator_value(ins->get_operator()));
if(ins->name() != "@return")
ops.add_results({get_shape(ins)});
......
......@@ -111,9 +111,7 @@ module {
migraphx::module m;
auto x = m.add_parameter("x", {migraphx::shape::float_type, {1, 8, 4, 4}});
auto w = m.add_parameter("w", {migraphx::shape::float_type, {2, 8, 3, 3}});
auto conv =
m.add_instruction(migraphx::make_op("convolution", {{"padding", {0, 0, 0, 0}}}), x, w);
// auto conv = m.add_instruction(migraphx::make_op("convolution"), x, w);
auto conv = m.add_instruction(migraphx::make_op("convolution"), x, w);
m.add_return({conv});
auto s = migraphx::gpu::dump_mlir(m);
// Skip test if MLIR is not enabled
......
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