Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions backends/arm/test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def get_u55_compile_spec(
memory_mode: str = "Shared_Sram",
extra_flags: str = "--debug-force-regor --output-format=raw",
custom_path: Optional[str] = None,
config: Optional[str] = "Arm/vela.ini",
) -> list[CompileSpec]:
"""
Compile spec for Ethos-U55.
Expand All @@ -105,6 +106,7 @@ def get_u55_compile_spec(
memory_mode=memory_mode,
extra_flags=extra_flags,
custom_path=custom_path,
config=config,
).build()


Expand All @@ -114,6 +116,7 @@ def get_u85_compile_spec(
memory_mode="Shared_Sram",
extra_flags="--output-format=raw",
custom_path=None,
config: Optional[str] = "Arm/vela.ini",
) -> list[CompileSpec]:
"""
Compile spec for Ethos-U85.
Expand All @@ -124,6 +127,7 @@ def get_u85_compile_spec(
memory_mode=memory_mode,
extra_flags=extra_flags,
custom_path=custom_path,
config=config,
).build()


Expand All @@ -133,6 +137,7 @@ def get_u55_compile_spec_unbuilt(
memory_mode: str,
extra_flags: str,
custom_path: Optional[str],
config: Optional[str],
) -> ArmCompileSpecBuilder:
"""Get the ArmCompileSpecBuilder for the Ethos-U55 tests, to modify
the compile spec before calling .build() to finalize it.
Expand All @@ -151,6 +156,7 @@ def get_u55_compile_spec_unbuilt(
system_config=system_config,
memory_mode=memory_mode,
extra_flags=extra_flags,
config_ini=config,
)
.dump_intermediate_artifacts_to(artifact_path)
)
Expand All @@ -163,6 +169,7 @@ def get_u85_compile_spec_unbuilt(
memory_mode: str,
extra_flags: str,
custom_path: Optional[str],
config: Optional[str],
) -> list[CompileSpec]:
"""Get the ArmCompileSpecBuilder for the Ethos-U85 tests, to modify
the compile spec before calling .build() to finalize it.
Expand All @@ -180,6 +187,7 @@ def get_u85_compile_spec_unbuilt(
system_config=system_config,
memory_mode=memory_mode,
extra_flags=extra_flags,
config_ini=config,
)
.dump_intermediate_artifacts_to(artifact_path)
)
Expand Down
10 changes: 10 additions & 0 deletions examples/arm/aot_arm_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ def get_compile_spec(
system_config: Optional[str] = None,
memory_mode: Optional[str] = None,
quantize: bool = False,
config: Optional[str] = None,
) -> list[CompileSpec]:
spec_builder = None
if target.startswith("TOSA"):
Expand All @@ -400,6 +401,7 @@ def get_compile_spec(
system_config=system_config,
memory_mode=memory_mode,
extra_flags="--verbose-operators --verbose-cycle-estimate",
config_ini=config,
)
elif "vgf" in target:
if quantize:
Expand Down Expand Up @@ -573,6 +575,12 @@ def get_args():
default=None,
help="Memory mode to select from the Vela configuration file (see vela.ini). Default is 'Shared_Sram' for Ethos-U55 targets and 'Sram_Only' for Ethos-U85 targets",
)
parser.add_argument(
"--config",
required=False,
default="Arm/vela.ini",
help="Specify custom vela configuration file (vela.ini)",
)
args = parser.parse_args()

if args.evaluate and (
Expand Down Expand Up @@ -706,6 +714,7 @@ def to_edge_TOSA_delegate(
args.system_config,
args.memory_mode,
args.quantize,
args.config,
)

model_int8 = None
Expand Down Expand Up @@ -746,6 +755,7 @@ def to_edge_no_delegate(exported_program, args, model: torch.nn.Module, example_
args.system_config,
args.memory_mode,
args.quantize,
args.config,
)
model, exported_program = quantize_model(
args, model, example_inputs, compile_spec
Expand Down
10 changes: 9 additions & 1 deletion examples/arm/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ build_type="Release"
extra_build_flags=""
build_only=false
system_config=""
config=""
memory_mode=""
et_build_root="${et_root_dir}/arm_test"
ethos_u_scratch_dir=${script_dir}/ethos-u-scratch
Expand All @@ -57,6 +58,7 @@ function help() {
echo " --build_only Only build, don't run FVP"
echo " --system_config=<CONFIG> System configuration to select from the Vela configuration file (see vela.ini). Default: Ethos_U55_High_End_Embedded for EthosU55 targets, Ethos_U85_SYS_DRAM_Mid for EthosU85 targets."
echo " NOTE: If given, this option must match the given target. This option also sets timing adapter values customized for specific hardware, see ./executor_runner/CMakeLists.txt."
echo " --config=<FILEPATH> System configuration file that specifies system configurations (vela.ini)"
echo " --memory_mode=<MODE> Memory mode to select from the Vela configuration file (see vela.ini), e.g. Shared_Sram/Sram_Only. Default: 'Shared_Sram' for Ethos-U55 targets, 'Sram_Only' for Ethos-U85 targets"
echo " --et_build_root=<FOLDER> Executorch build output root folder to use, defaults to ${et_build_root}"
echo " --scratch-dir=<FOLDER> Path to your Ethos-U scrach dir if you not using default ${ethos_u_scratch_dir}"
Expand All @@ -80,6 +82,7 @@ for arg in "$@"; do
--extra_build_flags=*) extra_build_flags="${arg#*=}";;
--build_only) build_only=true ;;
--system_config=*) system_config="${arg#*=}";;
--config=*) config="${arg#*=}";;
--memory_mode=*) memory_mode="${arg#*=}";;
--et_build_root=*) et_build_root="${arg#*=}";;
--scratch-dir=*) ethos_u_scratch_dir="${arg#*=}" ; scratch_dir_set=true ;;
Expand Down Expand Up @@ -114,6 +117,11 @@ then
fi
fi

if [[ ${config} == "" ]]
then
config="Arm/vela.ini"
fi

function check_setup () {
# basic checks that setup.sh did everything needed before we get started

Expand Down Expand Up @@ -242,7 +250,7 @@ for i in "${!test_model[@]}"; do
model_compiler_flags="${model_compiler_flags} --model_input=${model_input}"
fi

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"
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 --config=${config}"
echo "CALL ${ARM_AOT_CMD}" >&2
${ARM_AOT_CMD} 1>&2

Expand Down
Loading