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
OpenDAS
FlashMLA
Commits
24c52aee
Commit
24c52aee
authored
Feb 27, 2026
by
zhanghj2
Browse files
优化tp1 warp求和部分
parent
6a04965a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
csrc/extension/softmax.h
csrc/extension/softmax.h
+12
-5
No files found.
csrc/extension/softmax.h
View file @
24c52aee
...
...
@@ -77,12 +77,19 @@ __device__ __forceinline__ void warp_allreduce_tp1(Tensor<Engine0, Layout0> &dst
smem_reduce
[
row
*
2
+
(
warp_id
/
4
)]
=
dst
[
0
];
}
__syncthreads
();
if
(
col
==
0
&&
warp_id
<
4
)
{
// printf("sum %d %d %d %.2f %.2f \n", row, tidx, warp_id, smem_reduce[row * 2], smem_reduce[row * 2 + warp_id / 4]);
smem_reduce
[
128
+
row
]
=
op
(
smem_reduce
[
row
*
2
],
smem_reduce
[
row
*
2
+
1
]);
// if (col == 0 && warp_id < 4) {
// // printf("sum %d %d %d %.2f %.2f \n", row, tidx, warp_id, smem_reduce[row * 2], smem_reduce[row * 2 + warp_id / 4]);
// smem_reduce[128 + row] = op(smem_reduce[row * 2], smem_reduce[row * 2 + 1]);
// }
// __syncthreads();
// dst(0) = smem_reduce(128 + row);
if
(
warp_id
<
4
)
{
dst
(
0
)
=
op
(
dst
(
0
),
smem_reduce
[
row
*
2
+
1
]);
}
else
{
dst
(
0
)
=
op
(
dst
(
0
),
smem_reduce
[
row
*
2
]);
}
__syncthreads
(
);
dst
(
0
)
=
smem_reduce
(
128
+
row
);
// dst(0) = op(smem_reduce[row * 2], smem_reduce[row * 2 + 1]
);
}
template
<
typename
Engine0
,
typename
Layout0
,
typename
Engine1
,
typename
Layout1
,
typename
Operator
>
__device__
__forceinline__
void
warp_allreduce_tp4
(
Tensor
<
Engine0
,
Layout0
>
&
dst
,
Tensor
<
Engine1
,
Layout1
>
&
smem_reduce
,
Operator
&
op
)
{
...
...
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