From 8db6eb5d068d572829051ed9f9f515133dbeedf1 Mon Sep 17 00:00:00 2001 From: Denes Tarjan Date: Tue, 4 Feb 2025 11:56:26 +0000 Subject: [PATCH] Update public docker image to llvm-21, clang-format-20 and clang-tidy-20 --- .devcontainer/Dockerfile | 2 +- .gitlab-ci.yml | 2 +- docker/Dockerfile | 6 +-- kleidicv/src/conversions/float_conv_neon.cpp | 8 +-- kleidicv_thread/src/kleidicv_thread.cpp | 51 ++++++++++++-------- scripts/ci.sh | 2 +- scripts/format.sh | 4 +- test/api/test_exp.cpp | 2 +- test/api/test_scale.cpp | 5 +- 9 files changed, 48 insertions(+), 34 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 5d5fb90d5..3f4077bda 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # If changing this image ID, please also change it in .gitlab-ci.yml -FROM registry.gitlab.arm.com/kleidi/kleidicv:16 +FROM registry.gitlab.arm.com/kleidi/kleidicv:17 RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4e53f0e17..4d2edb3bf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # If changing this image ID, please also change it in .devcontainer/Dockerfile -image: registry.gitlab.arm.com/kleidi/kleidicv:16 +image: registry.gitlab.arm.com/kleidi/kleidicv:17 variables: KUBERNETES_CPU_REQUEST: "16" diff --git a/docker/Dockerfile b/docker/Dockerfile index 52796c12f..628a07ce8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -30,9 +30,9 @@ RUN apt-get update \ # Install latest version of most LLVM tools except clang-format and clang-tidy # because we prioritise stability when it comes to how we format our code and # which cland-tidy checks we expect. -ENV LLVM_VERSION=20 -ENV CLANG_FORMAT_VERSION=19 -ENV CLANG_TIDY_VERSION=19 +ENV LLVM_VERSION=21 +ENV CLANG_FORMAT_VERSION=20 +ENV CLANG_TIDY_VERSION=20 RUN wget -q https://apt.llvm.org/llvm-snapshot.gpg.key -O /etc/apt/trusted.gpg.d/apt.llvm.org.asc \ && echo "ce6eee4130298f79b0e0f09a89f93c1bc711cd68e7e3182d37c8e96c5227e2f0 /etc/apt/trusted.gpg.d/apt.llvm.org.asc" | sha256sum -c - \ diff --git a/kleidicv/src/conversions/float_conv_neon.cpp b/kleidicv/src/conversions/float_conv_neon.cpp index a50f6fbe5..e220dd914 100644 --- a/kleidicv/src/conversions/float_conv_neon.cpp +++ b/kleidicv/src/conversions/float_conv_neon.cpp @@ -137,8 +137,8 @@ s8_to_f32(const int8_t* src, size_t src_stride, float* dst, size_t dst_stride, dst[x] = src[x]; } - src += src_stride / sizeof(*src); - dst += dst_stride / sizeof(*dst); + src += static_cast(src_stride / sizeof(*src)); + dst += static_cast(dst_stride / sizeof(*dst)); } return KLEIDICV_OK; } @@ -182,8 +182,8 @@ u8_to_f32(const uint8_t* src, size_t src_stride, float* dst, size_t dst_stride, dst[x] = src[x]; } - src += src_stride / sizeof(*src); - dst += dst_stride / sizeof(*dst); + src += static_cast(src_stride / sizeof(*src)); + dst += static_cast(dst_stride / sizeof(*dst)); } return KLEIDICV_OK; } diff --git a/kleidicv_thread/src/kleidicv_thread.cpp b/kleidicv_thread/src/kleidicv_thread.cpp index 466994915..d3c77db97 100644 --- a/kleidicv_thread/src/kleidicv_thread.cpp +++ b/kleidicv_thread/src/kleidicv_thread.cpp @@ -5,6 +5,7 @@ #include "kleidicv_thread/kleidicv_thread.h" #include +#include #include #include #include @@ -75,9 +76,10 @@ inline kleidicv_error_t kleidicv_thread_unary_op_impl( F f, kleidicv_thread_multithreading mt, const SrcT *src, size_t src_stride, DstT *dst, size_t dst_stride, size_t width, size_t height, Args... args) { auto callback = [=](unsigned begin, unsigned end) { - return f(src + begin * src_stride / sizeof(SrcT), src_stride, - dst + begin * dst_stride / sizeof(DstT), dst_stride, width, - end - begin, args...); + return f(src + static_cast(begin * src_stride / sizeof(SrcT)), + src_stride, + dst + static_cast(begin * dst_stride / sizeof(DstT)), + dst_stride, width, end - begin, args...); }; return parallel_batches(callback, mt, height); } @@ -88,10 +90,13 @@ inline kleidicv_error_t kleidicv_thread_binary_op_impl( size_t src_a_stride, const SrcT *src_b, size_t src_b_stride, DstT *dst, size_t dst_stride, size_t width, size_t height, Args... args) { auto callback = [=](unsigned begin, unsigned end) { - return f(src_a + begin * src_a_stride / sizeof(SrcT), src_a_stride, - src_b + begin * src_b_stride / sizeof(SrcT), src_b_stride, - dst + begin * dst_stride / sizeof(DstT), dst_stride, width, - end - begin, args...); + return f( + src_a + static_cast(begin * src_a_stride / sizeof(SrcT)), + src_a_stride, + src_b + static_cast(begin * src_b_stride / sizeof(SrcT)), + src_b_stride, + dst + static_cast(begin * dst_stride / sizeof(DstT)), + dst_stride, width, end - begin, args...); }; return parallel_batches(callback, mt, height); } @@ -668,11 +673,12 @@ kleidicv_error_t kleidicv_thread_remap_s16_u8( return KLEIDICV_ERROR_NOT_IMPLEMENTED; } auto callback = [=](unsigned begin, unsigned end) { - return kleidicv_remap_s16_u8(src, src_stride, src_width, src_height, - dst + begin * dst_stride / sizeof(uint8_t), - dst_stride, dst_width, end - begin, channels, - mapxy + begin * mapxy_stride / sizeof(int16_t), - mapxy_stride, border_type, border_value); + return kleidicv_remap_s16_u8( + src, src_stride, src_width, src_height, + dst + begin * dst_stride / sizeof(uint8_t), dst_stride, dst_width, + end - begin, channels, + mapxy + static_cast(begin * mapxy_stride / sizeof(int16_t)), + mapxy_stride, border_type, border_value); }; return parallel_batches(callback, mt, dst_height); } @@ -691,8 +697,9 @@ kleidicv_error_t kleidicv_thread_remap_s16_u16( auto callback = [=](unsigned begin, unsigned end) { return kleidicv_remap_s16_u16( src, src_stride, src_width, src_height, - dst + begin * dst_stride / sizeof(uint16_t), dst_stride, dst_width, - end - begin, channels, mapxy + begin * mapxy_stride / sizeof(int16_t), + dst + static_cast(begin * dst_stride / sizeof(uint16_t)), + dst_stride, dst_width, end - begin, channels, + mapxy + static_cast(begin * mapxy_stride / sizeof(int16_t)), mapxy_stride, border_type, border_value); }; return parallel_batches(callback, mt, dst_height); @@ -714,8 +721,11 @@ kleidicv_error_t kleidicv_thread_remap_s16point5_u8( return kleidicv_remap_s16point5_u8( src, src_stride, src_width, src_height, dst + begin * dst_stride / sizeof(uint8_t), dst_stride, dst_width, - end - begin, channels, mapxy + begin * mapxy_stride / sizeof(int16_t), - mapxy_stride, mapfrac + begin * mapfrac_stride / sizeof(uint16_t), + end - begin, channels, + mapxy + static_cast(begin * mapxy_stride / sizeof(int16_t)), + mapxy_stride, + mapfrac + + static_cast(begin * mapfrac_stride / sizeof(uint16_t)), mapfrac_stride, border_type, border_value); }; return parallel_batches(callback, mt, dst_height); @@ -736,9 +746,12 @@ kleidicv_error_t kleidicv_thread_remap_s16point5_u16( auto callback = [=](unsigned begin, unsigned end) { return kleidicv_remap_s16point5_u16( src, src_stride, src_width, src_height, - dst + begin * dst_stride / sizeof(uint16_t), dst_stride, dst_width, - end - begin, channels, mapxy + begin * mapxy_stride / sizeof(int16_t), - mapxy_stride, mapfrac + begin * mapfrac_stride / sizeof(uint16_t), + dst + static_cast(begin * dst_stride / sizeof(uint16_t)), + dst_stride, dst_width, end - begin, channels, + mapxy + static_cast(begin * mapxy_stride / sizeof(int16_t)), + mapxy_stride, + mapfrac + + static_cast(begin * mapfrac_stride / sizeof(uint16_t)), mapfrac_stride, border_type, border_value); }; return parallel_batches(callback, mt, dst_height); diff --git a/scripts/ci.sh b/scripts/ci.sh index 452593782..80a9671f4 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -39,7 +39,7 @@ doxygen # Build cmake -S . -B build -G Ninja \ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON \ - -DCMAKE_CXX_CLANG_TIDY=clang-tidy-19 \ + -DCMAKE_CXX_CLANG_TIDY=clang-tidy-20 \ -DCMAKE_CXX_FLAGS="--target=aarch64-linux-gnu --coverage" \ -DCMAKE_EXE_LINKER_FLAGS="--rtlib=compiler-rt -static -fuse-ld=lld" \ -DKLEIDICV_ENABLE_SME2=ON \ diff --git a/scripts/format.sh b/scripts/format.sh index 121a43ca2..df56b4647 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -8,7 +8,7 @@ # # Options: # CHECK_ONLY: If set to 'ON', the script exists with non-zero value if source is not formatted. Defaults to 'OFF'. -# CLANG_FORMAT_BIN_PATH: Clang-format binary, defaults to 'clang-format=19'. +# CLANG_FORMAT_BIN_PATH: Clang-format binary, defaults to 'clang-format=20'. # VERBOSE: If set to 'ON', verbose output is printed. Defaults to 'OFF'. # ------------------------------------------------------------------------------ @@ -23,7 +23,7 @@ SCRIPT_PATH="$(realpath "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")" KLEIDICV_ROOT_PATH="$(realpath "${SCRIPT_PATH}"/..)" : "${CHECK_ONLY:=OFF}" -: "${CLANG_FORMAT_BIN_PATH:=clang-format-19}" +: "${CLANG_FORMAT_BIN_PATH:=clang-format-20}" : "${VERBOSE:=OFF}" # ------------------------------------------------------------------------------ diff --git a/test/api/test_exp.cpp b/test/api/test_exp.cpp index 33fa48953..e8cdebe1a 100644 --- a/test/api/test_exp.cpp +++ b/test/api/test_exp.cpp @@ -44,7 +44,7 @@ class ExpTestSpecial final : public UnaryOperationTest { public: ExpTestSpecial() : test_elements_(input_values().size()) { - auto inputs = input_values(); + const std::vector& inputs = input_values(); for (size_t i = 0; i < inputs.size(); ++i) { test_elements_[i].values[0] = inputs[i]; diff --git a/test/api/test_scale.cpp b/test/api/test_scale.cpp index 0b4a20dc0..0d404cfe5 100644 --- a/test/api/test_scale.cpp +++ b/test/api/test_scale.cpp @@ -166,10 +166,11 @@ class ScaleTestLinearBase { test::Array2D& expected) { for (size_t hindex = 0; hindex < source.height(); ++hindex) { for (size_t vindex = 0; vindex < source.width(); ++vindex) { - // NOLINTBEGIN(clang-analyzer-core.uninitialized.Assign) + // clang-tidy cannot detect that source is fully initialized + // NOLINTBEGIN(clang-analyzer-core.uninitialized.Assign,clang-analyzer-core.CallAndMessage) *expected.at(hindex, vindex) = scale_operation()( *source.at(hindex, vindex), scale(), shift()); - // NOLINTEND(clang-analyzer-core.uninitialized.Assign) + // NOLINTEND(clang-analyzer-core.uninitialized.Assign,clang-analyzer-core.CallAndMessage) } } } -- GitLab