Commit 944ddd4b authored by Khalique's avatar Khalique
Browse files

Merge branch 'develop' of https://github.com/ROCmSoftwarePlatform/AMDMIGraphX...

Merge branch 'develop' of https://github.com/ROCmSoftwarePlatform/AMDMIGraphX into conv_same_padding
parents 1b8efef8 dc85aa6b
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include <migraphx/instruction.hpp> #include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp> #include <migraphx/operators.hpp>
#include <migraphx/iterator_for.hpp> #include <migraphx/iterator_for.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/stringutils.hpp> #include <migraphx/stringutils.hpp>
#include <utility> #include <utility>
......
...@@ -11,7 +11,9 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -11,7 +11,9 @@ inline namespace MIGRAPHX_INLINE_NS {
struct program; struct program;
/** /**
* Remove identity instructions. * Remove identity instructions. Currently when used as the last pass, it will
* preserve the semantics of previous program state, therefore dead code elimination
* should not be used afterwards.
*/ */
struct eliminate_identity struct eliminate_identity
{ {
......
...@@ -253,6 +253,12 @@ struct miopen_conv_bias ...@@ -253,6 +253,12 @@ struct miopen_conv_bias
fusion::op_t conv; fusion::op_t conv;
fusion::op_t bias; fusion::op_t bias;
template <class Self, class F>
static auto reflect(Self& self, F f)
{
return op::convolution::reflect(self.op, f);
}
miopen_conv_bias(op::convolution c, const shape& input, const shape& weights, const shape& b) miopen_conv_bias(op::convolution c, const shape& input, const shape& weights, const shape& b)
: op(c), f(input) : op(c), f(input)
{ {
...@@ -290,6 +296,12 @@ struct miopen_conv_bias_relu ...@@ -290,6 +296,12 @@ struct miopen_conv_bias_relu
fusion::op_t bias; fusion::op_t bias;
fusion::op_t relu; fusion::op_t relu;
template <class Self, class F>
static auto reflect(Self& self, F f)
{
return op::convolution::reflect(self.op, f);
}
miopen_conv_bias_relu(op::convolution c, miopen_conv_bias_relu(op::convolution c,
const shape& input, const shape& input,
const shape& weights, const shape& weights,
......
...@@ -59,7 +59,7 @@ TEST_CASE(simple_test_end_dependency) ...@@ -59,7 +59,7 @@ TEST_CASE(simple_test_end_dependency)
p.add_instruction(sum_op{}, ans, three); p.add_instruction(sum_op{}, ans, three);
p.add_instruction(migraphx::op::identity{}, ans); p.add_instruction(migraphx::op::identity{}, ans);
p.compile(eliminate_identity_target{}); p.compile(eliminate_identity_target{});
EXPECT(!std::none_of(p.begin(), p.end(), [](const migraphx::instruction& ins) { EXPECT(std::any_of(p.begin(), p.end(), [](const migraphx::instruction& ins) {
return ins.name() == "identity"; return ins.name() == "identity";
})); }));
auto result = p.eval({}); auto result = p.eval({});
......
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