| Qualcomm Hexagon Public Interface | | --- | Loading... Searching... No Matches - [hexagon](https://docs.qualcomm.com/doc/80-63442-10/topic/dir_982cf7a9d44a85e97e2395acb6238b4d.html) - [include](https://docs.qualcomm.com/doc/80-63442-10/topic/dir_5fa78cc1eebfbbc1413556d9976823a3.html) - [pub](https://docs.qualcomm.com/doc/80-63442-10/topic/dir_3962d8b36b9bb67f8cb633b604becb68.html) [Classes](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#nested-classes) | [Macros](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#define-members) | [Typedefs](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#typedef-members) | [Enumerations](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#enum-members) | [Functions](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#func-members) qhpi.h File Reference Qualcomm HTP Plugin Interface (QHPI). [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#details) `#include ` `#include ` `#include ` `#include ` `#include "qhpi_compat.h"` [Go to the source code of this file.](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h_source.html) | Classes | Classes | | --- | --- | | struct | [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) | | | A small fixed-capacity vector of dimension sizes. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html#details) | | | | | struct | [QHPI_Quant_Parameters](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Quant__Parameters.html) | | | Quantization parameters mapping stored integers to real values. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Quant__Parameters.html#details) | | | | | struct | [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) | | | Properties of an output tensor for an operator. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html#details) | | | | | struct | [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) | | | Reference to a specific output of an operator. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html#details) | | | | | struct | [QHPI_DimInfo](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__DimInfo.html) | | | One dimension entry in a chunked memory layout descriptor. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__DimInfo.html#details) | | | | | struct | [QHPI_ChunkedMemoryLayout](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__ChunkedMemoryLayout.html) | | | Descriptor for a chunked (blocked) memory layout. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__ChunkedMemoryLayout.html#details) | | | | | struct | [QHPI_Tensor_Signature_v1](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Tensor__Signature__v1.html) | | | Tensor signature describing the expected properties of one input or output parameter of a kernel. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Tensor__Signature__v1.html#details) | | | | | struct | [QHPI_Kernel_v1](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Kernel__v1.html) | | | Description of a single kernel implementation for an operator. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Kernel__v1.html#details) | | | | | struct | [QHPI_OpInfo_v1](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpInfo__v1.html) | | | Description of a plugin operator, including all kernel implementations and optimization callbacks. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpInfo__v1.html#details) | | | | | Macros | Macros | | --- | --- | | #define | **QHPI\_MAX\_RANK**   8 | | | Maximum tensor rank supported by QHPI. | | | | | #define | **QHPI\_DEFAULT\_PACKAGE**   "q" | | | Default package name used when none is specified. | | | | | #define | **QHPI\_MAX\_MEMORY\_DIM\_INFO\_SIZE**   9 | | | Maximum number of [QHPI_DimInfo](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__DimInfo.html) entries in a chunked memory layout. | | | | | #define | **QHPI\_MAX\_MEMORY\_LAYOUT\_SIZE**    (sizeof([QHPI_ChunkedMemoryLayout](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__ChunkedMemoryLayout.html)) + (sizeof([QHPI_DimInfo](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__DimInfo.html)) \* [QHPI_MAX_MEMORY_DIM_INFO_SIZE](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aef305751417c4aeb1e18fdfe9dc250a8))) | | | Maximum byte size needed to store a [QHPI_ChunkedMemoryLayout](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__ChunkedMemoryLayout.html) with all dim\_info entries. | | | | | #define | **QHPI\_NO\_TILING**   0xffffffff | | | Sentinel value returned from QHPI\_TileShapeRequired to indicate that a dimension must not be tiled. | | | | | Typedefs | Typedefs | | --- | --- | | typedef uint32\_t | **QHPI\_StatusCode** | | | | | typedef uint32\_t | **QHPI\_Element\_Type** | | | | | typedef struct [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) | [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) | | | Opaque handle to an operator node in the graph. | | | | | typedef [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html)(\* | [QHPI_TileShapeRequired](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a9687456c5d032e5608caf76b52aa8b21)) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | | Callback type: return the required tile shape constraints for an operator. | | | | | typedef [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html)(\* | [QHPI_TileShapeLegalized](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a62dafb717f20073ad934710ccdd57819)) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op, const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \*shape) | | | Callback type: legalize a proposed tile shape by adjusting values. | | | | | typedef const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*(\* | [QHPI_BuildTileOfOp](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#acf284d0504357503f51fff7796c9d155)) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op, const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \*start, const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \*extent) | | | Callback type: build a tiled sub-graph computing a region of the output. | | | | | typedef const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*(\* | [QHPI_RewriteOpFunc](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a64ac2d99bc36b9abbcde1f6364f1e667)) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | | Callback type: rewrite an operator into an equivalent sub-graph. | | | | | typedef uint32\_t | **QHPI\_Standard\_Layout** | | | | | typedef uint32\_t | **QHPI\_MemLoc** | | | | | typedef uint32\_t | **QHPI\_Storage** | | | | | typedef struct [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) | [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) | | | Opaque handle to a tensor at execution time. | | | | | typedef struct [QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) | [QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) | | | Opaque handle to the runtime execution context. | | | | | typedef uint32\_t(\* | [QHPI_Plugin_Function](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#afe68c49db7697c20c13deb199f772879)) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle, uint32\_t num\_outputs, [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*\*outputs, uint32\_t num\_inputs, const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*const \*inputs) | | | Signature for a plugin kernel execution function. | | | | | typedef uint32\_t(\* | [QHPI_Precompute_Function](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ae61f8add7fdc0b41ad6c9955ddd91a78)) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle, void \*data, uint32\_t num\_outputs, [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*\*outputs, uint32\_t num\_inputs, const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*const \*inputs) | | | Signature for a precomputation function. | | | | | typedef uint32\_t(\* | [QHPI_Plugin_Precomputed_Function](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5886582522841b7edf1d442304f5cad4)) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle, const void \*precomputed\_data) | | | Signature for a kernel that uses precomputed data. | | | | | typedef uint32\_t(\* | [QHPI_Kernel_Predicate](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a23bd4de2dbd8709dfd9033498e47a051)) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op, const uint32\_t num\_inputs, const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*const \*inputs) | | | Signature for an optional kernel matching predicate. | | | | | typedef float(\* | [QHPI_Cost_Function](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a9fc47728335eababdc4c536612c99d27)) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle, const uint32\_t num\_inputs, const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*const \*inputs) | | | Signature for a cost estimation function. | | | | | typedef uint32\_t | **QHPI\_Resource** | | | | | Enumerations | Enumerations | | --- | --- | | enum | {

  [QHPI_SUCCESS](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a06fc87d81c62e9abb8790b6e5713c55bada0a5fa98fd5b0bc65e7f819e49a2845) = 0
, [QHPI_UNSUPPORTED](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a06fc87d81c62e9abb8790b6e5713c55badfbb587955138d57a1cec3b89d544018) = 1
, [QHPI_ERROR_FATAL](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a06fc87d81c62e9abb8790b6e5713c55ba92e0fa2c478d56228a8aec2ccd478fa0) = 2
, [QHPI_REGISTRATION_WARNING](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a06fc87d81c62e9abb8790b6e5713c55bada7d79073fc4649f6c2150ac14ac4e1d) = 3
,

  [QHPI_REGISTRATION_ERROR](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a06fc87d81c62e9abb8790b6e5713c55ba64f89fc5de06f38fd694fa6fa505cf72) = 4


} | | | Status codes returned by QHPI functions and plugin callbacks. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a06fc87d81c62e9abb8790b6e5713c55b) | | | | | enum | {

  [QHPI_UNKNOWN](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a531e2c5a377b33c7ddb435734cc0cba6) = 0
, [QHPI_QUINT8](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a7a0ff7cb86859020a5479845af533099) = 1
, [QHPI_QUINT16](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a02f29cf30c86ed19c83dfedff240364a) = 2
, [QHPI_QINT16](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a80f48f985122fb0dc4529af483f8a66e) = 3
,

  [QHPI_FLOAT32](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a215ee2719f8a018c15716b12104441c9) = 4
, [QHPI_INT32](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7afea9c7b3907557c8305a192a1c27df58) = 5
, [QHPI_QINT32](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a5dd213b877151fecedf37cb00a6a642a) = 6
, [QHPI_QINT8](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7afa8b0ba68c0013d49951d49ecdb0ffd3) = 7
,

  [QHPI_FLOAT16](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a66b83b88e8a3b92b950cd9dc53f2e2f7) = 8
, [QHPI_INT64](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a10d2dd6acefae18db2ec28206b3fbf81) = 9
, [QHPI_ELEMENT_TYPE_ANY](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a0028cec597f64d77aeb4d9c26700e969) = 240
, [QHPI_ELEMENT_TYPE_INVALID](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a2fe00075418f561570863d18a11592b2) = 241


} | | | Element data types for tensor values. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7) | | | | | enum | {

  [QHPI_LAYOUT_ANY](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5ad494b4f1be606c71e927bfe44d0d3df0) = 0
, [QHPI_LAYOUT_SHAPE_ONLY](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5ab1fa38ed1aa3b770774acbd24740d69a) = 1
, [QHPI_LAYOUT_FLAT_4](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5a86e2fed8ea3f5a5db2d3fdce7bc4a235) = 2
, [QHPI_LAYOUT_FLAT_5](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5a4c3f56ef0a08d2939e6c92548da0489a) = 3
,

  [QHPI_LAYOUT_FLAT_6](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5a11367c97ea14bcb8a4d5e91b8832c9a4) = 4
, [QHPI_LAYOUT_SINGULAR](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5ac880b3fd34dbdc8ec632957ed87af123) = 5
, [QHPI_LAYOUT_NCHW](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5a6e436951cdb040cb2d65982b918120dd) = 6
, [QHPI_LAYOUT_DEPTH_32](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5afe91d0a5bc28e85007ce4fa859098227) = 7
,

  [QHPI_LAYOUT_WEIGHTS_8X4](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5a7932b4bec5b36df5e2e2f035368187bb) = 8
, [QHPI_LAYOUT_CROUTON_8](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5a4dc89f0b453b13d1c04f2db87ee897f6) = 9
, [QHPI_LAYOUT_CROUTON_16](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5aa61786d1110a1af27a18622d5667e967) = 10
, [QHPI_LAYOUT_CROUTON_32](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5a1e769627d3cafa16e2a514ef34aeae69) = 11
,

  [QHPI_LAYOUT_CROUTON_4X1](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5ae598a38687ef756accbad373a9fc3f82) = 12
, [QHPI_LAYOUT_CROUTON_2X2](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5a767d4557a64904ca1c9018d146577939) = 13
, [QHPI_LAYOUT_WIDE_CROUTON_8](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5a0addcedf0034a4fd477a40f49d0e2265) = 14
, [QHPI_LAYOUT_WIDE_CROUTON_32](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5ae2f38d11dcd411888415bd1568d3a3d9) = 15
,

  [QHPI_LAYOUT_WIDE_CROUTON_2X2](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5a3beeef253ff55aec227934de6b2fb6ba) = 16
, [QHPI_LAYOUT_CUSTOM](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5ae72e106a7d65d460b58f7f57f9826245) = 1000
, [QHPI_LAYOUT_INVALID](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5ac5379b963124c5e61189847b83558921) = INT\_MAX


} | | | Standard memory layout identifiers. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5) | | | | | enum | { [QHPI_MEM_LOC_DDR_ONLY](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#abc6126af1d45847bc59afa0aa3216b04adbb31b7839a9d9e7d756486d9676c971) = 0
, [QHPI_MEM_LOC_TCM_ONLY](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#abc6126af1d45847bc59afa0aa3216b04a39a3b7cfce3f8c5808b8f82d7d169012) = 1
, [QHPI_MEM_LOC_DDR_OR_TCM](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#abc6126af1d45847bc59afa0aa3216b04a926ce4ab20d5cf3188ce5c341fcc52db) = 2
, [QHPI_MEM_LOC_INVALID](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#abc6126af1d45847bc59afa0aa3216b04afd562934f6a99a40fc59c504e26921fe) = INT\_MAX
} | | | Memory location constraint for tensors. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#abc6126af1d45847bc59afa0aa3216b04) | | | | | enum | { [QHPI_STORAGE_DIRECT](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adc29c2ff13d900c2f185ee95427fb06ca1b58e860bb6cfa64569588745c90f834) = 0
, [QHPI_STORAGE_INDIRECT](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adc29c2ff13d900c2f185ee95427fb06ca26c28aa23972020e45e7d925ed0b8b8e) = 1
, [QHPI_STORAGE_DIRECT_OR_INDIRECT](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adc29c2ff13d900c2f185ee95427fb06caaeebab9a2ea616af16b7b552f4333094) = 2
} | | | Storage access mode for tensor data. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adc29c2ff13d900c2f185ee95427fb06c) | | | | | enum | { [QHPI_RESOURCE_MAIN](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a61dadd085c1777f559549e05962b2c9ea0709a2de5b5c29f56703478254c5f328) = 1
, [QHPI_RESOURCE_HVX](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a61dadd085c1777f559549e05962b2c9ea4d6ea3db8fec0ba1a3ecc39a3cfb887f) = 2
, [QHPI_RESOURCE_HMX](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a61dadd085c1777f559549e05962b2c9ea2c760909de3772b513446812586f63e2) = 4
, [QHPI_RESOURCE_EXCLUSIVE](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a61dadd085c1777f559549e05962b2c9ea2b6831470a0aa65db07ba4558e9a8f60) = 0xf
} | | | Hardware resource flags for kernel requirements. [More...](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a61dadd085c1777f559549e05962b2c9e) | | | | | Functions | Functions | | --- | --- | | uint32\_t | [qhpi_element_type_size](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#abae8c4c276329634f4a6ee53e4f08b9d) (QHPI\_Element\_Type type) | | | Return the size in bytes of a single element of the given type. | | | | | [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) | [qhpi_op_reference](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ac949c184f0cb7659450595c709e6a661) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op, uint32\_t out\_number) | | | Construct a [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) from an operator pointer and output index. | | | | | const char \* | [qhpi_op_name](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ac8f104c0ba525091d28edfce5870d3f5) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | | Return the name of an operator. | | | | | uint32\_t | [qhpi_op_num_inputs](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aa38eb2047c7b292e6ad8f91b4e541123) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | | Return the number of inputs to an operator. | | | | | [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) | [qhpi_op_input](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a2be4a956697c0cd842a71cb1c087dbf9) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op, uint32\_t index) | | | Return a reference to a specific input of an operator. | | | | | uint32\_t | [qhpi_op_num_outputs](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a82e202752bf224685011327ee2da8684) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | | Return the number of outputs from an operator. | | | | | [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) | [qhpi_op_output](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aa33a4a60ad31c07c7f54fb21d7cbc6d3) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op, uint32\_t position) | | | Return the output definition for a specific output of an operator. | | | | | uint32\_t | [qhpi_op_is_constant](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aa011f2326d613b3a0a6d54450bedb12f) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | | Test whether an operator is a constant. | | | | | const void \* | [qhpi_op_constant_data](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a30745bf1fca422538685fc829fa649c8) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | | Return a pointer to the raw data of a constant operator. | | | | | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | [qhpi_op_create_constant](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a1733a9b7107af52abd794cf6c69cd735) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*root, const [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) \*output, uint32\_t size, const void \*data) | | | Create a new constant operator in the graph. | | | | | [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) | [qhpi_op_create_shape](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ace53acf29dc8e077144d54dc709b3406) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*root, const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \*shape) | | | Create a shape-only operator encoding dimension information. | | | | | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | [qhpi_op_create](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a3e0b92c711de850d825e40f0e18d2022) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*root, const char \*name, uint32\_t num\_inputs, const [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) \*inputs, uint32\_t num\_outputs, const [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) \*outputs) | | | Create a new operator in the graph. | | | | | QHPI\_StatusCode | [qhpi_option_int](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a07618754f8e20d9aa40da16f011a6156) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op, const char \*name, int32\_t \*value) | | | Retrieve the value of an integer runtime option. | | | | | uint32\_t | [qhpi_op_num_uses](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a80d1b607410d5cb4a2b5a6563099a31e) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | | Return the number of consumers of an operator's output. | | | | | uint32\_t | [qhpi_op_producer_for](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a1a1066cdfd3890bb32a6e58a36918113) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op, const char \*name) | | | Test whether an operator produces input for a named consumer. | | | | | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | [qhpi_op_create_multi_output](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adbd77954b8b21c931953b3e0627b1946) (uint32\_t num\_inputs, const [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) \*inputs) | | | Create a multi-output operator that copies each input as a separate output. | | | | | [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) | [qhpi_op_slice](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adee3795d259df547caf3541081febdf7) ([QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) ref, const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \*start, const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \*extent) | | | Create a slice of a tensor. | | | | | [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) | [qhpi_op_concat](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aecf4d202f6868fe96222f8d5bb91e323) (uint32\_t axis, uint32\_t num\_inputs, const [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) \*inputs) | | | Concatenate multiple tensors along a given axis. | | | | | QHPI\_StatusCode | [qhpi_chunked_layout](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a78a3292f2f1b8df7b9ea81a94f553c89) (QHPI\_Standard\_Layout standard\_layout, [QHPI_ChunkedMemoryLayout](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__ChunkedMemoryLayout.html) \*chunked\_layout, uint32\_t size) | | | Fill in a chunked memory layout descriptor for a standard layout. | | | | | [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) | [qhpi_tensor_shape](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a6e753a59fa2cfbb70a3d8e8db335a825) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor) | | | Return the logical shape of a tensor (excluding padding). | | | | | [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) | [qhpi_tensor_padding](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aa23b3bf302dfb70409b474c7205f85c1) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor) | | | Return the padding applied to a tensor. | | | | | [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) | [qhpi_tensor_padded_shape](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a344b4631f67fa3a00118281cab0633d3) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor) | | | Return the padded (allocated) shape of a tensor. | | | | | QHPI\_Element\_Type | [qhpi_tensor_type](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a1bb688803a2984c943c3d04a9cd1fed7) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor) | | | Return the element type of a tensor. | | | | | QHPI\_Standard\_Layout | [qhpi_tensor_layout](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a496526e42a107192bf49adac5914e40b) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor) | | | Return the memory layout of a tensor. | | | | | QHPI\_MemLoc | [qhpi_tensor_placement](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a7d54152c66efd87c17941d87cd28839f) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor) | | | Return the memory placement of a tensor. | | | | | [QHPI_Quant_Parameters](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Quant__Parameters.html) | [qhpi_tensor_quant_parameters](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a2a86e11ca5a37067edddba8b397a2452) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor) | | | Return the quantization parameters of a tensor. | | | | | void \* | [qhpi_tensor_raw_data](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ae006f6be55f831e8db78e8d20ee95ea4) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor) | | | Return a pointer to the raw data of a direct-storage tensor. | | | | | void \*\* | [qhpi_tensor_block_table](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a790447cce3ca8b8b1882265b1c862a9f) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor) | | | Return the block table of an indirect-storage tensor. | | | | | uint32\_t | [qhpi_tensor_block_table_length](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a12ae905e61acded4f81e266a63dec89e) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor) | | | Return the number of blocks in an indirect tensor's block table. | | | | | [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) | [qhpi_tensor_block_shape](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a0480fb0172c4d813a999e0797f88451e) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor) | | | Return the shape of individual blocks in a blocked tensor. | | | | | float | [qhpi_tensor_get](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad43a2518a3a52e585918271dd2721759) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor, uint32\_t rank,...) | | | Read a tensor element in logical coordinates as float. | | | | | void | [qhpi_tensor_set](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a2b0dffb4903b4b5305a284ab49c9a6b8) (const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*tensor, uint32\_t rank,...) | | | Write a tensor element in logical coordinates from float. | | | | | uint32\_t | [qhpi_num_slices](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a1b8d10f222a4a9daf05e59064975aa70) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle) | | | Return the total number of slices for a self-slicing operator. | | | | | uint32\_t | [qhpi_slice_number](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a97a08b6ad1658fea125710ef5464c96f) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle) | | | Return the slice index for the current invocation. | | | | | void \* | [qhpi_sync_block](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99aa667306d017f64e23557b3ca778f7) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle) | | | Return a pointer to the shared synchronization block. | | | | | uint32\_t | [qhpi_thread_resources](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a09546029ebad2e2490bb172cc20942b4) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*) | | | Return the resource type of the thread currently executing the kernel. | | | | | uint32\_t | [qhpi_srm_context](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a7759d83c7f2665f21a56a3d96a23ac52) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle) | | | Return the SRM compute resource context ID held by the graph. | | | | | uint32\_t | [qhpi_op_is_error](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a18d5b5cb878b64b11baca504f36cfdd1) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | | Test whether an operator is an error marker. | | | | | const char \* | [qhpi_op_error_description](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a928f42496304b0470c1156c7271e9ef7) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | | Return the descriptive text of an error marker operator. | | | | | uint32\_t | [qhpi_output_is_error](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a88374ef51801bf67a402da3305a31a93) (const [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) \*output) | | | Test whether an output definition represents an error. | | | | | const char \* | [qhpi_output_error_description](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a9afdec7634469dd45f4c8d7764b323c2) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*root, const [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) \*output) | | | Return the descriptive text for an error output. | | | | | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | [qhpi_op_create_error](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#afedd8732de05df76efc8a8a0c9d77f67) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*root, const char \*description) | | | Create an error marker operator with a description. | | | | | QHPI\_StatusCode | [qhpi_register_ops_v1](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a37b5475af2a832c6ee6b9f0e34e151b1) (uint32\_t num\_ops, [QHPI_OpInfo_v1](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpInfo__v1.html) \*operators, const char \*package) | | | Register a collection of plugin operators. | | | | ## Detailed Description Qualcomm HTP Plugin Interface (QHPI). QHPI is the C API through which plugin operators integrate with the graph compiler. It provides facilities for: - Registering custom operator packages with kernel implementations. - Inspecting and transforming the operator graph during preparation (rewriting, tiling). - Accessing tensor data and metadata at execution time. All graph-manipulation functions (qhpi\_op\_create, qhpi\_op\_slice, etc.) are available only during the prepare phase. Tensor accessor functions (qhpi\_tensor\_shape, qhpi\_tensor\_raw\_data, etc.) are available at execution time inside plugin kernel callbacks. ## Typedef Documentation ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#acf284d0504357503f51fff7796c9d155)QHPI\_BuildTileOfOp | typedef const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*(\* QHPI\_BuildTileOfOp) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op, const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \*start, const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \*extent) | | --- | Callback type: build a tiled sub-graph computing a region of the output. Given an output region defined by [`start`, `start` + `extent`), this callback constructs the sub-graph of operators needed to compute that region. It is responsible for determining the corresponding input slices. - Parameters - | op | The original (untiled) operator. | | --- | --- | | start | Per-dimension start offsets of the output tile. | | extent | Per-dimension sizes of the output tile. | - Returns - Pointer to the root operator of the tiled sub-graph. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a9fc47728335eababdc4c536612c99d27)QHPI\_Cost\_Function | typedef float(\* QHPI\_Cost\_Function) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle, const uint32\_t num\_inputs, const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*const \*inputs) | | --- | Signature for a cost estimation function. Returns an approximate cycle count for executing the operator with the given inputs. Used by the scheduler for ordering decisions; not used to distinguish between matching kernel instances. - Parameters - | handle | Runtime context. | | --- | --- | | num\_inputs | Number of input tensors. | | inputs | Array of pointers to read-only input tensors. | - Returns - Estimated execution cost in cycles. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a23bd4de2dbd8709dfd9033498e47a051)QHPI\_Kernel\_Predicate | typedef uint32\_t(\* QHPI\_Kernel\_Predicate) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op, const uint32\_t num\_inputs, const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*const \*inputs) | | --- | Signature for an optional kernel matching predicate. When set on a [QHPI_Kernel_v1](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Kernel__v1.html), this function is called during preparation to determine whether the kernel is a valid match for a given operator instance and its input tensors, beyond what the tensor signatures alone can express. - Parameters - | op | The operator being matched. | | --- | --- | | num\_inputs | Number of input tensors. | | inputs | Array of pointers to read-only input tensors. | - Returns - Non-zero if the kernel matches, 0 otherwise. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208)QHPI\_Op | typedef struct [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) | | --- | Opaque handle to an operator node in the graph. QHPI\_Op pointers are used during the prepare phase to inspect and transform the operator graph. They are not valid across different graph instances or after preparation completes. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#afe68c49db7697c20c13deb199f772879)QHPI\_Plugin\_Function | typedef uint32\_t(\* QHPI\_Plugin\_Function) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle, uint32\_t num\_outputs, [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*\*outputs, uint32\_t num\_inputs, const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*const \*inputs) | | --- | Signature for a plugin kernel execution function. Called by the runtime to execute an operator. The same function may be invoked on different resource types (HVX, HMX); the QHPI\_RuntimeHandle indicates which resource is allocated for the calling thread. - Parameters - | handle | Runtime context for this invocation. | | --- | --- | | num\_outputs | Number of output tensors. | | outputs | Array of pointers to writable output tensors. | | num\_inputs | Number of input tensors. | | inputs | Array of pointers to read-only input tensors. | - Returns - 0 on success, non-zero on error. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5886582522841b7edf1d442304f5cad4)QHPI\_Plugin\_Precomputed\_Function | typedef uint32\_t(\* QHPI\_Plugin\_Precomputed\_Function) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle, const void \*precomputed\_data) | | --- | Signature for a kernel that uses precomputed data. Called at inference time instead of QHPI\_Plugin\_Function when precomputed data is available. When this function pointer is set in [QHPI_Kernel_v1](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Kernel__v1.html), the `function` field must be NULL. - Parameters - | handle | Runtime context. | | --- | --- | | precomputed\_data | Read-only pointer to data populated by the QHPI\_Precompute\_Function. | - Returns - 0 on success, non-zero on error. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ae61f8add7fdc0b41ad6c9955ddd91a78)QHPI\_Precompute\_Function | typedef uint32\_t(\* QHPI\_Precompute\_Function) ([QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \*handle, void \*data, uint32\_t num\_outputs, [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*\*outputs, uint32\_t num\_inputs, const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \*const \*inputs) | | --- | Signature for a precomputation function. Called once when a graph is loaded, before any inference executions. Allows the kernel to compute data that depends on runtime information (e.g. tensor shapes, quantization) but is constant across inferences. The `data` buffer has size specified by [QHPI_Kernel_v1::precomputed_data_size](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Kernel__v1.html#a4143e9233bac18c2a387930db657e298) and is zero-initialized before the first call. - Parameters - | handle | Runtime context. | | --- | --- | | data | Writable buffer for precomputed data. | | num\_outputs | Number of output tensors. | | outputs | Array of pointers to output tensors. | | num\_inputs | Number of input tensors. | | inputs | Array of pointers to read-only input tensors. | - Returns - 0 on success, non-zero on error. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a64ac2d99bc36b9abbcde1f6364f1e667)QHPI\_RewriteOpFunc | typedef const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*(\* QHPI\_RewriteOpFunc) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | --- | Callback type: rewrite an operator into an equivalent sub-graph. Used for both early rewrites (before tiling, when source-level ops are still present) and late rewrites (after tiling, just before layout and placement decisions). - Parameters - | op | The operator to rewrite. | | --- | --- | - Returns - Pointer to the replacement operator (may be `op` itself if no rewrite is needed), or an error node. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87)QHPI\_RuntimeHandle | typedef struct [QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) [QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) | | --- | Opaque handle to the runtime execution context. Passed to plugin kernel functions at execution time. Provides access to runtime properties such as thread counts, slice information for self-slicing operators, and the synchronization block. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7)QHPI\_Tensor | typedef struct [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) | | --- | Opaque handle to a tensor at execution time. Provides access to tensor data and metadata through the qhpi\_tensor\_\* accessor functions. Only valid during kernel execution callbacks. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a62dafb717f20073ad934710ccdd57819)QHPI\_TileShapeLegalized | typedef [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html)(\* QHPI\_TileShapeLegalized) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op, const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \*shape) | | --- | Callback type: legalize a proposed tile shape by adjusting values. Called by the central tiling system with a proposed tile shape based on its heuristics. The callback should adjust dimension sizes as needed to make them legal for this operator (e.g. rounding up to required multiples). - Parameters - | op | The operator being tiled. | | --- | --- | | shape | The proposed tile shape to legalize. | - Returns - Legalized tile shape with dimensions >= the proposed values. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a9687456c5d032e5608caf76b52aa8b21)QHPI\_TileShapeRequired | typedef [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html)(\* QHPI\_TileShapeRequired) (const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \*op) | | --- | Callback type: return the required tile shape constraints for an operator. Called at the start of tiling to seed the central tiling system with per-operator constraints. For example, a convolution kernel might require that the depth dimension be 32. Return a shape where each dimension is the required alignment or chunk size. Set a dimension to [QHPI_NO_TILING](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a84e0566719321ce601f28f900494065c) to prevent tiling along that axis. - Parameters - | op | The operator being tiled. | | --- | --- | - Returns - Required tile shape constraints. ## Enumeration Type Documentation ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a06fc87d81c62e9abb8790b6e5713c55b)anonymous enum | anonymous enum | | --- | Status codes returned by QHPI functions and plugin callbacks. | Enumerator | Enumerator | | --- | --- | | QHPI\_SUCCESS | Operation completed successfully. | | QHPI\_UNSUPPORTED | Requested feature or option is not supported. | | QHPI\_ERROR\_FATAL | A fatal error occurred. | | QHPI\_REGISTRATION\_WARNING | Registration succeeded with warnings. | | QHPI\_REGISTRATION\_ERROR | Registration failed. | ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adf764cbdea00d65edcd07bb9953ad2b7)anonymous enum | anonymous enum | | --- | Element data types for tensor values. Types prefixed with `Q` are quantized types that use [QHPI_Quant_Parameters](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Quant__Parameters.html) to define the mapping between stored integer values and real numbers. | Enumerator | Enumerator | | --- | --- | | QHPI\_UNKNOWN | Unknown or unspecified type. | | QHPI\_QUINT8 | Quantized unsigned 8-bit integer. | | QHPI\_QUINT16 | Quantized unsigned 16-bit integer. | | QHPI\_QINT16 | Quantized signed 16-bit integer. | | QHPI\_FLOAT32 | 32-bit float. | | QHPI\_INT32 | Signed 32-bit integer. | | QHPI\_QINT32 | Quantized signed 32-bit integer. | | QHPI\_QINT8 | Quantized signed 8-bit integer. | | QHPI\_FLOAT16 | 16-bit float. | | QHPI\_INT64 | Signed 64-bit integer. | | QHPI\_ELEMENT\_TYPE\_ANY | Wildcard matching any element type (for signatures). | | QHPI\_ELEMENT\_TYPE\_INVALID | Pseudo-type indicating a preparation error. | ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99fb83031ce9923c84392b4e92f956b5)anonymous enum | anonymous enum | | --- | Standard memory layout identifiers. Each value corresponds to a predefined [QHPI_ChunkedMemoryLayout](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__ChunkedMemoryLayout.html) descriptor that can be retrieved with [qhpi_chunked_layout()](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a78a3292f2f1b8df7b9ea81a94f553c89). Values >= QHPI\_LAYOUT\_CUSTOM are defined by plugin usage. | Enumerator | Enumerator | | --- | --- | | QHPI\_LAYOUT\_ANY | No layout constraint (accepts any layout). | | QHPI\_LAYOUT\_SHAPE\_ONLY | Shape metadata only, no data storage. | | QHPI\_LAYOUT\_FLAT\_4 | 4D flat row-major layout. | | QHPI\_LAYOUT\_FLAT\_5 | 5D flat row-major layout. | | QHPI\_LAYOUT\_FLAT\_6 | 6D flat row-major layout. | | QHPI\_LAYOUT\_SINGULAR | Scalar (single element). | | QHPI\_LAYOUT\_NCHW | NCHW channel-first layout. | | QHPI\_LAYOUT\_DEPTH\_32 | Depth-32 blocked layout. | | QHPI\_LAYOUT\_WEIGHTS\_8X4 | 8x4 weight packing layout. | | QHPI\_LAYOUT\_CROUTON\_8 | 8-bit crouton (2 KB blocked) layout. | | QHPI\_LAYOUT\_CROUTON\_16 | 16-bit crouton layout. | | QHPI\_LAYOUT\_CROUTON\_32 | 32-bit crouton layout. | | QHPI\_LAYOUT\_CROUTON\_4X1 | 4x1 crouton variant. | | QHPI\_LAYOUT\_CROUTON\_2X2 | 2x2 crouton variant. | | QHPI\_LAYOUT\_WIDE\_CROUTON\_8 | 8-bit wide crouton layout. | | QHPI\_LAYOUT\_WIDE\_CROUTON\_32 | 32-bit wide crouton layout. | | QHPI\_LAYOUT\_WIDE\_CROUTON\_2X2 | 2x2 wide crouton variant. | | QHPI\_LAYOUT\_CUSTOM | Base value for plugin-defined custom layouts. | | QHPI\_LAYOUT\_INVALID | Sentinel for invalid layout. | ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#abc6126af1d45847bc59afa0aa3216b04)anonymous enum | anonymous enum | | --- | Memory location constraint for tensors. | Enumerator | Enumerator | | --- | --- | | QHPI\_MEM\_LOC\_DDR\_ONLY | Tensor must reside in DDR. | | QHPI\_MEM\_LOC\_TCM\_ONLY | Tensor must reside in TCM. | | QHPI\_MEM\_LOC\_DDR\_OR\_TCM | Tensor may reside in either DDR or TCM. | | QHPI\_MEM\_LOC\_INVALID | Sentinel for invalid placement. | ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adc29c2ff13d900c2f185ee95427fb06c)anonymous enum | anonymous enum | | --- | Storage access mode for tensor data. | Enumerator | Enumerator | | --- | --- | | QHPI\_STORAGE\_DIRECT | Data is contiguous; access via raw pointer. | | QHPI\_STORAGE\_INDIRECT | Data is in blocks; access via block table. | | QHPI\_STORAGE\_DIRECT\_OR\_INDIRECT | Either storage mode is acceptable. | ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a61dadd085c1777f559549e05962b2c9e)anonymous enum | anonymous enum | | --- | Hardware resource flags for kernel requirements. Specified as a bitmask in [QHPI_Kernel_v1::resources](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Kernel__v1.html#ae1d782ed3fd0472fa1a78583f5706830). When the kernel is not self-sliced, exactly one thread of the specified type calls it. When self-sliced (multithreaded), multiple threads of the specified type call the kernel; use [qhpi_num_slices()](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a1b8d10f222a4a9daf05e59064975aa70) and [qhpi_slice_number()](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a97a08b6ad1658fea125710ef5464c96f) to coordinate. | Enumerator | Enumerator | | --- | --- | | QHPI\_RESOURCE\_MAIN | Requires a main (scalar) thread. | | QHPI\_RESOURCE\_HVX | Requires an HVX (vector) thread. | | QHPI\_RESOURCE\_HMX | Requires an HMX (matrix) thread. | | QHPI\_RESOURCE\_EXCLUSIVE | Requires all threads. | ## Function Documentation ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a78a3292f2f1b8df7b9ea81a94f553c89)qhpi\_chunked\_layout() | QHPI\_StatusCode qhpi\_chunked\_layout | ( | QHPI\_Standard\_Layout | *standard\_layout*, | | --- | --- | --- | --- | | | | [QHPI_ChunkedMemoryLayout](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__ChunkedMemoryLayout.html) \* | *chunked\_layout*, | | | | uint32\_t | *size* ) | Fill in a chunked memory layout descriptor for a standard layout. Writes the [QHPI_ChunkedMemoryLayout](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__ChunkedMemoryLayout.html) corresponding to `standard_layout` into the buffer at `chunked_layout`. - Parameters - | | standard\_layout | The standard layout to look up. | | --- | --- | --- | | [out] | chunked\_layout | Buffer to receive the layout descriptor. | | | size | Size of the `chunked_layout` buffer in bytes. Must be at least large enough for the descriptor (use [QHPI_MAX_MEMORY_LAYOUT_SIZE](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ae043825bb1ac18d3bc56b9ba2c614f4e) for safety). | - Returns - `QHPI_SUCCESS` on success. - `QHPI_UNSUPPORTED` for layouts that have no chunked descriptor (QHPI\_LAYOUT\_ANY, QHPI\_LAYOUT\_SHAPE\_ONLY, QHPI\_LAYOUT\_CUSTOM). - `QHPI_ERROR_FATAL` if `size` is too small. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#abae8c4c276329634f4a6ee53e4f08b9d)qhpi\_element\_type\_size() | uint32\_t qhpi\_element\_type\_size | ( | QHPI\_Element\_Type | *type* | ) | | | --- | --- | --- | --- | --- | --- | Return the size in bytes of a single element of the given type. - Parameters - | type | The element type to query. | | --- | --- | - Returns - Size in bytes, or 0 for unsupported types (e.g. QHPI\_UNKNOWN, QHPI\_ELEMENT\_TYPE\_INVALID). ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a1b8d10f222a4a9daf05e59064975aa70)qhpi\_num\_slices() | uint32\_t qhpi\_num\_slices | ( | [QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \* | *handle* | ) | | | --- | --- | --- | --- | --- | --- | Return the total number of slices for a self-slicing operator. For multithreaded kernels, the runtime calls the kernel function `num_slices` times, each with a different slice index. - Parameters - | handle | Runtime context. | | --- | --- | - Returns - Total number of slices. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aecf4d202f6868fe96222f8d5bb91e323)qhpi\_op\_concat() | [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) qhpi\_op\_concat | ( | uint32\_t | *axis*, | | --- | --- | --- | --- | | | | uint32\_t | *num\_inputs*, | | | | const [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) \* | *inputs* ) | Concatenate multiple tensors along a given axis. All inputs must have the same rank, element type, and quantization parameters, and must match in all dimensions except the concatenation axis. The output dimension along `axis` is the sum of the input dimensions along that axis. - Parameters - | axis | Dimension along which to concatenate (zero-based). | | --- | --- | | num\_inputs | Number of tensors to concatenate. | | inputs | Array of `num_inputs` [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) structures. | - Returns - [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) referencing the concatenation result, or an error reference if validation fails. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a30745bf1fca422538685fc829fa649c8)qhpi\_op\_constant\_data() | const void \* qhpi\_op\_constant\_data | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op* | ) | | | --- | --- | --- | --- | --- | --- | Return a pointer to the raw data of a constant operator. Only valid when [qhpi_op_is_constant()](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aa011f2326d613b3a0a6d54450bedb12f) returns non-zero. The data is laid out in the element type indicated by the operator's output definition. - Parameters - | op | Pointer to a constant operator. | | --- | --- | - Returns - Pointer to the constant data, or NULL if `op` is not a constant. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a3e0b92c711de850d825e40f0e18d2022)qhpi\_op\_create() | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* qhpi\_op\_create | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *root*, | | --- | --- | --- | --- | | | | const char \* | *name*, | | | | uint32\_t | *num\_inputs*, | | | | const [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) \* | *inputs*, | | | | uint32\_t | *num\_outputs*, | | | | const [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) \* | *outputs* ) | Create a new operator in the graph. Inserts a new operator node with the given name, inputs, and output definitions. The `root` parameter associates the new operator with the correct graph context. - Parameters - | root | An existing operator used to identify the graph context. | | --- | --- | | name | Null-terminated operator name, including the "package::" prefix (e.g. "my\_package::MyOp"). | | num\_inputs | Number of input tensors. | | inputs | Array of `num_inputs` [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) structures, each referencing an output of a preceding operator. | | num\_outputs | Number of output tensors. | | outputs | Array of `num_outputs` [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) structures describing each output's type, quantization, and shape. | - Returns - Pointer to the newly created operator, or an error node if a problem is detected. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a1733a9b7107af52abd794cf6c69cd735)qhpi\_op\_create\_constant() | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* qhpi\_op\_create\_constant | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *root*, | | --- | --- | --- | --- | | | | const [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) \* | *output*, | | | | uint32\_t | *size*, | | | | const void \* | *data* ) | Create a new constant operator in the graph. The new constant holds a copy of the supplied data. The byte size `size` must equal the product of the output shape dimensions multiplied by the element size of the output type. - Parameters - | root | An existing operator used to identify the graph context. | | --- | --- | | output | Output definition (type, quantization, shape) for the constant. | | size | Size of `data` in bytes. | | data | Pointer to the constant data to copy. | - Returns - Pointer to the new constant operator, or an error node if validation fails (e.g. size mismatch). ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#afedd8732de05df76efc8a8a0c9d77f67)qhpi\_op\_create\_error() | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* qhpi\_op\_create\_error | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *root*, | | --- | --- | --- | --- | | | | const char \* | *description* ) | Create an error marker operator with a description. Error nodes propagate through the graph and can be detected with [qhpi_op_is_error()](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a18d5b5cb878b64b11baca504f36cfdd1). Use this to signal errors during rewrite or tiling callbacks. - Parameters - | root | An existing operator used to identify the graph context. | | --- | --- | | description | Null-terminated error description string. | - Returns - Pointer to the new error marker operator. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adbd77954b8b21c931953b3e0627b1946)qhpi\_op\_create\_multi\_output() | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* qhpi\_op\_create\_multi\_output | ( | uint32\_t | *num\_inputs*, | | --- | --- | --- | --- | | | | const [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) \* | *inputs* ) | Create a multi-output operator that copies each input as a separate output. The resulting operator has `num_inputs` outputs, where output *i* is a copy of input *i*. This is useful for broadcasting a set of tensors to multiple consumers. - Parameters - | num\_inputs | Number of input (and output) tensors. Must be > 0. | | --- | --- | | inputs | Array of `num_inputs` [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) structures. | - Returns - Pointer to the new multi-output operator, or NULL if `num_inputs` is 0. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ace53acf29dc8e077144d54dc709b3406)qhpi\_op\_create\_shape() | [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) qhpi\_op\_create\_shape | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *root*, | | --- | --- | --- | --- | | | | const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \* | *shape* ) | Create a shape-only operator encoding dimension information. The resulting operator carries only shape metadata with no tensor data. This is useful for operations that need explicit shape parameters (e.g. reshape targets, tiling specifications). - Parameters - | root | An existing operator used to identify the graph context. | | --- | --- | | shape | The shape to encode. | - Returns - [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) referencing the new shape operator. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a928f42496304b0470c1156c7271e9ef7)qhpi\_op\_error\_description() | const char \* qhpi\_op\_error\_description | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op* | ) | | | --- | --- | --- | --- | --- | --- | Return the descriptive text of an error marker operator. - Parameters - | op | Pointer to an error marker operator. | | --- | --- | - Returns - Null-terminated error description string. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a2be4a956697c0cd842a71cb1c087dbf9)qhpi\_op\_input() | [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) qhpi\_op\_input | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op*, | | --- | --- | --- | --- | | | | uint32\_t | *index* ) | Return a reference to a specific input of an operator. The returned [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) identifies the upstream operator and output index that feeds this input. - Parameters - | op | Pointer to the operator to query. | | --- | --- | | index | Zero-based input index. Must be less than [qhpi_op_num_inputs()](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aa38eb2047c7b292e6ad8f91b4e541123). | - Returns - [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) for the specified input, or an error reference if `index` is out of range. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aa011f2326d613b3a0a6d54450bedb12f)qhpi\_op\_is\_constant() | uint32\_t qhpi\_op\_is\_constant | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op* | ) | | | --- | --- | --- | --- | --- | --- | Test whether an operator is a constant. Constant operators hold fixed data (weights, biases, etc.) that does not change between inferences. - Parameters - | op | Pointer to the operator to query. | | --- | --- | - Returns - Non-zero if `op` is a constant, 0 otherwise. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a18d5b5cb878b64b11baca504f36cfdd1)qhpi\_op\_is\_error() | uint32\_t qhpi\_op\_is\_error | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op* | ) | | | --- | --- | --- | --- | --- | --- | Test whether an operator is an error marker. Error markers have 0 inputs, 0 outputs, and the name "$Error". - Parameters - | op | Pointer to the operator to test. | | --- | --- | - Returns - Non-zero if `op` is an error marker, 0 otherwise. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ac8f104c0ba525091d28edfce5870d3f5)qhpi\_op\_name() | const char \* qhpi\_op\_name | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op* | ) | | | --- | --- | --- | --- | --- | --- | Return the name of an operator. The returned string includes the package prefix separated by "::" (e.g. "my\_package::MyOp"). Internal operators (those in the default "q" package that are not QNN ops) return "<internal>". - Parameters - | op | Pointer to the operator to query. | | --- | --- | - Returns - Null-terminated operator name. The pointer remains valid for the lifetime of the graph. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aa38eb2047c7b292e6ad8f91b4e541123)qhpi\_op\_num\_inputs() | uint32\_t qhpi\_op\_num\_inputs | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op* | ) | | | --- | --- | --- | --- | --- | --- | Return the number of inputs to an operator. - Parameters - | op | Pointer to the operator to query. | | --- | --- | - Returns - Number of input tensors. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a82e202752bf224685011327ee2da8684)qhpi\_op\_num\_outputs() | uint32\_t qhpi\_op\_num\_outputs | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op* | ) | | | --- | --- | --- | --- | --- | --- | Return the number of outputs from an operator. - Parameters - | op | Pointer to the operator to query. | | --- | --- | - Returns - Number of output tensors. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a80d1b607410d5cb4a2b5a6563099a31e)qhpi\_op\_num\_uses() | uint32\_t qhpi\_op\_num\_uses | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op* | ) | | | --- | --- | --- | --- | --- | --- | Return the number of consumers of an operator's output. Counts how many downstream operators use the output(s) of `op` as an input. - Parameters - | op | Pointer to the operator to query. | | --- | --- | - Returns - Number of consumer operators. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aa33a4a60ad31c07c7f54fb21d7cbc6d3)qhpi\_op\_output() | [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) qhpi\_op\_output | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op*, | | --- | --- | --- | --- | | | | uint32\_t | *position* ) | Return the output definition for a specific output of an operator. - Parameters - | op | Pointer to the operator to query. | | --- | --- | | position | Zero-based output index. Must be less than [qhpi_op_num_outputs()](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a82e202752bf224685011327ee2da8684). | - Returns - [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) describing the output's type, quantization, and shape. If `position` is invalid, the returned OutputDef has type QHPI\_ELEMENT\_TYPE\_INVALID. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a1a1066cdfd3890bb32a6e58a36918113)qhpi\_op\_producer\_for() | uint32\_t qhpi\_op\_producer\_for | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op*, | | --- | --- | --- | --- | | | | const char \* | *name* ) | Test whether an operator produces input for a named consumer. Checks if any immediate consumer of `op` has the operator name `name`. - Parameters - | op | Pointer to the operator to query. | | --- | --- | | name | Null-terminated operator name to search for among consumers. | - Returns - Non-zero if `op` feeds an operator named `name`, 0 otherwise. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ac949c184f0cb7659450595c709e6a661)qhpi\_op\_reference() |
QHPI_OpRef qhpi_op_reference ( const QHPI_Op * op,
uint32_t out_number )
| inline | | --- | --- | Construct a [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) from an operator pointer and output index. - Parameters - | op | Pointer to the source operator. | | --- | --- | | out\_number | Zero-based output index on `op`. | - Returns - A [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) referencing the specified output. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#adee3795d259df547caf3541081febdf7)qhpi\_op\_slice() | [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) qhpi\_op\_slice | ( | [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) | *ref*, | | --- | --- | --- | --- | | | | const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \* | *start*, | | | | const [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) \* | *extent* ) | Create a slice of a tensor. Produces a sub-tensor starting at `start` with size `extent` along each dimension. Both shapes must have the same rank as the input tensor. For each dimension *i*, `start->dims`[i] + extent->dims[i] must not exceed the input dimension size. - Parameters - | ref | Reference to the tensor to slice. | | --- | --- | | start | Per-dimension start offsets. | | extent | Per-dimension sizes of the slice. | - Returns - [QHPI_OpRef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpRef.html) referencing the slice result, or an error reference if validation fails. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a07618754f8e20d9aa40da16f011a6156)qhpi\_option\_int() | QHPI\_StatusCode qhpi\_option\_int | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *op*, | | --- | --- | --- | --- | | | | const char \* | *name*, | | | | int32\_t \* | *value* ) | Retrieve the value of an integer runtime option. Allows plugin operators to query integer-valued configuration options. The special option names "tcm\_size" and "tcm\_size\_for\_tiling" return the hardware VTCM size and the VTCM size available for tiling, respectively. - Parameters - | | op | An operator providing the graph context. | | --- | --- | --- | | | name | Null-terminated name of the option to query. | | [out] | value | Receives the integer value if the option is found. | - Returns - `QHPI_SUCCESS` if the option was found, or a non-zero status code (e.g. `QHPI_UNSUPPORTED`) if the option does not exist. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a9afdec7634469dd45f4c8d7764b323c2)qhpi\_output\_error\_description() | const char \* qhpi\_output\_error\_description | ( | const [QHPI_Op](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad34b09b5fd1b00a0bf0cdc5bb93e9208) \* | *root*, | | --- | --- | --- | --- | | | | const [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) \* | *output* ) | Return the descriptive text for an error output. - Parameters - | root | An operator providing the graph context. | | --- | --- | | output | Pointer to an error output definition. | - Returns - Null-terminated error description string, or "invalid error reference" if the output is not a valid error. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a88374ef51801bf67a402da3305a31a93)qhpi\_output\_is\_error() | uint32\_t qhpi\_output\_is\_error | ( | const [QHPI_OutputDef](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OutputDef.html) \* | *output* | ) | | | --- | --- | --- | --- | --- | --- | Test whether an output definition represents an error. An error output has element type QHPI\_ELEMENT\_TYPE\_INVALID. - Parameters - | output | Pointer to the output definition to test. | | --- | --- | - Returns - Non-zero if the output is an error, 0 otherwise. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a37b5475af2a832c6ee6b9f0e34e151b1)qhpi\_register\_ops\_v1() | QHPI\_StatusCode qhpi\_register\_ops\_v1 | ( | uint32\_t | *num\_ops*, | | --- | --- | --- | --- | | | | [QHPI_OpInfo_v1](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpInfo__v1.html) \* | *operators*, | | | | const char \* | *package* ) | Register a collection of plugin operators. This is the main entry point for making custom operators available to the compiler. All operators in the array are registered under the given package name. - Parameters - | num\_ops | Number of operators in the `operators` array. | | --- | --- | | operators | Array of `num_ops` [QHPI_OpInfo_v1](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__OpInfo__v1.html) structures. | | package | Null-terminated package name used as a namespace prefix. | - Returns - `QHPI_SUCCESS` on success, or an error status code. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a97a08b6ad1658fea125710ef5464c96f)qhpi\_slice\_number() | uint32\_t qhpi\_slice\_number | ( | [QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \* | *handle* | ) | | | --- | --- | --- | --- | --- | --- | Return the slice index for the current invocation. For self-slicing operators, each thread receives a unique slice index in the range [0, [qhpi_num_slices()](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a1b8d10f222a4a9daf05e59064975aa70)). - Parameters - | handle | Runtime context. | | --- | --- | - Returns - Current slice index. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a7759d83c7f2665f21a56a3d96a23ac52)qhpi\_srm\_context() | uint32\_t qhpi\_srm\_context | ( | [QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \* | *handle* | ) | | | --- | --- | --- | --- | --- | --- | Return the SRM compute resource context ID held by the graph. - Parameters - | handle | Runtime context. | | --- | --- | - Returns - SRM context ID, or 0 if not available. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a99aa667306d017f64e23557b3ca778f7)qhpi\_sync\_block() | void \* qhpi\_sync\_block | ( | [QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \* | *handle* | ) | | | --- | --- | --- | --- | --- | --- | Return a pointer to the shared synchronization block. The sync block is a region of zero-initialized memory whose size is specified by [QHPI_Kernel_v1::sync_block_size](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Kernel__v1.html#a35e2cba1def79dc99eaab9922fb7c0cb). It is shared and writable by all threads in a self-sliced computation, enabling inter-thread coordination. - Parameters - | handle | Runtime context. | | --- | --- | - Returns - Pointer to the sync block, or NULL if `sync_block_size` is 0. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a0480fb0172c4d813a999e0797f88451e)qhpi\_tensor\_block\_shape() | [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) qhpi\_tensor\_block\_shape | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor* | ) | | | --- | --- | --- | --- | --- | --- | Return the shape of individual blocks in a blocked tensor. For crouton and other blocked layouts, returns the per-dimension size of each block. For non-blocked layouts, returns zeros. - Parameters - | tensor | Pointer to the tensor to query. | | --- | --- | - Returns - The block shape. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a790447cce3ca8b8b1882265b1c862a9f)qhpi\_tensor\_block\_table() | void \*\* qhpi\_tensor\_block\_table | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor* | ) | | | --- | --- | --- | --- | --- | --- | Return the block table of an indirect-storage tensor. For tensors with QHPI\_STORAGE\_INDIRECT storage mode, returns an array of pointers to individual data blocks (typically 2 KB each). - Parameters - | tensor | Pointer to the tensor to query. | | --- | --- | - Returns - Pointer to the array of block pointers. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a12ae905e61acded4f81e266a63dec89e)qhpi\_tensor\_block\_table\_length() | uint32\_t qhpi\_tensor\_block\_table\_length | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor* | ) | | | --- | --- | --- | --- | --- | --- | Return the number of blocks in an indirect tensor's block table. - Parameters - | tensor | Pointer to the tensor to query. | | --- | --- | - Returns - Number of entries in the block table. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ad43a2518a3a52e585918271dd2721759)qhpi\_tensor\_get() | float qhpi\_tensor\_get | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor*, | | --- | --- | --- | --- | | | | uint32\_t | *rank*, | | | | | *...* ) | Read a tensor element in logical coordinates as float. Works for any layout (Flat, Crouton, WideCrouton, etc.) and any quantized or floating element type. - Parameters - | tensor | Tensor handle. | | --- | --- | | rank | Rank of coordinate list. | | ... | rank logical indices. | - Returns - Logical tensor value converted to float. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a496526e42a107192bf49adac5914e40b)qhpi\_tensor\_layout() | QHPI\_Standard\_Layout qhpi\_tensor\_layout | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor* | ) | | | --- | --- | --- | --- | --- | --- | Return the memory layout of a tensor. - Parameters - | tensor | Pointer to the tensor to query. | | --- | --- | - Returns - A QHPI\_Standard\_Layout value identifying the layout. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a344b4631f67fa3a00118281cab0633d3)qhpi\_tensor\_padded\_shape() | [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) qhpi\_tensor\_padded\_shape | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor* | ) | | | --- | --- | --- | --- | --- | --- | Return the padded (allocated) shape of a tensor. This is the logical shape plus any padding required by the memory layout. For flat layouts this equals the logical shape. - Parameters - | tensor | Pointer to the tensor to query. | | --- | --- | - Returns - The padded shape. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#aa23b3bf302dfb70409b474c7205f85c1)qhpi\_tensor\_padding() | [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) qhpi\_tensor\_padding | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor* | ) | | | --- | --- | --- | --- | --- | --- | Return the padding applied to a tensor. For indirect crouton (blocked) layouts, returns the per-dimension offset into the first block where valid data begins. For flat layouts, all dimensions are zero. - Parameters - | tensor | Pointer to the tensor to query. | | --- | --- | - Returns - Per-dimension padding values. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a7d54152c66efd87c17941d87cd28839f)qhpi\_tensor\_placement() | QHPI\_MemLoc qhpi\_tensor\_placement | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor* | ) | | | --- | --- | --- | --- | --- | --- | Return the memory placement of a tensor. - Parameters - | tensor | Pointer to the tensor to query. | | --- | --- | - Returns - A QHPI\_MemLoc value. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a2a86e11ca5a37067edddba8b397a2452)qhpi\_tensor\_quant\_parameters() | [QHPI_Quant_Parameters](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Quant__Parameters.html) qhpi\_tensor\_quant\_parameters | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor* | ) | | | --- | --- | --- | --- | --- | --- | Return the quantization parameters of a tensor. Meaningful only for quantized element types. - Parameters - | tensor | Pointer to the tensor to query. | | --- | --- | - Returns - The tensor's quantization parameters (zero\_offset and stepsize). ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#ae006f6be55f831e8db78e8d20ee95ea4)qhpi\_tensor\_raw\_data() | void \* qhpi\_tensor\_raw\_data | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor* | ) | | | --- | --- | --- | --- | --- | --- | Return a pointer to the raw data of a direct-storage tensor. Only valid for tensors with QHPI\_STORAGE\_DIRECT storage mode. For indirect tensors, use [qhpi_tensor_block_table()](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a790447cce3ca8b8b1882265b1c862a9f) instead. - Parameters - | tensor | Pointer to the tensor to query. | | --- | --- | - Returns - Pointer to the contiguous tensor data, or NULL. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a2b0dffb4903b4b5305a284ab49c9a6b8)qhpi\_tensor\_set() | void qhpi\_tensor\_set | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor*, | | --- | --- | --- | --- | | | | uint32\_t | *rank*, | | | | | *...* ) | Write a tensor element in logical coordinates from float. Works for any layout and quantization. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a6e753a59fa2cfbb70a3d8e8db335a825)qhpi\_tensor\_shape() | [QHPI_Shape](https://docs.qualcomm.com/doc/80-63442-10/topic/structQHPI__Shape.html) qhpi\_tensor\_shape | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor* | ) | | | --- | --- | --- | --- | --- | --- | Return the logical shape of a tensor (excluding padding). - Parameters - | tensor | Pointer to the tensor to query. | | --- | --- | - Returns - The tensor's shape. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a1bb688803a2984c943c3d04a9cd1fed7)qhpi\_tensor\_type() | QHPI\_Element\_Type qhpi\_tensor\_type | ( | const [QHPI_Tensor](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#af8d3e843bc21fbce13ad8ddc6fa424b7) \* | *tensor* | ) | | | --- | --- | --- | --- | --- | --- | Return the element type of a tensor. - Parameters - | tensor | Pointer to the tensor to query. | | --- | --- | - Returns - The tensor's QHPI\_Element\_Type. ## [◆](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a09546029ebad2e2490bb172cc20942b4)qhpi\_thread\_resources() | uint32\_t qhpi\_thread\_resources | ( | [QHPI_RuntimeHandle](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html#a5523ad5f4f22698ceec27eb9cd7fed87) \* | | ) | | | --- | --- | --- | --- | --- | --- | Return the resource type of the thread currently executing the kernel. Useful for ops registered with `QHPI_RESOURCE_EXCLUSIVE`, which dispatch on multiple thread types simultaneously and may want to specialize their work per thread. - Parameters - | handle | Runtime context. | | --- | --- | - Returns - 0 for the main thread, otherwise one of `QHPI_RESOURCE_HVX`, `QHPI_RESOURCE_HMX`, or `QHPI_RESOURCE_HLX`. * * * Last Published: Aug 06, 2026 Source: [https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html](https://docs.qualcomm.com/doc/80-63442-10/topic/qhpi_8h.html)