Program Listing for File QnnCpuContext.h¶
↰ Return to documentation for file (include/QNN/CPU/QnnCpuContext.h)
//==============================================================================
//
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
// All rights reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
/** @file
* @brief QNN CPU component Context API.
*
* The interfaces in this file work with the top level QNN
* API and supplements QnnContext.h for CPU backend
*/
#ifndef QNN_CPU_CONTEXT_H
#define QNN_CPU_CONTEXT_H
#include "QnnContext.h"
#ifdef __cplusplus
extern "C" {
#endif
//=============================================================================
// Macros
//=============================================================================
//=============================================================================
// Data Types
//=============================================================================
/**
* @brief This enum provides different CPU context configuration
* options associated with QnnContext
*/
typedef enum {
QNN_CPU_CONTEXT_CONFIG_OPTION_USE_QMX = 1,
QNN_CPU_CONTEXT_CONFIG_OPTION_UNDEFINED = 0x7fffffff
} QnnCpuContext_ConfigOption_t;
/* @brief This structure will have a boolean variable useQmx.
* To enable/disable QMX from Context, this structure needs
* to be filled by the user.
*/
typedef struct {
bool useQmx;
} QnnCpuContext_UseQmx_t;
// clang-format off
/// QnnCpuGraph_UseQmx_t initializer macro
#define QNN_CPU_CONTEXT_USE_QMX_INIT \
{ \
false /*useQmx*/ \
}
// clang-format on
//=============================================================================
// Public Functions
//=============================================================================
//------------------------------------------------------------------------------
// Implementation Definition
//------------------------------------------------------------------------------
/**
* @brief Structure describing the set of configurations supported by context.
* Objects of this type are to be referenced through QnnContext_CustomConfig_t.
*
* The struct has two fields - option and a union of corresponding config values
* Based on the option corresponding item in the union can be used to specify
* config.
* Below is the map between QnnCpuContext_ConfigOption_t and config value
*
* \verbatim embed:rst:leading-asterisk
* +----+------------------------------------------+------------------------------------+
* | # | Config Option | Configuration Struct/value |
* +====+==========================================+====================================+
* | 2 | QNN_CPU_CONTEXT_CONFIG_OPTION_USE_QMX | QnnCpuContext_UseQmx_t |
* +----+------------------------------------------+------------------------------------+
* \endverbatim
*/
typedef struct {
QnnCpuContext_ConfigOption_t option;
union UNNAMED {
QnnCpuContext_UseQmx_t cpuContextUseQmx;
};
} QnnCpuContext_CustomConfig_t;
/// QnnCpuContext_ConfigOption_t initializer macro
#define QNN_CPU_CONTEXT_CUSTOM_CONFIG_INIT \
{ \
QNN_CPU_CONTEXT_CONFIG_OPTION_UNDEFINED, /*option*/ \
{ \
QNN_CPU_CONTEXT_USE_QMX_INIT /*useQmx*/ \
} \
}
#ifdef __cplusplus
} // extern "C"
#endif
#endif