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
OpenDAS
FastFold
Commits
1f6d6678
Commit
1f6d6678
authored
Apr 27, 2023
by
zhuwenwen
Browse files
support dtk2304
parent
dd424ec5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
fastfold/model/fastnn/kernel/cuda_native/csrc/layer_norm_cuda_kernel.cu
.../fastnn/kernel/cuda_native/csrc/layer_norm_cuda_kernel.cu
+7
-7
fastfold/model/fastnn/kernel/cuda_native/csrc/softmax_cuda_kernel.cu
...del/fastnn/kernel/cuda_native/csrc/softmax_cuda_kernel.cu
+2
-2
No files found.
fastfold/model/fastnn/kernel/cuda_native/csrc/layer_norm_cuda_kernel.cu
View file @
1f6d6678
// part of code modified from https://github.com/NVIDIA/apex
//#include <cooperative_groups.h>
#include <hip/hsa_detail/hip_cooperative_groups.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <hip/hip_cooperative_groups.h>
#include <torch/extension.h>
#include <THC/THCDeviceUtils.cuh>
...
...
@@ -48,15 +48,15 @@ __inline__ __device__ void WelfordWarpAllReduce(float thread_mean, float thread_
*
m2
=
thread_m2
;
*
count
=
thread_count
;
for
(
int
mask
=
1
;
mask
<
32
;
mask
*=
2
)
{
float
b_mean
=
__shfl_down
_sync
(
0xffffffff
,
*
mean
,
mask
);
float
b_m2
=
__shfl_down
_sync
(
0xffffffff
,
*
m2
,
mask
);
float
b_count
=
__shfl_down
_sync
(
0xffffffff
,
*
count
,
mask
);
float
b_mean
=
__shfl_down
(
*
mean
,
mask
);
float
b_m2
=
__shfl_down
(
*
m2
,
mask
);
float
b_count
=
__shfl_down
(
*
count
,
mask
);
WelfordOnline
(
b_mean
,
b_m2
,
b_count
,
mean
,
m2
,
count
);
}
*
mean
=
__shfl
_sync
(
0xffffffff
,
*
mean
,
0
,
32
);
*
m2
=
__shfl
_sync
(
0xffffffff
,
*
m2
,
0
,
32
);
*
count
=
__shfl
_sync
(
0xffffffff
,
*
count
,
0
,
32
);
*
mean
=
__shfl
(
*
mean
,
0
,
32
);
*
m2
=
__shfl
(
*
m2
,
0
,
32
);
*
count
=
__shfl
(
*
count
,
0
,
32
);
}
template
<
typename
T
>
...
...
fastfold/model/fastnn/kernel/cuda_native/csrc/softmax_cuda_kernel.cu
View file @
1f6d6678
...
...
@@ -17,14 +17,14 @@
__inline__
__device__
float
WarpAllReduceMax
(
float
val
)
{
for
(
int
mask
=
1
;
mask
<
32
;
mask
*=
2
)
{
val
=
max
(
val
,
__shfl_xor
_sync
(
0xffffffff
,
val
,
mask
));
val
=
max
(
val
,
__shfl_xor
(
val
,
mask
));
}
return
val
;
}
__inline__
__device__
float
WarpAllReduceSum
(
float
val
)
{
for
(
int
mask
=
1
;
mask
<
32
;
mask
*=
2
)
{
val
+=
__shfl_xor
_sync
(
0xffffffff
,
val
,
mask
);
val
+=
__shfl_xor
(
val
,
mask
);
}
return
val
;
}
...
...
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