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
3f0f2e22
Commit
3f0f2e22
authored
Nov 29, 2018
by
Khalique
Browse files
continue testing
parent
d9208110
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
88 additions
and
57 deletions
+88
-57
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+0
-39
src/targets/gpu/CMakeLists.txt
src/targets/gpu/CMakeLists.txt
+4
-4
src/targets/gpu/include/migraphx/gpu/device/max.hpp
src/targets/gpu/include/migraphx/gpu/device/max.hpp
+0
-6
src/targets/gpu/include/migraphx/gpu/device/min.hpp
src/targets/gpu/include/migraphx/gpu/device/min.hpp
+0
-6
src/targets/gpu/include/migraphx/gpu/max.hpp
src/targets/gpu/include/migraphx/gpu/max.hpp
+1
-1
src/targets/gpu/include/migraphx/gpu/min.hpp
src/targets/gpu/include/migraphx/gpu/min.hpp
+1
-1
src/targets/gpu/max.cpp
src/targets/gpu/max.cpp
+1
-0
src/targets/gpu/min.cpp
src/targets/gpu/min.cpp
+1
-0
test/onnx/max_test.onnx
test/onnx/max_test.onnx
+21
-0
test/onnx/min_test.onnx
test/onnx/min_test.onnx
+21
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+17
-0
test/onnx/sum_test.onnx
test/onnx/sum_test.onnx
+21
-0
No files found.
src/onnx/onnx.cpp
View file @
3f0f2e22
...
...
@@ -123,45 +123,6 @@ struct onnx_parser
}
return
prog
.
add_instruction
(
x
,
args
);
}
<<<<<<<
HEAD
=======
else
if
(
args
[
0
]
->
get_shape
()
!=
args
[
1
]
->
get_shape
())
{
// Example:
// s0 = (3,2,4,5) and s1 = (2,1,1)
//
// In this case we need to broadcast (:,1,1) portion of
// s1 plus broadcast the 1st dimension of s1
// giving output_lens = (3,2,4,5)
//
// Another example:
// s0 = (3,2,1,5) and s1 = (2,7,5)
// In this case we need to broadcast the (:,:,1:,:) axis
// of s0 plus the 1st dimension of s1 giving
// output_lens = (3,2,7,5)
//
// Get lengths for both arguments
const
std
::
vector
<
std
::
size_t
>*
s0
=
&
args
[
0
]
->
get_shape
().
lens
();
const
std
::
vector
<
std
::
size_t
>*
s1
=
&
args
[
1
]
->
get_shape
().
lens
();
// Make sure s0 is the smaller size
if
(
s0
->
size
()
>
s1
->
size
())
std
::
swap
(
s0
,
s1
);
// Copy the larger vector to output_lens
std
::
vector
<
std
::
size_t
>
output_lens
=
*
s1
;
auto
offset
=
s1
->
size
()
-
s0
->
size
();
std
::
transform
(
s0
->
begin
(),
s0
->
end
(),
s1
->
begin
()
+
offset
,
output_lens
.
begin
()
+
offset
,
[](
auto
a
,
auto
b
)
{
return
std
::
max
(
a
,
b
);
});
auto
l0
=
prog
.
add_instruction
(
op
::
multibroadcast
{
output_lens
},
args
[
0
]);
auto
l1
=
prog
.
add_instruction
(
op
::
multibroadcast
{
output_lens
},
args
[
1
]);
return
prog
.
add_instruction
(
x
,
l0
,
l1
);
}
>>>>>>>
84e7335
eb6088f9918dcf86f9fc1b58ef27c3360
else
{
return
add_broadcastable_binary_op
(
args
[
0
],
args
[
1
],
x
);
...
...
src/targets/gpu/CMakeLists.txt
View file @
3f0f2e22
...
...
@@ -12,13 +12,13 @@ endif()
add_library
(
migraphx_device
device/add.cpp
device/max.cpp
device/min.cpp
device/sin.cpp
device/add_relu.cpp
device/contiguous.cpp
device/mul.cpp
device/concat.cpp
device/max.cpp
device/min.cpp
)
set_target_properties
(
migraphx_device PROPERTIES EXPORT_NAME device
)
rocm_clang_tidy_check
(
migraphx_device
)
...
...
@@ -42,6 +42,8 @@ add_library(migraphx_gpu
leaky_relu.cpp
add.cpp
sin.cpp
max.cpp
min.cpp
mul.cpp
batchnorm.cpp
write_literals.cpp
...
...
@@ -50,8 +52,6 @@ add_library(migraphx_gpu
tanh.cpp
abs.cpp
elu.cpp
max.cpp
min.cpp
)
set_target_properties
(
migraphx_gpu PROPERTIES EXPORT_NAME gpu
)
rocm_clang_tidy_check
(
migraphx_gpu
)
...
...
src/targets/gpu/include/migraphx/gpu/device/max.hpp
View file @
3f0f2e22
...
...
@@ -13,12 +13,6 @@ namespace device {
void
max
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg1
,
const
argument
&
arg2
);
void
max
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg1
,
const
argument
&
arg2
,
const
argument
&
arg3
);
}
// namespace device
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
...
...
src/targets/gpu/include/migraphx/gpu/device/min.hpp
View file @
3f0f2e22
...
...
@@ -13,12 +13,6 @@ namespace device {
void
min
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg1
,
const
argument
&
arg2
);
void
min
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg1
,
const
argument
&
arg2
,
const
argument
&
arg3
);
}
// namespace device
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
...
...
src/targets/gpu/include/migraphx/gpu/max.hpp
View file @
3f0f2e22
...
...
@@ -7,7 +7,6 @@
#include <migraphx/operators.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <migraphx/gpu/hip.hpp>
#include <migraphx/dfor.hpp>
...
...
@@ -16,6 +15,7 @@
#include <migraphx/iterator_for.hpp>
#include <migraphx/gpu/rocblas.hpp>
#include <migraphx/gpu/context.hpp>
#include <migraphx/config.hpp>
#include <utility>
namespace
migraphx
{
...
...
src/targets/gpu/include/migraphx/gpu/min.hpp
View file @
3f0f2e22
...
...
@@ -7,7 +7,6 @@
#include <migraphx/operators.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <migraphx/gpu/hip.hpp>
#include <migraphx/dfor.hpp>
...
...
@@ -16,6 +15,7 @@
#include <migraphx/iterator_for.hpp>
#include <migraphx/gpu/rocblas.hpp>
#include <migraphx/gpu/context.hpp>
#include <migraphx/config.hpp>
#include <utility>
namespace
migraphx
{
...
...
src/targets/gpu/max.cpp
View file @
3f0f2e22
#include <migraphx/gpu/max.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <utility>
...
...
src/targets/gpu/min.cpp
View file @
3f0f2e22
#include <migraphx/gpu/min.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/manage_ptr.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/miopen.hpp>
#include <utility>
...
...
test/onnx/max_test.onnx
0 → 100644
View file @
3f0f2e22
max-example:e
0
1
23"Maxtest-dropoutZ
0
Z
1
Z
2
b
2
B
\ No newline at end of file
test/onnx/min_test.onnx
0 → 100644
View file @
3f0f2e22
min-example:e
0
1
23"Mintest-dropoutZ
0
Z
1
Z
2
b
2
B
\ No newline at end of file
test/onnx/onnx_test.cpp
View file @
3f0f2e22
...
...
@@ -169,6 +169,22 @@ void dropout_test()
EXPECT
(
p
==
prog
);
}
void
sum_test
()
{
migraphx
::
program
p
;
auto
input0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
}});
auto
input1
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
}});
auto
input2
=
p
.
add_parameter
(
"2"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
}});
}
auto
l0
=
p
.
add_instruction
(
migraphx
::
op
::
add
{},
input0
,
input1
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l0
,
input2
);
auto
prog
=
migraph
::
parse_onnx
(
"sum_test.onnx"
);
EXPECT
(
p
==
prog
);
}
int
main
()
{
pytorch_conv_bias_test
();
...
...
@@ -181,4 +197,5 @@ int main()
globalmaxpool_test
();
transpose_test
();
dropout_test
();
sum_test
();
}
test/onnx/sum_test.onnx
0 → 100644
View file @
3f0f2e22
sum-example:e
0
1
23"Sumtest-dropoutZ
0
Z
1
Z
2
b
2
B
\ No newline at end of file
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