Skip to content

Commit 6e0085a

Browse files
roycho96yaox12
andauthored
[Common] Remove redundant grad_logits zero-initialization in fused router backward kernels (NVIDIA#2745)
Remove redundant grad_logits zero-initialization in fused router backward kernels Signed-off-by: Sung Hyun Cho <hope5487@gmail.com> Co-authored-by: Xin Yao <xiny@nvidia.com>
1 parent 34a6c0a commit 6e0085a

2 files changed

Lines changed: 0 additions & 8 deletions

File tree

transformer_engine/common/fused_router/fused_score_for_moe_aux_loss.cu

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,6 @@ __global__ void fused_score_for_moe_aux_loss_backward_kernel(const CompType *int
211211
* - Load the dgrad/output_from_fwd to shmem
212212
*/
213213
int pos_offset = token_offset_cur_warp * num_experts;
214-
// Clear the logits_grad in global mem
215-
for (int i = lane_id; i < num_experts; i += kThreadsPerWarp) {
216-
grad_logits[pos_offset + i] = 0.0f;
217-
}
218214
// Load the dgrad/output_from_fwd to shmem
219215
for (int i = lane_id; i < num_experts; i += kThreadsPerWarp) {
220216
local_grad[i] = grad_scores[pos_offset + i];

transformer_engine/common/fused_router/fused_topk_with_score_function.cu

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,6 @@ __global__ void fused_topk_with_score_function_backward_kernel(
328328
* - Load the dgrad/output_from_fwd to shmem
329329
*/
330330
int pos_offset = token_offset_cur_warp * num_experts;
331-
// Clear the logits_grad in global mem
332-
for (int i = lane_id; i < num_experts; i += kThreadsPerWarp) {
333-
grad_logits[pos_offset + i] = 0.0f;
334-
}
335331
// Load the dgrad/output_from_fwd to shmem
336332
for (int i = lane_id; i < num_experts; i += kThreadsPerWarp) {
337333
local_grad[i] = grad_probs[pos_offset + i];

0 commit comments

Comments
 (0)