xref: /aosp_15_r20/external/executorch/backends/qualcomm/runtime/backends/htpbackend/HtpDeviceCustomConfig.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/qc_compiler_spec_generated.h>
11 
12 #include <memory>
13 #include <vector>
14 
15 #include "HTP/QnnHtpDevice.h"
16 namespace executorch {
17 namespace backends {
18 namespace qnn {
19 using namespace qnn_delegate;
20 class HtpDeviceCustomConfig {
21  public:
HtpDeviceCustomConfig(const QnnExecuTorchHtpBackendOptions * htp_options)22   explicit HtpDeviceCustomConfig(
23       const QnnExecuTorchHtpBackendOptions* htp_options)
24       : htp_options_(htp_options) {}
25   std::vector<QnnDevice_CustomConfig_t> CreateDeviceCustomConfig(
26       const SocInfo* qcom_target_soc_info);
27 
AllocDeviceCustomConfig()28   QnnHtpDevice_CustomConfig_t* AllocDeviceCustomConfig() {
29     htp_device_config_.emplace_back(
30         std::make_unique<QnnHtpDevice_CustomConfig_t>());
31     htp_device_config_.back()->option = QNN_HTP_DEVICE_CONFIG_OPTION_UNKNOWN;
32     return htp_device_config_.back().get();
33   }
34 
35  private:
36   [[maybe_unused]] const QnnExecuTorchHtpBackendOptions* htp_options_;
37   std::vector<std::unique_ptr<QnnHtpDevice_CustomConfig_t>> htp_device_config_;
38 };
39 } // namespace qnn
40 } // namespace backends
41 } // namespace executorch
42