"src/tl_templates/vscode:/vscode.git/clone" did not exist on "471cc7f846fe7df75dc39bf010ed69d5dbf535c7"
Commit d16f702c authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format.

parent ccb23388
...@@ -22,21 +22,23 @@ namespace migraphx { ...@@ -22,21 +22,23 @@ namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
namespace gpu { namespace gpu {
template<class Derived> template <class Derived>
struct oper struct oper
{ {
std::string name() const { return get_type_name<Derived>(); } std::string name() const { return get_type_name<Derived>(); }
}; };
template<class Derived, void(*F)(hipStream_t, const argument&, const argument&)> template <class Derived, void (*F)(hipStream_t, const argument&, const argument&)>
struct unary_device : oper<Derived> struct unary_device : oper<Derived>
{ {
shape compute_shape(const std::vector<shape>& inputs) const { shape compute_shape(const std::vector<shape>& inputs) const
{
check_shapes{inputs, *this}.has(2); check_shapes{inputs, *this}.has(2);
return inputs.at(0); return inputs.at(0);
} }
argument compute(context& ctx, const shape&, const std::vector<argument>& args) const { argument compute(context& ctx, const shape&, const std::vector<argument>& args) const
{
F(ctx.get_stream().get(), args[1], args[0]); F(ctx.get_stream().get(), args[1], args[0]);
return args[1]; return args[1];
} }
...@@ -44,15 +46,17 @@ struct unary_device : oper<Derived> ...@@ -44,15 +46,17 @@ struct unary_device : oper<Derived>
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; } int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
template<class Derived, void(*F)(hipStream_t, const argument&, const argument&, const argument&)> template <class Derived, void (*F)(hipStream_t, const argument&, const argument&, const argument&)>
struct binary_device : oper<Derived> struct binary_device : oper<Derived>
{ {
shape compute_shape(const std::vector<shape>& inputs) const { shape compute_shape(const std::vector<shape>& inputs) const
{
check_shapes{inputs, *this}.has(3); check_shapes{inputs, *this}.has(3);
return inputs.at(0); return inputs.at(0);
} }
argument compute(context& ctx, const shape&, const std::vector<argument>& args) const { argument compute(context& ctx, const shape&, const std::vector<argument>& args) const
{
F(ctx.get_stream().get(), args[2], args[1], args[0]); F(ctx.get_stream().get(), args[2], args[1], args[0]);
return args[2]; return args[2];
} }
...@@ -60,7 +64,6 @@ struct binary_device : oper<Derived> ...@@ -60,7 +64,6 @@ struct binary_device : oper<Derived>
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; } int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
......
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