From 6e56bf3b58719772111236d3b0030fbb5e8d2e16 Mon Sep 17 00:00:00 2001 From: Jakub Sujak Date: Wed, 23 Aug 2023 14:42:26 +0100 Subject: Revise clang-format configuration Clang-format options now match those in clang-format version 14. Remove Astyle checks as the same code style checks are provided by clang-format. Resolves: COMPMID-6576 Change-Id: Iefa9bb719826242a3276e9ca058d0c84624f7302 Signed-off-by: Felix Thomasmathibalan Signed-off-by: Jakub Sujak Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10399 Benchmark: Arm Jenkins Comments-Addressed: Arm Jenkins Reviewed-by: Gunes Bayir Tested-by: Arm Jenkins --- .clang-format | 125 +++++++++++++++++++++------------ .pre-commit-config.yaml | 41 +++++++++-- arm_compute/runtime/CL/CLFunctions.h | 20 +++--- arm_compute/runtime/NEON/NEFunctions.h | 18 ++--- compute_kernel_writer/.clang-format | 47 ------------- scripts/format_code.py | 45 +----------- scripts/include_functions_kernels.py | 6 +- src/core/CL/CLKernels.h | 12 ++-- src/core/NEON/NEKernels.h | 10 +-- 9 files changed, 153 insertions(+), 171 deletions(-) delete mode 100644 compute_kernel_writer/.clang-format diff --git a/.clang-format b/.clang-format index 01a1f0eadc..5f9346526e 100644 --- a/.clang-format +++ b/.clang-format @@ -1,48 +1,85 @@ +# Copyright (c) 2017, 2023 Arm Limited. +# +# SPDX-License-Identifier: MIT +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. --- Language: Cpp -AccessModifierOffset: '0' +BasedOnStyle: LLVM +Standard: c++14 +ColumnLimit: 120 + +# Override LLVM style options +AccessModifierOffset: -4 AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: 'true' -AlignConsecutiveDeclarations: 'true' -AlignEscapedNewlinesLeft: 'true' -AlignTrailingComments: 'true' -AllowShortBlocksOnASingleLine: 'false' -AllowShortCaseLabelsOnASingleLine: 'false' +AlignConsecutiveAssignments: Consecutive +AlignConsecutiveBitFields: Consecutive +AlignConsecutiveDeclarations: Consecutive +AlignConsecutiveMacros: Consecutive +AlignEscapedNewlines: Left AllowShortFunctionsOnASingleLine: None -AllowShortIfStatementsOnASingleLine: 'false' -AllowShortLoopsOnASingleLine: 'false' -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: 'true' -AlwaysBreakTemplateDeclarations: 'true' -BreakBeforeBinaryOperators: NonAssignment -BreakBeforeBraces: Allman -BreakBeforeTernaryOperators: 'false' -BreakConstructorInitializersBeforeComma: 'false' -#BreakStringLiterals: 'true' -ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' -Cpp11BracedListStyle: 'false' -DerivePointerAlignment: 'false' -IndentCaseLabels: 'true' -IndentWidth: '4' -IndentWrappedFunctionNames: 'false' -KeepEmptyLinesAtTheStartOfBlocks: 'false' -MaxEmptyLinesToKeep: '1' -NamespaceIndentation: None -PointerAlignment: Right -SortIncludes: 'true' -SpaceAfterCStyleCast: 'false' -SpaceBeforeAssignmentOperators: 'true' -SpaceBeforeParens: Never -SpaceInEmptyParentheses: 'false' -SpacesInAngles: 'false' -SpacesInCStyleCastParentheses: 'false' -SpacesInParentheses: 'false' -SpacesInSquareBrackets: 'false' -Standard: Cpp11 -TabWidth: '4' -UseTab: Never -ReflowComments: 'false' -ContinuationIndentWidth: '4' -ColumnLimit: 0 ---- +AlwaysBreakTemplateDeclarations: Yes +BinPackParameters: false +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: false + BeforeCatch: true + BeforeElse: true + BeforeLambdaBody: true + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBraces: Custom +IndentCaseLabels: true +IndentExternBlock: AfterExternBlock +IndentWidth: 4 +KeepEmptyLinesAtTheStartOfBlocks: false +PackConstructorInitializers: NextLine +ReflowComments: false + +# Includes order +SortIncludes: CaseInsensitive +IncludeBlocks: Regroup +IncludeCategories: + # Project headers + - Regex: '^"(arm_compute|ckw)/' + Priority: 1 + SortPriority: 1 + # Third-party headers + - Regex: '^"(cl|opencl|half|npy|stb)/' + Priority: 2 + SortPriority: 2 + # Private headers + - Regex: '^"(src|tests|examples|utils|support)/' + Priority: 3 + SortPriority: 3 + # System headers + - Regex: '.*' + Priority: 10 + SortPriority: 10 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9f3ae3709a..108f84387c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,37 @@ +# Copyright (c) 2023 Arm Limited. +# +# SPDX-License-Identifier: MIT +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. fail_fast: false -exclude: ^(data|include)/.* exclude: | (?x)^( data/.*| include/.*| src/CMakeLists.txt| src/Bazel.build| - Android.bp + Android.bp| + src/core/NEON/kernels/convolution/.*| + src/core/NEON/kernels/arm_gemm/.*| + src/core/NEON/kernels/arm_conv/.*| + compute_kernel_writer/validation/.* )$ repos: @@ -36,14 +60,23 @@ repos: name: Fix header guards in CKW stages: [commit] language: python - entry: python ./scripts/check_header_guards.py --extensions=h,hpp,inl --comment_style=double_slash --prefix=CKW --include=compute_kernel_writer/ --add_extension --drop_outermost_subdir + entry: python ./scripts/check_header_guards.py --extensions=h,hh,hpp,inl --comment_style=double_slash --prefix=CKW --include=compute_kernel_writer/ --add_extension --drop_outermost_subdir pass_filenames: true - id: fix-header-guards-acl name: Fix header guards in ACL stages: [commit] language: python - entry: python ./scripts/check_header_guards.py --extensions=h,hpp,inl --comment_style=double_slash --prefix=ACL --exclude=compute_kernel_writer/,src/core/NEON/kernels/convolution/,src/core/NEON/kernels/arm_gemm/,src/core/NEON/kernels/arm_conv/,include/ --add_extension + entry: python ./scripts/check_header_guards.py --extensions=h,hh,hpp,inl --comment_style=double_slash --prefix=ACL --exclude=compute_kernel_writer/,src/core/NEON/kernels/convolution/,src/core/NEON/kernels/arm_gemm/,src/core/NEON/kernels/arm_conv/,include/ --add_extension pass_filenames: true + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v14.0.6 + hooks: + - id: clang-format + files: .*\.(cpp|h|hpp|hh|cc|inl|c)$ + exclude: | + (?x)^( + tests/.* + )$ - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: diff --git a/arm_compute/runtime/CL/CLFunctions.h b/arm_compute/runtime/CL/CLFunctions.h index 26e459680c..cf757239cb 100644 --- a/arm_compute/runtime/CL/CLFunctions.h +++ b/arm_compute/runtime/CL/CLFunctions.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_CLFUNCTIONS_H -#define ARM_COMPUTE_CLFUNCTIONS_H +#ifndef ACL_ARM_COMPUTE_RUNTIME_CL_CLFUNCTIONS_H +#define ACL_ARM_COMPUTE_RUNTIME_CL_CLFUNCTIONS_H /* Header regrouping all the CL functions */ #include "arm_compute/runtime/CL/functions/CLActivationLayer.h" @@ -62,44 +62,44 @@ #include "arm_compute/runtime/CL/functions/CLFloor.h" #include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h" #include "arm_compute/runtime/CL/functions/CLFuseBatchNormalization.h" +#include "arm_compute/runtime/CL/functions/CLGather.h" #include "arm_compute/runtime/CL/functions/CLGEMM.h" #include "arm_compute/runtime/CL/functions/CLGEMMConvolutionLayer.h" #include "arm_compute/runtime/CL/functions/CLGEMMDeconvolutionLayer.h" #include "arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h" #include "arm_compute/runtime/CL/functions/CLGEMMLowpOutputStage.h" -#include "arm_compute/runtime/CL/functions/CLGather.h" #include "arm_compute/runtime/CL/functions/CLGenerateProposalsLayer.h" #include "arm_compute/runtime/CL/functions/CLIndirectConvolutionLayer.h" #include "arm_compute/runtime/CL/functions/CLInstanceNormalizationLayer.h" #include "arm_compute/runtime/CL/functions/CLL2NormalizeLayer.h" -#include "arm_compute/runtime/CL/functions/CLLSTMLayer.h" -#include "arm_compute/runtime/CL/functions/CLLSTMLayerQuantized.h" #include "arm_compute/runtime/CL/functions/CLLogicalAnd.h" #include "arm_compute/runtime/CL/functions/CLLogicalNot.h" #include "arm_compute/runtime/CL/functions/CLLogicalOr.h" +#include "arm_compute/runtime/CL/functions/CLLSTMLayer.h" +#include "arm_compute/runtime/CL/functions/CLLSTMLayerQuantized.h" #include "arm_compute/runtime/CL/functions/CLMatMul.h" #include "arm_compute/runtime/CL/functions/CLMaxUnpoolingLayer.h" #include "arm_compute/runtime/CL/functions/CLMeanStdDevNormalizationLayer.h" #include "arm_compute/runtime/CL/functions/CLNormalizationLayer.h" #include "arm_compute/runtime/CL/functions/CLNormalizePlanarYUVLayer.h" -#include "arm_compute/runtime/CL/functions/CLPReluLayer.h" #include "arm_compute/runtime/CL/functions/CLPadLayer.h" #include "arm_compute/runtime/CL/functions/CLPermute.h" #include "arm_compute/runtime/CL/functions/CLPixelWiseMultiplication.h" #include "arm_compute/runtime/CL/functions/CLPooling3dLayer.h" #include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" +#include "arm_compute/runtime/CL/functions/CLPReluLayer.h" #include "arm_compute/runtime/CL/functions/CLPriorBoxLayer.h" #include "arm_compute/runtime/CL/functions/CLQLSTMLayer.h" #include "arm_compute/runtime/CL/functions/CLQuantizationLayer.h" -#include "arm_compute/runtime/CL/functions/CLRNNLayer.h" -#include "arm_compute/runtime/CL/functions/CLROIAlignLayer.h" -#include "arm_compute/runtime/CL/functions/CLROIPoolingLayer.h" #include "arm_compute/runtime/CL/functions/CLRange.h" #include "arm_compute/runtime/CL/functions/CLReduceMean.h" #include "arm_compute/runtime/CL/functions/CLReductionOperation.h" #include "arm_compute/runtime/CL/functions/CLReorgLayer.h" #include "arm_compute/runtime/CL/functions/CLReshapeLayer.h" #include "arm_compute/runtime/CL/functions/CLReverse.h" +#include "arm_compute/runtime/CL/functions/CLRNNLayer.h" +#include "arm_compute/runtime/CL/functions/CLROIAlignLayer.h" +#include "arm_compute/runtime/CL/functions/CLROIPoolingLayer.h" #include "arm_compute/runtime/CL/functions/CLScale.h" #include "arm_compute/runtime/CL/functions/CLSelect.h" #include "arm_compute/runtime/CL/functions/CLSlice.h" @@ -114,4 +114,4 @@ #include "arm_compute/runtime/CL/functions/CLUnstack.h" #include "arm_compute/runtime/CL/functions/CLWinogradConvolutionLayer.h" -#endif /* ARM_COMPUTE_CLFUNCTIONS_H */ +#endif // ACL_ARM_COMPUTE_RUNTIME_CL_CLFUNCTIONS_H diff --git a/arm_compute/runtime/NEON/NEFunctions.h b/arm_compute/runtime/NEON/NEFunctions.h index 3a10310452..cc4d303202 100644 --- a/arm_compute/runtime/NEON/NEFunctions.h +++ b/arm_compute/runtime/NEON/NEFunctions.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_NEFUNCTIONS_H -#define ARM_COMPUTE_NEFUNCTIONS_H +#ifndef ACL_ARM_COMPUTE_RUNTIME_NEON_NEFUNCTIONS_H +#define ACL_ARM_COMPUTE_RUNTIME_NEON_NEFUNCTIONS_H #include "arm_compute/runtime/NEON/functions/NEActivationLayer.h" #include "arm_compute/runtime/NEON/functions/NEAddMulAdd.h" @@ -62,34 +62,31 @@ #include "arm_compute/runtime/NEON/functions/NEFloor.h" #include "arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h" #include "arm_compute/runtime/NEON/functions/NEFuseBatchNormalization.h" +#include "arm_compute/runtime/NEON/functions/NEGather.h" #include "arm_compute/runtime/NEON/functions/NEGEMM.h" #include "arm_compute/runtime/NEON/functions/NEGEMMConv2d.h" #include "arm_compute/runtime/NEON/functions/NEGEMMConvolutionLayer.h" #include "arm_compute/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.h" #include "arm_compute/runtime/NEON/functions/NEGEMMLowpOutputStage.h" -#include "arm_compute/runtime/NEON/functions/NEGather.h" #include "arm_compute/runtime/NEON/functions/NEGenerateProposalsLayer.h" #include "arm_compute/runtime/NEON/functions/NEInstanceNormalizationLayer.h" #include "arm_compute/runtime/NEON/functions/NEL2NormalizeLayer.h" +#include "arm_compute/runtime/NEON/functions/NELogical.h" #include "arm_compute/runtime/NEON/functions/NELSTMLayer.h" #include "arm_compute/runtime/NEON/functions/NELSTMLayerQuantized.h" -#include "arm_compute/runtime/NEON/functions/NELogical.h" #include "arm_compute/runtime/NEON/functions/NEMatMul.h" #include "arm_compute/runtime/NEON/functions/NEMaxUnpoolingLayer.h" #include "arm_compute/runtime/NEON/functions/NEMeanStdDevNormalizationLayer.h" #include "arm_compute/runtime/NEON/functions/NENormalizationLayer.h" -#include "arm_compute/runtime/NEON/functions/NEPReluLayer.h" #include "arm_compute/runtime/NEON/functions/NEPadLayer.h" #include "arm_compute/runtime/NEON/functions/NEPermute.h" #include "arm_compute/runtime/NEON/functions/NEPixelWiseMultiplication.h" #include "arm_compute/runtime/NEON/functions/NEPooling3dLayer.h" #include "arm_compute/runtime/NEON/functions/NEPoolingLayer.h" +#include "arm_compute/runtime/NEON/functions/NEPReluLayer.h" #include "arm_compute/runtime/NEON/functions/NEPriorBoxLayer.h" #include "arm_compute/runtime/NEON/functions/NEQLSTMLayer.h" #include "arm_compute/runtime/NEON/functions/NEQuantizationLayer.h" -#include "arm_compute/runtime/NEON/functions/NERNNLayer.h" -#include "arm_compute/runtime/NEON/functions/NEROIAlignLayer.h" -#include "arm_compute/runtime/NEON/functions/NEROIPoolingLayer.h" #include "arm_compute/runtime/NEON/functions/NERange.h" #include "arm_compute/runtime/NEON/functions/NEReduceMean.h" #include "arm_compute/runtime/NEON/functions/NEReductionOperation.h" @@ -97,6 +94,9 @@ #include "arm_compute/runtime/NEON/functions/NEReorgLayer.h" #include "arm_compute/runtime/NEON/functions/NEReshapeLayer.h" #include "arm_compute/runtime/NEON/functions/NEReverse.h" +#include "arm_compute/runtime/NEON/functions/NERNNLayer.h" +#include "arm_compute/runtime/NEON/functions/NEROIAlignLayer.h" +#include "arm_compute/runtime/NEON/functions/NEROIPoolingLayer.h" #include "arm_compute/runtime/NEON/functions/NEScale.h" #include "arm_compute/runtime/NEON/functions/NESelect.h" #include "arm_compute/runtime/NEON/functions/NESlice.h" @@ -111,4 +111,4 @@ #include "arm_compute/runtime/NEON/functions/NEUnstack.h" #include "arm_compute/runtime/NEON/functions/NEWinogradConvolutionLayer.h" -#endif /* ARM_COMPUTE_NEFUNCTIONS_H */ +#endif // ACL_ARM_COMPUTE_RUNTIME_NEON_NEFUNCTIONS_H diff --git a/compute_kernel_writer/.clang-format b/compute_kernel_writer/.clang-format deleted file mode 100644 index b2b21d75f3..0000000000 --- a/compute_kernel_writer/.clang-format +++ /dev/null @@ -1,47 +0,0 @@ ---- -Language: Cpp -AccessModifierOffset: -4 -AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: true -AlignConsecutiveDeclarations: true -AlignEscapedNewlinesLeft: true -AlignTrailingComments: true -AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: None -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: true -AlwaysBreakTemplateDeclarations: true -BreakBeforeBinaryOperators: NonAssignment -BreakBeforeBraces: Allman -BreakBeforeTernaryOperators: false -BreakConstructorInitializersBeforeComma: false -ConstructorInitializerAllOnOneLineOrOnePerLine: true -Cpp11BracedListStyle: false -DerivePointerAlignment: false -IndentCaseLabels: true -IndentWidth: 4 -IndentWrappedFunctionNames: false -KeepEmptyLinesAtTheStartOfBlocks: false -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -PointerAlignment: Right -SortIncludes: true -SpaceAfterCStyleCast: false -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: Never -SpaceInEmptyParentheses: false -SpacesInAngles: false -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: c++14 -TabWidth: 4 -UseTab: Never -ReflowComments: false -ContinuationIndentWidth: 4 -ColumnLimit: 0 ---- diff --git a/scripts/format_code.py b/scripts/format_code.py index 94c49fdb59..f1ee7a731c 100755 --- a/scripts/format_code.py +++ b/scripts/format_code.py @@ -36,23 +36,7 @@ from modules.Shell import Shell logger = logging.getLogger("format_code") -ASTYLE_PARAMETERS ="--style=ansi \ - --indent=spaces \ - --indent-switches \ - --indent-col1-comments \ - --min-conditional-indent=0 \ - --max-instatement-indent=120 \ - --pad-oper \ - --align-pointer=name \ - --align-reference=name \ - --break-closing-brackets \ - --keep-one-line-statements \ - --max-code-length=200 \ - --mode=c \ - --lineend=linux \ - --indent-preprocessor \ - " - +# List of directories to exclude exceptions = [ "src/core/NEON/kernels/assembly/gemm", "src/core/NEON/kernels/assembly/arm", @@ -60,7 +44,6 @@ exceptions = [ "/convolution/", "/arm_gemm/", "/arm_conv/", - "compute_kernel_writer/", "SConscript", "SConstruct" ] @@ -241,7 +224,7 @@ class FormatCodeRun: skip_copyright = True grep_folder = "grep -e \"^\\(arm_compute\\|src\\|examples\\|tests\\|utils\\|support\\)/\"" - grep_extension = "grep -e \"\\.\\(cpp\\|h\\|inl\\|cl\\|cs\\|hpp\\)$\"" + grep_extension = "grep -e \"\\.\\(cpp\\|h\\|hh\\|inl\\|cl\\|cs\\|hpp\\)$\"" list_files = shell.run_single_to_str(cmd+" | { "+ grep_folder+" | "+grep_extension + " || true; }") to_check = [ f for f in list_files.split("\n") if len(f) > 0] @@ -277,16 +260,7 @@ class FormatCodeRun: try: self.shell.cd(self.folder) self.shell.prepend_env("PATH","%s/../bin" % this_dir) - clang_format = "clang-format -i -style=file " - astyle = "astyle -n -q %s " % (ASTYLE_PARAMETERS) - - if sys.platform == 'darwin': - # this platform explicitly needs an extension for the temporary file - sed = "sed -i '.log' 's/\\t/ /g' " - else: - sed = "sed -i 's/\\t/ /g' " - single_eol = "%s/ensure_single_eol.py " % this_dir for f in self.files: skip_this_file = False for e in exceptions: @@ -300,21 +274,6 @@ class FormatCodeRun: logger.info("Formatting %s" % f) if not self.skip_copyright: check_copyright(f) - cmds = [ - sed + f, - clang_format + f, - astyle + f, - single_eol + f - ] - - if sys.platform == 'darwin': - # the temporary file creted by 'sed' will be removed here - cmds.append(f"rm {f}.log") - - for cmd in cmds: - output = self.shell.run_single_to_str(cmd) - if len(output) > 0: - logger.info(output) check_license("LICENSE") diff --git a/scripts/include_functions_kernels.py b/scripts/include_functions_kernels.py index 82b40f0e36..49c12867e6 100644 --- a/scripts/include_functions_kernels.py +++ b/scripts/include_functions_kernels.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (c) 2017-2018, 2020-2021 Arm Limited. +# Copyright (c) 2017-2018, 2020-2021, 2023 Arm Limited. # # SPDX-License-Identifier: MIT # @@ -74,7 +74,7 @@ def create_include_list(folder): files_path = folder + "/*.h" files = glob.glob(files_path) updated_files = [include_str + folder + "/" + x.rsplit('/',1)[1] + "\"\n" for x in files] - updated_files.sort() + updated_files.sort(key=lambda x: x.lower()) return updated_files @@ -86,7 +86,7 @@ def include_components(target, path, header_prefix, folder, subfolders=None): include_list = create_include_list(target_path + folder) for s in subfolders or []: include_list += create_include_list( target_path + folder + "/" + s) - include_list.sort() + include_list.sort(key=lambda x: x.lower()) lines = read_file(components_file) lines, first_pos = remove_existing_includes(lines) lines = add_updated_includes(lines, first_pos, include_list) diff --git a/src/core/CL/CLKernels.h b/src/core/CL/CLKernels.h index 63be7b1ea8..9a681a4f45 100644 --- a/src/core/CL/CLKernels.h +++ b/src/core/CL/CLKernels.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2022 Arm Limited. + * Copyright (c) 2016-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_CLKERNELS_H -#define ARM_COMPUTE_CLKERNELS_H +#ifndef ACL_SRC_CORE_CL_CLKERNELS_H +#define ACL_SRC_CORE_CL_CLKERNELS_H /* Header regrouping all the CL kernels */ #include "src/core/CL/kernels/CLArgMinMaxLayerKernel.h" @@ -52,12 +52,12 @@ #include "src/core/CL/kernels/CLPadLayerKernel.h" #include "src/core/CL/kernels/CLPriorBoxLayerKernel.h" #include "src/core/CL/kernels/CLQLSTMLayerNormalizationKernel.h" -#include "src/core/CL/kernels/CLROIAlignLayerKernel.h" -#include "src/core/CL/kernels/CLROIPoolingLayerKernel.h" #include "src/core/CL/kernels/CLRangeKernel.h" #include "src/core/CL/kernels/CLReductionOperationKernel.h" #include "src/core/CL/kernels/CLReorgLayerKernel.h" #include "src/core/CL/kernels/CLReverseKernel.h" +#include "src/core/CL/kernels/CLROIAlignLayerKernel.h" +#include "src/core/CL/kernels/CLROIPoolingLayerKernel.h" #include "src/core/CL/kernels/CLSelectKernel.h" #include "src/core/CL/kernels/CLSpaceToBatchLayerKernel.h" #include "src/core/CL/kernels/CLSpaceToDepthLayerKernel.h" @@ -65,4 +65,4 @@ #include "src/core/CL/kernels/CLStridedSliceKernel.h" #include "src/core/CL/kernels/CLTileKernel.h" -#endif /* ARM_COMPUTE_CLKERNELS_H */ +#endif // ACL_SRC_CORE_CL_CLKERNELS_H diff --git a/src/core/NEON/NEKernels.h b/src/core/NEON/NEKernels.h index 75016b0db1..8675eec93f 100644 --- a/src/core/NEON/NEKernels.h +++ b/src/core/NEON/NEKernels.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_NEKERNELS_H -#define ARM_COMPUTE_NEKERNELS_H +#ifndef ACL_SRC_CORE_NEON_NEKERNELS_H +#define ACL_SRC_CORE_NEON_NEKERNELS_H #include "src/core/NEON/kernels/NEBatchNormalizationLayerKernel.h" #include "src/core/NEON/kernels/NEBatchToSpaceLayerKernel.h" @@ -50,13 +50,13 @@ #include "src/core/NEON/kernels/NEPadLayerKernel.h" #include "src/core/NEON/kernels/NEPriorBoxLayerKernel.h" #include "src/core/NEON/kernels/NEQLSTMLayerNormalizationKernel.h" -#include "src/core/NEON/kernels/NEROIAlignLayerKernel.h" -#include "src/core/NEON/kernels/NEROIPoolingLayerKernel.h" #include "src/core/NEON/kernels/NERangeKernel.h" #include "src/core/NEON/kernels/NEReductionOperationKernel.h" #include "src/core/NEON/kernels/NEReorderKernel.h" #include "src/core/NEON/kernels/NEReorgLayerKernel.h" #include "src/core/NEON/kernels/NEReverseKernel.h" +#include "src/core/NEON/kernels/NEROIAlignLayerKernel.h" +#include "src/core/NEON/kernels/NEROIPoolingLayerKernel.h" #include "src/core/NEON/kernels/NESelectKernel.h" #include "src/core/NEON/kernels/NESpaceToBatchLayerKernel.h" #include "src/core/NEON/kernels/NESpaceToDepthLayerKernel.h" @@ -64,4 +64,4 @@ #include "src/core/NEON/kernels/NEStridedSliceKernel.h" #include "src/core/NEON/kernels/NETileKernel.h" -#endif /* ARM_COMPUTE_NEKERNELS_H */ +#endif // ACL_SRC_CORE_NEON_NEKERNELS_H -- cgit v1.2.1