Skip to content

Commit b1d071d

Browse files
authored
Merge branch 'main' into seperate-sampler-targets
2 parents f51e11e + fb3f6eb commit b1d071d

89 files changed

Lines changed: 2054 additions & 1381 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/riscv64.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,22 @@ jobs:
2828
strategy:
2929
fail-fast: false
3030
matrix:
31-
include:
32-
- { model: add, xnnpack: false, quantize: false }
33-
- { model: add, xnnpack: true, quantize: false }
34-
- { model: mv2, xnnpack: false, quantize: false }
35-
- { model: mv2, xnnpack: true, quantize: false }
36-
- { model: mv2, xnnpack: true, quantize: true }
37-
- { model: mobilebert, xnnpack: false, quantize: false }
38-
- { model: mobilebert, xnnpack: true, quantize: false }
39-
- { model: mobilebert, xnnpack: true, quantize: true }
40-
- { model: llama2, xnnpack: false, quantize: false }
41-
- { model: llama2, xnnpack: true, quantize: false }
42-
- { model: llama2, xnnpack: true, quantize: true }
43-
- { model: resnet18, xnnpack: false, quantize: false }
44-
- { model: resnet18, xnnpack: true, quantize: false }
45-
- { model: resnet18, xnnpack: true, quantize: true }
31+
model:
32+
- add
33+
- mv2
34+
- mobilebert
35+
- llama2
36+
- resnet18
37+
- yolo26
38+
xnnpack: [true, false]
39+
quantize: [true, false]
40+
exclude:
41+
# We only enable quantization with XNNPACK
42+
- xnnpack: false
43+
quantize: true
44+
# We don't test quantization for Yolo26
45+
- model: yolo26
46+
quantize: true
4647
permissions:
4748
id-token: write
4849
contents: read

.lintrunner.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ include_patterns = [
112112
'backends/arm/**/*.cpp',
113113
'backends/arm/**/*.h',
114114
'backends/arm/**/*.hpp',
115+
'backends/cortex_m/**/*.cpp',
116+
'backends/cortex_m/**/*.h',
115117
'examples/arm/**/*.cpp',
116118
'examples/arm/**/*.h',
117119
'examples/arm/**/*.hpp',

backends/arm/runtime/VGFSetup.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -793,9 +793,14 @@ bool VgfRepr::process_vgf(
793793
return false;
794794
}
795795

796-
vector<VkDataGraphPipelineSessionBindPointRequirementARM>
797-
bind_point_requirements;
798-
bind_point_requirements.resize(bind_point_count);
796+
vector<VkDataGraphPipelineSessionBindPointRequirementARM> bind_point_requirements(
797+
bind_point_count,
798+
{
799+
.sType =
800+
VK_STRUCTURE_TYPE_DATA_GRAPH_PIPELINE_SESSION_BIND_POINT_REQUIREMENT_ARM,
801+
.pNext = nullptr,
802+
});
803+
799804
result = vkGetDataGraphPipelineSessionBindPointRequirementsARM(
800805
vk_device,
801806
&bind_point_requirements_info,

backends/arm/scripts/build_executorch.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# Optional parameter:
88
# --build_type= "Release" | "Debug" | "RelWithDebInfo" | "UndefinedSanitizer" | "AddressSanitizer"
99
# --etdump build with devtools-etdump support
10+
# --cmake-args= Additional arguments passed to cmake configure
1011

1112
set -eu
1213

@@ -24,6 +25,7 @@ build_type="Release"
2425
build_devtools=OFF
2526
build_with_etdump=OFF
2627
is_linux_musl=0
28+
extra_cmake_args=()
2729
target_cpu=""
2830

2931
help() {
@@ -33,6 +35,7 @@ help() {
3335
echo " --build_type=<TYPE> Build with Release, Debug, RelWithDebInfo, UndefinedSanitizer or AddressSanitizer, default is ${build_type}"
3436
echo " --devtools Build Devtools libs"
3537
echo " --etdump Adds Devtools etdump support to track timing, etdump area will be base64 encoded in the log"
38+
echo " --cmake-args=<ARGS> Additional arguments passed to cmake configure"
3639
echo " --toolchain=<TOOLCHAIN> Toolchain can be specified (arm-none-eabi-gcc, arm-zephyr-eabi-gcc, aarch64-linux-musl-gcc). Default: ${toolchain}"
3740
echo " --target_cpu=<CPU> Override the toolchain's default TARGET_CPU (e.g. cortex-m4). Switching target_cpu reuses the same cmake-out dir, so clear ${et_build_root}/cmake-out first to avoid stale per-CPU artifacts. Default: unset (toolchain default)."
3841
exit 0
@@ -45,6 +48,10 @@ for arg in "$@"; do
4548
--build_type=*) build_type="${arg#*=}";;
4649
--devtools) build_devtools=ON ;;
4750
--etdump) build_with_etdump=ON ;;
51+
--cmake-args=*)
52+
# shellcheck disable=SC2206
53+
extra_cmake_args=(${arg#*=})
54+
;;
4855
--toolchain=*) toolchain="${arg#*=}";;
4956
--target_cpu=*) target_cpu="${arg#*=}";;
5057
*)
@@ -89,6 +96,7 @@ cmake_args=(
8996
-DEXECUTORCH_BUILD_DEVTOOLS=${build_devtools}
9097
-DEXECUTORCH_BUILD_ARM_ETDUMP=${build_with_etdump}
9198
-DEXECUTORCH_BAREMETAL_SKIP_INSTALL=OFF
99+
"${extra_cmake_args[@]}"
92100
)
93101

