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
7a7040aa
Unverified
Commit
7a7040aa
authored
Mar 18, 2023
by
Umang Yadav
Committed by
GitHub
Mar 18, 2023
Browse files
Dynamically plug-in backend target libs (#1608)
Fixes #1595
parent
9ef6801e
Changes
50
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
95 additions
and
94 deletions
+95
-94
test/ref_rnn_ops_test.cpp
test/ref_rnn_ops_test.cpp
+75
-75
test/rewrite_gelu_test.cpp
test/rewrite_gelu_test.cpp
+1
-1
test/rewrite_pooling_test.cpp
test/rewrite_pooling_test.cpp
+3
-3
test/rewrite_quantization_test.cpp
test/rewrite_quantization_test.cpp
+1
-1
test/run_loop_test.cpp
test/run_loop_test.cpp
+2
-2
test/serialize_program.cpp
test/serialize_program.cpp
+2
-2
test/simplify_qdq_test.cpp
test/simplify_qdq_test.cpp
+5
-5
test/targets.cpp
test/targets.cpp
+4
-2
test/verify/run_verify.cpp
test/verify/run_verify.cpp
+2
-2
tools/api/api.cpp
tools/api/api.cpp
+0
-1
No files found.
test/ref_rnn_ops_test.cpp
View file @
7a7040aa
This diff is collapsed.
Click to expand it.
test/rewrite_gelu_test.cpp
View file @
7a7040aa
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
#include <migraphx/rewrite_gelu.hpp>
#include <migraphx/rewrite_gelu.hpp>
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/op/convolution.hpp>
#include <migraphx/op/convolution.hpp>
#include <migraphx/op/reshape.hpp>
#include <migraphx/op/reshape.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
...
...
test/rewrite_pooling_test.cpp
View file @
7a7040aa
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#include <migraphx/op/pooling.hpp>
#include <migraphx/op/pooling.hpp>
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/ranges.hpp>
...
@@ -194,8 +194,8 @@ TEST_CASE(literal_rewrite_pooling_test)
...
@@ -194,8 +194,8 @@ TEST_CASE(literal_rewrite_pooling_test)
const
migraphx
::
operation
&
op
)
{
const
migraphx
::
operation
&
op
)
{
migraphx
::
program
p1
=
pooling_program
(
mode
);
migraphx
::
program
p1
=
pooling_program
(
mode
);
migraphx
::
program
p2
=
opt_program
(
op
);
migraphx
::
program
p2
=
opt_program
(
op
);
p1
.
compile
(
migraphx
::
ref
::
target
{}
);
p1
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
p2
.
compile
(
migraphx
::
ref
::
target
{}
);
p2
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result1
=
p1
.
eval
({}).
back
();
auto
result1
=
p1
.
eval
({}).
back
();
auto
result2
=
p2
.
eval
({}).
back
();
auto
result2
=
p2
.
eval
({}).
back
();
visit_all
(
result1
,
visit_all
(
result1
,
...
...
test/rewrite_quantization_test.cpp
View file @
7a7040aa
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
*/
*/
#include <migraphx/rewrite_quantization.hpp>
#include <migraphx/rewrite_quantization.hpp>
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/op/convolution.hpp>
#include <migraphx/op/convolution.hpp>
#include <migraphx/op/reshape.hpp>
#include <migraphx/op/reshape.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
...
...
test/run_loop_test.cpp
View file @
7a7040aa
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include <migraphx/literal.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/quantization.hpp>
#include <migraphx/quantization.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/shape.hpp>
#include <migraphx/shape.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
...
@@ -207,7 +207,7 @@ static auto run_prog(migraphx::program p, int64_t iter_num, bool cond, int64_t i
...
@@ -207,7 +207,7 @@ static auto run_prog(migraphx::program p, int64_t iter_num, bool cond, int64_t i
migraphx
::
shape
s
{
migraphx
::
shape
::
int64_type
,
{
1
}};
migraphx
::
shape
s
{
migraphx
::
shape
::
int64_type
,
{
1
}};
migraphx
::
shape
sc
{
migraphx
::
shape
::
bool_type
};
migraphx
::
shape
sc
{
migraphx
::
shape
::
bool_type
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
parameter_map
pp
;
migraphx
::
parameter_map
pp
;
pp
[
"iter_num"
]
=
migraphx
::
argument
(
si
,
&
iter_num
);
pp
[
"iter_num"
]
=
migraphx
::
argument
(
si
,
&
iter_num
);
pp
[
"ccond"
]
=
migraphx
::
argument
(
sc
,
&
cond
);
pp
[
"ccond"
]
=
migraphx
::
argument
(
sc
,
&
cond
);
...
...
test/serialize_program.cpp
View file @
7a7040aa
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
* THE SOFTWARE.
* THE SOFTWARE.
*/
*/
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/load_save.hpp>
#include <migraphx/load_save.hpp>
#include "test.hpp"
#include "test.hpp"
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
...
@@ -82,7 +82,7 @@ TEST_CASE(as_file)
...
@@ -82,7 +82,7 @@ TEST_CASE(as_file)
TEST_CASE
(
compiled
)
TEST_CASE
(
compiled
)
{
{
migraphx
::
program
p1
=
create_program
();
migraphx
::
program
p1
=
create_program
();
p1
.
compile
(
migraphx
::
ref
::
target
{}
);
p1
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
std
::
vector
<
char
>
buffer
=
migraphx
::
save_buffer
(
p1
);
std
::
vector
<
char
>
buffer
=
migraphx
::
save_buffer
(
p1
);
migraphx
::
program
p2
=
migraphx
::
load_buffer
(
buffer
);
migraphx
::
program
p2
=
migraphx
::
load_buffer
(
buffer
);
EXPECT
(
p1
.
sort
()
==
p2
.
sort
());
EXPECT
(
p1
.
sort
()
==
p2
.
sort
());
...
...
test/simplify_qdq_test.cpp
View file @
7a7040aa
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
*/
*/
#include <migraphx/simplify_qdq.hpp>
#include <migraphx/simplify_qdq.hpp>
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
#include <test.hpp>
#include <test.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
...
@@ -686,8 +686,8 @@ TEST_CASE(conv_correctness)
...
@@ -686,8 +686,8 @@ TEST_CASE(conv_correctness)
auto
input
=
migraphx
::
argument
(
si
,
iv
.
data
());
auto
input
=
migraphx
::
argument
(
si
,
iv
.
data
());
std
::
vector
<
float
>
wv
(
sw
.
elements
(),
10
);
std
::
vector
<
float
>
wv
(
sw
.
elements
(),
10
);
auto
weights
=
migraphx
::
argument
(
sw
,
wv
.
data
());
auto
weights
=
migraphx
::
argument
(
sw
,
wv
.
data
());
p1
.
compile
(
migraphx
::
target
(
migraphx
::
ref
::
target
{}
));
p1
.
compile
(
migraphx
::
target
(
migraphx
::
make_
target
(
"ref"
)
));
p2
.
compile
(
migraphx
::
target
(
migraphx
::
ref
::
target
{}
));
p2
.
compile
(
migraphx
::
target
(
migraphx
::
make_
target
(
"ref"
)
));
auto
result1
=
p1
.
eval
({{
"input"
,
input
},
{
"weights"
,
weights
}}).
back
();
auto
result1
=
p1
.
eval
({{
"input"
,
input
},
{
"weights"
,
weights
}}).
back
();
std
::
vector
<
float
>
rv1
(
16
);
std
::
vector
<
float
>
rv1
(
16
);
...
@@ -736,8 +736,8 @@ TEST_CASE(dot_correctness)
...
@@ -736,8 +736,8 @@ TEST_CASE(dot_correctness)
auto
a
=
migraphx
::
argument
(
sh1
,
av
.
data
());
auto
a
=
migraphx
::
argument
(
sh1
,
av
.
data
());
std
::
vector
<
float
>
bv
(
sh2
.
elements
(),
10
);
std
::
vector
<
float
>
bv
(
sh2
.
elements
(),
10
);
auto
b
=
migraphx
::
argument
(
sh2
,
bv
.
data
());
auto
b
=
migraphx
::
argument
(
sh2
,
bv
.
data
());
p1
.
compile
(
migraphx
::
target
(
migraphx
::
ref
::
target
{}
));
p1
.
compile
(
migraphx
::
target
(
migraphx
::
make_
target
(
"ref"
)
));
p2
.
compile
(
migraphx
::
target
(
migraphx
::
ref
::
target
{}
));
p2
.
compile
(
migraphx
::
target
(
migraphx
::
make_
target
(
"ref"
)
));
auto
result1
=
p1
.
eval
({{
"a"
,
a
},
{
"b"
,
b
}}).
back
();
auto
result1
=
p1
.
eval
({{
"a"
,
a
},
{
"b"
,
b
}}).
back
();
std
::
vector
<
float
>
rv1
(
sh3
.
elements
());
std
::
vector
<
float
>
rv1
(
sh3
.
elements
());
...
...
test/targets.cpp
View file @
7a7040aa
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
* THE SOFTWARE.
* THE SOFTWARE.
*/
*/
#include <migraphx/register_target.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/ref/target.hpp>
#include <migraphx/target.hpp>
#include <migraphx/target.hpp>
#include "test.hpp"
#include "test.hpp"
...
@@ -43,7 +42,10 @@ TEST_CASE(make_invalid_target)
...
@@ -43,7 +42,10 @@ TEST_CASE(make_invalid_target)
TEST_CASE
(
targets
)
TEST_CASE
(
targets
)
{
{
auto
ts
=
migraphx
::
get_targets
();
auto
ts
=
migraphx
::
get_targets
();
EXPECT
(
ts
.
size
()
>
0
);
EXPECT
(
ts
.
size
()
==
0
);
auto
ref_t
=
migraphx
::
make_target
(
"ref"
);
ts
=
migraphx
::
get_targets
();
EXPECT
(
ts
.
size
()
==
1
);
}
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
test/verify/run_verify.cpp
View file @
7a7040aa
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include "verify_program.hpp"
#include "verify_program.hpp"
#include "test.hpp"
#include "test.hpp"
#include <migraphx/env.hpp>
#include <migraphx/env.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/load_save.hpp>
#include <migraphx/load_save.hpp>
...
@@ -117,7 +117,7 @@ void run_verify::validate(const migraphx::target& t,
...
@@ -117,7 +117,7 @@ void run_verify::validate(const migraphx::target& t,
std
::
vector
<
migraphx
::
argument
>
run_verify
::
run_ref
(
migraphx
::
program
p
,
std
::
vector
<
migraphx
::
argument
>
run_verify
::
run_ref
(
migraphx
::
program
p
,
migraphx
::
parameter_map
inputs
)
const
migraphx
::
parameter_map
inputs
)
const
{
{
migraphx
::
ref
::
target
t
{}
;
migraphx
::
target
t
=
migraphx
::
make_target
(
"ref"
)
;
auto_print
pp
{
p
,
t
.
name
()};
auto_print
pp
{
p
,
t
.
name
()};
compile_check
(
p
,
t
);
compile_check
(
p
,
t
);
return
p
.
eval
(
std
::
move
(
inputs
));
return
p
.
eval
(
std
::
move
(
inputs
));
...
...
tools/api/api.cpp
View file @
7a7040aa
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
#include <migraphx/register_target.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/quantization.hpp>
#include <migraphx/quantization.hpp>
#include <migraphx/ref/target.hpp>
#include <migraphx/load_save.hpp>
#include <migraphx/load_save.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/register_op.hpp>
#include <migraphx/register_op.hpp>
...
...
Prev
1
2
3
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