Skip to content

Commit 4e112f9

Browse files
authored
Qualcomm AI Engine Direct - add op support list (#10253)
### Summary - add op support list of HTP BE - rearrange a bit for matching QNN document Fixes #10220. ### Test plan python backends/qualcomm/tests/test_qnn_delegate.py TestQNNQuantizedOperator -s $DEVICE_SN -b build-android -m SM8750
1 parent cb80092 commit 4e112f9

File tree

4 files changed

+139
-16
lines changed

4 files changed

+139
-16
lines changed

backends/qualcomm/builders/README.md

Lines changed: 124 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Thank you for contributing to Qualcomm AI Engine Direct delegate for ExecuTorch.
88
* [Check Operator Spec](#check-operator-spec)
99
* [Implementation](#implementation)
1010
* [Quantizer Annotation](#quantizer-annotation)
11+
* [Operator Support Status](#operator-support-status)
1112
* [Issues](#issues)
1213
* [Pull Requests](#pull-requests)
1314

@@ -246,7 +247,7 @@ Now, we can start to fill in function body step by step:
246247
nodes_to_wrappers,
247248
)
248249
```
249-
The logic should be similar and straightforward. Please carefully set arguments `tensor_type`
250+
The logic should be similar and straightforward. Please carefully set arguments `tensor_type`
250251
according to tensors' property.
251252
252253
3. Define parameters:
@@ -355,6 +356,128 @@ Now, we can start to fill in function body step by step:
355356
### Quantizer Annotation
356357
The operator now should be functional for Qualcomm backends. For operator to work in fixed-precision, we should also make `QnnQuantizer` to correctly insert observers for recording calibrated encodings. Please read more on the [Quantization Annotation Tutorial](../quantizer//README.md).
357358

359+
## Operator Support Status
360+
Please help update following table if you are contributing new operators:
361+
362+
| Operators | HTP - 77/116 Enabled |
363+
|-----------|---------|
364+
| Argmax | ✗ |
365+
| Argmin | ✓ |
366+
| BatchNorm | ✓ |
367+
| BatchToSpace | ✗ |
368+
| Cast | ✓ |
369+
| ChannelShuffle | ✗ |
370+
| Concat | ✓ |
371+
| Conv2d | ✓ |
372+
| Conv3d | ✗ |
373+
| Convert | ✓ |
374+
| CreateSparse | ✗ |
375+
| CumulativeSum | ✓ |
376+
| DepthToSpace | ✓ |
377+
| DepthWiseConv2d | ✓ |
378+
| Dequantize | ✓ |
379+
| DetectionOutput | ✗ |
380+
| ElementWiseAbs | ✓ |
381+
| ElementWiseAdd | ✓ |
382+
| ElementWiseAnd | ✓ |
383+
| ElementWiseAsin | ✗ |
384+
| ElementWiseAtan | ✗ |
385+
| ElementWiseBinary | ✗ |
386+
| ElementWiseCeil | ✓ |
387+
| ElementWiseCos | ✓ |
388+
| ElementWiseDivide | ✓ |
389+
| ElementWiseEqual | ✓ |
390+
| ElementWiseExp | ✓ |
391+
| ElementWiseFloor | ✗ |
392+
| ElementWiseFloorDiv | ✗ |
393+
| ElementWiseGreater | ✓ |
394+
| ElementWiseGreaterEqual | ✓ |
395+
| ElementWiseLess | ✓ |
396+
| ElementWiseLessEqual | ✓ |
397+
| ElementWiseLog | ✓ |
398+
| ElementWiseMaximum | ✓ |
399+
| ElementWiseMinimum | ✓ |
400+
| ElementWiseMultiply | ✓ |
401+
| ElementWiseNeg | ✓ |
402+
| ElementWiseNeuron | ✓ |
403+
| ElementWiseNot | ✓ |
404+
| ElementWiseNotEqual | ✓ |
405+
| ElementWiseOr | ✓ |
406+
| ElementWisePower | ✓ |
407+
| ElementWiseRound | ✗ |
408+
| ElementWiseRsqrt | ✓ |
409+
| ElementWiseSelect | ✓ |
410+
| ElementWiseSign | ✗ |
411+
| ElementWiseSin | ✓ |
412+
| ElementWiseSquaredDifference | ✗ |
413+
| ElementWiseSquareRoot | ✓ |
414+
| ElementWiseSubtract | ✓ |
415+
| ElementWiseUnary | ✗ |
416+
| ElementWiseXor | ✗ |
417+
| Elu | ✓ |
418+
| ExpandDims | ✓ |
419+
| ExtractGlimpse | ✗ |
420+
| ExtractPatches | ✗ |
421+
| FullyConnected | ✓ |
422+
| Gather | ✓ |
423+
| GatherElements | ✗ |
424+
| GatherNd | ✓ |
425+
| Gelu | ✓ |
426+
| GetSparseIndices | ✗ |
427+
| GetSparseValues | ✗ |
428+
| GridSample | ✗ |
429+
| GroupNorm | ✓ |
430+
| HardSwish | ✓ |
431+
| InstanceNorm | ✓ |
432+
| L2Norm | ✗ |
433+
| LayerNorm | ✓ |
434+
| LogSoftmax | ✓ |
435+
| Lrn | ✗ |
436+
| Lstm | ✗ |
437+
| MatMul | ✓ |
438+
| MultiClassNms | ✗ |
439+
| NonMaxSuppression | ✗ |
440+
| Nonzero | ✗ |
441+
| OneHot | ✗ |
442+
| Pack | ✓ |
443+
| Pad | ✓ |
444+
| PoolAvg2d | ✓ |
445+
| PoolAvg3d | ✗ |
446+
| PoolMax2d | ✓ |
447+
| Prelu | ✓ |
448+
| Quantize | ✓ |
449+
| ReduceMax | ✓ |
450+
| ReduceMean | ✓ |
451+
| ReduceMin | ✗ |
452+
| ReduceSum | ✓ |
453+
| Relu | ✓ |
454+
| Relu1 | ✗ |
455+
| Relu6 | ✗ |
456+
| ReluMinMax | ✓ |
457+
| Reshape | ✓ |
458+
| Resize | ✗ |
459+
| ResizeBilinear | ✓ |
460+
| ResizeNearestNeighbor | ✓ |
461+
| RoiAlign | ✗ |
462+
| RmsNorm | ✓ |
463+
| ScatterElements | ✗ |
464+
| ScatterNd | ✓ |
465+
| Sigmoid | ✓ |
466+
| Softmax | ✓ |
467+
| SpaceToBatch | ✗ |
468+
| SpaceToDepth | ✓ |
469+
| SparseToDense | ✗ |
470+
| Split | ✓ |
471+
| Squeeze | ✓ |
472+
| StridedSlice | ✓ |
473+
| Tanh | ✓ |
474+
| Tile | ✓ |
475+
| TopK | ✓ |
476+
| TransPose | ✓ |
477+
| TransPoseConv2d | ✓ |
478+
| TransPoseConv3d | ✗ |
479+
| Unpack | ✓ |
480+
358481
## Issues
359482
Please refer to the [issue section](../README.md#issues) for more information.
360483

backends/qualcomm/builders/op_amax.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from executorch.backends.qualcomm.utils.constants import QCOM_AXIS_ORDER, QCOM_DATA
1414

1515
from .node_visitor import NodeVisitor, register_node_visitor
16-
from .qnn_constants import OpAmax, QNN_OP_PACKAGE_NAME_QTI_AISW
16+
from .qnn_constants import OpReduceMax, QNN_OP_PACKAGE_NAME_QTI_AISW
1717

1818

1919
@register_node_visitor
@@ -61,12 +61,12 @@ def define_node(
6161
reduce_max_op = PyQnnWrapper.PyQnnOpWrapper(
6262
node.name,
6363
QNN_OP_PACKAGE_NAME_QTI_AISW,
64-
OpAmax.op_name,
64+
OpReduceMax.op_name,
6565
)
6666
reduce_max_op.AddInputTensors([input_tensor_wrapper])
6767
reduce_max_op.AddOutputTensors([output_tensor_wrapper])
6868
reduce_max_op.AddTensorParam(
69-
OpAmax.param_axes,
69+
OpReduceMax.param_axes,
7070
PyQnnWrapper.Qnn_DataType_t.QNN_DATATYPE_UINT_32,
7171
len(mean_dims_shape),
7272
mean_dims_shape,
@@ -76,7 +76,7 @@ def define_node(
7676
if len(node.args) > 2:
7777
keep_dims = cast(bool, node.args[2])
7878
reduce_max_op.AddScalarParam(
79-
OpAmax.param_keep_dims,
79+
OpReduceMax.param_keep_dims,
8080
PyQnnWrapper.Qnn_DataType_t.QNN_DATATYPE_BOOL_8,
8181
{QCOM_DATA: keep_dims},
8282
)

backends/qualcomm/builders/op_sqrt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import torch
1111

1212
from .node_visitor import NodeVisitor, register_node_visitor
13-
from .qnn_constants import OpElementWiseSqrt, QNN_OP_PACKAGE_NAME_QTI_AISW
13+
from .qnn_constants import OpElementWiseSquareRoot, QNN_OP_PACKAGE_NAME_QTI_AISW
1414

1515

1616
@register_node_visitor
@@ -51,7 +51,7 @@ def define_node(
5151
sqrt_op = PyQnnWrapper.PyQnnOpWrapper(
5252
node.name,
5353
QNN_OP_PACKAGE_NAME_QTI_AISW,
54-
OpElementWiseSqrt.op_name,
54+
OpElementWiseSquareRoot.op_name,
5555
)
5656
sqrt_op.AddInputTensors(sqrt_input_tensors)
5757
sqrt_op.AddOutputTensors(sqrt_output_tensors)

backends/qualcomm/builders/qnn_constants.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616

1717
@dataclass(init=False, frozen=True)
18-
class OpAmax:
19-
op_name: str = "ReduceMax"
20-
param_axes: str = "axes"
18+
class OpArgmin:
19+
op_name: str = "Argmin"
20+
param_axis: str = "axis"
2121
param_keep_dims: str = "keep_dims"
2222

2323

@@ -219,7 +219,7 @@ class OpElementWiseSelect:
219219

220220

221221
@dataclass(init=False, frozen=True)
222-
class OpElementWiseSqrt:
222+
class OpElementWiseSquareRoot:
223223
op_name = "ElementWiseSquareRoot"
224224

225225

@@ -365,16 +365,16 @@ class OpQuantize:
365365

366366

367367
@dataclass(init=False, frozen=True)
368-
class OpReduceMean:
369-
op_name: str = "ReduceMean"
368+
class OpReduceMax:
369+
op_name: str = "ReduceMax"
370370
param_axes: str = "axes"
371371
param_keep_dims: str = "keep_dims"
372372

373373

374374
@dataclass(init=False, frozen=True)
375-
class OpArgmin:
376-
op_name: str = "Argmin"
377-
param_axis: str = "axis"
375+
class OpReduceMean:
376+
op_name: str = "ReduceMean"
377+
param_axes: str = "axes"
378378
param_keep_dims: str = "keep_dims"
379379

380380

0 commit comments

Comments
 (0)