File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ et_root_dir=$(realpath "${script_dir}/../..")
1717model=" add"
1818xnnpack=false
1919quantize=false
20+ verbose=false
2021
2122usage () {
2223 cat << EOF
@@ -34,6 +35,7 @@ for arg in "$@"; do
3435 --model=* ) model=" ${arg#* =} " ;;
3536 --xnnpack) xnnpack=true ;;
3637 --quantize) quantize=true ;;
38+ --verbose) verbose=true ;;
3739 -h|--help) usage; exit 0 ;;
3840 * ) echo " Unknown option: $arg " >&2 ; usage; exit 1 ;;
3941 esac
4648if ${quantize} ; then
4749 run_extra_args+=(--quantize)
4850fi
51+ if ${verbose} ; then
52+ run_extra_args+=(--verbose)
53+ fi
4954
5055bash " ${et_root_dir} /examples/riscv/setup.sh"
5156bash " ${et_root_dir} /examples/riscv/run.sh" --model=" ${model} " " ${run_extra_args[@]} "
Original file line number Diff line number Diff line change 1111"""
1212
1313import argparse
14+ import logging
1415from pathlib import Path
1516
1617import torch
@@ -75,8 +76,16 @@ def main() -> None:
7576 action = "store_true" ,
7677 help = "Produce an 8-bit quantized model" ,
7778 )
79+ parser .add_argument (
80+ "--verbose" ,
81+ action = "store_true" ,
82+ help = "Enable XNNPACK partitioner DEBUG logging and dump the lowered graph" ,
83+ )
7884 args = parser .parse_args ()
7985
86+ if args .verbose :
87+ logging .basicConfig (level = logging .DEBUG )
88+
8089 if args .output is None :
8190 args .output = Path (f"{ args .model } _riscv.bpte" )
8291
@@ -100,7 +109,8 @@ def main() -> None:
100109 from executorch .backends .xnnpack .partition .xnnpack_partitioner import (
101110 XnnpackPartitioner ,
102111 )
103- partitioners .append (XnnpackPartitioner ())
112+
113+ partitioners .append (XnnpackPartitioner (verbose = args .verbose ))
104114
105115 compile_config = None
106116 if args .quantize :
@@ -121,6 +131,11 @@ def main() -> None:
121131 f"quantize={ args .quantize } delegated_nodes={ delegated } "
122132 )
123133
134+ if args .verbose :
135+ from executorch .exir .backend .utils import print_delegated_graph
136+
137+ print_delegated_graph (edge .exported_program ().graph_module )
138+
124139 et_program = edge .to_executorch ()
125140
126141 test_suite = MethodTestSuite (
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ qemu_timeout="600"
2323model=" add"
2424xnnpack=false
2525quantize=false
26+ verbose=false
2627
2728usage () {
2829 cat << EOF
@@ -31,6 +32,7 @@ Options:
3132 --model=<NAME> Which model to export and run (default: ${model} )
3233 --xnnpack Enable the XNNPACK backend (AOT partitioner + runtime)
3334 --quantize Produce an 8-bit quantized model
35+ --verbose Enable XNNPACK partitioner DEBUG logging and dump the lowered graph
3436 --build_only Only export and cross-compile; do not invoke QEMU
3537 --build_dir=<DIR> CMake build directory (default: ${build_dir} )
3638 --output_dir=<DIR> Directory for the exported .bpte (default: ${output_dir} )
@@ -45,6 +47,7 @@ for arg in "$@"; do
4547 --model=* ) model=" ${arg#* =} " ;;
4648 --xnnpack) xnnpack=true ;;
4749 --quantize) quantize=true ;;
50+ --verbose) verbose=true ;;
4851 --build_only) build_only=true ;;
4952 --build_dir=* ) build_dir=" ${arg#* =} " ;;
5053 --output_dir=* ) output_dir=" ${arg#* =} " ;;
6669if ${quantize} ; then
6770 aot_extra_args+=(--quantize)
6871fi
72+ if ${verbose} ; then
73+ aot_extra_args+=(--verbose)
74+ fi
6975python " ${script_dir} /aot_riscv.py" --model " ${model} " " ${aot_extra_args[@]} " --output " ${bpte_path} "
7076
7177echo " [run.sh] Step 2/3: cross-compile executor_runner for riscv64-linux"
You can’t perform that action at this time.
0 commit comments