Skip to content

Arm backend: Remove the reordering of inputs flag #7698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2025
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
10 changes: 0 additions & 10 deletions backends/arm/arm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,6 @@ def dump_intermediate_artifacts_to(
self.path_for_intermediates = output_path
return self

def set_input_order(
self, input_order: Optional[str] = None
) -> "ArmCompileSpecBuilder":
"""
Reorder the inputs coming in. This may be required when inputs > 1.
And while using the U55/U85 CompileSpec.
"""
self.input_order = input_order
return self

def build(self) -> List[CompileSpec]:
"""
Generate a list of compile spec objects from the builder
Expand Down
8 changes: 0 additions & 8 deletions backends/arm/test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,33 +85,28 @@ def get_tosa_compile_spec_unbuilt(

def get_u55_compile_spec(
custom_path=None,
reorder_inputs=None,
) -> list[CompileSpec]:
"""
Default compile spec for Ethos-U55 tests.
"""
return get_u55_compile_spec_unbuilt(
custom_path=custom_path,
reorder_inputs=reorder_inputs,
).build()


def get_u85_compile_spec(
custom_path=None,
reorder_inputs=None,
) -> list[CompileSpec]:
"""
Default compile spec for Ethos-U85 tests.
"""
return get_u85_compile_spec_unbuilt(
custom_path=custom_path,
reorder_inputs=reorder_inputs,
).build()


def get_u55_compile_spec_unbuilt(
custom_path=None,
reorder_inputs=None,
) -> ArmCompileSpecBuilder:
"""Get the ArmCompileSpecBuilder for the Ethos-U55 tests, to modify
the compile spec before calling .build() to finalize it.
Expand All @@ -128,14 +123,12 @@ def get_u55_compile_spec_unbuilt(
extra_flags="--debug-force-regor --output-format=raw",
)
.dump_intermediate_artifacts_to(artifact_path)
.set_input_order(reorder_inputs)
)
return compile_spec


