未验证 提交 676c960c 编写于 作者: H hong 提交者: GitHub

add depthwise conv hip support (#41537) (#41603)

上级 9fb7dff3
...@@ -626,6 +626,39 @@ void Conv3DCudnnGradKernel(const Context& dev_ctx, ...@@ -626,6 +626,39 @@ void Conv3DCudnnGradKernel(const Context& dev_ctx,
filter_grad); filter_grad);
} }
template <typename T, typename Context>
void DepthwiseConvCudnnGradKernel(const Context& dev_ctx,
const DenseTensor& input,
const DenseTensor& filter,
const DenseTensor& out_grad,
const std::vector<int>& strides,
const std::vector<int>& paddings,
const std::string& paddding_algorithm,
int groups,
const std::vector<int>& dilations,
const std::string& data_format,
bool use_addto,
int workspace_size_MB,
bool exhaustive_search,
DenseTensor* input_grad,
DenseTensor* filter_grad) {
ConvCudnnGradKernel<T>(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 } // namespace phi
#ifdef PADDLE_WITH_HIP #ifdef PADDLE_WITH_HIP
...@@ -642,6 +675,13 @@ PD_REGISTER_KERNEL(conv3d_grad, ...@@ -642,6 +675,13 @@ PD_REGISTER_KERNEL(conv3d_grad,
phi::Conv3DCudnnGradKernel, phi::Conv3DCudnnGradKernel,
float, float,
phi::dtype::float16) {} phi::dtype::float16) {}
PD_REGISTER_KERNEL(depthwise_conv2d_grad,
GPUDNN,
ALL_LAYOUT,
phi::DepthwiseConvCudnnGradKernel,
float,
phi::dtype::float16) {}
#else #else
#if CUDNN_VERSION_MIN(8, 1, 0) #if CUDNN_VERSION_MIN(8, 1, 0)
PD_REGISTER_KERNEL(conv2d_grad, PD_REGISTER_KERNEL(conv2d_grad,
......
...@@ -418,6 +418,35 @@ void Conv3DCudnnKernel(const Context& dev_ctx, ...@@ -418,6 +418,35 @@ void Conv3DCudnnKernel(const Context& dev_ctx,
out); out);
} }
template <typename T, typename Context>
void DepthwiseConvCudnnKernel(const Context& dev_ctx,
const DenseTensor& input,
const DenseTensor& filter,
const std::vector<int>& strides,
const std::vector<int>& paddings,
const std::string& padding_algorithm,
int groups,
const std::vector<int>& dilations,
const std::string& data_format,
bool use_addto,
int workspace_size_MB,
bool exhaustive_search,
DenseTensor* out) {
ConvCudnnKernel<T>(dev_ctx,
input,
filter,
strides,
paddings,
padding_algorithm,
groups,
dilations,
data_format,
use_addto,
workspace_size_MB,
exhaustive_search,
out);
}
} // namespace phi } // namespace phi
#ifdef PADDLE_WITH_HIP #ifdef PADDLE_WITH_HIP
...@@ -434,6 +463,14 @@ PD_REGISTER_KERNEL(conv3d, ...@@ -434,6 +463,14 @@ PD_REGISTER_KERNEL(conv3d,
phi::Conv3DCudnnKernel, phi::Conv3DCudnnKernel,
float, float,
phi::dtype::float16) {} phi::dtype::float16) {}
PD_REGISTER_KERNEL(depthwise_conv2d,
GPUDNN,
ALL_LAYOUT,
phi::DepthwiseConvCudnnKernel,
float,
phi::dtype::float16) {}
#else #else
#if CUDNN_VERSION_MIN(8, 1, 0) #if CUDNN_VERSION_MIN(8, 1, 0)
PD_REGISTER_KERNEL(conv2d, PD_REGISTER_KERNEL(conv2d,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册