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
4f0c21f5
Commit
4f0c21f5
authored
Jul 12, 2019
by
Shucai Xiao
Browse files
clang format
parent
413036a1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
15 deletions
+8
-15
src/targets/gpu/include/migraphx/gpu/miopen.hpp
src/targets/gpu/include/migraphx/gpu/miopen.hpp
+2
-0
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+1
-5
src/targets/gpu/quant_convolution.cpp
src/targets/gpu/quant_convolution.cpp
+5
-10
No files found.
src/targets/gpu/include/migraphx/gpu/miopen.hpp
View file @
4f0c21f5
...
@@ -49,6 +49,8 @@ inline tensor_descriptor make_tensor(const migraphx::shape& s, bool pack = false
...
@@ -49,6 +49,8 @@ inline tensor_descriptor make_tensor(const migraphx::shape& s, bool pack = false
d
=
miopenFloat
;
d
=
miopenFloat
;
else
if
(
s
.
type
()
==
shape
::
half_type
)
else
if
(
s
.
type
()
==
shape
::
half_type
)
d
=
miopenHalf
;
d
=
miopenHalf
;
else
if
(
s
.
type
()
==
shape
::
int32_type
)
d
=
miopenInt32
;
else
if
(
s
.
type
()
==
shape
::
int8_type
)
else
if
(
s
.
type
()
==
shape
::
int8_type
)
{
{
if
(
pack
)
if
(
pack
)
...
...
src/targets/gpu/lowering.cpp
View file @
4f0c21f5
...
@@ -177,14 +177,10 @@ struct miopen_apply
...
@@ -177,14 +177,10 @@ struct miopen_apply
auto
ws
=
conv
.
compile
(
ctx
,
ins
->
get_shape
(),
to_shapes
(
ins
->
inputs
()));
auto
ws
=
conv
.
compile
(
ctx
,
ins
->
get_shape
(),
to_shapes
(
ins
->
inputs
()));
auto
workspace
=
insert_allocation
(
ins
,
ws
,
"workspace"
);
auto
workspace
=
insert_allocation
(
ins
,
ws
,
"workspace"
);
// add a temp float output to store the miopen convolution output
shape
tmp_output_shape
{
shape
::
float_type
,
ins
->
get_shape
().
lens
()};
auto
tmp_output
=
insert_allocation
(
ins
,
tmp_output_shape
,
"tmp_out"
);
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
return
prog
->
replace_instruction
(
return
prog
->
replace_instruction
(
ins
,
conv
,
ins
->
inputs
().
at
(
0
),
ins
->
inputs
().
at
(
1
),
workspace
,
tmp_output
,
output
);
ins
,
conv
,
ins
->
inputs
().
at
(
0
),
ins
->
inputs
().
at
(
1
),
workspace
,
output
);
});
});
}
}
...
...
src/targets/gpu/quant_convolution.cpp
View file @
4f0c21f5
...
@@ -9,7 +9,7 @@ namespace gpu {
...
@@ -9,7 +9,7 @@ namespace gpu {
shape
miopen_quant_convolution
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
shape
miopen_quant_convolution
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
{
check_shapes
{
inputs
,
*
this
}.
has
(
5
).
standard
();
check_shapes
{
inputs
,
*
this
}.
has
(
4
).
standard
();
return
op
.
compute_shape
({
inputs
.
at
(
0
),
inputs
.
at
(
1
)});
return
op
.
compute_shape
({
inputs
.
at
(
0
),
inputs
.
at
(
1
)});
}
}
argument
miopen_quant_convolution
::
compute
(
context
&
ctx
,
argument
miopen_quant_convolution
::
compute
(
context
&
ctx
,
...
@@ -20,8 +20,7 @@ argument miopen_quant_convolution::compute(context& ctx,
...
@@ -20,8 +20,7 @@ argument miopen_quant_convolution::compute(context& ctx,
auto
x_desc_vec4
=
make_tensor
(
args
[
0
].
get_shape
(),
true
);
auto
x_desc_vec4
=
make_tensor
(
args
[
0
].
get_shape
(),
true
);
auto
w_desc
=
make_tensor
(
args
[
1
].
get_shape
());
auto
w_desc
=
make_tensor
(
args
[
1
].
get_shape
());
auto
w_desc_vec4
=
make_tensor
(
args
[
1
].
get_shape
(),
true
);
auto
w_desc_vec4
=
make_tensor
(
args
[
1
].
get_shape
(),
true
);
shape
tmp_output_shape
{
shape
::
float_type
,
output_shape
.
lens
()};
auto
y_desc
=
make_tensor
(
output_shape
);
auto
y_desc
=
make_tensor
(
tmp_output_shape
);
float
alpha
=
1
;
float
alpha
=
1
;
float
beta
=
0
;
float
beta
=
0
;
...
@@ -70,10 +69,7 @@ argument miopen_quant_convolution::compute(context& ctx,
...
@@ -70,10 +69,7 @@ argument miopen_quant_convolution::compute(context& ctx,
MIGRAPHX_THROW
(
"QUANT_CONVOLUTION: run convolution forward failed"
);
MIGRAPHX_THROW
(
"QUANT_CONVOLUTION: run convolution forward failed"
);
}
}
// Add a conversion from float to int32_t
return
args
[
3
];
device
::
convert
(
ctx
.
get_stream
().
get
(),
args
[
4
],
args
[
3
]);
return
args
[
4
];
}
}
shape
miopen_quant_convolution
::
compile
(
context
&
ctx
,
shape
miopen_quant_convolution
::
compile
(
context
&
ctx
,
...
@@ -83,8 +79,7 @@ shape miopen_quant_convolution::compile(context& ctx,
...
@@ -83,8 +79,7 @@ shape miopen_quant_convolution::compile(context& ctx,
shape
workspace_shape
{};
shape
workspace_shape
{};
auto
x_desc
=
make_tensor
(
inputs
[
0
],
true
);
auto
x_desc
=
make_tensor
(
inputs
[
0
],
true
);
auto
w_desc
=
make_tensor
(
inputs
[
1
],
true
);
auto
w_desc
=
make_tensor
(
inputs
[
1
],
true
);
shape
tmp_output_shape
{
shape
::
float_type
,
output_shape
.
lens
()};
auto
y_desc
=
make_tensor
(
output_shape
);
auto
y_desc
=
make_tensor
(
tmp_output_shape
);
std
::
size_t
workspace_size
=
0
;
std
::
size_t
workspace_size
=
0
;
miopenConvolutionForwardGetWorkSpaceSize
(
ctx
.
get_stream
().
get_miopen
(),
miopenConvolutionForwardGetWorkSpaceSize
(
ctx
.
get_stream
().
get_miopen
(),
...
@@ -97,7 +92,7 @@ shape miopen_quant_convolution::compile(context& ctx,
...
@@ -97,7 +92,7 @@ shape miopen_quant_convolution::compile(context& ctx,
arg_vec4_x
=
to_gpu
(
generate_argument
(
pack_int8_shape
(
inputs
[
0
])));
arg_vec4_x
=
to_gpu
(
generate_argument
(
pack_int8_shape
(
inputs
[
0
])));
arg_vec4_w
=
to_gpu
(
generate_argument
(
pack_int8_shape
(
inputs
[
1
])));
arg_vec4_w
=
to_gpu
(
generate_argument
(
pack_int8_shape
(
inputs
[
1
])));
auto
y
=
allocate_gpu
(
tmp_
output_shape
);
auto
y
=
allocate_gpu
(
output_shape
);
auto
workspace
=
allocate_gpu
(
workspace_shape
);
auto
workspace
=
allocate_gpu
(
workspace_shape
);
int
algo_count
=
1
;
int
algo_count
=
1
;
...
...
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