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
a6477298
Commit
a6477298
authored
Apr 04, 2022
by
Shucai Xiao
Browse files
clang format
parent
fe849702
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
src/targets/gpu/device/layernorm.cpp
src/targets/gpu/device/layernorm.cpp
+22
-15
No files found.
src/targets/gpu/device/layernorm.cpp
View file @
a6477298
...
@@ -215,8 +215,11 @@ __device__ __half2 block_reduce_half2(
...
@@ -215,8 +215,11 @@ __device__ __half2 block_reduce_half2(
// m = x - mean(x)
// m = x - mean(x)
// m / sqrt(mean(m ^ 2) + 1e-12)
// m / sqrt(mean(m ^ 2) + 1e-12)
__device__
void
layernorm_kernel_half2
(
__half2
*
in_data
,
__half2
*
in_data_reduce
,
__device__
void
layernorm_kernel_half2
(
__half2
*
in_data
,
__half2
*
out
,
index_int
batch_item_num
,
index_int
block_size
,
__half2
*
in_data_reduce
,
__half2
*
out
,
index_int
batch_item_num
,
index_int
block_size
,
float
rbatch_num
)
float
rbatch_num
)
{
{
auto
rnum
=
__float2half2_rn
(
rbatch_num
);
auto
rnum
=
__float2half2_rn
(
rbatch_num
);
...
@@ -289,8 +292,12 @@ block_reduce_half(T* buffer, index_int batch_item_num, index_int tid, index_int
...
@@ -289,8 +292,12 @@ block_reduce_half(T* buffer, index_int batch_item_num, index_int tid, index_int
// m = x - mean(x)
// m = x - mean(x)
// m / sqrt(mean(m ^ 2) + 1e-12)
// m / sqrt(mean(m ^ 2) + 1e-12)
__device__
void
layernorm_kernel_half
(
__half
*
in_data
,
__half
*
in_data_reduce
,
__half
*
out
,
__device__
void
layernorm_kernel_half
(
__half
*
in_data
,
index_int
batch_item_num
,
index_int
block_size
,
float
rnum
)
__half
*
in_data_reduce
,
__half
*
out
,
index_int
batch_item_num
,
index_int
block_size
,
float
rnum
)
{
{
auto
m
=
block_reduce_half
(
in_data_reduce
,
batch_item_num
,
threadIdx
.
x
,
block_size
);
auto
m
=
block_reduce_half
(
in_data_reduce
,
batch_item_num
,
threadIdx
.
x
,
block_size
);
m
*=
rnum
;
m
*=
rnum
;
...
...
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