Skip to content

Commit a7d6cc8

Browse files
authored
Merge branch 'main' into export-D79381683
2 parents df8a600 + cf2f170 commit a7d6cc8

File tree

99 files changed

+3772
-86
lines changed

Some content is hidden

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

99 files changed

+3772
-86
lines changed

CMakePresets.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@
128128
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/zephyr.cmake",
129129
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake"
130130
}
131+
},
132+
{
133+
"name": "arm-baremetal",
134+
"displayName": "Build ExecuTorch for Arm baremetal",
135+
"inherits": ["common"],
136+
"cacheVariables": {
137+
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/arm_baremetal.cmake",
138+
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake"
139+
}
131140
}
132141
]
133142
}

backends/arm/scripts/build_executorch.sh

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ _setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly ins
1919

2020
et_build_root="${et_root_dir}/arm_test"
2121
build_type="Release"
22-
build_devtools=false
23-
build_with_etdump=false
22+
build_devtools=OFF
23+
build_with_etdump=OFF
2424

2525
help() {
2626
echo "Usage: $(basename $0) [options]"
@@ -38,8 +38,8 @@ for arg in "$@"; do
3838
-h|--help) help ;;
3939
--et_build_root=*) et_build_root="${arg#*=}";;
4040
--build_type=*) build_type="${arg#*=}";;
41-
--devtools) build_devtools=true ;;
42-
--etdump) build_with_etdump=true ;;
41+
--devtools) build_devtools=ON ;;
42+
--etdump) build_with_etdump=ON ;;
4343
--toolchain=*) toolchain="${arg#*=}";;
4444
*)
4545
;;
@@ -48,7 +48,7 @@ done
4848

4949
if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then
5050
toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake
51-
elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then
51+
elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then
5252
toolchain_cmake=${et_root_dir}/examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake
5353
else
5454
echo "Error: Invalid toolchain selection, provided: ${tolchain}"
@@ -74,40 +74,12 @@ cd "${et_root_dir}"
7474
echo "Build ExecuTorch target libs ${build_type} into '${et_build_dir}'" ;
7575
echo "--------------------------------------------------------------------------------" )
7676

77-
build_devtools_flags=" -DEXECUTORCH_BUILD_DEVTOOLS=OFF "
78-
if [ "$build_devtools" = true ] ; then
79-
build_devtools_flags=" -DEXECUTORCH_BUILD_DEVTOOLS=ON "
80-
fi
81-
82-
build_with_etdump_flags=" -DEXECUTORCH_ENABLE_EVENT_TRACER=OFF "
83-
if [ "$build_with_etdump" = true ] ; then
84-
# Add DevTools flags use in the Target build below
85-
build_with_etdump_flags="-DEXECUTORCH_BUILD_DEVTOOLS=ON \
86-
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
87-
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=OFF \
88-
-DFLATCC_ALLOW_WERROR=OFF "
89-
fi
90-
91-
echo "Building with Devtools: ${build_devtools_flags} ${build_with_etdump_flags}"
92-
93-
9477
# Build
95-
cmake \
96-
-DCMAKE_INSTALL_PREFIX=${et_build_dir} \
97-
-DCMAKE_BUILD_TYPE=${build_type} \
98-
-DCMAKE_TOOLCHAIN_FILE="${toolchain_cmake}" \
99-
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
100-
-DEXECUTORCH_BUILD_ARM_BAREMETAL=ON \
101-
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
102-
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
103-
-DEXECUTORCH_BUILD_CORTEX_M=ON \
104-
-DEXECUTORCH_ENABLE_LOGGING=ON \
105-
${build_devtools_flags} \
106-
${build_with_etdump_flags} \
107-
-B"${et_build_dir}" \
108-
"${et_root_dir}"
109-
110-
echo "[$(basename $0)] Configured CMAKE"
78+
cmake -DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} \
79+
-DCMAKE_BUILD_TYPE=Release \
80+
-DEXECUTORCH_BUILD_DEVTOOLS=$build_devtools \
81+
-DEXECUTORCH_BUILD_ARM_ETDUMP=$build_with_etdump \
82+
--preset arm-baremetal -B${et_build_dir}
11183

11284
cmake --build ${et_build_dir} -j$(nproc) --target install --config ${build_type} --
11385

backends/arm/test/ops/test_abs.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
EthosU85PipelineINT,
1616
TosaPipelineFP,
1717
TosaPipelineINT,
18+
VgfPipeline,
1819
)
1920

