@@ -177,10 +177,6 @@ def main(args):
177177 # ensure the working directory exist.
178178 os .makedirs (args .artifact , exist_ok = True )
179179
180- quant_dtype = QuantDtype .use_8a8w
181- if args .use_fp16 :
182- quant_dtype = None
183-
184180 instance = Model ()
185181 pte_filename = "custom_qnn"
186182 sample_input = (torch .ones (1 , 32 , 28 , 28 ),)
@@ -194,12 +190,17 @@ def main(args):
194190 soc_info .htp_info .htp_arch ,
195191 args .build_op_package ,
196192 )
197- quantizer = make_quantizer (
198- quant_dtype = quant_dtype ,
199- custom_annotations = (annotate_custom ,),
200- backend = get_backend_type (args .backend ),
201- soc_model = args .model ,
202- )
193+
194+ quant_dtype = QuantDtype .use_8a8w
195+ if args .use_fp16 :
196+ quantizer = None
197+ else :
198+ quantizer = make_quantizer (
199+ quant_dtype = quant_dtype ,
200+ custom_annotations = (annotate_custom ,),
201+ backend = get_backend_type (args .backend ),
202+ soc_model = args .model ,
203+ )
203204
204205 build_executorch_binary (
205206 instance ,
@@ -262,7 +263,17 @@ def main(args):
262263 target = args .target ,
263264 )
264265 adb .push (inputs = sample_input , files = op_package_paths )
266+ if args .debug :
267+ adb .execute (custom_runner_cmd = "logcat -c" )
268+ adb .execute (
269+ custom_runner_cmd = f"echo 0x1f > { workspace } /qnn_executor_runner.farf"
270+ )
271+
265272 adb .execute ()
273+ if args .debug :
274+ adb .execute (
275+ custom_runner_cmd = f"logcat -d -v time >{ workspace } /outputs/debug_logs.txt"
276+ )
266277 adb .pull (host_output_path = args .artifact )
267278
268279 x86_golden = instance (* sample_input )
@@ -326,6 +337,13 @@ def main(args):
326337 default = False ,
327338 )
328339
340+ parser .add_argument (
341+ "--debug" ,
342+ help = "Enable device logging" ,
343+ action = "store_true" ,
344+ default = False ,
345+ )
346+
329347 args = parser .parse_args ()
330348 args .validate (args )
331349
0 commit comments