Unverified Commit 00bfed4d authored by Paul Fultz II's avatar Paul Fultz II Committed by GitHub
Browse files

Fuse convert ops (#1020)

parent 1793cc54
...@@ -33,9 +33,6 @@ static void create_pointwise_modules(module_pass_manager& mpm) ...@@ -33,9 +33,6 @@ static void create_pointwise_modules(module_pass_manager& mpm)
{ {
if(not ins->get_operator().attributes().get("pointwise", false)) if(not ins->get_operator().attributes().get("pointwise", false))
continue; continue;
// Skip convert op for now
if(ins->name() == "convert")
continue;
assert(ins->get_operator().attributes().contains("point_op")); assert(ins->get_operator().attributes().contains("point_op"));
auto* pm = mpm.create_module(mpm.get_module().name() + ":pointwise" + std::to_string(n++)); auto* pm = mpm.create_module(mpm.get_module().name() + ":pointwise" + std::to_string(n++));
pm->set_bypass(); pm->set_bypass();
......
...@@ -32,6 +32,11 @@ struct convert : unary<convert> ...@@ -32,6 +32,11 @@ struct convert : unary<convert>
return {target_type, inputs.at(0).lens(), inputs.at(0).strides()}; return {target_type, inputs.at(0).lens(), inputs.at(0).strides()};
} }
std::string point_op() const
{
return "${function:convert}<" + shape::cpp_type(target_type) + ">(${0})";
}
auto apply() const auto apply() const
{ {
auto type = target_type; auto type = target_type;
......
...@@ -110,5 +110,11 @@ constexpr auto& min(const T& a, const U& b) ...@@ -110,5 +110,11 @@ constexpr auto& min(const T& a, const U& b)
return (a > b) ? b : a; return (a > b) ? b : a;
} }
template <class T, class U>
constexpr T convert(U x)
{
return x;
}
} // namespace migraphx } // namespace migraphx
#endif // MIGRAPHX_GUARD_KERNELS_MATH_HPP #endif // MIGRAPHX_GUARD_KERNELS_MATH_HPP
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