From 2434960d8c9cd35b8dd861508cbe24ae09840384 Mon Sep 17 00:00:00 2001 From: ysh329 Date: Wed, 17 Mar 2021 13:42:28 +0800 Subject: [PATCH] [BugFix][OpenCL] Fix GenerateLocalByGlobal with CL_INVALID_WORK_GROUP_SIZE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > CL_INVALID_WORK_GROUP_SIZE if local_work_size is specified and number of work-items specified by global_work_size is not evenly divisable by size of work-group given by local_work_size or does not match the work-group size specified for kernel using the __attribute__((reqd_work_group_size(X, Y, Z))) qualifier in program source. --- mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.cc b/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.cc index 5df0f217650..a9801021f5a 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.cc @@ -338,7 +338,9 @@ std::set OpenCLKernel::GenerateLocalByGlobal(size_t global_i) { std::set local_ = {}; int index = 1; while (index <= global_i) { - local_.insert(index); + if (global_i % index == 0) { + local_.insert(index); + } index *= 2; } for (size_t i = 1; i <= 16; i++) {