xref: /aosp_15_r20/external/executorch/backends/qualcomm/runtime/backends/htpbackend/HtpBackend.h (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1 /*
2  * Copyright (c) Qualcomm Innovation Center, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 #pragma once
9 
10 #include <executorch/backends/qualcomm/runtime/backends/QnnBackendCommon.h>
11 #include "HTP/QnnHtpCommon.h"
12 #include "HTP/QnnHtpProfile.h"
13 #include "QnnTypes.h"
14 namespace executorch {
15 namespace backends {
16 namespace qnn {
17 class HtpBackend : public QnnBackend {
18  public:
HtpBackend(const QnnImplementation & implementation,QnnLogger * logger)19   HtpBackend(const QnnImplementation& implementation, QnnLogger* logger)
20       : QnnBackend(implementation, logger) {}
~HtpBackend()21   ~HtpBackend() {}
22 
IsProfileEventTypeParentOfNodeTime(QnnProfile_EventType_t event_type)23   bool IsProfileEventTypeParentOfNodeTime(
24       QnnProfile_EventType_t event_type) override {
25     return (
26         event_type == QNN_HTP_PROFILE_EVENTTYPE_GRAPH_EXECUTE_ACCEL_TIME_CYCLE);
27   }
28 
GetExpectedBackendVersion()29   Qnn_Version_t GetExpectedBackendVersion() const override {
30     Qnn_Version_t backend_version;
31     backend_version.major = QNN_HTP_API_VERSION_MAJOR;
32     backend_version.minor = QNN_HTP_API_VERSION_MINOR;
33     backend_version.patch = QNN_HTP_API_VERSION_PATCH;
34     return backend_version;
35   }
36 
37  protected:
MakeConfig(std::vector<const QnnBackend_Config_t * > & config)38   executorch::runtime::Error MakeConfig(
39       std::vector<const QnnBackend_Config_t*>& config) override {
40     return executorch::runtime::Error::Ok;
41   }
42 };
43 } // namespace qnn
44 } // namespace backends
45 } // namespace executorch
46