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
2ae93464
Commit
2ae93464
authored
Jan 27, 2023
by
Paul
Browse files
Format
parent
78a1dc1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
11 deletions
+7
-11
src/targets/gpu/jit/groupnorm.cpp
src/targets/gpu/jit/groupnorm.cpp
+1
-4
src/targets/gpu/kernels/include/migraphx/kernels/groupnorm.hpp
...argets/gpu/kernels/include/migraphx/kernels/groupnorm.hpp
+6
-7
No files found.
src/targets/gpu/jit/groupnorm.cpp
View file @
2ae93464
...
...
@@ -61,10 +61,7 @@ __global__ void groupnorm_kernel(${params})
struct
groupnorm_compiler
:
compiler
<
groupnorm_compiler
>
{
std
::
vector
<
std
::
string
>
names
()
const
{
return
{
"groupnorm"
};
}
std
::
vector
<
std
::
string
>
names
()
const
{
return
{
"groupnorm"
};
}
operation
compile_op
(
context
&
ctx
,
const
std
::
vector
<
shape
>&
inputs
,
const
value
&
v
)
const
{
...
...
src/targets/gpu/kernels/include/migraphx/kernels/groupnorm.hpp
View file @
2ae93464
...
...
@@ -8,18 +8,17 @@
namespace
migraphx
{
template
<
class
Output
,
class
T
>
__device__
void
groupnorm
(
Output
out
,
T
x0
)
{
template
<
class
Output
,
class
T
>
__device__
void
groupnorm
(
Output
out
,
T
x0
)
{
reduce
::
block
::
run
<
Output
>
([
&
](
auto
out_idx
,
auto
r
)
{
constexpr
auto
relements
=
r
.
template
elements
<
T
>();
auto
z1
=
r
.
reduce
(
op
::
sum
{},
0
,
op
::
mean
<
relements
>
{})(
x0
);
auto
z4
=
r
.
reduce
(
op
::
sum
{},
0
,
[
&
](
auto
x
)
{
auto
z1
=
r
.
reduce
(
op
::
sum
{},
0
,
op
::
mean
<
relements
>
{})(
x0
);
auto
z4
=
r
.
reduce
(
op
::
sum
{},
0
,
[
&
](
auto
x
)
{
auto
diff
=
x
-
z1
;
return
(
diff
*
diff
)
/
vec_type
<
decltype
(
diff
)
>
{
relements
};
})(
x0
);
r
.
outer
([
&
]
{
out
[
out_idx
]
=
migraphx
::
rsqrt
(
z4
+
1e-12
);
});
r
.
outer
([
&
]
{
out
[
out_idx
]
=
migraphx
::
rsqrt
(
z4
+
1e-12
);
});
});
}
...
...
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