From 6f59791d099167c947afe777e8aec2419ef3eda1 Mon Sep 17 00:00:00 2001 From: yejianwu Date: Wed, 18 Jul 2018 16:33:03 +0800 Subject: [PATCH] fix lws overflow --- mace/kernels/opencl/depthwise_conv.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mace/kernels/opencl/depthwise_conv.cc b/mace/kernels/opencl/depthwise_conv.cc index ec358d09..ca44be2f 100644 --- a/mace/kernels/opencl/depthwise_conv.cc +++ b/mace/kernels/opencl/depthwise_conv.cc @@ -38,7 +38,7 @@ std::vector LocalWS(const uint32_t *gws, const uint32_t kwg_size) { kwg_size / lws[1]); } } - lws[0] = std::max(lws[0], 1); + lws[0] = std::max(std::min(lws[0], kwg_size / lws[1]), 1); const uint32_t lws_size = lws[0] * lws[1]; lws[2] = std::min((cache_size / kernel_cache_size / lws_size) * 4, gws[2]); -- GitLab