Skip to content
Merged
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
16 changes: 15 additions & 1 deletion examples/arm/aot_arm_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ def get_compile_spec(
quantize: bool = False,
config: Optional[str] = None,
debug_mode: Optional[str] = None,
direct_drive: bool = False,
) -> TosaCompileSpec | EthosUCompileSpec | VgfCompileSpec:
compile_spec = None
if target.startswith("TOSA"):
Expand All @@ -446,6 +447,9 @@ def get_compile_spec(
extra_flags = ["--verbose-operators", "--verbose-cycle-estimate"]
if debug_mode is not None:
extra_flags.append("--enable-debug-db")
if direct_drive:
extra_flags.append("--separate-io-regions")
extra_flags.append("--cop-format=COP2")
compile_spec = EthosUCompileSpec(
target,
system_config=system_config,
Expand Down Expand Up @@ -616,6 +620,13 @@ def get_args():
choices=["json", "tosa"],
help="Flag to enable ATen-to-TOSA debug mode and dumping of Vela's debug database.",
)
parser.add_argument(
"--direct_drive",
action="store_true",
required=False,
default=False,
help="Flag for enabling direct drive.",
)
args = parser.parse_args()

if args.evaluate and (
Expand Down Expand Up @@ -762,6 +773,7 @@ def to_edge_TOSA_delegate(
args.quantize,
args.config,
args.enable_debug_mode,
args.direct_drive,
)

model_quant = None
Expand Down Expand Up @@ -801,6 +813,7 @@ def to_edge_no_delegate(
args.quantize,
args.config,
args.enable_debug_mode,
args.direct_drive,
)
model, exported_program = quantize_model(
args, model, example_inputs, compile_spec
Expand Down Expand Up @@ -877,7 +890,8 @@ def transform_for_cortex_m_backend(edge_program_manager, args):
exported_program, args, model, example_inputs
)

if args.target != "vgf":
# Cortex-m ops are never included in vgf or direct-drive
if args.target != "vgf" and not args.direct_drive:
# Transform so we can use ops from the Cortex M backend
edge = transform_for_cortex_m_backend(edge, args)

Expand Down
Loading