Skip to content

Commit 389918b

Browse files
Arm backend: Fix qdq_fusion flag (#13843)
The flag was incorrectly handled leading to broken CI. Instead, make the flag behave as a boolean. Leaving it out behaves the same way as setting it to False previously should have. Signed-off-by: Sebastian Larsson <[email protected]>
1 parent 8cb191e commit 389918b

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

examples/arm/aot_arm_compiler.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,8 @@ def get_args():
602602
)
603603
parser.add_argument(
604604
"--enable_qdq_fusion_pass",
605-
action="store",
606-
default=False,
607-
help="Skip the QuantizedOpFusionPass fusion step (default: False)",
605+
action="store_true",
606+
help="Enable the QuantizedOpFusionPass fusion step",
608607
)
609608
args = parser.parse_args()
610609

@@ -806,7 +805,7 @@ def transform_for_cortex_m_backend(edge, args):
806805
passes = [ReplaceQuantNodesPass()]
807806

808807
# Conditionally add the QuantizedOpFusionPass
809-
if args.enable_qdq_fusion_pass.lower() == "true":
808+
if args.enable_qdq_fusion_pass:
810809
passes.append(QuantizedOpFusionPass())
811810

812811
# Apply the passes

examples/arm/run.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function help() {
7070
echo " --pte_placement=<elf|ADDR> Ethos-U: Control if runtime has PTE baked into the elf or if its placed in memory outside of the elf, defaults to ${pte_placement}"
7171
echo " --et_build_root=<FOLDER> Executorch build output root folder to use, defaults to ${et_build_root}"
7272
echo " --scratch-dir=<FOLDER> Path to your Ethos-U scrach dir if you not using default ${ethos_u_scratch_dir}"
73-
echo " --qdq_fusion_op=<true/false> Enable/Disable QDQ fusion op"
73+
echo " --qdq_fusion_op Enable QDQ fusion op"
7474
exit 0
7575
}
7676

@@ -98,7 +98,7 @@ for arg in "$@"; do
9898
--pte_placement=*) pte_placement="${arg#*=}";;
9999
--et_build_root=*) et_build_root="${arg#*=}";;
100100
--scratch-dir=*) ethos_u_scratch_dir="${arg#*=}" ; scratch_dir_set=true ;;
101-
--qdq_fusion_op=*) qdq_fusion_op="${arg#*=}";;
101+
--qdq_fusion_op) qdq_fusion_op=true;;
102102
*)
103103
;;
104104
esac
@@ -200,6 +200,7 @@ devtools_flag=""
200200
bundleio_flag=""
201201
etrecord_flag=""
202202
et_dump_flag=""
203+
qdq_fusion_op_flag=""
203204
if [ "$build_with_etdump" = true ] ; then
204205
et_dump_flag="--etdump"
205206
etrecord_flag="--etrecord"
@@ -210,6 +211,10 @@ if [ "$bundleio" = true ] ; then
210211
bundleio_flag="--bundleio"
211212
fi
212213

214+
if [ "$qdq_fusion_op" = true ] ; then
215+
qdq_fusion_op_flag="--enable_qdq_fusion_pass"
216+
fi
217+
213218
backends/arm/scripts/build_executorch.sh --et_build_root="${et_build_root}" --build_type=$build_type $devtools_flag $et_dump_flag --toolchain="${toolchain}"
214219

215220
if [[ -z "$model_name" ]]; then
@@ -278,7 +283,7 @@ for i in "${!test_model[@]}"; do
278283
model_compiler_flags="${model_compiler_flags} --model_input=${model_input}"
279284
fi
280285

281-
ARM_AOT_CMD="python3 -m examples.arm.aot_arm_compiler --model_name=${model} --target=${target} ${model_compiler_flags} --intermediate=${output_folder} --output=${pte_file} --system_config=${system_config} --memory_mode=${memory_mode} $bundleio_flag ${etrecord_flag} --config=${config} --enable_qdq_fusion_pass=${qdq_fusion_op}"
286+
ARM_AOT_CMD="python3 -m examples.arm.aot_arm_compiler --model_name=${model} --target=${target} ${model_compiler_flags} --intermediate=${output_folder} --output=${pte_file} --system_config=${system_config} --memory_mode=${memory_mode} $bundleio_flag ${etrecord_flag} --config=${config} $qdq_fusion_op_flag"
282287
echo "CALL ${ARM_AOT_CMD}" >&2
283288
${ARM_AOT_CMD} 1>&2
284289

0 commit comments

Comments
 (0)