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
6d360afd
Commit
6d360afd
authored
Nov 15, 2018
by
Shucai Xiao
Browse files
priliminary implementation of the sin operator on GPU.
parent
e1bc4b99
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
0 deletions
+108
-0
.gitignore
.gitignore
+5
-0
src/targets/gpu/CMakeLists.txt
src/targets/gpu/CMakeLists.txt
+2
-0
src/targets/gpu/device/sin.cpp
src/targets/gpu/device/sin.cpp
+17
-0
src/targets/gpu/include/migraph/gpu/device/sin.hpp
src/targets/gpu/include/migraph/gpu/device/sin.hpp
+21
-0
src/targets/gpu/include/migraph/gpu/sin.hpp
src/targets/gpu/include/migraph/gpu/sin.hpp
+37
-0
src/targets/gpu/sin.cpp
src/targets/gpu/sin.cpp
+26
-0
No files found.
.gitignore
View file @
6d360afd
*.swp
.metadata/
.vscode/
build/
deps/
src/targets/gpu/CMakeLists.txt
View file @
6d360afd
...
...
@@ -12,6 +12,7 @@ endif()
add_library
(
migraphx_device
device/add.cpp
device/sin.cpp
device/add_relu.cpp
device/contiguous.cpp
device/mul.cpp
...
...
@@ -38,6 +39,7 @@ add_library(migraphx_gpu
relu.cpp
leaky_relu.cpp
add.cpp
sin.cpp
mul.cpp
batchnorm.cpp
write_literals.cpp
...
...
src/targets/gpu/device/sin.cpp
0 → 100644
View file @
6d360afd
#include <migraph/gpu/device/sin.hpp>
#include <migraph/gpu/device/nary.hpp>
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
device
{
void
sin
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
)
{
nary
(
stream
,
result
,
arg
)([](
auto
x
)
{
return
sinf
(
x
);
});
}
}
// namespace device
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
src/targets/gpu/include/migraph/gpu/device/sin.hpp
0 → 100644
View file @
6d360afd
#ifndef MIGRAPH_GUARD_RTGLIB_DEVICE_ADD_HPP
#define MIGRAPH_GUARD_RTGLIB_DEVICE_ADD_HPP
#include <migraph/argument.hpp>
#include <migraph/config.hpp>
#include <hip/hip_runtime_api.h>
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
device
{
void
sin
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
);
}
// namespace device
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
#endif
src/targets/gpu/include/migraph/gpu/sin.hpp
0 → 100644
View file @
6d360afd
#ifndef MIGRAPH_GUARD_RTGLIB_SIN_HPP
#define MIGRAPH_GUARD_RTGLIB_SIN_HPP
#include <migraph/gpu/lowering.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/sin.hpp>
#include <migraph/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph/config.hpp>
#include <utility>
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
struct
hip_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 MIGRAPH_INLINE_NS
}
// namespace migraph
#endif
src/targets/gpu/sin.cpp
0 → 100644
View file @
6d360afd
#include <migraph/gpu/sin.hpp>
#include <migraph/operators.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp>
#include <utility>
namespace
migraph
{
inline
namespace
MIGRAPH_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 MIGRAPH_INLINE_NS
}
// namespace migraph
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