Skip to content

Commit a945e40

Browse files
cccclaifacebook-github-bot
authored andcommitted
Add buck file for unit test (#8106)
Summary: Pull Request resolved: #8106 ``` buck2 test 'fbcode//mode/dev-nosan' fbcode//executorch/backends/qualcomm/tests/fb:test_qnn_delegate_simulator -- --exact 'executorch/backends/qualcomm/tests/fb:test_qnn_delegate_simulator - test_qnn_backend_mha (executorch.backends.qualcomm.tests.fb.test_qnn_delegate_simulator.TestQNNQuantizedOperatorSimulator)' ``` Differential Revision: D67463640
1 parent 746875c commit a945e40

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

backends/qualcomm/tests/TARGETS

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
2+
load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest")
3+
load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_verision")
4+
5+
python_library(
6+
name = "models",
7+
srcs = ["models.py"],
8+
deps = [
9+
"//caffe2:torch",
10+
]
11+
)
12+
13+
python_library(
14+
name = "test_qnn_delegate",
15+
srcs = [
16+
"test_qnn_delegate.py",
17+
"utils.py",
18+
],
19+
# env = {
20+
# "LD_LIBRARY_PATH": "$(location fbsource//third-party/qualcomm/qnn/qnn-{0}:qnn_offline_compile_libs)".format(get_qnn_library_verision()),
21+
# },
22+
deps = [
23+
":models",
24+
"//caffe2:torch",
25+
"//caffe2/functorch:functorch_src",
26+
"//executorch/exir/backend:partitioner",
27+
"//executorch/exir/dialects:lib",
28+
"//executorch/extension/pybindings:portable_lib", # @manual
29+
"//executorch/extension/pytree:pylib",
30+
"//executorch/backends/qualcomm/partition:partition",
31+
"//executorch/backends/qualcomm/quantizer:quantizer",
32+
"//executorch/backends/qualcomm/serialization:serialization",
33+
"//executorch/backends/qualcomm/utils:utils",
34+
"//executorch/devtools:lib",
35+
"//executorch/examples/qualcomm:utils",
36+
"//executorch/examples/models:models",
37+
"//executorch/backends/qualcomm/debugger:utils",
38+
],
39+
)

backends/qualcomm/tests/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class TestQNN(unittest.TestCase):
114114
host: str = ""
115115
device: str = ""
116116
build_folder: str = ""
117-
model: QcomChipset = None
117+
model: str = "SM8650"
118118
compiler_specs: List[CompileSpec] = None
119119
chipset_table = get_soc_to_chipset_map()
120120
error_only = False
@@ -125,13 +125,15 @@ class TestQNN(unittest.TestCase):
125125
image_dataset: str = ""
126126
pretrained_weight: str = ""
127127
enable_profile: bool = False
128+
compile_only: bool = True
128129
online_prepare: bool = False
129130
use_8a8w: str = "8a8w"
130131
use_16a16w: str = "16a16w"
131132
use_16a4w: str = "16a4w"
132133
shared_buffer: bool = False
133-
enable_x86_64: bool = False
134+
enable_x86_64: bool = True
134135
compile_only: bool = False
136+
dump_intermediate_outputs: bool = False
135137

136138
def _assert_outputs_equal(self, model_output, ref_output):
137139
self.assertTrue(len(ref_output) == len(model_output))
@@ -198,6 +200,7 @@ def verify_output( # noqa: C901
198200
)
199201

200202
output_dir = f"{tmp_dir}/outputs"
203+
os.makedirs(output_dir, exist_ok=True)
201204
outputs = []
202205
etdump_path = f"{tmp_dir}/etdump.etdp"
203206
debug_output_path = f"{tmp_dir}/debug_output.bin"

0 commit comments

Comments
 (0)