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
bb0fff52
Commit
bb0fff52
authored
May 03, 2022
by
Paul
Browse files
Format
parent
c9bc461c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
src/targets/gpu/jit/softmax.cpp
src/targets/gpu/jit/softmax.cpp
+2
-2
src/targets/gpu/kernels/include/migraphx/kernels/softmax.hpp
src/targets/gpu/kernels/include/migraphx/kernels/softmax.hpp
+1
-1
No files found.
src/targets/gpu/jit/softmax.cpp
View file @
bb0fff52
...
@@ -52,8 +52,8 @@ struct softmax_compiler : compiler<softmax_compiler>
...
@@ -52,8 +52,8 @@ struct softmax_compiler : compiler<softmax_compiler>
operation
compile_op
(
context
&
ctx
,
const
std
::
vector
<
shape
>&
inputs
,
const
value
&
v
)
const
operation
compile_op
(
context
&
ctx
,
const
std
::
vector
<
shape
>&
inputs
,
const
value
&
v
)
const
{
{
auto
axis
=
v
.
at
(
"axis"
).
to
<
int64_t
>
();
auto
axis
=
v
.
at
(
"axis"
).
to
<
int64_t
>
();
auto
relements
=
inputs
[
0
].
lens
()[
axis
];
auto
relements
=
inputs
[
0
].
lens
()[
axis
];
auto
nelements
=
inputs
.
back
().
elements
()
/
relements
;
auto
nelements
=
inputs
.
back
().
elements
()
/
relements
;
auto
block_size
=
compute_block_size
(
relements
,
256
);
auto
block_size
=
compute_block_size
(
relements
,
256
);
hip_compile_options
options
;
hip_compile_options
options
;
options
.
set_launch_params
(
options
.
set_launch_params
(
...
...
src/targets/gpu/kernels/include/migraphx/kernels/softmax.hpp
View file @
bb0fff52
...
@@ -14,7 +14,7 @@ __device__ void softmax(Input input, Output output)
...
@@ -14,7 +14,7 @@ __device__ void softmax(Input input, Output output)
auto
batch_sum
=
auto
batch_sum
=
r
.
reduce
(
op
::
sum
{},
0
,
[
&
](
auto
x
)
{
return
migraphx
::
exp
(
x
-
batch_max
);
})(
input
);
r
.
reduce
(
op
::
sum
{},
0
,
[
&
](
auto
x
)
{
return
migraphx
::
exp
(
x
-
batch_max
);
})(
input
);
r
.
inner
([
&
](
auto
&
y
,
auto
x
)
{
y
=
migraphx
::
exp
(
x
-
batch_max
)
/
batch_sum
;
})(
output
,
r
.
inner
([
&
](
auto
&
y
,
auto
x
)
{
y
=
migraphx
::
exp
(
x
-
batch_max
)
/
batch_sum
;
})(
output
,
input
);
input
);
});
});
}
}
...
...
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