Skip to content

Commit

Permalink
remove magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
EsdeathYZH committed Jun 7, 2022
1 parent 5d3e4ec commit 55b1f2a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion paddle/phi/kernels/gpu/batch_norm_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,10 @@ void BatchNormKernel(const Context &ctx,
// static_cast<void *>(saved_variance->template mutable_data<
// BatchNormParamType<T>>(ctx.GetPlace()))));
#else
const bool use_native_kernel = (x_dims.size() == 2 && N >= 131070);
// CUDNN PER_ACTIVATION mode only support small batch size
const size_t CUDNN_PER_ACTIVATION_THRESHOLD = 131070;
const bool use_native_kernel =
(x_dims.size() == 2 && N >= CUDNN_PER_ACTIVATION_THRESHOLD);
if (use_native_kernel) {
const int block = 512;
const int max_threads = ctx.GetMaxPhysicalThreadCount();
Expand Down

0 comments on commit 55b1f2a

Please sign in to comment.