xref: /aosp_15_r20/external/executorch/backends/qualcomm/runtime/backends/htpbackend/HtpGraph.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/QnnGraphCommon.h>
11 #include <executorch/backends/qualcomm/runtime/backends/htpbackend/HtpGraphCustomConfig.h>
12 
13 #include <memory>
14 
15 #include "HTP/QnnHtpGraph.h"
16 namespace executorch {
17 namespace backends {
18 namespace qnn {
19 class HtpGraph : public QnnGraph {
20  public:
HtpGraph(const QnnImplementation & implementation,QnnBackend * backend,QnnContext * context,const QnnExecuTorchProfileLevel & profile_level,const SocInfo * soc_info,const QnnExecuTorchHtpBackendOptions * htp_options)21   HtpGraph(
22       const QnnImplementation& implementation,
23       QnnBackend* backend,
24       QnnContext* context,
25       const QnnExecuTorchProfileLevel& profile_level,
26       const SocInfo* soc_info,
27       const QnnExecuTorchHtpBackendOptions* htp_options)
28       : QnnGraph(implementation, backend, context, profile_level),
29         qcom_target_soc_info_(soc_info),
30         htp_options_(htp_options) {
31     htp_graph_custom_config_ =
32         std::make_unique<HtpGraphCustomConfig>(htp_options, context);
33   }
~HtpGraph()34   ~HtpGraph() {}
35 
36  protected:
37   executorch::runtime::Error MakeConfig(
38       std::vector<const QnnGraph_Config_t*>& config) override;
39 
40  private:
41   std::vector<QnnGraph_Config_t> graph_config_;
42   std::unique_ptr<HtpGraphCustomConfig> htp_graph_custom_config_;
43   const SocInfo* qcom_target_soc_info_;
44   [[maybe_unused]] const QnnExecuTorchHtpBackendOptions* htp_options_;
45 };
46 } // namespace qnn
47 } // namespace backends
48 } // namespace executorch
49