aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiCong Li <sicong.li@arm.com>2023-11-14 15:17:10 +0000
committerAnitha Raj <anitha.raj@arm.com>2023-11-15 14:16:26 +0000
commit26c68a0e5f555e316cab18352fa3b62f22af8bfb (patch)
treef8a24f6cda3c05335e752aeba5a5f3e0286ac15e
parentc107c9329d258f684c5834ad7bf607fc7cb7305e (diff)
downloadComputeLibrary-26c68a0e5f555e316cab18352fa3b62f22af8bfb.tar.gz
Fix various coverity issues
Resolves COMPMID-6677 Signed-off-by: SiCong Li <sicong.li@arm.com> Change-Id: I99bf2385f6edc0836faacb31f5c66ed4fb051e40 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10729 Benchmark: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Viet-Hoa Do <viet-hoa.do@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--src/core/CL/CLMutableCommandBuffer.cpp7
-rw-r--r--src/cpu/operators/internal/CpuGemmAssemblyDispatch.cpp6
-rw-r--r--src/gpu/cl/operators/ClMatMul.cpp2
-rw-r--r--src/runtime/CL/CLMemoryRegion.cpp11
4 files changed, 20 insertions, 6 deletions
diff --git a/src/core/CL/CLMutableCommandBuffer.cpp b/src/core/CL/CLMutableCommandBuffer.cpp
index 05b351fc25..0e078d8416 100644
--- a/src/core/CL/CLMutableCommandBuffer.cpp
+++ b/src/core/CL/CLMutableCommandBuffer.cpp
@@ -26,6 +26,7 @@
#include "arm_compute/core/Error.h"
+#include "src/common/utils/Log.h"
#include "src/core/CL/CLUtils.h"
namespace arm_compute
@@ -48,7 +49,11 @@ CLMutableCommandBuffer::CLMutableCommandBuffer(cl_command_queue queue) : CLComma
CLMutableCommandBuffer::~CLMutableCommandBuffer()
{
const auto status = clReleaseCommandBufferKHR(_cb);
- handle_cl_error("clReleaseCommandBufferKHR", status);
+ if (status != CL_SUCCESS)
+ {
+ const std::string error_message = "clReleaseCommandBufferKHR - Error code: " + std::to_string(status);
+ ARM_COMPUTE_LOG_ERROR_ACL(error_message);
+ }
}
void CLMutableCommandBuffer::add_kernel(cl_kernel kernel,
diff --git a/src/cpu/operators/internal/CpuGemmAssemblyDispatch.cpp b/src/cpu/operators/internal/CpuGemmAssemblyDispatch.cpp
index 82bd465c99..611bc76463 100644
--- a/src/cpu/operators/internal/CpuGemmAssemblyDispatch.cpp
+++ b/src/cpu/operators/internal/CpuGemmAssemblyDispatch.cpp
@@ -541,6 +541,7 @@ void Fallback<TypeInput, TypeOutput, OutputStage>::prepare(ITensorPack &tensors)
{
auto b = tensors.get_const_tensor(TensorType::ACL_SRC_1);
auto c = tensors.get_const_tensor(TensorType::ACL_SRC_2);
+ ARM_COMPUTE_ERROR_ON_NULLPTR(b);
// Setup up matrix bias in the assembly kernel, it's just a pointer to matrix C.
if (c && c->info()->data_type() == DataType::S32)
@@ -614,6 +615,7 @@ void Fallback<TypeInput, TypeOutput, OutputStage>::run(ITensorPack &tensors)
auto b = tensors.get_const_tensor(TensorType::ACL_SRC_1);
auto c = tensors.get_const_tensor(TensorType::ACL_SRC_2);
auto d = tensors.get_tensor(TensorType::ACL_DST);
+ ARM_COMPUTE_ERROR_ON_NULLPTR(a, d);
int lda = a->info()->strides_in_bytes().y() / a->info()->element_size();
int ldb = 0;
@@ -652,7 +654,7 @@ void Fallback<TypeInput, TypeOutput, OutputStage>::run(ITensorPack &tensors)
}
// Check if B is pre-tranposed and de-reference if not
- if (!_gemm_kernel_asm->B_is_pretransposed())
+ if (b_to_use && !_gemm_kernel_asm->B_is_pretransposed())
{
ldb = b_to_use->info()->strides_in_bytes().y() / b_to_use->info()->element_size();
multi_stride_b = b_to_use->info()->strides_in_bytes().z() / b_to_use->info()->element_size();
@@ -670,7 +672,7 @@ void Fallback<TypeInput, TypeOutput, OutputStage>::run(ITensorPack &tensors)
}
// Pretranspose B if required
- if (_B_pretranspose_required)
+ if (b_to_use && _B_pretranspose_required)
{
// Fixed format kernels need no pretranspose.
ARM_COMPUTE_ERROR_ON(arm_compute::is_fixed_format(
diff --git a/src/gpu/cl/operators/ClMatMul.cpp b/src/gpu/cl/operators/ClMatMul.cpp
index 9962ee550a..43303001d0 100644
--- a/src/gpu/cl/operators/ClMatMul.cpp
+++ b/src/gpu/cl/operators/ClMatMul.cpp
@@ -91,8 +91,6 @@ MatMulKernelType get_matmul_kernel(const ITensorInfo *lhs,
return MatMulKernelType::NATIVE_FP;
}
-
- return is_quantized ? MatMulKernelType::NATIVE_QUANTIZED : MatMulKernelType::NATIVE_FP;
}
} // namespace
using namespace arm_compute::opencl::kernels;
diff --git a/src/runtime/CL/CLMemoryRegion.cpp b/src/runtime/CL/CLMemoryRegion.cpp
index 835958b816..c9ddf9b85c 100644
--- a/src/runtime/CL/CLMemoryRegion.cpp
+++ b/src/runtime/CL/CLMemoryRegion.cpp
@@ -26,6 +26,8 @@
#include "arm_compute/core/Error.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
+#include "src/common/utils/Log.h"
+
namespace arm_compute
{
ICLMemoryRegion::ICLMemoryRegion(size_t size)
@@ -72,7 +74,14 @@ CLBufferMemoryRegion::~CLBufferMemoryRegion()
// Flush the command queue to ensure all commands that may use this memory buffer are scheduled to be finished before
// this buffer is freed
// Do not call finish as it is a blocking call which affects the performance
- CLScheduler::get().queue().flush();
+ try
+ {
+ CLScheduler::get().queue().flush();
+ }
+ catch (const std::exception &e)
+ {
+ ARM_COMPUTE_LOG_ERROR_ACL(e.what());
+ }
}
void *CLBufferMemoryRegion::ptr()