Skip to content

Commit b347f0c

Browse files
yucai-intelpytorchmergebot
authored andcommitted
Add xpu backend for depthwise_conv2d/3d Ops
1 parent cc2decd commit b347f0c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

aten/src/ATen/native/Convolution.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ struct ConvParams {
603603
// nInputPlane and nInputPlane == nOutputPlane (the latter due to the lack of
604604
// a depthwise multiplier)
605605
bool is_depthwise(const at::Tensor& input, const at::Tensor& weight) const {
606-
return input.is_cuda() &&
606+
return (input.is_cuda() || input.is_xpu()) &&
607607
!transposed &&
608608
(input.ndimension() == 4 || input.ndimension() == 5) &&
609609
at::symint::size<T>(input, 1) == groups &&
@@ -1219,6 +1219,12 @@ ConvBackend _select_conv_backend(
12191219
return ConvBackend::Cudnn;
12201220
} else if (params.use_miopen(input, weight, bias_sizes_opt.has_value())) {
12211221
return ConvBackend::MiopenDepthwise;
1222+
} else if (params.use_mkldnn(input, weight)) {
1223+
if (params.transposed) {
1224+
return ConvBackend::MkldnnTranspose;
1225+
} else {
1226+
return ConvBackend::Mkldnn;
1227+
}
12221228
} else {
12231229
if (input.ndimension() == 4) {
12241230
return ConvBackend::CudaDepthwise2d;

0 commit comments

Comments
 (0)