2021
aten_op = "torch.ops.aten.abs.default"
@@ -66,3 +67,25 @@ def test_abs_u85_INT(test_data: torch.Tensor):
6667
Abs(), test_data(), aten_op, exir_op, run_on_fvp=True
6768
)
6869
pipeline.run()
70+
71+
72+
@common.parametrize("test_data", Abs.test_parameters)
73+
@common.SkipIfNoModelConverter
74+
def test_abs_vgf_FP(test_data: input_t1):
75+
pipeline = VgfPipeline[input_t1](
76+
Abs(), test_data(), aten_op, exir_op, tosa_version="TOSA-1.0+FP"
77+
)
78+
pipeline.run()
79+
80+
81+
@common.parametrize("test_data", Abs.test_parameters)
82+
@common.SkipIfNoModelConverter
83+
def test_abs_vgf_INT(test_data: input_t1):
84+
pipeline = VgfPipeline[input_t1](
85+
Abs(),
86+
test_data(),
87+
aten_op,
88+
exir_op,
89+
tosa_version="TOSA-1.0+INT",
90+
)
91+
pipeline.run()

backends/arm/test/ops/test_acosh.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
EthosU85PipelineINT,
1515
TosaPipelineFP,
1616
TosaPipelineINT,
17+
VgfPipeline,
1718
)
1819

1920
input_t = Tuple[torch.Tensor] # Input x
@@ -112,3 +113,27 @@ def test_acosh_u85_INT_xfail(test_data: Tuple):
112113
run_on_fvp=False,
113114
)
114115
pipeline.run()
116+
117+
118+
@common.parametrize("test_data", test_data_suite)
119+
@common.SkipIfNoModelConverter
120+
def test_acosh_vgf_FP(test_data: Tuple):
121+
pipeline = VgfPipeline[input_t](
122+
Acosh(),
123+
(test_data(),),
124+
aten_op,
125+
tosa_version="TOSA-1.0+FP",
126+
)
127+
pipeline.run()
128+
129+
130+
@common.parametrize("test_data", test_data_suite)
131+
@common.SkipIfNoModelConverter
132+
def test_acosh_vgf_INT(test_data: Tuple):
133+
pipeline = VgfPipeline[input_t](
134+
Acosh(),
135+
(test_data(),),
136+
aten_op,
137+
tosa_version="TOSA-1.0+INT",
138+
)
139+
pipeline.run()

backends/arm/test/ops/test_adaptive_avg_pool2d.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
EthosU85PipelineINT,
1515
TosaPipelineFP,
1616
TosaPipelineINT,
17+
VgfPipeline,
1718
)
1819

1920
exir_op = "executorch_exir_dialects_edge__ops_aten_avg_pool2d_default"
@@ -161,3 +162,31 @@ def test_adaptive_avg_pool2d_u85_INT(test_module):
161162
exir_ops=exir_op,
162163
)
163164
pipeline.run()
165+
166+
167+
@common.parametrize("test_module", test_modules)
168+
@common.SkipIfNoModelConverter
169+
def test_adaptive_avg_pool2d_vgf_FP(test_module):
170+
model, input_tensor = test_module()
171+
pipeline = VgfPipeline[input_t](
172+
model,
173+
input_tensor,
174+
[],
175+
exir_op,
176+
tosa_version="TOSA-1.0+FP",
177+
)
178+
pipeline.run()
179+
180+
181+
@common.parametrize("test_module", test_modules)
182+
@common.SkipIfNoModelConverter
183+
def test_adaptive_avg_pool2d_vgf_INT(test_module):
184+
model, input_tensor = test_module()
185+
pipeline = VgfPipeline[input_t](
186+
model,
187+
input_tensor,
188+
[],
189+
exir_op,
190+
tosa_version="TOSA-1.0+INT",
191+
)
192+
pipeline.run()

backends/arm/test/ops/test_addmm.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
EthosU85PipelineINT,
1414
TosaPipelineFP,
1515
TosaPipelineINT,
16+
VgfPipeline,
1617
)
1718