def get_u85_compile_spec_unbuilt(
custom_path=None,
reorder_inputs=None,
) -> list[CompileSpec]:
"""Get the ArmCompileSpecBuilder for the Ethos-U85 tests, to modify
the compile spec before calling .build() to finalize it.
Expand All @@ -150,7 +143,6 @@ def get_u85_compile_spec_unbuilt(
extra_flags="--output-format=raw",
)
.dump_intermediate_artifacts_to(artifact_path)
.set_input_order(reorder_inputs)
)
return compile_spec

Expand Down
4 changes: 2 additions & 2 deletions backends/arm/test/test_arm_baremetal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ test_run_ethosu_fvp() { # End to End model tests
# Ethos-U55
echo "${TEST_SUITE_NAME}: Test ethos-u target Ethos-U55"
examples/arm/run.sh --target=ethos-u55-128 --model_name=mv2
examples/arm/run.sh --target=ethos-u55-128 --model_name=lstm --reorder_inputs=1,0,2
examples/arm/run.sh --target=ethos-u55-128 --model_name=lstm

# Ethos-U85
echo "${TEST_SUITE_NAME}: Test ethos-u target Ethos-U85"
examples/arm/run.sh --target=ethos-u85-128 --model_name=mv2
examples/arm/run.sh --target=ethos-u85-128 --model_name=lstm --reorder_inputs=1,0,2
examples/arm/run.sh --target=ethos-u85-128 --model_name=lstm
}

${TEST_SUITE}
38 changes: 10 additions & 28 deletions examples/arm/aot_arm_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,34 +259,25 @@ def get_calibration_data(
def get_compile_spec(
target: str,
intermediates: Optional[str] = None,
reorder_inputs: Optional[str] = None,
system_config: Optional[str] = None,
memory_mode: Optional[str] = None,
) -> list[CompileSpec]:
spec_builder = None
if target == "TOSA":
spec_builder = ArmCompileSpecBuilder().tosa_compile_spec("TOSA-0.80+BI")
elif "ethos-u55" in target:
spec_builder = (
ArmCompileSpecBuilder()
.ethosu_compile_spec(
target,
system_config=system_config,
memory_mode=memory_mode,
extra_flags="--debug-force-regor --output-format=raw --verbose-operators --verbose-cycle-estimate",
)
.set_input_order(reorder_inputs)
spec_builder = ArmCompileSpecBuilder().ethosu_compile_spec(
target,
system_config=system_config,
memory_mode=memory_mode,
extra_flags="--debug-force-regor --output-format=raw --verbose-operators --verbose-cycle-estimate",
)
elif "ethos-u85" in target:
spec_builder = (
ArmCompileSpecBuilder()
.ethosu_compile_spec(
target,
system_config=system_config,
memory_mode=memory_mode,
extra_flags="--output-format=raw --verbose-operators --verbose-cycle-estimate",
)
.set_input_order(reorder_inputs)
spec_builder = ArmCompileSpecBuilder().ethosu_compile_spec(
target,
system_config=system_config,
memory_mode=memory_mode,
extra_flags="--output-format=raw --verbose-operators --verbose-cycle-estimate",
)

if intermediates is not None:
Expand Down Expand Up @@ -429,14 +420,6 @@ def get_args():
required=False,
help="Location for outputs, if not the default of cwd.",
)
parser.add_argument(
"-r",
"--reorder_inputs",
type=str,
required=False,
default=None,
help="Provide the order of the inputs. This can be required when inputs > 1.",
)
parser.add_argument(
"--system_config",
required=False,
Expand Down Expand Up @@ -519,7 +502,6 @@ def get_args():
compile_spec = get_compile_spec(
args.target,
args.intermediates,
args.reorder_inputs,
args.system_config,
args.memory_mode,
)
Expand Down
6 changes: 1 addition & 5 deletions examples/arm/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ build_with_etdump=false
build_type="Release"
extra_build_flags=""
build_only=false
reorder_inputs=""
system_config=""
memory_mode=""

Expand All @@ -46,7 +45,6 @@ help() {
echo " --extra_build_flags Extra flags to pass to cmake like -DET_ARM_BAREMETAL_METHOD_ALLOCATOR_POOL_SIZE=60000 Default: none "
echo " --build_only Only build, don't run FVP"
echo " --scratch-dir=<FOLDER> Path to your Ethos-U scrach dir if you not using default"
echo " --reorder_inputs=<FLAGS> Reorder the inputs. This can be required when inputs > 1."
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 " --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"
Expand All @@ -66,7 +64,6 @@ for arg in "$@"; do
--extra_build_flags=*) extra_build_flags="${arg#*=}";;
--build_only) build_only=true ;;
--scratch-dir=*) root_dir="${arg#*=}";;
--reorder_inputs=*) reorder_inputs="${arg#*=}";;
--system_config=*) system_config="${arg#*=}";;
--memory_mode=*) memory_mode="${arg#*=}";;
*)
Expand Down Expand Up @@ -151,7 +148,7 @@ function generate_pte_file() {
# We are using the aot_lib from build_quantization_aot_lib below
SO_LIB=$(find cmake-out-aot-lib -name libquantized_ops_aot_lib.${SO_EXT})

local ARM_AOT_CMD="python3 -m examples.arm.aot_arm_compiler --model_name=${model} --target=${target} ${model_compiler_flags} --reorder_inputs=${reorder_inputs} --output ${output_folder} --so_library=$SO_LIB --system_config=${system_config} --memory_mode=${memory_mode}"
local ARM_AOT_CMD="python3 -m examples.arm.aot_arm_compiler --model_name=${model} --target=${target} ${model_compiler_flags} --output ${output_folder} --so_library=$SO_LIB --system_config=${system_config} --memory_mode=${memory_mode}"
echo "CALL ${ARM_AOT_CMD}" >&2
${ARM_AOT_CMD} 1>&2

Expand Down Expand Up @@ -372,7 +369,6 @@ if [[ -z "$model_name" ]]; then
else
test_model=( "$model_name" )
model_compiler_flags=( "$aot_arm_compiler_flags" )
reorder_inputs=( "$reorder_inputs" )
fi

# loop over running the AoT flow and executing the model on device
Expand Down
Loading