|
| 1 | +# Copyright (c) Qualcomm Innovation Center, Inc. |
| 2 | +# All rights reserved |
| 3 | +# |
| 4 | +# This source code is licensed under the BSD-style license found in the |
| 5 | +# LICENSE file in the root directory of this source tree. |
| 6 | + |
| 7 | +""" |
| 8 | +Buck-native entry point that runs the QNN operator tests on the x86_64 host |
| 9 | +simulator (no connected device, no CMake build tree). |
| 10 | +
|
| 11 | +The full ``test_qnn_delegate.py`` suite is normally driven by its argparse |
| 12 | +``__main__`` block (``setup_environment``). That block never executes under a |
| 13 | +Buck ``python_test`` runner -- Buck imports the module and runs the discovered |
| 14 | +``TestCase`` subclasses directly -- so the flags that select host simulation |
| 15 | +(``--enable_x86_64``, ``--soc_model``, ``--backend``) are never parsed. This |
| 16 | +module re-exports the operator test classes and sets the equivalent ``TestQNN`` |
| 17 | +class attributes at import time so the same tests run unmodified under |
| 18 | +``buck test``. |
| 19 | +
|
| 20 | +The QNN x86 SDK libraries and the host ``qnn_executor_runner`` binary are |
| 21 | +provided by the Buck target's ``env`` (``QNN_SDK_ROOT``, ``LD_LIBRARY_PATH``, |
| 22 | +``QNN_EXECUTOR_RUNNER``); see the ``test_qnn_delegate_x86`` target in BUCK. |
| 23 | +""" |
| 24 | + |
| 25 | +import os |
| 26 | + |
| 27 | +from executorch.backends.qualcomm.tests import test_qnn_delegate as _ops |
| 28 | +from executorch.backends.qualcomm.tests.utils import TestQNN |
| 29 | + |
| 30 | +# Compile ahead-of-time and execute through the x86 simulator (qnn_executor_runner) |
| 31 | +# instead of pushing to a device over adb. |
| 32 | +TestQNN.enable_x86_64 = True |
| 33 | +TestQNN.backend = os.environ.get("QNN_BACKEND", "htp") |
| 34 | +# Only selects the HTP architecture baked into the offline-compiled context |
| 35 | +# binary; the x86 simulator runs the same graph regardless of the physical SoC. |
| 36 | +TestQNN.soc_model = os.environ.get("QNN_SOC_MODEL", "SM8650") |
| 37 | + |
| 38 | + |
| 39 | +# Subclass (rather than re-import) so the test runner discovers these classes as |
| 40 | +# defined in this module. The base classes stay behind the `_ops` module handle |
| 41 | +# so they are not collected (and double-run) from this module's namespace. |
| 42 | +class TestQNNFloatingPointOperator(_ops.TestQNNFloatingPointOperator): |
| 43 | + pass |
| 44 | + |
| 45 | + |
| 46 | +class TestQNNQuantizedOperator(_ops.TestQNNQuantizedOperator): |
| 47 | + pass |
0 commit comments