Skip to content

Commit 55ed63f

Browse files
winskuo-quicfacebook-github-bot
authored andcommitted
Qualcomm AI Engine Direct - Update arch and soc chipset terms (#6227)
Summary: - Previously, we use the term arch_table and soc model interchangeably. However, these 2 terms referd to 2 different things. arch_table is now referred to htp arch table, which refers to htp architecture verison, such as v73, v75, etc. On the other hand, SoC model will be referring to the SoC chipsets ID, such as SM8550, SM8650, etc. - Removed tutorial to add SoC. I don't think external users will be able to get SoC IDs. Pull Request resolved: #6227 Reviewed By: tarun292 Differential Revision: D64411771 Pulled By: cccclai fbshipit-source-id: 1871b1df1633560be48eb80f62ac83382dd7164f
1 parent 8dbd14c commit 55ed63f

File tree

5 files changed

+31
-40
lines changed

5 files changed

+31
-40
lines changed

backends/qualcomm/README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,8 @@ Please check `generate_qnn_executorch_compiler_spec()` in
2121
- Snapdragon 8 Gen 2
2222
- Snapdragon 8 Gen 3
2323

24-
### How to add more supported Chipset
25-
26-
#### Step 1: Check SoC model of snapdragon device
27-
Get SoC model which would like to be supported from the document of Qualcomm AI Engine Direct SDK.
28-
29-
#### Step 2: Update schema of compiler option and SoC information in serialization
30-
Add SoC model into QcomChipset enum in [schema](./serialization/schema.fbs) and [qnn_compile_spec_schema](./serialization/qnn_compile_spec_schema.py).
31-
Insert new SoC information into _soc_info_table in [qnn_compile_spec_schema](./serialization/qnn_compile_spec_schema.py).
32-
33-
#### Step 3: Recompile the .pte file
34-
Follow [setup](../../docs/source/build-run-qualcomm-ai-engine-direct-backend.md) to setup environment and build runtime with new schema header.
24+
### Adding more supported Chipset
25+
Currently, users cannot add additional chipset models because the chipset ID is not accessible to community users. If you have specific chipset models you wish to add, please contact one of the authors in the `Code Reviews` section at the bottom of this page.
3526

3627
### Supported Inference Type
3728
- Quantized

backends/qualcomm/tests/test_qnn_delegate.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def setUp(self):
6868
TestQNN.rtol = 1e-1
6969
backend_options = generate_htp_compiler_spec(use_fp16=True)
7070
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
71-
soc_model=self.arch_table[TestQNN.model],
71+
soc_model=self.chipset_table[TestQNN.model],
7272
backend_options=backend_options,
7373
debug=False,
7474
saver=False,
@@ -522,7 +522,7 @@ def setUp(self):
522522
TestQNN.rtol = 1e-1
523523
backend_options = generate_htp_compiler_spec(use_fp16=True)
524524
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
525-
soc_model=self.arch_table[TestQNN.model],
525+
soc_model=self.chipset_table[TestQNN.model],
526526
backend_options=backend_options,
527527
debug=False,
528528
saver=False,
@@ -674,7 +674,7 @@ def setUp(self):
674674
TestQNN.rtol = 1
675675
backend_options = generate_htp_compiler_spec(use_fp16=False)
676676
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
677-
soc_model=self.arch_table[TestQNN.model],
677+
soc_model=self.chipset_table[TestQNN.model],
678678
backend_options=backend_options,
679679
debug=False,
680680
saver=False,
@@ -1236,7 +1236,7 @@ def setUp(self):
12361236
TestQNN.rtol = 1
12371237
backend_options = generate_htp_compiler_spec(use_fp16=False)
12381238
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
1239-
soc_model=self.arch_table[TestQNN.model],
1239+
soc_model=self.chipset_table[TestQNN.model],
12401240
backend_options=backend_options,
12411241
debug=False,
12421242
saver=False,
@@ -1444,7 +1444,7 @@ def setUp(self):
14441444
TestQNN.rtol = 1e-1
14451445
backend_options = generate_htp_compiler_spec(use_fp16=True)
14461446
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
1447-
soc_model=self.arch_table[TestQNN.model],
1447+
soc_model=self.chipset_table[TestQNN.model],
14481448
backend_options=backend_options,
14491449
debug=False,
14501450
saver=False,
@@ -1453,7 +1453,7 @@ def setUp(self):
14531453
def test_qnn_backend_dump_intermediate_outputs(self):
14541454
backend_options = generate_htp_compiler_spec(use_fp16=True)
14551455
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
1456-
soc_model=self.arch_table[TestQNN.model],
1456+
soc_model=self.chipset_table[TestQNN.model],
14571457
backend_options=backend_options,
14581458
dump_intermediate_outputs=True,
14591459
)
@@ -1498,7 +1498,7 @@ def test_qnn_backend_multi_contexts(self):
14981498
use_multi_contexts=True,
14991499
)
15001500
compiler_specs = generate_qnn_executorch_compiler_spec(
1501-
soc_model=self.arch_table[TestQNN.model],
1501+
soc_model=self.chipset_table[TestQNN.model],
15021502
backend_options=backend_options,
15031503
)
15041504
partitioner = QnnPartitioner(compiler_specs)
@@ -1514,7 +1514,7 @@ def test_qnn_backend_multi_contexts_composite(self):
15141514
use_multi_contexts=True,
15151515
)
15161516
compiler_specs = generate_qnn_executorch_compiler_spec(
1517-
soc_model=self.arch_table[TestQNN.model],
1517+
soc_model=self.chipset_table[TestQNN.model],
15181518
backend_options=backend_options,
15191519
)
15201520
module = CompositeDelegateModule( # noqa: F405
@@ -1535,7 +1535,7 @@ def test_qnn_backend_profile_op(self):
15351535
TestQNN.enable_profile = True
15361536
backend_options = generate_htp_compiler_spec(use_fp16=True)
15371537
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
1538-
soc_model=self.arch_table[TestQNN.model],
1538+
soc_model=self.chipset_table[TestQNN.model],
15391539
backend_options=backend_options,
15401540
profile=True,
15411541
)
@@ -1554,7 +1554,7 @@ def test_qnn_backend_shared_buffer(self):
15541554
use_fp16=True,
15551555
)
15561556
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
1557-
soc_model=self.arch_table[TestQNN.model],
1557+
soc_model=self.chipset_table[TestQNN.model],
15581558
backend_options=backend_options,
15591559
shared_buffer=True,
15601560
)
@@ -1569,7 +1569,7 @@ def test_qnn_backend_shared_buffer(self):
15691569
def test_qnn_backend_online_prepare(self):
15701570
backend_options = generate_htp_compiler_spec(use_fp16=True)
15711571
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
1572-
soc_model=self.arch_table[TestQNN.model],
1572+
soc_model=self.chipset_table[TestQNN.model],
15731573
backend_options=backend_options,
15741574
online_prepare=True,
15751575
)
@@ -1590,7 +1590,7 @@ def test_qnn_backend_context_direct(self):
15901590
bundle_program = from_context_binary(ctx_path, "ctx_loader")
15911591
backend_options = generate_htp_compiler_spec(use_fp16=True)
15921592
compiler_specs = generate_qnn_executorch_compiler_spec(
1593-
soc_model=self.arch_table[TestQNN.model],
1593+
soc_model=self.chipset_table[TestQNN.model],
15941594
backend_options=backend_options,
15951595
is_from_context_binary=True,
15961596
)
@@ -1614,7 +1614,7 @@ def setUp(self):
16141614
TestQNN.rtol = 1
16151615
backend_options = generate_htp_compiler_spec(use_fp16=False)
16161616
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
1617-
soc_model=self.arch_table[TestQNN.model],
1617+
soc_model=self.chipset_table[TestQNN.model],
16181618
backend_options=backend_options,
16191619
debug=False,
16201620
saver=False,
@@ -1623,7 +1623,7 @@ def setUp(self):
16231623
def test_qnn_backend_dump_intermediate_outputs(self):
16241624
backend_options = generate_htp_compiler_spec(use_fp16=False)
16251625
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
1626-
soc_model=self.arch_table[TestQNN.model],
1626+
soc_model=self.chipset_table[TestQNN.model],
16271627
backend_options=backend_options,
16281628
dump_intermediate_outputs=True,
16291629
)
@@ -1657,7 +1657,7 @@ def test_qnn_backend_skip_node_id_quantizer(self):
16571657
use_fp16=False,
16581658
)
16591659
compiler_specs = generate_qnn_executorch_compiler_spec(
1660-
soc_model=self.arch_table[TestQNN.model],
1660+
soc_model=self.chipset_table[TestQNN.model],
16611661
backend_options=backend_options,
16621662
)
16631663
partitioner = QnnPartitioner(compiler_specs)
@@ -1704,7 +1704,7 @@ def test_qnn_backend_skip_node_op_quantizer(self):
17041704
use_fp16=False,
17051705
)
17061706
compiler_specs = generate_qnn_executorch_compiler_spec(
1707-
soc_model=self.arch_table[TestQNN.model],
1707+
soc_model=self.chipset_table[TestQNN.model],
17081708
backend_options=backend_options,
17091709
)
17101710
partitioner = QnnPartitioner(compiler_specs)
@@ -1740,7 +1740,7 @@ def test_qnn_backend_graph_level_mixed_precision(self):
17401740
use_fp16=False,
17411741
)
17421742
compiler_specs = generate_qnn_executorch_compiler_spec(
1743-
soc_model=self.arch_table[TestQNN.model],
1743+
soc_model=self.chipset_table[TestQNN.model],
17441744
backend_options=backend_options,
17451745
)
17461746
partitioner = QnnPartitioner(compiler_specs)
@@ -1781,7 +1781,7 @@ def test_qnn_backend_multi_contexts(self):
17811781
use_multi_contexts=True,
17821782
)
17831783
compiler_specs = generate_qnn_executorch_compiler_spec(
1784-
soc_model=self.arch_table[TestQNN.model],
1784+
soc_model=self.chipset_table[TestQNN.model],
17851785
backend_options=backend_options,
17861786
)
17871787
partitioner = QnnPartitioner(compiler_specs)
@@ -1797,7 +1797,7 @@ def test_qnn_backend_multi_contexts_composite(self):
17971797
use_multi_contexts=True,
17981798
)
17991799
compiler_specs = generate_qnn_executorch_compiler_spec(
1800-
soc_model=self.arch_table[TestQNN.model],
1800+
soc_model=self.chipset_table[TestQNN.model],
18011801
backend_options=backend_options,
18021802
)
18031803
module = CompositeDelegateModule( # noqa: F405
@@ -1819,7 +1819,7 @@ def test_qnn_backend_profile_op(self):
18191819
TestQNN.enable_profile = True
18201820
backend_options = generate_htp_compiler_spec(use_fp16=False)
18211821
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
1822-
soc_model=self.arch_table[TestQNN.model],
1822+
soc_model=self.chipset_table[TestQNN.model],
18231823
backend_options=backend_options,
18241824
profile=True,
18251825
)
@@ -1839,7 +1839,7 @@ def test_qnn_backend_shared_buffer(self):
18391839
use_fp16=False,
18401840
)
18411841
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
1842-
soc_model=self.arch_table[TestQNN.model],
1842+
soc_model=self.chipset_table[TestQNN.model],
18431843
backend_options=backend_options,
18441844
shared_buffer=True,
18451845
)
@@ -1855,7 +1855,7 @@ def test_qnn_backend_shared_buffer(self):
18551855
def test_qnn_backend_online_prepare(self):
18561856
backend_options = generate_htp_compiler_spec(use_fp16=False)
18571857
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
1858-
soc_model=self.arch_table[TestQNN.model],
1858+
soc_model=self.chipset_table[TestQNN.model],
18591859
backend_options=backend_options,
18601860
online_prepare=True,
18611861
)
@@ -1877,7 +1877,7 @@ def test_qnn_backend_context_direct(self):
18771877
bundle_program = from_context_binary(ctx_path, "ctx_loader")
18781878
backend_options = generate_htp_compiler_spec(use_fp16=False)
18791879
compiler_specs = generate_qnn_executorch_compiler_spec(
1880-
soc_model=self.arch_table[TestQNN.model],
1880+
soc_model=self.chipset_table[TestQNN.model],
18811881
backend_options=backend_options,
18821882
is_from_context_binary=True,
18831883
)

