diff --git a/paddle/phi/kernels/gpudnn/conv_grad_kernel.cu b/paddle/phi/kernels/gpudnn/conv_grad_kernel.cu index 985371ede9c5d627b416d598bfac6db95038d0d8..3696ab08ea83e6d3e03c04974fc0e0198396923e 100644 --- a/paddle/phi/kernels/gpudnn/conv_grad_kernel.cu +++ b/paddle/phi/kernels/gpudnn/conv_grad_kernel.cu @@ -627,6 +627,39 @@ void Conv3DCudnnGradKernel(const Context& dev_ctx, filter_grad); } +template +void DepthwiseConvCudnnGradKernel(const Context& dev_ctx, + const DenseTensor& input, + const DenseTensor& filter, + const DenseTensor& out_grad, + const std::vector& strides, + const std::vector& paddings, + const std::string& paddding_algorithm, + int groups, + const std::vector& dilations, + const std::string& data_format, + bool use_addto, + int workspace_size_MB, + bool exhaustive_search, + DenseTensor* input_grad, + DenseTensor* filter_grad) { + ConvCudnnGradKernel(dev_ctx, + input, + filter, + out_grad, + strides, + paddings, + paddding_algorithm, + groups, + dilations, + data_format, + use_addto, + workspace_size_MB, + exhaustive_search, + input_grad, + filter_grad); +} + } // namespace phi #ifdef PADDLE_WITH_HIP @@ -643,6 +676,13 @@ PD_REGISTER_KERNEL(conv3d_grad, phi::Conv3DCudnnGradKernel, float, phi::dtype::float16) {} + +PD_REGISTER_KERNEL(depthwise_conv2d_grad, + GPUDNN, + ALL_LAYOUT, + phi::DepthwiseConvCudnnGradKernel, + float, + phi::dtype::float16) {} #else #if CUDNN_VERSION_MIN(8, 1, 0) PD_REGISTER_KERNEL(conv2d_grad, diff --git a/paddle/phi/kernels/gpudnn/conv_kernel.cu b/paddle/phi/kernels/gpudnn/conv_kernel.cu index 37f66e0b25a618b3a431c8715f6c0e14c92cddd9..d40cbecaee6d51d78da5e55f45109257ab5cbbb5 100644 --- a/paddle/phi/kernels/gpudnn/conv_kernel.cu +++ b/paddle/phi/kernels/gpudnn/conv_kernel.cu @@ -416,6 +416,35 @@ void Conv3DCudnnKernel(const Context& dev_ctx, out); } +template +void DepthwiseConvCudnnKernel(const Context& dev_ctx, + const DenseTensor& input, + const DenseTensor& filter, + const std::vector& strides, + const std::vector& paddings, + const std::string& padding_algorithm, + int groups, + const std::vector& dilations, + const std::string& data_format, + bool use_addto, + int workspace_size_MB, + bool exhaustive_search, + DenseTensor* out) { + ConvCudnnKernel(dev_ctx, + input, + filter, + strides, + paddings, + padding_algorithm, + groups, + dilations, + data_format, + use_addto, + workspace_size_MB, + exhaustive_search, + out); +} + } // namespace phi #ifdef PADDLE_WITH_HIP @@ -432,6 +461,14 @@ PD_REGISTER_KERNEL(conv3d, phi::Conv3DCudnnKernel, float, phi::dtype::float16) {} + +PD_REGISTER_KERNEL(depthwise_conv2d, + GPUDNN, + ALL_LAYOUT, + phi::DepthwiseConvCudnnKernel, + float, + phi::dtype::float16) {} + #else #if CUDNN_VERSION_MIN(8, 1, 0) PD_REGISTER_KERNEL(conv2d,