Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize cuComputePartGradGammaBeta kernel for MI100 #10475

Merged
merged 3 commits into from
Feb 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions orttraining/orttraining/training_ops/cuda/nn/layer_norm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ Status LayerNormGrad<T, U, simplified>::ComputeInternal(OpKernelContext* p_op_ke
bias_grad_data = reinterpret_cast<CudaT*>(bias_grad->template MutableData<T>());
}

#ifndef __HIP_PLATFORM_HCC__
hubertlu-tw marked this conversation as resolved.
Show resolved Hide resolved
const int part_size = 16;
#else
// Optimization for ROCm MI100
const int part_size = 64;
#endif
auto part_grad_gamma = GetScratchBuffer<CudaU>(part_size * n2);
auto part_grad_beta = GetScratchBuffer<CudaU>(part_size * n2);

Expand Down Expand Up @@ -138,7 +143,12 @@ Status InvertibleLayerNormGrad<T, U>::ComputeInternal(OpKernelContext* p_op_kern
auto scale_grad_data = reinterpret_cast<CudaT*>(scale_grad->template MutableData<T>());
auto bias_grad_data = reinterpret_cast<CudaT*>(bias_grad->template MutableData<T>());

#ifndef __HIP_PLATFORM_HCC__
hubertlu-tw marked this conversation as resolved.
Show resolved Hide resolved
const int part_size = 16;
#else
// Optimization for ROCm MI100
const int part_size = 64;
#endif
auto part_grad_gamma = GetScratchBuffer<CudaU>(part_size * n2);
auto part_grad_beta = GetScratchBuffer<CudaU>(part_size * n2);

Expand Down