From afd38f0c617d6f89b2b4532c6c44f116617e2b6f Mon Sep 17 00:00:00 2001 From: Felix Thomasmathibalan Date: Wed, 27 Sep 2023 17:46:17 +0100 Subject: Apply clang-format on repository Code is formatted as per a revised clang format configuration file(not part of this delivery). Version 14.0.6 is used. Exclusion List: - files with .cl extension - files that are not strictly C/C++ (e.g. Android.bp, Sconscript ...) And the following directories - compute_kernel_writer/validation/ - tests/ - include/ - src/core/NEON/kernels/convolution/ - src/core/NEON/kernels/arm_gemm/ - src/core/NEON/kernels/arm_conv/ - data/ There will be a follow up for formatting of .cl files and the files under tests/ and compute_kernel_writer/validation/. Signed-off-by: Felix Thomasmathibalan Change-Id: Ib7eb1fcf4e7537b9feaefcfc15098a804a3fde0a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10391 Benchmark: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Gunes Bayir --- src/core/Validate.cpp | 115 +++++++++++++++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 43 deletions(-) (limited to 'src/core/Validate.cpp') diff --git a/src/core/Validate.cpp b/src/core/Validate.cpp index 5a6486e11e..d8f796193e 100644 --- a/src/core/Validate.cpp +++ b/src/core/Validate.cpp @@ -23,13 +23,16 @@ */ #include "arm_compute/core/Validate.h" -arm_compute::Status arm_compute::error_on_mismatching_windows(const char *function, const char *file, const int line, - const arm_compute::Window &full, const arm_compute::Window &win) +arm_compute::Status arm_compute::error_on_mismatching_windows(const char *function, + const char *file, + const int line, + const arm_compute::Window &full, + const arm_compute::Window &win) { full.validate(); win.validate(); - for(size_t i = 0; i < arm_compute::Coordinates::num_max_dimensions; ++i) + for (size_t i = 0; i < arm_compute::Coordinates::num_max_dimensions; ++i) { ARM_COMPUTE_RETURN_ERROR_ON_LOC(full[i].start() != win[i].start(), function, file, line); ARM_COMPUTE_RETURN_ERROR_ON_LOC(full[i].end() != win[i].end(), function, file, line); @@ -38,13 +41,16 @@ arm_compute::Status arm_compute::error_on_mismatching_windows(const char *functi return arm_compute::Status{}; } -arm_compute::Status arm_compute::error_on_invalid_subwindow(const char *function, const char *file, const int line, - const arm_compute::Window &full, const arm_compute::Window &sub) +arm_compute::Status arm_compute::error_on_invalid_subwindow(const char *function, + const char *file, + const int line, + const arm_compute::Window &full, + const arm_compute::Window &sub) { full.validate(); sub.validate(); - for(size_t i = 0; i < arm_compute::Coordinates::num_max_dimensions; ++i) + for (size_t i = 0; i < arm_compute::Coordinates::num_max_dimensions; ++i) { ARM_COMPUTE_RETURN_ERROR_ON_LOC(full[i].start() > sub[i].start(), function, file, line); ARM_COMPUTE_RETURN_ERROR_ON_LOC(full[i].end() < sub[i].end(), function, file, line); @@ -54,8 +60,12 @@ arm_compute::Status arm_compute::error_on_invalid_subwindow(const char *function return arm_compute::Status{}; } -arm_compute::Status arm_compute::error_on_window_not_collapsable_at_dimension(const char *function, const char *file, const int line, - const arm_compute::Window &full, const arm_compute::Window &window, const int dim) +arm_compute::Status arm_compute::error_on_window_not_collapsable_at_dimension(const char *function, + const char *file, + const int line, + const arm_compute::Window &full, + const arm_compute::Window &window, + const int dim) { full.validate(); window.validate(); @@ -67,65 +77,73 @@ arm_compute::Status arm_compute::error_on_window_not_collapsable_at_dimension(co return arm_compute::Status{}; } -arm_compute::Status arm_compute::error_on_coordinates_dimensions_gte(const char *function, const char *file, const int line, - const arm_compute::Coordinates &pos, unsigned int max_dim) +arm_compute::Status arm_compute::error_on_coordinates_dimensions_gte( + const char *function, const char *file, const int line, const arm_compute::Coordinates &pos, unsigned int max_dim) { - for(unsigned int i = max_dim; i < arm_compute::Coordinates::num_max_dimensions; ++i) + for (unsigned int i = max_dim; i < arm_compute::Coordinates::num_max_dimensions; ++i) { ARM_COMPUTE_RETURN_ERROR_ON_LOC(pos[i] != 0, function, file, line); } return arm_compute::Status{}; } -arm_compute::Status arm_compute::error_on_window_dimensions_gte(const char *function, const char *file, const int line, - const arm_compute::Window &win, unsigned int max_dim) +arm_compute::Status arm_compute::error_on_window_dimensions_gte( + const char *function, const char *file, const int line, const arm_compute::Window &win, unsigned int max_dim) { - for(unsigned int i = max_dim; i < arm_compute::Coordinates::num_max_dimensions; ++i) + for (unsigned int i = max_dim; i < arm_compute::Coordinates::num_max_dimensions; ++i) { - ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR((win[i].start() != 0) || (win[i].end() != win[i].step()), - function, file, line, - "Maximum number of dimensions expected %u but dimension %u is not empty", max_dim, i); + ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR( + (win[i].start() != 0) || (win[i].end() != win[i].step()), function, file, line, + "Maximum number of dimensions expected %u but dimension %u is not empty", max_dim, i); } return arm_compute::Status{}; } -arm_compute::Status arm_compute::error_on_tensor_not_2d(const char *function, const char *file, const int line, +arm_compute::Status arm_compute::error_on_tensor_not_2d(const char *function, + const char *file, + const int line, const arm_compute::ITensor *tensor) { ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line); ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor->info() == nullptr, function, file, line); - ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(tensor->info()->num_dimensions() != 2, - function, file, line, - "Only 2D Tensors are supported by this kernel (%zu passed)", tensor->info()->num_dimensions()); + ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(tensor->info()->num_dimensions() != 2, function, file, line, + "Only 2D Tensors are supported by this kernel (%zu passed)", + tensor->info()->num_dimensions()); return arm_compute::Status{}; } -arm_compute::Status arm_compute::error_on_tensor_not_2d(const char *function, const char *file, const int line, +arm_compute::Status arm_compute::error_on_tensor_not_2d(const char *function, + const char *file, + const int line, const arm_compute::ITensorInfo *tensor) { ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line); - ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(tensor->num_dimensions() != 2, - function, file, line, - "Only 2D Tensors are supported by this kernel (%zu passed)", tensor->num_dimensions()); + ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(tensor->num_dimensions() != 2, function, file, line, + "Only 2D Tensors are supported by this kernel (%zu passed)", + tensor->num_dimensions()); return arm_compute::Status{}; } -arm_compute::Status arm_compute::error_on_channel_not_in_known_format(const char *function, const char *file, const int line, - arm_compute::Format fmt, arm_compute::Channel cn) +arm_compute::Status arm_compute::error_on_channel_not_in_known_format( + const char *function, const char *file, const int line, arm_compute::Format fmt, arm_compute::Channel cn) { ARM_COMPUTE_RETURN_ERROR_ON_LOC(fmt == arm_compute::Format::UNKNOWN, function, file, line); ARM_COMPUTE_RETURN_ERROR_ON_LOC(cn == arm_compute::Channel::UNKNOWN, function, file, line); - switch(fmt) + switch (fmt) { case arm_compute::Format::RGB888: - arm_compute::error_on_channel_not_in(function, file, line, cn, arm_compute::Channel::R, arm_compute::Channel::G, arm_compute::Channel::B); + arm_compute::error_on_channel_not_in(function, file, line, cn, arm_compute::Channel::R, + arm_compute::Channel::G, arm_compute::Channel::B); break; case arm_compute::Format::RGBA8888: - arm_compute::error_on_channel_not_in(function, file, line, cn, arm_compute::Channel::R, arm_compute::Channel::G, arm_compute::Channel::B, arm_compute::Channel::A); + arm_compute::error_on_channel_not_in(function, file, line, cn, arm_compute::Channel::R, + arm_compute::Channel::G, arm_compute::Channel::B, + arm_compute::Channel::A); break; case arm_compute::Format::UV88: - arm_compute::error_on_channel_not_in(function, file, line, cn, arm_compute::Channel::U, arm_compute::Channel::V); + arm_compute::error_on_channel_not_in(function, file, line, cn, arm_compute::Channel::U, + arm_compute::Channel::V); break; case arm_compute::Format::IYUV: case arm_compute::Format::UYVY422: @@ -133,7 +151,8 @@ arm_compute::Status arm_compute::error_on_channel_not_in_known_format(const char case arm_compute::Format::NV12: case arm_compute::Format::NV21: case arm_compute::Format::YUV444: - arm_compute::error_on_channel_not_in(function, file, line, cn, arm_compute::Channel::Y, arm_compute::Channel::U, arm_compute::Channel::V); + arm_compute::error_on_channel_not_in(function, file, line, cn, arm_compute::Channel::Y, + arm_compute::Channel::U, arm_compute::Channel::V); break; default: ARM_COMPUTE_ERROR_LOC(function, file, line, "Not supported format."); @@ -141,21 +160,26 @@ arm_compute::Status arm_compute::error_on_channel_not_in_known_format(const char return arm_compute::Status{}; } -arm_compute::Status arm_compute::error_on_unconfigured_kernel(const char *function, const char *file, const int line, +arm_compute::Status arm_compute::error_on_unconfigured_kernel(const char *function, + const char *file, + const int line, const arm_compute::IKernel *kernel) { ARM_COMPUTE_RETURN_ERROR_ON_LOC(kernel == nullptr, function, file, line); - ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(!kernel->is_window_configured(), - function, file, line, + ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(!kernel->is_window_configured(), function, file, line, "This kernel hasn't been configured."); return arm_compute::Status{}; } -arm_compute::Status arm_compute::error_on_invalid_subtensor(const char *function, const char *file, const int line, - const TensorShape &parent_shape, const Coordinates &coords, const TensorShape &shape) +arm_compute::Status arm_compute::error_on_invalid_subtensor(const char *function, + const char *file, + const int line, + const TensorShape &parent_shape, + const Coordinates &coords, + const TensorShape &shape) { // Check dimensions - for(unsigned int i = 0; i < TensorShape::num_max_dimensions; ++i) + for (unsigned int i = 0; i < TensorShape::num_max_dimensions; ++i) { const bool invalid_idx = coords[i] >= static_cast(parent_shape[i]); const bool out_of_bounds_size = coords[i] + static_cast(shape[i]) > static_cast(parent_shape[i]); @@ -164,15 +188,20 @@ arm_compute::Status arm_compute::error_on_invalid_subtensor(const char *function return arm_compute::Status{}; } -arm_compute::Status arm_compute::error_on_invalid_subtensor_valid_region(const char *function, const char *file, const int line, - const ValidRegion &parent_valid_region, const ValidRegion &valid_region) +arm_compute::Status arm_compute::error_on_invalid_subtensor_valid_region(const char *function, + const char *file, + const int line, + const ValidRegion &parent_valid_region, + const ValidRegion &valid_region) { // Check valid regions - for(unsigned int d = 0; d < TensorShape::num_max_dimensions; ++d) + for (unsigned int d = 0; d < TensorShape::num_max_dimensions; ++d) { ARM_COMPUTE_RETURN_ERROR_ON_LOC((parent_valid_region.anchor[d] > valid_region.anchor[d]), function, file, line); - ARM_COMPUTE_RETURN_ERROR_ON_LOC((parent_valid_region.anchor[d] + static_cast(parent_valid_region.shape[d])) < (valid_region.anchor[d] + static_cast(valid_region.shape[d])), - function, file, line); + ARM_COMPUTE_RETURN_ERROR_ON_LOC( + (parent_valid_region.anchor[d] + static_cast(parent_valid_region.shape[d])) < + (valid_region.anchor[d] + static_cast(valid_region.shape[d])), + function, file, line); } return arm_compute::Status{}; -- cgit v1.2.1