1819
aten_op = "torch.ops.aten.addmm.default"
@@ -155,3 +156,29 @@ def test_addmm_u85_INT(test_data: Tuple):
155156
exir_ops=exir_op,
156157
)
157158
pipeline.run()
159+
160+
161+
@common.parametrize("test_data", test_data_suite)
162+
@common.SkipIfNoModelConverter
163+
def test_addmm_vgf_FP(test_data: input_t1):
164+
pipeline = VgfPipeline[input_t1](
165+
Addmm(),
166+
(*test_data,),
167+
aten_op=aten_op,
168+
exir_op=exir_op,
169+
tosa_version="TOSA-1.0+FP",
170+
)
171+
pipeline.run()
172+
173+
174+
@common.parametrize("test_data", test_data_suite)
175+
@common.SkipIfNoModelConverter
176+
def test_addmm_vgf_INT(test_data: input_t1):
177+
pipeline = VgfPipeline[input_t1](
178+
Addmm(),
179+
(*test_data,),
180+
aten_op=[],
181+
exir_op=exir_op,
182+
tosa_version="TOSA-1.0+INT",
183+
)
184+
pipeline.run()

backends/arm/test/ops/test_alias_copy.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
EthosU85PipelineINT,
1313
TosaPipelineFP,
1414
TosaPipelineINT,
15+
VgfPipeline,
1516
)
1617

1718
input_t1 = Tuple[torch.Tensor]
@@ -83,3 +84,29 @@ def test_alias_u85_INT(test_data: input_t1):
8384
AliasCopy.aten_op,
8485
AliasCopy.exir_op,
8586
).run()
87+
88+
89+
@common.parametrize("test_data", AliasCopy.test_data)
90+
@common.SkipIfNoModelConverter
91+
def test_alias_vgf_FP(test_data: input_t1):
92+
pipeline = VgfPipeline[input_t1](
93+
AliasCopy(),
94+
test_data(),
95+
AliasCopy.aten_op,
96+
AliasCopy.exir_op,
97+
tosa_version="TOSA-1.0+FP",
98+
)
99+
pipeline.run()
100+
101+
102+
@common.parametrize("test_data", AliasCopy.test_data)
103+
@common.SkipIfNoModelConverter
104+
def test_alias_vgf_INT(test_data: input_t1):
105+
pipeline = VgfPipeline[input_t1](
106+
AliasCopy(),
107+
test_data(),
108+
AliasCopy.aten_op,
109+
AliasCopy.exir_op,
110+
tosa_version="TOSA-1.0+INT",
111+
)
112+
pipeline.run()

backends/arm/test/ops/test_amax.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
OpNotSupportedPipeline,
1515
TosaPipelineFP,
1616
TosaPipelineINT,
17+
VgfPipeline,
1718
)
1819

1920

@@ -138,3 +139,57 @@ def test_max_dim_tosa_FP_not_delegated():
138139
data, dim = Max.test_data["rank_4_dim_3"]()
139140
pipeline = OpNotSupportedPipeline[Max.input_t](MaxWithIndex(dim), data, {})
140141
pipeline.run()
142+
143+
144+
@common.parametrize("test_data", Amax.test_data)
145+
@common.SkipIfNoModelConverter
146+
def test_amax_vgf_FP(test_data: Amax.input_t):
147+
data, dim, keep_dims = test_data()
148+
module = Amax(dim, keep_dims)
149+
pipeline = VgfPipeline[Amax.input_t](
150+
module,
151+
data,
152+
Amax.aten_op,
153+
tosa_version="TOSA-1.0+FP",
154+
)
155+
pipeline.run()
156+
157+
158+
@common.parametrize("test_data", Amax.test_data)
159+
@common.SkipIfNoModelConverter
160+
def test_amax_vgf_INT(test_data: Amax.input_t):
161+
data, dim, keep_dims = test_data()
162+
module = Amax(dim, keep_dims)
163+
pipeline = VgfPipeline[Amax.input_t](
164+
module,
165+
data,
166+
Amax.aten_op,
167+
tosa_version="TOSA-1.0+INT",
168+
)
169+
pipeline.run()
170+
171+
172+
@common.parametrize("test_data", Max.test_data)
173+
@common.SkipIfNoModelConverter
174+
def test_max_dim_vgf_FP_to_amax(test_data: Max.input_t):
175+
data, dim = test_data()
176+
pipeline = VgfPipeline[Max.input_t](
177+
Max(dim),
178+
data,
179+
"torch.ops.aten.max",
180+
tosa_version="TOSA-1.0+FP",
181+
)
182+
pipeline.run()
183+
184+
185+
@common.parametrize("test_data", Max.test_data)
186+
@common.SkipIfNoModelConverter
187+
def test_max_dim_vgf_INT_to_amax(test_data: Max.input_t):
188+
data, dim = test_data()
189+
pipeline = VgfPipeline[Max.input_t](
190+
Max(dim),
191+
data,
192+
"torch.ops.aten.amax",
193+
tosa_version="TOSA-1.0+INT",
194+
)
195+
pipeline.run()

0 commit comments

Comments
 (0)