backends/qualcomm/tests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class TestQNN(unittest.TestCase):
120120
build_folder: Literal = ""
121121
model: QcomChipset = None
122122
compiler_specs: List[CompileSpec] = None
123-
arch_table = get_soc_to_chipset_map()
123+
chipset_table = get_soc_to_chipset_map()
124124
error_only = False
125125
ip = "localhost"
126126
port = 8080

examples/qualcomm/oss_scripts/llama2/llama.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def compile(args):
394394
end_quantize_ts = time.time()
395395
print("single_llama.quantize(quant_dtype)", end_quantize_ts - start_quantize_ts)
396396
single_llama.lowering_modules(
397-
args.artifact, kv_type=kv_type, soc_model=get_soc_to_chipset_map[args.model]
397+
args.artifact, kv_type=kv_type, soc_model=get_soc_to_chipset_map()[args.model]
398398
)
399399
end_lowering_ts = time.time()
400400
print("Complete Compile", end_lowering_ts - end_quantize_ts)

examples/qualcomm/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(
8383
self.dump_intermediate_outputs = dump_intermediate_outputs
8484
self.debug_output_path = f"{self.workspace}/debug_output.bin"
8585
self.output_folder = f"{self.workspace}/outputs"
86-
self.soc_model = get_soc_to_arch_map()[soc_model]
86+
self.htp_arch = get_soc_to_arch_map()[soc_model]
8787
self.error_only = error_only
8888
self.shared_buffer = shared_buffer
8989
self.runner = runner
@@ -108,12 +108,12 @@ def push(self, inputs=None, input_list=None, files=None):
108108
*self.pte_path,
109109
f"{self.qnn_sdk}/lib/aarch64-android/libQnnHtp.so",
110110
(
111-
f"{self.qnn_sdk}/lib/hexagon-v{self.soc_model}/"
112-
f"unsigned/libQnnHtpV{self.soc_model}Skel.so"
111+
f"{self.qnn_sdk}/lib/hexagon-v{self.htp_arch}/"
112+
f"unsigned/libQnnHtpV{self.htp_arch}Skel.so"
113113
),
114114
(
115115
f"{self.qnn_sdk}/lib/aarch64-android/"
116-
f"libQnnHtpV{self.soc_model}Stub.so"
116+
f"libQnnHtpV{self.htp_arch}Stub.so"
117117
),
118118
f"{self.qnn_sdk}/lib/aarch64-android/libQnnHtpPrepare.so",
119119
f"{self.qnn_sdk}/lib/aarch64-android/libQnnSystem.so",

0 commit comments

Comments
 (0)