Commit 98ff3b74 authored by Shucai Xiao's avatar Shucai Xiao
Browse files

combine unary and binary gpu operators to simplify code.

parent fd97cabc
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_ACOS_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_ADD_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_ASIN_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_ATAN_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_COS_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_COSH_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_EXP_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_LOG_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_MAX_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_MIN_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_MUL_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -17,6 +17,7 @@
#include <migraphx/gpu/context.hpp>
#include <migraphx/config.hpp>
#include <utility>
#include <iostream>
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
......@@ -25,7 +26,25 @@ namespace gpu {
template <class Derived>
struct oper
{
std::string name() const { return get_type_name<Derived>(); }
std::string name() const {
const std::string& name = get_type_name<Derived>();
// search the namespace gpu (::gpu::)
auto pos_ns = name.find("::gpu::");
if (pos_ns != std::string::npos)
{
auto pos_name = name.find("hip_", pos_ns + std::string("::gpu::").length());
if (pos_name != std::string::npos)
{
return std::string("gpu::") + name.substr(pos_name + 4);
}
else
{
return name.substr(pos_ns + 2);
}
}
return "unknown";
}
};
template <class Derived, void (*F)(hipStream_t, const argument&, const argument&)>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_SIN_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_SINH_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
......
......@@ -2,7 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_TAN_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/unary.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.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