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
ca2cb168
Commit
ca2cb168
authored
Apr 29, 2019
by
Shucai Xiao
Browse files
temp changes.
parents
a443007e
d4d2335a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
src/include/migraphx/op/binary.hpp
src/include/migraphx/op/binary.hpp
+23
-0
test/eliminate_contiguous_test.cpp
test/eliminate_contiguous_test.cpp
+2
-2
No files found.
src/include/migraphx/op/binary.hpp
View file @
ca2cb168
...
@@ -30,6 +30,29 @@ struct binary
...
@@ -30,6 +30,29 @@ struct binary
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
).
lens
()};
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
).
lens
()};
}
}
}
}
argument
compute
(
const
shape
&
output_shape
,
std
::
vector
<
argument
>
args
)
const
{
argument
result
{
output_shape
};
visit_all
(
result
,
args
[
0
],
args
[
1
])([
&
](
auto
output
,
auto
input1
,
auto
input2
)
{
if
(
input1
.
get_shape
().
standard
()
and
input2
.
get_shape
().
standard
())
{
std
::
transform
(
input1
.
begin
(),
input1
.
end
(),
input2
.
begin
(),
output
.
begin
(),
static_cast
<
const
Derived
&>
(
*
this
).
apply
());
}
else
{
shape_for_each
(
output
.
get_shape
(),
[
&
](
const
auto
&
idx
)
{
output
(
idx
.
begin
(),
idx
.
end
())
=
static_cast
<
const
Derived
&>
(
*
this
).
apply
()(
input1
(
idx
.
begin
(),
idx
.
end
()),
input2
(
idx
.
begin
(),
idx
.
end
()));
});
}
});
return
result
;
}
};
};
}
// namespace op
}
// namespace op
...
...
test/eliminate_contiguous_test.cpp
View file @
ca2cb168
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/op/identity.hpp>
#include <migraphx/op/identity.hpp>
#include <migraphx/op/dot.hpp>
#include <migraphx/op/dot.hpp>
#include <migraphx/op/
add
.hpp>
#include <migraphx/op/
sin
.hpp>
#include <migraphx/op/transpose.hpp>
#include <migraphx/op/transpose.hpp>
#include <migraphx/op/contiguous.hpp>
#include <migraphx/op/contiguous.hpp>
#include <basic_ops.hpp>
#include <basic_ops.hpp>
...
@@ -61,7 +61,7 @@ TEST_CASE(transpose_standard_op)
...
@@ -61,7 +61,7 @@ TEST_CASE(transpose_standard_op)
auto
l
=
p
.
add_literal
(
get_2x2
());
auto
l
=
p
.
add_literal
(
get_2x2
());
auto
t
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
1
,
0
}},
l
);
auto
t
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
1
,
0
}},
l
);
auto
c
=
p
.
add_instruction
(
migraphx
::
op
::
contiguous
{},
t
);
auto
c
=
p
.
add_instruction
(
migraphx
::
op
::
contiguous
{},
t
);
auto
sum
=
p
.
add_instruction
(
migraphx
::
op
::
add
{},
c
,
c
);
auto
sum
=
p
.
add_instruction
(
migraphx
::
op
::
sin
{}
,
c
);
p
.
add_instruction
(
pass_standard_op
{},
sum
);
p
.
add_instruction
(
pass_standard_op
{},
sum
);
auto
count
=
std
::
distance
(
p
.
begin
(),
p
.
end
());
auto
count
=
std
::
distance
(
p
.
begin
(),
p
.
end
());
p
.
compile
(
eliminate_contiguous_target
{});
p
.
compile
(
eliminate_contiguous_target
{});
...
...
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