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 #include <executorch/backends/qualcomm/runtime/backends/QnnContextCommon.h> 10 11 #include <executorch/backends/qualcomm/qc_compiler_spec_generated.h> 12 13 #include <memory> 14 #include <vector> 15 16 #include "HTP/QnnHtpGraph.h" 17 namespace executorch { 18 namespace backends { 19 namespace qnn { 20 using namespace qnn_delegate; 21 class HtpGraphCustomConfig { 22 public: HtpGraphCustomConfig(const QnnExecuTorchHtpBackendOptions * htp_options,const QnnContext * context)23 explicit HtpGraphCustomConfig( 24 const QnnExecuTorchHtpBackendOptions* htp_options, 25 const QnnContext* context) 26 : htp_options_(htp_options), context_(context) {} 27 28 std::vector<QnnGraph_CustomConfig_t> CreateGraphCustomConfig( 29 const SocInfo* qcom_target_soc_info); 30 31 private: AllocGraphCustomConfig()32 QnnHtpGraph_CustomConfig_t* AllocGraphCustomConfig() { 33 htp_graph_config_.emplace_back( 34 std::make_unique<QnnHtpGraph_CustomConfig_t>()); 35 htp_graph_config_.back()->option = QNN_HTP_GRAPH_CONFIG_OPTION_UNKNOWN; 36 return htp_graph_config_.back().get(); 37 } 38 std::vector<QnnGraph_CustomConfig_t> CreateGraphCustomConfigCommon( 39 const SocInfo* qcom_target_soc_info, 40 float opt_level); 41 42 [[maybe_unused]] const QnnExecuTorchHtpBackendOptions* htp_options_; 43 std::vector<std::unique_ptr<QnnHtpGraph_CustomConfig_t>> htp_graph_config_; 44 const QnnContext* context_; 45 }; 46 } // namespace qnn 47 } // namespace backends 48 } // namespace executorch 49