Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GPU] Fix uninitialized output in col2im kernel (#38208)

David Nam639a39e1fa6d
diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/col2im.cl b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/col2im.cl
index 650c1c6d32c..c7f1aa2c7e7 100644
--- a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/col2im.cl
+++ b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/col2im.cl
@@ -13,20 +13,10 @@ KERNEL(col2im)(const __global INPUT0_TYPE* input,
const int channel_offset = (batch * NUM_CHANNELS + channel_idx) * OUT_SIZE_0;
- for (int idx = 0; idx < KERNEL_PRODUCT; ++idx) {
- const int width_offset = (idx % KERNEL_SIZE_1) * DILATION_1 - PAD_BEGIN_1;
- const int height_offset = ((idx / KERNEL_SIZE_1) % KERNEL_SIZE_0) * DILATION_0 - PAD_BEGIN_0;
- const int max_width = MIN((ORIG_WIDTH * STRIDE_1), (OUT_SIZE_1 - width_offset));
- const int max_height = MIN((ORIG_HEIGHT * STRIDE_0), (OUT_SIZE_0-height_offset));
- const int min_width = MAX(((-width_offset)/STRIDE_1)*STRIDE_1, 0);
- const int min_height = MAX(((-height_offset)/STRIDE_0)*STRIDE_0, 0);
-
- for (int image_height_idx = min_height; image_height_idx < max_height; image_height_idx+=STRIDE_0) {
- for (int image_width_idx = min_width; image_width_idx < max_width; image_width_idx+=STRIDE_1) {
- const int img_idx = (channel_offset + image_height_idx + height_offset) * OUT_SIZE_1 + image_width_idx + width_offset;
- output[img_idx] = 0;
- }
- }
+ // fill output with zeros to account for values missing due to dilation and stride
+ const int plane_offset = channel_offset * OUT_SIZE_1;
+ for (int i = 0; i < OUT_SIZE_0 * OUT_SIZE_1; ++i) {
+ output[plane_offset + i] = 0;
}
for (int idx = 0; idx < KERNEL_PRODUCT; ++idx) {