|
26 | 26 | )
|
27 | 27 | from executorch.examples.qualcomm.utils import (
|
28 | 28 | build_executorch_binary,
|
| 29 | + generate_inputs, |
29 | 30 | make_output_dir,
|
30 | 31 | make_quantizer,
|
31 | 32 | setup_common_args_and_variables,
|
@@ -230,29 +231,54 @@ def main(args):
|
230 | 231 | if args.compile_only:
|
231 | 232 | sys.exit(0)
|
232 | 233 |
|
233 |
| - # setup required paths accordingly |
234 |
| - # qnn_sdk : QNN SDK path setup in environment variable |
235 |
| - # artifact_path : path where artifacts were built |
236 |
| - # pte_path : path where executorch binary was stored |
237 |
| - # device_id : serial number of android device |
238 |
| - # workspace : folder for storing artifacts on android device |
239 |
| - adb = SimpleADB( |
240 |
| - qnn_sdk=os.getenv("QNN_SDK_ROOT"), |
241 |
| - build_path=f"{args.build_folder}", |
242 |
| - pte_path=f"{args.artifact}/{pte_filename}.pte", |
243 |
| - workspace=workspace, |
244 |
| - device_id=args.device, |
245 |
| - host_id=args.host, |
246 |
| - soc_model=args.model, |
247 |
| - ) |
248 |
| - adb.push(inputs=sample_input, input_list=input_list, files=op_package_paths) |
249 |
| - adb.execute() |
250 |
| - |
251 | 234 | # collect output data
|
252 | 235 | output_data_folder = f"{args.artifact}/outputs"
|
253 | 236 | make_output_dir(output_data_folder)
|
254 | 237 |
|
255 |
| - adb.pull(output_path=args.artifact) |
| 238 | + if args.enable_x86_64: |
| 239 | + input_list_filename = "input_list.txt" |
| 240 | + input_list = f"{args.artifact}/{input_list}" |
| 241 | + generate_inputs(args.artifact, input_list_filename, sample_input, input_list) |
| 242 | + qnn_sdk = os.getenv("QNN_SDK_ROOT") |
| 243 | + assert qnn_sdk, "QNN_SDK_ROOT was not found in environment variable" |
| 244 | + target = "x86_64-linux-clang" |
| 245 | + |
| 246 | + runner_cmd = " ".join( |
| 247 | + [ |
| 248 | + f"export LD_LIBRARY_PATH={qnn_sdk}/lib/{target}/:{args.build_folder}/lib &&", |
| 249 | + f"./{args.build_folder}/examples/qualcomm/executor_runner/qnn_executor_runner", |
| 250 | + f"--model_path {args.artifact}/{pte_filename}.pte", |
| 251 | + f"--input_list_path {args.artifact}/{input_list_filename}", |
| 252 | + f"--output_folder_path {output_data_folder}", |
| 253 | + ] |
| 254 | + ) |
| 255 | + subprocess.run( |
| 256 | + runner_cmd, |
| 257 | + # stdout=subprocess.PIPE, |
| 258 | + # stderr=subprocess.STDOUT, |
| 259 | + shell=True, |
| 260 | + executable="/bin/bash", |
| 261 | + capture_output=True, |
| 262 | + ) |
| 263 | + else: |
| 264 | + # setup required paths accordingly |
| 265 | + # qnn_sdk : QNN SDK path setup in environment variable |
| 266 | + # artifact_path : path where artifacts were built |
| 267 | + # pte_path : path where executorch binary was stored |
| 268 | + # device_id : serial number of android device |
| 269 | + # workspace : folder for storing artifacts on android device |
| 270 | + adb = SimpleADB( |
| 271 | + qnn_sdk=os.getenv("QNN_SDK_ROOT"), |
| 272 | + build_path=f"{args.build_folder}", |
| 273 | + pte_path=f"{args.artifact}/{pte_filename}.pte", |
| 274 | + workspace=workspace, |
| 275 | + device_id=args.device, |
| 276 | + host_id=args.host, |
| 277 | + soc_model=args.model, |
| 278 | + ) |
| 279 | + adb.push(inputs=sample_input, input_list=input_list, files=op_package_paths) |
| 280 | + adb.execute() |
| 281 | + adb.pull(output_path=args.artifact) |
256 | 282 |
|
257 | 283 | x86_golden = instance(*sample_input)
|
258 | 284 | device_output = torch.from_numpy(
|
|
0 commit comments