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
3272b22e
Commit
3272b22e
authored
Feb 12, 2022
by
Shucai Xiao
Browse files
clang format
parent
94e3a2e4
Changes
74
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
53 additions
and
71 deletions
+53
-71
src/api/api.cpp
src/api/api.cpp
+4
-5
src/api/include/migraphx/migraphx.hpp
src/api/include/migraphx/migraphx.hpp
+2
-5
src/argument.cpp
src/argument.cpp
+2
-2
src/cpp_generator.cpp
src/cpp_generator.cpp
+1
-1
src/dead_code_elimination.cpp
src/dead_code_elimination.cpp
+1
-1
src/driver/main.cpp
src/driver/main.cpp
+1
-1
src/include/migraphx/gemm.hpp
src/include/migraphx/gemm.hpp
+1
-1
src/include/migraphx/load_save.hpp
src/include/migraphx/load_save.hpp
+1
-2
src/include/migraphx/op/gather.hpp
src/include/migraphx/op/gather.hpp
+1
-1
src/include/migraphx/op/loop.hpp
src/include/migraphx/op/loop.hpp
+3
-3
src/include/migraphx/op/nonmaxsuppression.hpp
src/include/migraphx/op/nonmaxsuppression.hpp
+3
-3
src/include/migraphx/op/pooling.hpp
src/include/migraphx/op/pooling.hpp
+1
-1
src/include/migraphx/par_dfor.hpp
src/include/migraphx/par_dfor.hpp
+6
-9
src/include/migraphx/program.hpp
src/include/migraphx/program.hpp
+1
-2
src/include/migraphx/tf.hpp
src/include/migraphx/tf.hpp
+2
-2
src/onnx/parse_gru.cpp
src/onnx/parse_gru.cpp
+2
-3
src/onnx/parse_lstm.cpp
src/onnx/parse_lstm.cpp
+2
-3
src/onnx/parse_resize.cpp
src/onnx/parse_resize.cpp
+11
-17
src/onnx/parse_rnn.cpp
src/onnx/parse_rnn.cpp
+2
-3
src/opt/memory_coloring_impl.cpp
src/opt/memory_coloring_impl.cpp
+6
-6
No files found.
src/api/api.cpp
View file @
3272b22e
...
@@ -94,9 +94,7 @@ void set_nhwc(tf_options& options, bool is_nhwc) { options.is_nhwc = is_nhwc; }
...
@@ -94,9 +94,7 @@ void set_nhwc(tf_options& options, bool is_nhwc) { options.is_nhwc = is_nhwc; }
void
set_default_dim_value
(
tf_options
&
options
,
size_t
value
)
{
options
.
batch_size
=
value
;
}
void
set_default_dim_value
(
tf_options
&
options
,
size_t
value
)
{
options
.
batch_size
=
value
;
}
void
set_input_parameter_shape
(
onnx_options
&
options
,
void
set_input_parameter_shape
(
onnx_options
&
options
,
const
char
*
name
,
std
::
vector
<
int
>
dims
)
const
char
*
name
,
std
::
vector
<
int
>
dims
)
{
{
options
.
map_input_dims
[
std
::
string
(
name
)]
=
std
::
move
(
dims
);
options
.
map_input_dims
[
std
::
string
(
name
)]
=
std
::
move
(
dims
);
}
}
...
@@ -855,7 +853,8 @@ migraphx_operation_name(char* out, int out_size, migraphx_operation_t operation)
...
@@ -855,7 +853,8 @@ migraphx_operation_name(char* out, int out_size, migraphx_operation_t operation)
if
(
operation
==
nullptr
)
if
(
operation
==
nullptr
)
MIGRAPHX_THROW
(
migraphx_status_bad_param
,
"Bad parameter operation: Null pointer"
);
MIGRAPHX_THROW
(
migraphx_status_bad_param
,
"Bad parameter operation: Null pointer"
);
auto
&&
api_result
=
(
operation
->
object
).
name
();
auto
&&
api_result
=
(
operation
->
object
).
name
();
auto
*
it
=
std
::
copy_n
(
api_result
.
begin
(),
std
::
min
(
static_cast
<
int
>
(
api_result
.
size
()),
out_size
-
1
),
out
);
auto
*
it
=
std
::
copy_n
(
api_result
.
begin
(),
std
::
min
(
static_cast
<
int
>
(
api_result
.
size
()),
out_size
-
1
),
out
);
*
it
=
'\0'
;
*
it
=
'\0'
;
});
});
return
api_error_result
;
return
api_error_result
;
...
...
src/api/include/migraphx/migraphx.hpp
View file @
3272b22e
...
@@ -235,9 +235,7 @@ struct shape : MIGRAPHX_CONST_HANDLE_BASE(shape)
...
@@ -235,9 +235,7 @@ struct shape : MIGRAPHX_CONST_HANDLE_BASE(shape)
this
->
make_handle
(
&
migraphx_shape_create
,
type
,
plengths
.
data
(),
plengths
.
size
());
this
->
make_handle
(
&
migraphx_shape_create
,
type
,
plengths
.
data
(),
plengths
.
size
());
}
}
shape
(
migraphx_shape_datatype_t
type
,
shape
(
migraphx_shape_datatype_t
type
,
std
::
vector
<
int
>
plengths
,
std
::
vector
<
int
>
pstrides
)
std
::
vector
<
int
>
plengths
,
std
::
vector
<
int
>
pstrides
)
{
{
this
->
make_handle
(
&
migraphx_shape_create_with_strides
,
this
->
make_handle
(
&
migraphx_shape_create_with_strides
,
type
,
type
,
...
@@ -699,8 +697,7 @@ inline program parse_onnx(const char* filename)
...
@@ -699,8 +697,7 @@ inline program parse_onnx(const char* filename)
}
}
/// Parse a buffer of memory as an onnx file
/// Parse a buffer of memory as an onnx file
inline
program
inline
program
parse_onnx_buffer
(
const
void
*
data
,
int
size
,
const
migraphx
::
onnx_options
&
options
)
parse_onnx_buffer
(
const
void
*
data
,
int
size
,
const
migraphx
::
onnx_options
&
options
)
{
{
return
program
(
return
program
(
make
<
migraphx_program
>
(
&
migraphx_parse_onnx_buffer
,
data
,
size
,
options
.
get_handle_ptr
()),
make
<
migraphx_program
>
(
&
migraphx_parse_onnx_buffer
,
data
,
size
,
options
.
get_handle_ptr
()),
...
...
src/argument.cpp
View file @
3272b22e
src/cpp_generator.cpp
View file @
3272b22e
src/dead_code_elimination.cpp
View file @
3272b22e
src/driver/main.cpp
View file @
3272b22e
src/include/migraphx/gemm.hpp
View file @
3272b22e
src/include/migraphx/load_save.hpp
View file @
3272b22e
...
@@ -15,8 +15,7 @@ struct file_options
...
@@ -15,8 +15,7 @@ struct file_options
program
load
(
const
std
::
string
&
filename
,
const
file_options
&
options
=
file_options
{});
program
load
(
const
std
::
string
&
filename
,
const
file_options
&
options
=
file_options
{});
program
load_buffer
(
const
std
::
vector
<
char
>&
buffer
,
const
file_options
&
options
=
file_options
{});
program
load_buffer
(
const
std
::
vector
<
char
>&
buffer
,
const
file_options
&
options
=
file_options
{});
program
program
load_buffer
(
const
char
*
buffer
,
int
size
,
const
file_options
&
options
=
file_options
{});
load_buffer
(
const
char
*
buffer
,
int
size
,
const
file_options
&
options
=
file_options
{});
void
save
(
const
program
&
p
,
void
save
(
const
program
&
p
,
const
std
::
string
&
filename
,
const
std
::
string
&
filename
,
...
...
src/include/migraphx/op/gather.hpp
View file @
3272b22e
src/include/migraphx/op/loop.hpp
View file @
3272b22e
src/include/migraphx/op/nonmaxsuppression.hpp
View file @
3272b22e
src/include/migraphx/op/pooling.hpp
View file @
3272b22e
src/include/migraphx/par_dfor.hpp
View file @
3272b22e
...
@@ -21,12 +21,9 @@ auto par_dfor(Ts... xs)
...
@@ -21,12 +21,9 @@ auto par_dfor(Ts... xs)
{
{
array_type
strides
;
array_type
strides
;
strides
.
fill
(
1
);
strides
.
fill
(
1
);
std
::
partial_sum
(
lens
.
rbegin
(),
std
::
partial_sum
(
lens
.
rend
()
-
1
,
lens
.
rbegin
(),
lens
.
rend
()
-
1
,
strides
.
rbegin
()
+
1
,
std
::
multiplies
<
int
>
());
strides
.
rbegin
()
+
1
,
auto
size
=
std
::
accumulate
(
lens
.
begin
(),
lens
.
end
(),
1
,
std
::
multiplies
<
int
>
());
std
::
multiplies
<
int
>
());
auto
size
=
std
::
accumulate
(
lens
.
begin
(),
lens
.
end
(),
1
,
std
::
multiplies
<
int
>
());
par_for
(
size
,
min_grain
,
[
&
](
int
i
)
{
par_for
(
size
,
min_grain
,
[
&
](
int
i
)
{
array_type
indices
;
array_type
indices
;
std
::
transform
(
strides
.
begin
(),
std
::
transform
(
strides
.
begin
(),
...
...
src/include/migraphx/program.hpp
View file @
3272b22e
...
@@ -67,8 +67,7 @@ struct program
...
@@ -67,8 +67,7 @@ struct program
void
finalize
();
void
finalize
();
void
void
perf_report
(
std
::
ostream
&
os
,
int
n
,
parameter_map
params
,
int
batch
=
1
)
const
;
perf_report
(
std
::
ostream
&
os
,
int
n
,
parameter_map
params
,
int
batch
=
1
)
const
;
void
mark
(
const
parameter_map
&
params
,
marker
&&
m
);
void
mark
(
const
parameter_map
&
params
,
marker
&&
m
);
...
...
src/include/migraphx/tf.hpp
View file @
3272b22e
src/onnx/parse_gru.cpp
View file @
3272b22e
...
@@ -24,8 +24,7 @@ struct parse_gru : op_parser<parse_gru>
...
@@ -24,8 +24,7 @@ struct parse_gru : op_parser<parse_gru>
if
(
contains
(
info
.
attributes
,
"hidden_size"
))
if
(
contains
(
info
.
attributes
,
"hidden_size"
))
{
{
int
hidden_size_att
=
int
hidden_size_att
=
parser
.
parse_value
(
info
.
attributes
.
at
(
"hidden_size"
)).
at
<
int
>
();
parser
.
parse_value
(
info
.
attributes
.
at
(
"hidden_size"
)).
at
<
int
>
();
if
(
hidden_size
!=
hidden_size_att
)
if
(
hidden_size
!=
hidden_size_att
)
{
{
MIGRAPHX_THROW
(
"GRU: hidden size mismatch in input and attribute"
);
MIGRAPHX_THROW
(
"GRU: hidden size mismatch in input and attribute"
);
...
...
src/onnx/parse_lstm.cpp
View file @
3272b22e
...
@@ -107,8 +107,7 @@ struct parse_lstm : op_parser<parse_lstm>
...
@@ -107,8 +107,7 @@ struct parse_lstm : op_parser<parse_lstm>
if
(
contains
(
info
.
attributes
,
"hidden_size"
))
if
(
contains
(
info
.
attributes
,
"hidden_size"
))
{
{
int
hidden_size_att
=
int
hidden_size_att
=
parser
.
parse_value
(
info
.
attributes
.
at
(
"hidden_size"
)).
at
<
int
>
();
parser
.
parse_value
(
info
.
attributes
.
at
(
"hidden_size"
)).
at
<
int
>
();
if
(
hidden_size
!=
hidden_size_att
)
if
(
hidden_size
!=
hidden_size_att
)
{
{
MIGRAPHX_THROW
(
"LSTM: hidden size mismatch in input and attribute"
);
MIGRAPHX_THROW
(
"LSTM: hidden size mismatch in input and attribute"
);
...
...
src/onnx/parse_resize.cpp
View file @
3272b22e
...
@@ -45,10 +45,7 @@ const auto& get_original_idx_op(const std::string& mode)
...
@@ -45,10 +45,7 @@ const auto& get_original_idx_op(const std::string& mode)
{
{
using
original_idx_op
=
std
::
function
<
double
(
int
,
int
,
int
,
double
)
>
;
using
original_idx_op
=
std
::
function
<
double
(
int
,
int
,
int
,
double
)
>
;
static
std
::
unordered_map
<
std
::
string
,
original_idx_op
>
const
idx_ops
=
{
static
std
::
unordered_map
<
std
::
string
,
original_idx_op
>
const
idx_ops
=
{
{
"half_pixel"
,
{
"half_pixel"
,
[
=
](
int
,
int
,
int
idx
,
double
scale
)
{
return
(
idx
+
0.5
)
/
scale
-
0.5
;
}},
[
=
](
int
,
int
,
int
idx
,
double
scale
)
{
return
(
idx
+
0.5
)
/
scale
-
0.5
;
}},
{
"pytorch_half_pixel"
,
{
"pytorch_half_pixel"
,
[
=
](
int
,
int
l_out
,
int
idx
,
double
scale
)
{
[
=
](
int
,
int
l_out
,
int
idx
,
double
scale
)
{
return
l_out
>
1
?
(
idx
+
0.5
)
/
scale
-
0.5
:
0.0
;
return
l_out
>
1
?
(
idx
+
0.5
)
/
scale
-
0.5
:
0.0
;
...
@@ -57,11 +54,9 @@ const auto& get_original_idx_op(const std::string& mode)
...
@@ -57,11 +54,9 @@ const auto& get_original_idx_op(const std::string& mode)
[
=
](
int
l_in
,
int
l_out
,
int
idx
,
double
)
{
[
=
](
int
l_in
,
int
l_out
,
int
idx
,
double
)
{
return
(
l_out
==
1
)
?
0.0
:
(
1.0
*
idx
*
(
l_in
-
1.0
)
/
(
l_out
-
1.0
));
return
(
l_out
==
1
)
?
0.0
:
(
1.0
*
idx
*
(
l_in
-
1.0
)
/
(
l_out
-
1.0
));
}},
}},
{
"asymmetric"
,
{
"asymmetric"
,
[
=
](
int
,
int
,
int
idx
,
double
scale
)
{
return
idx
/
scale
;
}},
[
=
](
int
,
int
,
int
idx
,
double
scale
)
{
return
idx
/
scale
;
}},
{
"tf_half_pixel_for_nn"
,
{
"tf_half_pixel_for_nn"
,
[
=
](
int
,
int
,
int
idx
,
double
scale
)
{
[
=
](
int
,
int
,
int
idx
,
double
scale
)
{
return
(
idx
+
0.5
)
/
scale
;
}}};
return
(
idx
+
0.5
)
/
scale
;
}}};
if
(
!
contains
(
idx_ops
,
mode
))
if
(
!
contains
(
idx_ops
,
mode
))
{
{
...
@@ -251,13 +246,12 @@ struct parse_resize : op_parser<parse_resize>
...
@@ -251,13 +246,12 @@ struct parse_resize : op_parser<parse_resize>
": ranks of input and scale are different!"
);
": ranks of input and scale are different!"
);
}
}
std
::
transform
(
in_lens
.
begin
(),
std
::
transform
(
in_lens
.
begin
(),
in_lens
.
end
(),
in_lens
.
end
(),
vec_scale
.
begin
(),
vec_scale
.
begin
(),
out_lens
.
begin
(),
out_lens
.
begin
(),
[
&
](
auto
idx
,
auto
scale
)
{
[
&
](
auto
idx
,
auto
scale
)
{
return
static_cast
<
int
>
(
idx
*
scale
);
});
return
static_cast
<
int
>
(
idx
*
scale
);
});
}
}
}
}
}
}
...
...
src/onnx/parse_rnn.cpp
View file @
3272b22e
...
@@ -24,8 +24,7 @@ struct parse_rnn : op_parser<parse_rnn>
...
@@ -24,8 +24,7 @@ struct parse_rnn : op_parser<parse_rnn>
if
(
contains
(
info
.
attributes
,
"hidden_size"
))
if
(
contains
(
info
.
attributes
,
"hidden_size"
))
{
{
int
hidden_size_att
=
int
hidden_size_att
=
parser
.
parse_value
(
info
.
attributes
.
at
(
"hidden_size"
)).
at
<
int
>
();
parser
.
parse_value
(
info
.
attributes
.
at
(
"hidden_size"
)).
at
<
int
>
();
if
(
hidden_size
!=
hidden_size_att
)
if
(
hidden_size
!=
hidden_size_att
)
{
{
MIGRAPHX_THROW
(
"RNN: hidden size mismatch in input and attribute"
);
MIGRAPHX_THROW
(
"RNN: hidden size mismatch in input and attribute"
);
...
...
src/opt/memory_coloring_impl.cpp
View file @
3272b22e
Prev
1
2
3
4
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