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
ffebc6a8
Commit
ffebc6a8
authored
Jan 24, 2023
by
Paul
Browse files
Fix verify bugs
parent
c47fa173
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
src/targets/gpu/compile_gen.cpp
src/targets/gpu/compile_gen.cpp
+3
-2
src/targets/gpu/jit/fused_reduce.cpp
src/targets/gpu/jit/fused_reduce.cpp
+2
-7
No files found.
src/targets/gpu/compile_gen.cpp
View file @
ffebc6a8
...
@@ -223,8 +223,9 @@ struct reduce_op
...
@@ -223,8 +223,9 @@ struct reduce_op
}
}
else
if
(
ins
->
name
()
==
"reduce_mean"
)
else
if
(
ins
->
name
()
==
"reduce_mean"
)
{
{
auto
reduce_elements
=
get_reduce_elements
(
ins
->
inputs
());
auto
s
=
ins
->
inputs
().
front
()
->
get_shape
();
auto
reduce_type
=
ins
->
inputs
().
front
()
->
get_shape
().
type
();
auto
reduce_elements
=
s
.
elements
()
/
ins
->
get_shape
().
elements
();
auto
reduce_type
=
s
.
type
();
r
.
reduction
=
"op::sum{}"
;
r
.
reduction
=
"op::sum{}"
;
std
::
string
mean
=
"op::mean{"
+
std
::
to_string
(
reduce_elements
)
+
"}"
;
std
::
string
mean
=
"op::mean{"
+
std
::
to_string
(
reduce_elements
)
+
"}"
;
// Use float accumulator when reduction size is too large for half
// Use float accumulator when reduction size is too large for half
...
...
src/targets/gpu/jit/fused_reduce.cpp
View file @
ffebc6a8
...
@@ -47,7 +47,7 @@ ${preamble}
...
@@ -47,7 +47,7 @@ ${preamble}
extern "C" {
extern "C" {
__global__ void ${kernel}(${params})
__global__ void ${kernel}(${params})
{
{
transform_args(make_tensors(), ${transformers})(${args})([](auto y, auto... xs) {
transform_args(make_tensors(),
rotate_last(),
${transformers})(${args})([](auto y, auto... xs) {
fused_reduce<reduce::${algo}, ${reduced}>(y, partial(${lambda})(xs...));
fused_reduce<reduce::${algo}, ${reduced}>(y, partial(${lambda})(xs...));
});
});
}
}
...
@@ -58,11 +58,6 @@ __global__ void ${kernel}(${params})
...
@@ -58,11 +58,6 @@ __global__ void ${kernel}(${params})
)__migraphx__"
;
)__migraphx__"
;
static
std
::
size_t
get_reduce_elements
(
const
std
::
vector
<
shape
>&
inputs
)
{
return
inputs
.
front
().
elements
()
/
inputs
.
back
().
elements
();
}
template
<
class
T
>
template
<
class
T
>
static
shape
get_reduced_shape
(
const
shape
&
s
,
const
std
::
vector
<
T
>&
axes
)
static
shape
get_reduced_shape
(
const
shape
&
s
,
const
std
::
vector
<
T
>&
axes
)
{
{
...
@@ -115,7 +110,7 @@ struct fused_reduce_compiler : compiler<fused_reduce_compiler>
...
@@ -115,7 +110,7 @@ struct fused_reduce_compiler : compiler<fused_reduce_compiler>
{
{
vec
=
vectorize
::
elements
(
ctx
,
faxis
,
options
.
virtual_inputs
);
vec
=
vectorize
::
elements
(
ctx
,
faxis
,
options
.
virtual_inputs
);
}
}
auto
relements
=
get_
reduce
_
elements
(
options
.
virtual_inputs
)
/
vec
.
size
;
auto
relements
=
reduce
d_shape
.
elements
()
/
vec
.
size
;
auto
nelements
=
options
.
virtual_inputs
.
back
().
elements
();
auto
nelements
=
options
.
virtual_inputs
.
back
().
elements
();
auto
algo
=
v
.
get
(
"algo"
,
get_reduce_algo
(
options
.
virtual_inputs
,
reduced_shape
.
lens
()));
auto
algo
=
v
.
get
(
"algo"
,
get_reduce_algo
(
options
.
virtual_inputs
,
reduced_shape
.
lens
()));
if
(
algo
==
"block"
)
if
(
algo
==
"block"
)
...
...
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