From 97e258000f99c6a5f872f4e8968eaf6a93de2cf7 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Thu, 25 Mar 2021 12:37:45 +0000 Subject: Check biases pointer before referencing in CLDirectConvolutionLayer The biases input can be nullptr, hence we need to check before referencing. A test is also added to ensure a successful configure and run of Direct Convolution when there is no bias. Resolves: COMPMID-4315 Change-Id: I23223efd6ced81215aff490221fb4606945c139b Signed-off-by: Michele Di Giorgio Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5322 Tested-by: Arm Jenkins Reviewed-by: James Conroy Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins --- src/core/CL/CLKernelLibrary.cpp | 3 ++- src/core/CL/cl_kernels/direct_convolution.cl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/CL/CLKernelLibrary.cpp b/src/core/CL/CLKernelLibrary.cpp index 726efa3575..2652884912 100644 --- a/src/core/CL/CLKernelLibrary.cpp +++ b/src/core/CL/CLKernelLibrary.cpp @@ -901,12 +901,13 @@ std::string CLKernelLibrary::get_program_name(const std::string &kernel_name) co void CLKernelLibrary::init(std::string kernel_path, cl::Context context, cl::Device device) { _compile_context = CLCompileContext(context, device); - _kernel_path = kernel_path; + _kernel_path = kernel_path + "/"; } void CLKernelLibrary::set_kernel_path(const std::string &kernel_path) { _kernel_path = std::move(kernel_path); + _kernel_path += "/"; } cl::Context &CLKernelLibrary::context() diff --git a/src/core/CL/cl_kernels/direct_convolution.cl b/src/core/CL/cl_kernels/direct_convolution.cl index 1de3737965..dde024faa4 100644 --- a/src/core/CL/cl_kernels/direct_convolution.cl +++ b/src/core/CL/cl_kernels/direct_convolution.cl @@ -105,8 +105,9 @@ __kernel void direct_convolution_nhwc( TENSOR4D(src, SRC_TENSOR_TYPE), TENSOR4D(dst, DST_TENSOR_TYPE), - TENSOR4D(wei, WEI_TENSOR_TYPE), + TENSOR4D(wei, WEI_TENSOR_TYPE) #if defined(HAS_BIAS) + , VECTOR_DECLARATION(bia) #endif // defined(HAS_BIAS) ) -- cgit v1.2.1