Current section
Files
Jump to
Current section
Files
c_src/qnn_api.hpp
#ifndef QNN_API_HPP
#define QNN_API_HPP
#include <string>
#include "QnnInterface.h"
#include "System/QnnSystemInterface.h"
// Resolved QNN function tables + handles for one backend library.
// The backend (libQnnHtp.so / libQnnCpu.so) and libQnnSystem.so are
// dlopen'd at runtime; nothing links against the SDK.
struct QnnApi {
void *core_lib = nullptr;
void *system_lib = nullptr;
QNN_INTERFACE_VER_TYPE fn{};
QNN_SYSTEM_INTERFACE_VER_TYPE sys_fn{};
Qnn_LogHandle_t log = nullptr;
Qnn_BackendHandle_t backend = nullptr;
Qnn_DeviceHandle_t device = nullptr;
std::string backend_lib_name;
std::string build_id;
};
// Loads the backend + system libraries, resolves providers and creates
// log/backend/device handles. Returns empty string on success, or a
// human-readable error tag (used as the :error atom/message).
std::string qnn_api_open(QnnApi &api,
const std::string &backend_lib,
const std::string &system_lib,
int log_level);
// Frees handles and dlcloses libraries. Safe to call twice.
void qnn_api_close(QnnApi &api);
#endif // QNN_API_HPP