Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
ddb799b0
Commit
ddb799b0
authored
Dec 07, 2018
by
Khalique
Browse files
manual merge
parents
a0172c38
436b459e
Changes
40
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
259 additions
and
188 deletions
+259
-188
src/targets/gpu/include/migraphx/gpu/log.hpp
src/targets/gpu/include/migraphx/gpu/log.hpp
+34
-0
src/targets/gpu/include/migraphx/gpu/max.hpp
src/targets/gpu/include/migraphx/gpu/max.hpp
+2
-5
src/targets/gpu/include/migraphx/gpu/min.hpp
src/targets/gpu/include/migraphx/gpu/min.hpp
+2
-5
src/targets/gpu/include/migraphx/gpu/mul.hpp
src/targets/gpu/include/migraphx/gpu/mul.hpp
+2
-5
src/targets/gpu/include/migraphx/gpu/oper.hpp
src/targets/gpu/include/migraphx/gpu/oper.hpp
+91
-0
src/targets/gpu/include/migraphx/gpu/sin.hpp
src/targets/gpu/include/migraphx/gpu/sin.hpp
+2
-5
src/targets/gpu/include/migraphx/gpu/sinh.hpp
src/targets/gpu/include/migraphx/gpu/sinh.hpp
+2
-5
src/targets/gpu/include/migraphx/gpu/tan.hpp
src/targets/gpu/include/migraphx/gpu/tan.hpp
+2
-7
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+4
-0
src/targets/gpu/max.cpp
src/targets/gpu/max.cpp
+0
-26
src/targets/gpu/min.cpp
src/targets/gpu/min.cpp
+0
-26
src/targets/gpu/mul.cpp
src/targets/gpu/mul.cpp
+0
-26
src/targets/gpu/sin.cpp
src/targets/gpu/sin.cpp
+0
-26
src/targets/gpu/sinh.cpp
src/targets/gpu/sinh.cpp
+0
-26
src/targets/gpu/tan.cpp
src/targets/gpu/tan.cpp
+0
-26
test/cpu_ops_test.cpp
test/cpu_ops_test.cpp
+14
-0
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+28
-0
test/onnx/exp_test.onnx
test/onnx/exp_test.onnx
+13
-0
test/onnx/log_test.onnx
test/onnx/log_test.onnx
+13
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+50
-0
No files found.
src/targets/gpu/
cos.c
pp
→
src/targets/gpu/
include/migraphx/gpu/log.h
pp
View file @
ddb799b0
#include <migraphx/gpu/cos.hpp>
#ifndef MIGRAPHX_GUARD_RTGLIB_LOG_HPP
#include <migraphx/operators.hpp>
#define MIGRAPHX_GUARD_RTGLIB_LOG_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/config.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <migraphx/gpu/hip.hpp>
#include <migraphx/dfor.hpp>
#include <migraphx/gpu/device/contiguous.hpp>
#include <migraphx/gpu/device/log.hpp>
#include <migraphx/iterator_for.hpp>
#include <migraphx/gpu/rocblas.hpp>
#include <migraphx/gpu/context.hpp>
#include <migraphx/config.hpp>
#include <utility>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
hip_cos
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
struct
hip_log
:
unary_device
<
hip_log
,
device
::
log
>
{
check_shapes
{
inputs
,
*
this
}.
has
(
2
);
return
inputs
.
at
(
0
);
}
argument
hip_cos
::
compute
(
context
&
ctx
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
{
{
device
::
cos
(
ctx
.
get_stream
().
get
(),
args
[
1
],
args
[
0
]);
};
return
args
[
1
];
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
src/targets/gpu/include/migraphx/gpu/max.hpp
View file @
ddb799b0
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_MAX_HPP
#define MIGRAPHX_GUARD_RTGLIB_MAX_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/operators.hpp>
...
@@ -22,12 +23,8 @@ namespace migraphx {
...
@@ -22,12 +23,8 @@ namespace migraphx {
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
hip_max
struct
hip_max
:
binary_device
<
hip_max
,
device
::
max
>
{
{
std
::
string
name
()
const
{
return
"gpu::max"
;
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
compute
(
context
&
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
...
...
src/targets/gpu/include/migraphx/gpu/min.hpp
View file @
ddb799b0
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_MIN_HPP
#define MIGRAPHX_GUARD_RTGLIB_MIN_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/operators.hpp>
...
@@ -22,12 +23,8 @@ namespace migraphx {
...
@@ -22,12 +23,8 @@ namespace migraphx {
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
hip_min
struct
hip_min
:
binary_device
<
hip_min
,
device
::
min
>
{
{
std
::
string
name
()
const
{
return
"gpu::min"
;
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
compute
(
context
&
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
...
...
src/targets/gpu/include/migraphx/gpu/mul.hpp
View file @
ddb799b0
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_MUL_HPP
#define MIGRAPHX_GUARD_RTGLIB_MUL_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/operators.hpp>
...
@@ -22,12 +23,8 @@ namespace migraphx {
...
@@ -22,12 +23,8 @@ namespace migraphx {
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
hip_mul
struct
hip_mul
:
binary_device
<
hip_mul
,
device
::
mul
>
{
{
std
::
string
name
()
const
{
return
"gpu::mul"
;
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
compute
(
context
&
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
...
...
src/targets/gpu/include/migraphx/gpu/oper.hpp
0 → 100644
View file @
ddb799b0
#ifndef MIGRAPHX_GUARD_RTGLIB_UNARY_HPP
#define MIGRAPHX_GUARD_RTGLIB_UNARY_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <migraphx/gpu/hip.hpp>
#include <migraphx/dfor.hpp>
#include <migraphx/type_name.hpp>
#include <migraphx/gpu/device/contiguous.hpp>
#include <migraphx/iterator_for.hpp>
#include <migraphx/gpu/rocblas.hpp>
#include <migraphx/gpu/context.hpp>
#include <migraphx/config.hpp>
#include <utility>
#include <iostream>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
template
<
class
Derived
>
struct
oper
{
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
&
)>
struct
unary_device
:
oper
<
Derived
>
{
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
2
);
return
inputs
.
at
(
0
);
}
argument
compute
(
context
&
ctx
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
{
F
(
ctx
.
get_stream
().
get
(),
args
[
1
],
args
[
0
]);
return
args
[
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
&
)>
struct
binary_device
:
oper
<
Derived
>
{
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
3
);
return
inputs
.
at
(
0
);
}
argument
compute
(
context
&
ctx
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
{
F
(
ctx
.
get_stream
().
get
(),
args
[
2
],
args
[
1
],
args
[
0
]);
return
args
[
2
];
}
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
#endif
src/targets/gpu/include/migraphx/gpu/sin.hpp
View file @
ddb799b0
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_SIN_HPP
#define MIGRAPHX_GUARD_RTGLIB_SIN_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/operators.hpp>
...
@@ -22,12 +23,8 @@ namespace migraphx {
...
@@ -22,12 +23,8 @@ namespace migraphx {
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
hip_sin
struct
hip_sin
:
unary_device
<
hip_sin
,
device
::
sin
>
{
{
std
::
string
name
()
const
{
return
"gpu::sin"
;
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
compute
(
context
&
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
...
...
src/targets/gpu/include/migraphx/gpu/sinh.hpp
View file @
ddb799b0
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_SINH_HPP
#define MIGRAPHX_GUARD_RTGLIB_SINH_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/operators.hpp>
...
@@ -22,12 +23,8 @@ namespace migraphx {
...
@@ -22,12 +23,8 @@ namespace migraphx {
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
hip_sinh
struct
hip_sinh
:
unary_device
<
hip_sinh
,
device
::
sinh
>
{
{
std
::
string
name
()
const
{
return
"gpu::sinh"
;
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
compute
(
context
&
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
...
...
src/targets/gpu/include/migraphx/gpu/tan.hpp
View file @
ddb799b0
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define MIGRAPHX_GUARD_RTGLIB_TAN_HPP
#define MIGRAPHX_GUARD_RTGLIB_TAN_HPP
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/oper.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/operators.hpp>
...
@@ -11,8 +12,6 @@
...
@@ -11,8 +12,6 @@
#include <migraphx/gpu/hip.hpp>
#include <migraphx/gpu/hip.hpp>
#include <migraphx/dfor.hpp>
#include <migraphx/dfor.hpp>
#include <migraphx/gpu/device/contiguous.hpp>
#include <migraphx/gpu/device/contiguous.hpp>
#include <migraphx/gpu/device/sin.hpp>
#include <migraphx/gpu/device/cos.hpp>
#include <migraphx/gpu/device/tan.hpp>
#include <migraphx/gpu/device/tan.hpp>
#include <migraphx/iterator_for.hpp>
#include <migraphx/iterator_for.hpp>
#include <migraphx/gpu/rocblas.hpp>
#include <migraphx/gpu/rocblas.hpp>
...
@@ -24,12 +23,8 @@ namespace migraphx {
...
@@ -24,12 +23,8 @@ namespace migraphx {
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
hip_tan
struct
hip_tan
:
unary_device
<
hip_tan
,
device
::
tan
>
{
{
std
::
string
name
()
const
{
return
"gpu::tan"
;
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
compute
(
context
&
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
...
...
src/targets/gpu/lowering.cpp
View file @
ddb799b0
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
#include <migraphx/gpu/elu.hpp>
#include <migraphx/gpu/elu.hpp>
#include <migraphx/gpu/softmax.hpp>
#include <migraphx/gpu/softmax.hpp>
#include <migraphx/gpu/add.hpp>
#include <migraphx/gpu/add.hpp>
#include <migraphx/gpu/exp.hpp>
#include <migraphx/gpu/log.hpp>
#include <migraphx/gpu/sin.hpp>
#include <migraphx/gpu/sin.hpp>
#include <migraphx/gpu/cos.hpp>
#include <migraphx/gpu/cos.hpp>
#include <migraphx/gpu/tan.hpp>
#include <migraphx/gpu/tan.hpp>
...
@@ -69,6 +71,8 @@ struct miopen_apply
...
@@ -69,6 +71,8 @@ struct miopen_apply
add_miopen_extend_op
<
miopen_elu
,
op
::
elu
>
(
"elu"
,
make_elu
);
add_miopen_extend_op
<
miopen_elu
,
op
::
elu
>
(
"elu"
,
make_elu
);
add_generic_op
<
hip_add
>
(
"add"
);
add_generic_op
<
hip_add
>
(
"add"
);
add_generic_op
<
hip_exp
>
(
"exp"
);
add_generic_op
<
hip_log
>
(
"log"
);
add_generic_op
<
hip_sin
>
(
"sin"
);
add_generic_op
<
hip_sin
>
(
"sin"
);
add_generic_op
<
hip_cos
>
(
"cos"
);
add_generic_op
<
hip_cos
>
(
"cos"
);
add_generic_op
<
hip_tan
>
(
"tan"
);
add_generic_op
<
hip_tan
>
(
"tan"
);
...
...
src/targets/gpu/max.cpp
deleted
100644 → 0
View file @
a0172c38
#include <migraphx/gpu/max.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
shape
hip_max
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
// check_shapes{inputs, *this}.has(3).standard();
check_shapes
{
inputs
,
*
this
}.
has
(
3
);
return
inputs
.
at
(
0
);
}
argument
hip_max
::
compute
(
context
&
ctx
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
{
device
::
max
(
ctx
.
get_stream
().
get
(),
args
[
2
],
args
[
0
],
args
[
1
]);
return
args
[
2
];
}
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
src/targets/gpu/min.cpp
deleted
100644 → 0
View file @
a0172c38
#include <migraphx/gpu/min.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
shape
hip_min
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
// check_shapes{inputs, *this}.has(3).standard();
check_shapes
{
inputs
,
*
this
}.
has
(
3
);
return
inputs
.
at
(
0
);
}
argument
hip_min
::
compute
(
context
&
ctx
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
{
device
::
min
(
ctx
.
get_stream
().
get
(),
args
[
2
],
args
[
0
],
args
[
1
]);
return
args
[
2
];
}
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
src/targets/gpu/mul.cpp
deleted
100644 → 0
View file @
a0172c38
#include <migraphx/gpu/mul.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
shape
hip_mul
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
// check_shapes{inputs, *this}.has(3).standard();
check_shapes
{
inputs
,
*
this
}.
has
(
3
);
return
inputs
.
at
(
0
);
}
argument
hip_mul
::
compute
(
context
&
ctx
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
{
device
::
mul
(
ctx
.
get_stream
().
get
(),
args
[
2
],
args
[
0
],
args
[
1
]);
return
args
[
2
];
}
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
src/targets/gpu/sin.cpp
deleted
100644 → 0
View file @
a0172c38
#include <migraphx/gpu/sin.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
shape
hip_sin
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
2
);
return
inputs
.
at
(
0
);
}
argument
hip_sin
::
compute
(
context
&
ctx
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
{
device
::
sin
(
ctx
.
get_stream
().
get
(),
args
[
1
],
args
[
0
]);
return
args
[
1
];
}
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
src/targets/gpu/sinh.cpp
deleted
100644 → 0
View file @
a0172c38
#include <migraphx/gpu/sinh.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
shape
hip_sinh
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
2
);
return
inputs
.
at
(
0
);
}
argument
hip_sinh
::
compute
(
context
&
ctx
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
{
device
::
sinh
(
ctx
.
get_stream
().
get
(),
args
[
1
],
args
[
0
]);
return
args
[
1
];
}
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
src/targets/gpu/tan.cpp
deleted
100644 → 0
View file @
a0172c38
#include <migraphx/gpu/tan.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
shape
hip_tan
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
2
);
return
inputs
.
at
(
0
);
}
argument
hip_tan
::
compute
(
context
&
ctx
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
{
device
::
tan
(
ctx
.
get_stream
().
get
(),
args
[
1
],
args
[
0
]);
return
args
[
1
];
}
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
test/cpu_ops_test.cpp
View file @
ddb799b0
...
@@ -413,6 +413,20 @@ TEST_CASE(exp_test)
...
@@ -413,6 +413,20 @@ TEST_CASE(exp_test)
EXPECT
(
migraphx
::
verify_range
(
results_vector
,
gold
));
EXPECT
(
migraphx
::
verify_range
(
results_vector
,
gold
));
}
}
TEST_CASE
(
log_test
)
{
migraphx
::
program
p
;
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
}};
auto
l
=
p
.
add_literal
(
migraphx
::
literal
{
s
,
{
1
,
2
,
3
}});
p
.
add_instruction
(
migraphx
::
op
::
log
{},
l
);
p
.
compile
(
migraphx
::
cpu
::
target
{});
auto
result
=
p
.
eval
({});
std
::
vector
<
float
>
results_vector
(
3
);
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
std
::
vector
<
float
>
gold
=
{
0.0
f
,
0.6931471806
f
,
1.0986122887
f
};
EXPECT
(
migraphx
::
verify_range
(
results_vector
,
gold
));
}
TEST_CASE
(
sin_test
)
TEST_CASE
(
sin_test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
...
...
test/gpu/miopen.cpp
View file @
ddb799b0
...
@@ -203,6 +203,32 @@ struct test_mul
...
@@ -203,6 +203,32 @@ struct test_mul
}
}
};
};
struct
test_exp
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
6
}};
std
::
vector
<
float
>
data
{
0.1
f
,
0.2
f
,
1.
f
,
2.
f
,
0.6
f
,
10.
f
};
auto
x
=
p
.
add_literal
(
s
,
data
);
p
.
add_instruction
(
migraphx
::
op
::
exp
{},
x
);
return
p
;
}
};
struct
test_log
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
6
}};
std
::
vector
<
float
>
data
{
0.1
f
,
0.2
f
,
1.
f
,
2.
f
,
0.6
f
,
100.
f
};
auto
x
=
p
.
add_literal
(
s
,
data
);
p
.
add_instruction
(
migraphx
::
op
::
log
{},
x
);
return
p
;
}
};
struct
test_sin
struct
test_sin
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
...
@@ -984,6 +1010,8 @@ int main()
...
@@ -984,6 +1010,8 @@ int main()
verify_program
<
test_add
>
();
verify_program
<
test_add
>
();
verify_program
<
test_add_half
>
();
verify_program
<
test_add_half
>
();
verify_program
<
test_mul
>
();
verify_program
<
test_mul
>
();
verify_program
<
test_exp
>
();
verify_program
<
test_log
>
();
verify_program
<
test_sin
>
();
verify_program
<
test_sin
>
();
verify_program
<
test_cos
>
();
verify_program
<
test_cos
>
();
verify_program
<
test_tan
>
();
verify_program
<
test_tan
>
();
...
...
test/onnx/exp_test.onnx
0 → 100644
View file @
ddb799b0
exp-example:9
xy"Exptest_expZ
x
b
y
B
\ No newline at end of file
test/onnx/log_test.onnx
0 → 100644
View file @
ddb799b0
log-example:9
xy"Logtest_logZ
x
b
y
B
\ No newline at end of file
test/onnx/onnx_test.cpp
View file @
ddb799b0
...
@@ -179,6 +179,27 @@ TEST_CASE(sum_test)
...
@@ -179,6 +179,27 @@ TEST_CASE(sum_test)
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l0
,
input2
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l0
,
input2
);
auto
prog
=
migraphx
::
parse_onnx
(
"sum_test.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"sum_test.onnx"
);
EXPECT
(
p
==
prog
);
}
void
exp_test
()
{
migraphx
::
program
p
;
auto
input
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
10
}});
p
.
add_instruction
(
migraphx
::
op
::
exp
{},
input
);
auto
prog
=
migraphx
::
parse_onnx
(
"exp_test.onnx"
);
EXPECT
(
p
==
prog
);
}
void
log_test
()
{
migraphx
::
program
p
;
auto
input
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
10
}});
p
.
add_instruction
(
migraphx
::
op
::
log
{},
input
);
auto
prog
=
migraphx
::
parse_onnx
(
"log_test.onnx"
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
sin_test
)
TEST_CASE
(
sin_test
)
...
@@ -301,6 +322,7 @@ TEST_CASE(atan_test)
...
@@ -301,6 +322,7 @@ TEST_CASE(atan_test)
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
<<<<<<<
HEAD
TEST_CASE
(
add_bcast_test
)
TEST_CASE
(
add_bcast_test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
...
@@ -312,6 +334,34 @@ TEST_CASE(add_bcast_test)
...
@@ -312,6 +334,34 @@ TEST_CASE(add_bcast_test)
auto
prog
=
migraphx
::
parse_onnx
(
"add_bcast_test.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"add_bcast_test.onnx"
);
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
=======
int
main
()
{
pytorch_conv_bias_test
();
pytorch_conv_relu_maxpool
();
pytorch_conv_bn_relu_maxpool
();
pytorch_conv_relu_maxpool_x2
();
leaky_relu_test
();
imagescaler_test
();
globalavgpool_test
();
globalmaxpool_test
();
transpose_test
();
dropout_test
();
sum_test
();
max_test
();
min_test
();
exp_test
();
log_test
();
sin_test
();
cos_test
();
tan_test
();
sinh_test
();
cosh_test
();
tanh_test
();
asin_test
();
acos_test
();
atan_test
();
>>>>>>>
436
b459e73e8a18e3f08ac6863c25279ca811fd9
}
}
TEST_CASE
(
implicit_bcast_test
)
TEST_CASE
(
implicit_bcast_test
)
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment