Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
30a94e97
Commit
30a94e97
authored
Aug 24, 2018
by
Paul
Browse files
Remove unuse headers
parent
05f60267
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
117 deletions
+0
-117
src/targets/gpu/device/include/migraph/gpu/device/binary.hpp
src/targets/gpu/device/include/migraph/gpu/device/binary.hpp
+0
-61
src/targets/gpu/device/include/migraph/gpu/device/unary.hpp
src/targets/gpu/device/include/migraph/gpu/device/unary.hpp
+0
-56
No files found.
src/targets/gpu/device/include/migraph/gpu/device/binary.hpp
deleted
100644 → 0
View file @
05f60267
#ifndef MIGRAPH_GUARD_RTGLIB_DEVICE_BINARY_HPP
#define MIGRAPH_GUARD_RTGLIB_DEVICE_BINARY_HPP
#include <migraph/gpu/device/tensor.hpp>
#include <migraph/gpu/device/launch.hpp>
namespace
migraph
{
namespace
gpu
{
namespace
device
{
template
<
class
F
>
void
binary
(
argument
x
,
argument
y
,
argument
result
,
F
f
)
{
if
(
x
.
get_shape
().
standard
())
binary_standard
(
x
,
y
,
result
,
f
);
else
binary_nonstandard
(
x
,
y
,
result
,
f
);
}
template
<
class
F
>
void
binary_nonstandard
(
argument
x
,
argument
y
,
argument
result
,
F
f
)
{
auto
output_shape
=
result
.
get_shape
();
auto
input_shape
=
x
.
get_shape
();
visit_all
(
result
,
x
,
y
)([
&
](
auto
output
,
auto
input1
,
auto
input2
)
{
visit_tensor_size
(
output_shape
.
lens
().
size
(),
[
&
](
auto
ndim
)
{
hip_tensor_descriptor
<
ndim
>
x_desc
(
x
.
get_shape
().
lens
(),
x
.
get_shape
().
strides
());
hip_tensor_descriptor
<
ndim
>
y_desc
(
y
.
get_shape
().
lens
(),
y
.
get_shape
().
strides
());
hip_tensor_descriptor
<
ndim
>
out_desc
(
output_shape
.
lens
(),
output_shape
.
strides
());
auto
*
xp
=
input1
.
data
();
auto
*
yp
=
input2
.
data
();
auto
*
outp
=
output
.
data
();
gs_launch
(
input_shape
.
elements
())([
=
](
auto
i
)
{
auto
outidx
=
out_desc
.
multi
(
i
);
size_t
xidx
=
x_desc
.
linear
(
outidx
);
size_t
yidx
=
y_desc
.
linear
(
outidx
);
outp
[
i
]
=
f
(
xp
[
xidx
],
yp
[
yidx
]);
});
});
});
}
template
<
class
F
>
void
binary_standard
(
argument
x
,
argument
y
,
argument
result
,
F
f
)
{
assert
(
x
.
get_shape
().
elements
()
==
y
.
get_shape
().
elements
());
auto
output_shape
=
result
.
get_shape
();
auto
input_shape
=
x
.
get_shape
();
visit_all
(
result
,
x
,
y
)([
&
](
auto
output
,
auto
input1
,
auto
input2
)
{
auto
*
xp
=
input1
.
data
();
auto
*
yp
=
input2
.
data
();
auto
*
outp
=
output
.
data
();
gs_launch
(
input_shape
.
elements
())([
=
](
auto
i
)
{
outp
[
i
]
=
f
(
xp
[
i
],
yp
[
i
]);
});
});
}
}
// namespace device
}
// namespace gpu
}
// namespace migraph
#endif
src/targets/gpu/device/include/migraph/gpu/device/unary.hpp
deleted
100644 → 0
View file @
05f60267
#ifndef MIGRAPH_GUARD_RTGLIB_DEVICE_UNARY_HPP
#define MIGRAPH_GUARD_RTGLIB_DEVICE_UNARY_HPP
#include <migraph/gpu/device/tensor.hpp>
#include <migraph/gpu/device/launch.hpp>
namespace
migraph
{
namespace
gpu
{
namespace
device
{
template
<
class
F
>
void
unary
(
argument
x
,
argument
result
,
F
f
)
{
if
(
x
.
get_shape
().
standard
())
unary_standard
(
x
,
result
,
f
);
else
unary_nonstandard
(
x
,
result
,
f
);
}
template
<
class
F
>
void
unary_nonstandard
(
argument
x
,
argument
result
,
F
f
)
{
auto
output_shape
=
result
.
get_shape
();
auto
input_shape
=
x
.
get_shape
();
visit_all
(
result
,
x
)([
&
](
auto
output
,
auto
input
)
{
visit_tensor_size
(
output_shape
.
lens
().
size
(),
[
&
](
auto
ndim
)
{
hip_tensor_descriptor
<
ndim
>
x_desc
(
input_shape
.
lens
(),
input_shape
.
strides
());
hip_tensor_descriptor
<
ndim
>
out_desc
(
output_shape
.
lens
(),
output_shape
.
strides
());
auto
*
xp
=
input
.
data
();
auto
*
outp
=
output
.
data
();
gs_launch
(
input_shape
.
elements
())([
=
](
auto
i
)
{
size_t
xidx
=
x_desc
.
linear
(
out_desc
.
multi
(
i
));
outp
[
i
]
=
f
(
xp
[
xidx
]);
});
});
});
}
template
<
class
F
>
void
unary_standard
(
argument
x
,
argument
result
,
F
f
)
{
auto
output_shape
=
result
.
get_shape
();
auto
input_shape
=
x
.
get_shape
();
visit_all
(
result
,
x
)([
&
](
auto
output
,
auto
input
)
{
auto
*
xp
=
input
.
data
();
auto
*
outp
=
output
.
data
();
gs_launch
(
input_shape
.
elements
())([
=
](
auto
i
)
{
outp
[
i
]
=
f
(
xp
[
i
]);
});
});
}
}
// namespace device
}
// namespace gpu
}
// namespace migraph
#endif
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