94102
if [[ -n "${target_cpu}" ]]; then

backends/arm/scripts/corstone_utils.cmake

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@ function(fetch_ethos_u_content ETHOS_SDK_PATH ET_DIR_PATH)
5050
WORKING_DIRECTORY ${ET_DIR_PATH}
5151
)
5252
# Always patch the core_platform repo since this is fast enough. TODO:
53-
# examples/arm/ethos-u-setup/core_platform/0002-*.patch is a transient bridge
54-
# that guards Armv8-M-only MPU init so the source compiles for non-Armv8-M
55-
# Cortex-M cores. Once the same guard lands upstream in ethos-u/core_platform
56-
# and ${core_platform_base_rev} is bumped past that commit, delete the 0002
57-
# patch.
53+
# examples/arm/ethos-u-setup/core_platform/0002-*.patch and 0003-*.patch are
54+
# transient bridges that guard Armv8-M-only MPU init and the Armv7-M-and-newer
55+
# HardFault handler so the Corstone-300 target source compiles for older
56+
# Cortex-M cores. Once the equivalent guards land upstream in
57+
# ethos-u/core_platform and ${core_platform_base_rev} is bumped past those
58+
# commits, delete the 0002 and 0003 patches.
5859
set(core_platform_base_rev "26.02")
5960
execute_process(
6061
COMMAND

backends/cortex_m/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ set(CMSIS_NN_LOCAL_PATH
3030
""
3131
CACHE PATH "Path to existing local CMSIS-NN installation"
3232
)
33+
option(CORTEX_M_ENABLE_RUNTIME_CHECKS
34+
"Enable additional Cortex-M runtime assertions and validation checks"
35+
OFF
36+
)
3337

3438
# Try to find existing / local CMSIS-NN installation. This is useful for
3539
# debugging and testing with local changes. This is not common, as the CMSIS-NN
@@ -107,6 +111,11 @@ target_link_libraries(
107111
PRIVATE executorch
108112
PRIVATE kernels_util_all_deps
109113
)
114+
target_compile_definitions(
115+
cortex_m_kernels
116+
PRIVATE
117+
$<$<BOOL:${CORTEX_M_ENABLE_RUNTIME_CHECKS}>:CORTEX_M_ENABLE_RUNTIME_CHECKS>
118+
)
110119

111120
# Include directories for cortex_m_kernels
112121
target_include_directories(

backends/cortex_m/ops/cmsis_scratch_buffer_context.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// cppcheck-suppress-file unusedFunction
12
/*
23
* Copyright (c) Meta Platforms, Inc. and affiliates.
34
* All rights reserved.

backends/cortex_m/ops/cortex_m_ops_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ inline void validate_quantization_params(
113113
const int64_t shift2,
114114
const int64_t output_zero_point,
115115
const int64_t output_multiplier,
116-
const int64_t output_shift,
117-
Tensor& output) {
116+
const int64_t output_shift) {
118117
validate_single_quant_params(
119118
zero_point1, multiplier1, shift1, "Single quant Input1");
120119
validate_single_quant_params(
@@ -346,6 +345,7 @@ inline bool prepare_cmsis_pool2d_config(
346345
// https://github.com/ARM-software/CMSIS-NN/blob/main/Include/arm_nnsupportfunctions.h#L1625
347346
// multiplier: Range {ARM_NN_Q31_MIN + 1, Q32_MAX}
348347
// shift : Range {-31, 30}
348+
// cppcheck-suppress unusedFunction
349349
inline bool validate_per_channel_quant_params(
350350
const Int64ArrayRef multipliers,
351351
const Int64ArrayRef shifts,

backends/cortex_m/ops/op_dequantize_per_tensor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ F dequantize_val(float scale, int32_t zero_point, Q qvalue) {
100100
} // namespace
101101

102102
Tensor& dequantize_per_tensor_out(
103+
// cppcheck-suppress constParameterReference
103104
KernelRuntimeContext& context,
104105
const Tensor& input,
105106
double scale,

backends/cortex_m/ops/op_maximum.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2025 Arm Limited and/or its affiliates.
2+
* Copyright 2025-2026 Arm Limited and/or its affiliates.
33
*
44
* This source code is licensed under the BSD-style license found in the
55
* LICENSE file in the root directory of this source tree.
@@ -12,6 +12,7 @@ namespace native {
1212

1313
using KernelRuntimeContext = torch::executor::KernelRuntimeContext;
1414

15+
// cppcheck-suppress unusedFunction
1516
Tensor& maximum_out(
1617
KernelRuntimeContext& context,
1718
const Tensor& input1,

0 commit comments

Comments
 (0)