Commit a6c9ad80 authored by Paul's avatar Paul
Browse files

Propogate const for contiguous

parent 924d0f2b
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include <migraphx/iterator_for.hpp> #include <migraphx/iterator_for.hpp>
#include <migraphx/ranges.hpp> #include <migraphx/ranges.hpp>
#include <migraphx/stringutils.hpp> #include <migraphx/stringutils.hpp>
#include <migraphx/op/contiguous.hpp>
#include <migraphx/op/identity.hpp>
#include <utility> #include <utility>
namespace migraphx { namespace migraphx {
...@@ -82,6 +84,11 @@ void eliminate_contiguous::apply(program& p) const ...@@ -82,6 +84,11 @@ void eliminate_contiguous::apply(program& p) const
{ {
instruction::replace_argument(ins, arg, prev); instruction::replace_argument(ins, arg, prev);
} }
else if (prev->can_eval())
{
auto c = p.insert_instruction(arg, op::contiguous{}, prev);
p.replace_instruction(arg, op::identity{}, c);
}
} }
} }
} }
......
...@@ -62,6 +62,8 @@ std::vector<pass> target::get_passes(migraphx::context& gctx) const ...@@ -62,6 +62,8 @@ std::vector<pass> target::get_passes(migraphx::context& gctx) const
dead_code_elimination{}, dead_code_elimination{},
eliminate_contiguous{}, eliminate_contiguous{},
dead_code_elimination{}, dead_code_elimination{},
propagate_constant{},
dead_code_elimination{},
adjust_allocation{}, adjust_allocation{},
dead_code_elimination{}, dead_code_elimination{},
fuse_ops{&ctx}, fuse_ops{&ctx},
......
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