@@ -436,9 +436,38 @@ def validate_intermediate_tensor():
436436 # ok, assuming the user give a relative path to cwd
437437 build_folder = os .path .join (os .getcwd (), self .build_folder )
438438
439+ env_runner = os .environ .get ("QNN_EXECUTOR_RUNNER" )
440+ runner_from_env = bool (env_runner and env_runner .strip ())
441+ if runner_from_env :
442+ qnn_executor_runner = os .path .abspath (env_runner .strip ())
443+ else :
444+ qnn_executor_runner = os .path .join (
445+ build_folder ,
446+ "examples/qualcomm/executor_runner/qnn_executor_runner" ,
447+ )
448+ if not os .path .isfile (qnn_executor_runner ):
449+ if runner_from_env :
450+ raise FileNotFoundError (
451+ f"QNN_EXECUTOR_RUNNER is set to { qnn_executor_runner !r} "
452+ "but no file exists at that path. Update the "
453+ "environment variable to point at the built "
454+ "qnn_executor_runner binary."
455+ )
456+ raise FileNotFoundError (
457+ f"qnn_executor_runner not found at { qnn_executor_runner !r} . "
458+ "Set the QNN_EXECUTOR_RUNNER environment variable to the "
459+ "built binary, or build it via CMake so it appears at "
460+ f"{ build_folder } /examples/qualcomm/executor_runner/qnn_executor_runner."
461+ )
462+ if not os .access (qnn_executor_runner , os .X_OK ):
463+ raise PermissionError (
464+ f"{ qnn_executor_runner !r} exists but is not executable. "
465+ "Run `chmod +x` on the binary or rebuild it."
466+ )
467+
439468 cmd = [
440469 # qnn_executor_runner
441- f" { build_folder } /examples/qualcomm/executor_runner/ qnn_executor_runner" ,
470+ qnn_executor_runner ,
442471 "--model_path" ,
443472 pte_fname ,
444473 "--input_list_path" ,
0 commit comments