From 2e4ad3ab7182cbc666af3a5c32d59bbd7cf710b7 Mon Sep 17 00:00:00 2001 From: "Chereshnev, Eugene" Date: Tue, 5 Apr 2022 13:25:02 -0700 Subject: [PATCH] gpu: jit: conv: fix zero padding with sum --- src/gpu/jit/conv/post_op_support.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gpu/jit/conv/post_op_support.hpp b/src/gpu/jit/conv/post_op_support.hpp index 9166a420bdb..b9b6955e70f 100644 --- a/src/gpu/jit/conv/post_op_support.hpp +++ b/src/gpu/jit/conv/post_op_support.hpp @@ -396,7 +396,12 @@ class post_op_context_t { if (!eltwise_fwd_pd_t::eltwise_preserves_zero(po.eltwise)) return true; } else if (po.is_sum(/*require_scale_one=*/false)) { - // Preserves zero padding. + for (int j = 0; j < cp_ndims(); j++) { + if (!is_cp_dim_zero_padded(j)) continue; + // Size one dimensions are treated as broadcast which does + // not preserve zero padding with block updates. + if (cp_view_.vdims()[j] == 1) return true; + } } else if (po.is_binary()) { for (int j = 0; j < cp_ndims(); j++) { if (!is_cp_dim_zero_padded(j)) continue;