@@ -2178,22 +2178,22 @@ vectorizePadOpPrecondition(tensor::PadOp padOp,
21782178 inputVectorSizes)))
21792179 return failure ();
21802180
2181- // Low padding is currently unsupported for the general case as this
2182- // would require shifting the results to the right for the low padded dims by
2183- // the required amount of low padding. However, we do support low padding if
2184- // the dims being low padded have result sizes of 1. The reason is when we
2185- // have a low pad on a unit result dim, the input size of that dimension will
2186- // be dynamically zero (as the sum of the low pad and input dim size has to be
2187- // one) and hence we will create a zero mask as the lowering logic just makes
2188- // the mask one for the input dim size - which is zero here. Hence we will
2189- // load the pad value which is what we want in this case. If the low pad is
2190- // dynamically zero then the lowering is correct as well as no shifts are
2191- // necessary.
2181+ // Padding with non-zero low pad values is not supported, unless the
2182+ // corresponding result dim is 1 as this would require shifting the results to
2183+ // the right for the low padded dims by the required amount of low padding.
2184+ // However, we do support low padding if the dims being low padded have result
2185+ // sizes of 1. The reason is when we have a low pad on a unit result dim, the
2186+ // input size of that dimension will be dynamically zero (as the sum of the
2187+ // low pad and input dim size has to be one) and hence we will create a zero
2188+ // mask as the lowering logic just makes the mask one for the input dim size -
2189+ // which is zero here. Hence we will load the pad value which is what we want
2190+ // in this case. If the low pad is dynamically zero then the lowering is
2191+ // correct as well as no shifts are necessary.
21922192 if (llvm::any_of (llvm::enumerate (padOp.getLow ()), [&](const auto &en) {
21932193 Value padValue = en.value ();
21942194 unsigned pos = en.index ();
2195- std::optional<int64_t > res = getConstantIntValue (padValue);
2196- return (!res .has_value () || res .value () != 0 ) &&
2195+ std::optional<int64_t > pad = getConstantIntValue (padValue);
2196+ return (!pad .has_value () || pad .value () != 0 ) &&
21972197 resultTensorShape[pos] != 1 ;
21982198 })) {
21992199 LDBG (" low pad must all be zero for all non unit dims: " << padOp << " \n " );
0 commit comments