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
d24755de
Commit
d24755de
authored
Nov 14, 2018
by
Paul
Browse files
Formatting
parent
96358e41
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
99 additions
and
80 deletions
+99
-80
src/include/migraphx/matcher.hpp
src/include/migraphx/matcher.hpp
+11
-11
src/include/migraphx/requires.hpp
src/include/migraphx/requires.hpp
+3
-3
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+1
-1
src/onnx/verify_onnx.cpp
src/onnx/verify_onnx.cpp
+4
-3
test/cpu_ops_test.cpp
test/cpu_ops_test.cpp
+14
-14
test/eliminate_allocation_test.cpp
test/eliminate_allocation_test.cpp
+4
-3
test/eliminate_concat_test.cpp
test/eliminate_concat_test.cpp
+18
-16
test/fwd_conv_batchnorm_rewrite_test.cpp
test/fwd_conv_batchnorm_rewrite_test.cpp
+4
-3
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+19
-11
test/include/basic_ops.hpp
test/include/basic_ops.hpp
+3
-2
test/memory_coloring_test.cpp
test/memory_coloring_test.cpp
+2
-2
test/op_shape_test.cpp
test/op_shape_test.cpp
+9
-6
test/operation.cpp
test/operation.cpp
+7
-5
No files found.
src/include/migraphx/matcher.hpp
View file @
d24755de
src/include/migraphx/requires.hpp
View file @
d24755de
src/onnx/onnx.cpp
View file @
d24755de
src/onnx/verify_onnx.cpp
View file @
d24755de
...
...
@@ -38,7 +38,8 @@ migraphx::argument run_gpu(F f)
migraphx
::
program
::
parameter_map
m
;
for
(
auto
&&
x
:
p
.
get_parameter_shapes
())
{
m
[
x
.
first
]
=
migraphx
::
gpu
::
to_gpu
(
migraphx
::
generate_argument
(
x
.
second
,
get_hash
(
x
.
first
)));
m
[
x
.
first
]
=
migraphx
::
gpu
::
to_gpu
(
migraphx
::
generate_argument
(
x
.
second
,
get_hash
(
x
.
first
)));
}
auto
out
=
migraphx
::
gpu
::
from_gpu
(
p
.
eval
(
m
));
std
::
cout
<<
p
<<
std
::
endl
;
...
...
test/cpu_ops_test.cpp
View file @
d24755de
test/eliminate_allocation_test.cpp
View file @
d24755de
...
...
@@ -10,7 +10,8 @@ struct eliminate_allocation_target
std
::
string
name
()
const
{
return
"eliminate_allocation"
;
}
std
::
vector
<
migraphx
::
pass
>
get_passes
(
migraphx
::
context
&
)
const
{
return
{
migraphx
::
eliminate_allocation
{
"allocate"
,
align
},
migraphx
::
dead_code_elimination
{}};
return
{
migraphx
::
eliminate_allocation
{
"allocate"
,
align
},
migraphx
::
dead_code_elimination
{}};
}
migraphx
::
context
get_context
()
const
{
return
{};
}
};
...
...
test/eliminate_concat_test.cpp
View file @
d24755de
...
...
@@ -93,20 +93,22 @@ TEST_CASE(basic)
p
.
add_instruction
(
allocate
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
5
,
8
,
8
}}});
auto
p3
=
p
.
add_instruction
(
fred_op
{},
a3
);
std
::
size_t
axis
=
1
;
auto
a4
=
p
.
add_instruction
(
allocate
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
10
,
8
,
8
}}});
auto
a4
=
p
.
add_instruction
(
allocate
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
10
,
8
,
8
}}});
p
.
add_instruction
(
concat
(
axis
),
p1
,
p2
,
p3
,
a4
);
return
p
;
};
auto
create_control_program
=
[]()
{
migraphx
::
program
p
;
auto
a1
=
p
.
add_instruction
(
allocate
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
10
,
8
,
8
}}});
auto
a1
=
p
.
add_instruction
(
allocate
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
10
,
8
,
8
}}});
auto
l1
=
p
.
add_instruction
(
migraphx
::
op
::
load
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
8
,
8
}},
0
},
{
a1
});
migraphx
::
op
::
load
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
8
,
8
}},
0
},
{
a1
});
auto
p1
=
p
.
add_instruction
(
fred_op
{},
l1
);
auto
l2
=
p
.
add_instruction
(
migraphx
::
op
::
load
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
8
,
8
}},
512
},
{
a1
});
migraphx
::
op
::
load
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
8
,
8
}},
512
},
{
a1
});
auto
p2
=
p
.
add_instruction
(
fred_op
{},
l2
);
auto
l3
=
p
.
add_instruction
(
migraphx
::
op
::
load
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
5
,
8
,
8
}},
1280
},
...
...
@@ -137,8 +139,8 @@ TEST_CASE(wont_work)
p
.
add_instruction
(
allocate
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
5
,
8
,
8
}}});
auto
p3
=
p
.
add_instruction
(
fred_op
{},
a3
);
std
::
size_t
axis
=
1
;
auto
a4
=
p
.
add_instruction
(
allocate
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
10
,
8
,
8
}}});
auto
a4
=
p
.
add_instruction
(
allocate
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
10
,
8
,
8
}}});
p
.
add_instruction
(
concat
(
axis
),
p1
,
p2
,
p3
,
a4
);
return
p
;
};
...
...
@@ -154,8 +156,8 @@ TEST_CASE(wont_work)
p
.
add_instruction
(
allocate
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
5
,
8
,
8
}}});
auto
p3
=
p
.
add_instruction
(
fred_op
{},
a3
);
std
::
size_t
axis
=
1
;
auto
a4
=
p
.
add_instruction
(
allocate
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
10
,
8
,
8
}}});
auto
a4
=
p
.
add_instruction
(
allocate
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
10
,
8
,
8
}}});
p
.
add_instruction
(
concat
(
axis
),
p1
,
p2
,
p3
,
a4
);
return
p
;
};
...
...
test/fwd_conv_batchnorm_rewrite_test.cpp
View file @
d24755de
...
...
@@ -38,7 +38,8 @@ TEST_CASE(fwd_conv_batchnorm_rewrite_test)
migraphx
::
program
p
;
auto
x
=
p
.
add_literal
(
xs
,
xdata
);
auto
w
=
p
.
add_literal
(
ws
,
wdata
);
auto
conv
=
p
.
add_instruction
(
migraphx
::
op
::
convolution
{{{
0
,
0
}},
{{
1
,
1
}},
{{
1
,
1
}}},
x
,
w
);
auto
conv
=
p
.
add_instruction
(
migraphx
::
op
::
convolution
{{{
0
,
0
}},
{{
1
,
1
}},
{{
1
,
1
}}},
x
,
w
);
auto
scale
=
p
.
add_literal
(
migraphx
::
literal
{
vars
,
{
3.0
f
}});
auto
bias
=
p
.
add_literal
(
migraphx
::
literal
{
vars
,
{
8.1
f
}});
auto
mean
=
p
.
add_literal
(
migraphx
::
literal
{
vars
,
{
4.0
f
}});
...
...
test/gpu/miopen.cpp
View file @
d24755de
...
...
@@ -119,7 +119,8 @@ migraphx::argument run_gpu(migraphx::program& p)
migraphx
::
program
::
parameter_map
m
;
for
(
auto
&&
x
:
p
.
get_parameter_shapes
())
{
m
[
x
.
first
]
=
migraphx
::
gpu
::
to_gpu
(
migraphx
::
generate_argument
(
x
.
second
,
get_hash
(
x
.
first
)));
m
[
x
.
first
]
=
migraphx
::
gpu
::
to_gpu
(
migraphx
::
generate_argument
(
x
.
second
,
get_hash
(
x
.
first
)));
}
EXPECT
(
bool
{
m
.
find
(
"output"
)
!=
m
.
end
()});
return
migraphx
::
gpu
::
from_gpu
(
p
.
eval
(
m
));
...
...
@@ -365,7 +366,8 @@ struct test_softmax2
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
x
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1000
,
1
,
1
}});
auto
x
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1000
,
1
,
1
}});
p
.
add_instruction
(
migraphx
::
op
::
softmax
{},
x
);
return
p
;
}
...
...
@@ -376,7 +378,8 @@ struct test_conv
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
input
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
,
3
,
3
}});
auto
input
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
,
3
,
3
}});
auto
weights
=
p
.
add_parameter
(
"w"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
,
3
,
3
}});
p
.
add_instruction
(
migraphx
::
op
::
convolution
{},
input
,
weights
);
...
...
@@ -403,7 +406,8 @@ struct test_conv_relu
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
input
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
,
3
,
3
}});
auto
input
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
,
3
,
3
}});
auto
weights
=
p
.
add_parameter
(
"w"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
,
3
,
3
}});
auto
conv
=
p
.
add_instruction
(
migraphx
::
op
::
convolution
{},
input
,
weights
);
...
...
@@ -417,7 +421,8 @@ struct test_conv_relu_half
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
input
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
4
,
3
,
3
,
3
}});
auto
input
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
4
,
3
,
3
,
3
}});
auto
weights
=
p
.
add_parameter
(
"w"
,
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
4
,
3
,
3
,
3
}});
auto
conv
=
p
.
add_instruction
(
migraphx
::
op
::
convolution
{},
input
,
weights
);
...
...
@@ -525,8 +530,10 @@ struct test_gemm_ld
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
a
=
p
.
add_parameter
(
"a"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
5
},
{
10
,
1
}});
auto
b
=
p
.
add_parameter
(
"b"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
5
,
3
},
{
20
,
1
}});
auto
a
=
p
.
add_parameter
(
"a"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
5
},
{
10
,
1
}});
auto
b
=
p
.
add_parameter
(
"b"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
5
,
3
},
{
20
,
1
}});
p
.
add_instruction
(
migraphx
::
op
::
dot
{},
a
,
b
);
return
p
;
}
...
...
@@ -800,7 +807,8 @@ struct test_conv_bn_relu_pooling2
auto
scale
=
p
.
add_literal
(
migraphx
::
abs
(
migraphx
::
generate_literal
(
vars
,
1
+
channels
)));
auto
bias
=
p
.
add_literal
(
migraphx
::
abs
(
migraphx
::
generate_literal
(
vars
,
2
+
channels
)));
auto
mean
=
p
.
add_literal
(
migraphx
::
abs
(
migraphx
::
generate_literal
(
vars
,
3
+
channels
)));
auto
variance
=
p
.
add_literal
(
migraphx
::
abs
(
migraphx
::
generate_literal
(
vars
,
4
+
channels
)));
auto
variance
=
p
.
add_literal
(
migraphx
::
abs
(
migraphx
::
generate_literal
(
vars
,
4
+
channels
)));
return
p
.
add_instruction
(
migraphx
::
op
::
batch_norm_inference
{},
x
,
scale
,
bias
,
mean
,
variance
);
}
...
...
test/include/basic_ops.hpp
View file @
d24755de
...
...
@@ -110,8 +110,9 @@ struct pass_standard_op
struct
nop
{
std
::
string
name
()
const
{
return
"nop"
;
}
migraphx
::
argument
compute
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
const
std
::
vector
<
migraphx
::
argument
>&
)
const
migraphx
::
argument
compute
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
const
std
::
vector
<
migraphx
::
argument
>&
)
const
{
return
{};
}
...
...
test/memory_coloring_test.cpp
View file @
d24755de
test/op_shape_test.cpp
View file @
d24755de
...
...
@@ -120,12 +120,15 @@ TEST_CASE(flatten_shape)
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
*
4
*
6
*
8
}},
migraphx
::
op
::
flatten
{
0
},
input
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
4
*
6
*
8
}},
migraphx
::
op
::
flatten
{
1
},
input
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
*
4
,
6
*
8
}},
migraphx
::
op
::
flatten
{
2
},
input
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
*
4
*
6
,
8
}},
migraphx
::
op
::
flatten
{
3
},
input
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
4
*
6
*
8
}},
migraphx
::
op
::
flatten
{
1
},
input
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
*
4
,
6
*
8
}},
migraphx
::
op
::
flatten
{
2
},
input
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
*
4
*
6
,
8
}},
migraphx
::
op
::
flatten
{
3
},
input
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
*
4
*
6
*
8
,
1
}},
migraphx
::
op
::
flatten
{
4
},
input
);
...
...
test/operation.cpp
View file @
d24755de
...
...
@@ -17,8 +17,9 @@ struct simple_operation
{
MIGRAPH_THROW
(
"not computable"
);
}
migraphx
::
argument
compute
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
const
std
::
vector
<
migraphx
::
argument
>&
)
const
migraphx
::
argument
compute
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
const
std
::
vector
<
migraphx
::
argument
>&
)
const
{
MIGRAPH_THROW
(
"not computable"
);
}
...
...
@@ -36,8 +37,9 @@ struct simple_operation_no_print
{
MIGRAPH_THROW
(
"not computable"
);
}
migraphx
::
argument
compute
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
const
std
::
vector
<
migraphx
::
argument
>&
)
const
migraphx
::
argument
compute
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
const
std
::
vector
<
migraphx
::
argument
>&
)
const
{
MIGRAPH_THROW
(
"not computable"
);
}
...
...
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