xref: /aosp_15_r20/external/executorch/backends/qualcomm/runtime/backends/QnnDeviceCommon.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 #include <executorch/backends/qualcomm/runtime/Logging.h>
12 #include <executorch/backends/qualcomm/runtime/backends/QnnImplementation.h>
13 #include <executorch/backends/qualcomm/runtime/backends/QnnLogger.h>
14 
15 #include <vector>
16 
17 #include "QnnDevice.h"
18 namespace executorch {
19 namespace backends {
20 namespace qnn {
21 class QnnDevice {
22  public:
QnnDevice(const QnnImplementation & implementation,QnnLogger * logger)23   explicit QnnDevice(const QnnImplementation& implementation, QnnLogger* logger)
24       : implementation_(implementation), handle_(nullptr), logger_(logger) {}
25 
26   virtual ~QnnDevice();
27 
GetHandle()28   Qnn_DeviceHandle_t GetHandle() {
29     return handle_;
30   }
31 
32   executorch::runtime::Error Configure();
33 
34  protected:
MakeConfig(std::vector<const QnnDevice_Config_t * > & config)35   virtual executorch::runtime::Error MakeConfig(
36       std::vector<const QnnDevice_Config_t*>& config) {
37     return executorch::runtime::Error::Ok;
38   };
39 
AfterCreateDevice()40   virtual executorch::runtime::Error AfterCreateDevice() {
41     return executorch::runtime::Error::Ok;
42   };
43   const QnnImplementation& implementation_;
44 
45  private:
46   Qnn_DeviceHandle_t handle_;
47   QnnLogger* logger_;
48 };
49 } // namespace qnn
50 } // namespace backends
51 } // namespace executorch
52