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
DeepEP
Commits
0970c4c8
Unverified
Commit
0970c4c8
authored
Sep 10, 2025
by
Shangyan Zhou
Committed by
GitHub
Sep 10, 2025
Browse files
Fix tma mbarrier (#399)
* Fix mbarrier * Remove redundant store
parent
174c209f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
csrc/kernels/internode.cu
csrc/kernels/internode.cu
+6
-5
No files found.
csrc/kernels/internode.cu
View file @
0970c4c8
...
@@ -444,7 +444,7 @@ dispatch(int4* recv_x, float* recv_x_scales, int64_t* recv_topk_idx, float* recv
...
@@ -444,7 +444,7 @@ dispatch(int4* recv_x, float* recv_x_scales, int64_t* recv_topk_idx, float* recv
// TMA stuffs
// TMA stuffs
extern
__shared__
__align__
(
1024
)
uint8_t
smem_tma_buffer
[];
extern
__shared__
__align__
(
1024
)
uint8_t
smem_tma_buffer
[];
auto
tma_buffer
=
smem_tma_buffer
+
target_rank
*
kNumTMABytesPerWarp
;
auto
tma_buffer
=
smem_tma_buffer
+
target_rank
*
kNumTMABytesPerWarp
;
auto
tma_mbarrier
=
reinterpret_cast
<
uint64_t
*>
(
tma_buffer
+
hidden_bytes
);
auto
tma_mbarrier
=
reinterpret_cast
<
uint64_t
*>
(
tma_buffer
+
num_bytes_per_token
);
uint32_t
tma_phase
=
0
;
uint32_t
tma_phase
=
0
;
if
((
warp_role
==
WarpRole
::
kRDMAAndNVLForwarder
or
warp_role
==
WarpRole
::
kNVLReceivers
)
and
lane_id
==
0
)
{
if
((
warp_role
==
WarpRole
::
kRDMAAndNVLForwarder
or
warp_role
==
WarpRole
::
kNVLReceivers
)
and
lane_id
==
0
)
{
mbarrier_init
(
tma_mbarrier
,
1
);
mbarrier_init
(
tma_mbarrier
,
1
);
...
@@ -943,16 +943,17 @@ dispatch(int4* recv_x, float* recv_x_scales, int64_t* recv_topk_idx, float* recv
...
@@ -943,16 +943,17 @@ dispatch(int4* recv_x, float* recv_x_scales, int64_t* recv_topk_idx, float* recv
}
}
__syncwarp
();
__syncwarp
();
mbarrier_wait
(
tma_mbarrier
,
tma_phase
);
mbarrier_wait
(
tma_mbarrier
,
tma_phase
);
if
(
lane_id
==
0
)
if
(
lane_id
==
0
)
{
tma_store_1d
(
tma_buffer
,
recv_x
+
recv_token_idx
*
hidden_int4
,
hidden_bytes
,
false
);
tma_store_1d
(
tma_buffer
,
recv_x
+
recv_token_idx
*
hidden_int4
,
hidden_bytes
,
false
);
if
(
scale_aligned
)
tma_store_1d
(
tma_buffer
+
hidden_bytes
,
recv_x_scales
+
recv_token_idx
*
num_scales
,
scale_bytes
,
false
);
}
__syncwarp
();
__syncwarp
();
shifted
+=
hidden_bytes
;
shifted
+=
hidden_bytes
;
// Copy scales
// Copy scales
// TODO: make it as templated
// TODO: make it as templated
if
(
scale_aligned
)
{
if
(
not
scale_aligned
)
{
tma_store_1d
(
tma_buffer
+
hidden_bytes
,
recv_x_scales
+
recv_token_idx
*
num_scales
,
scale_bytes
,
false
);
}
else
{
UNROLLED_WARP_COPY
(
1
,
lane_id
,
num_scales
,
UNROLLED_WARP_COPY
(
1
,
lane_id
,
num_scales
,
recv_x_scales
+
recv_token_idx
*
num_scales
,
recv_x_scales
+
recv_token_idx
*
num_scales
,
reinterpret_cast
<
float
*>
(
shifted
),
reinterpret_cast
<
float
*>
(
shifted
),
...
...
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