xref: /aosp_15_r20/external/executorch/backends/qualcomm/aot/ir/qcir_utils.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 
9 #pragma once
10 
11 #include <executorch/backends/qualcomm/aot/ir/qcir_generated.h>
12 #include "QnnTypes.h"
13 
14 namespace executorch {
15 namespace backends {
16 namespace qnn {
17 
18 typedef flatbuffers::Vector<::flatbuffers::Offset<qcir::Tensor>>::return_type
19     tensor_type;
20 typedef flatbuffers::Vector<
21     ::flatbuffers::Offset<qcir::QuantizeParam>>::return_type qparam_type;
22 
23 qcir::TensorType ToTensorType(Qnn_TensorType_t type);
24 Qnn_TensorType_t ToTensorType(qcir::TensorType type);
25 qcir::DataType ToDataType(Qnn_DataType_t type);
26 Qnn_DataType_t ToDataType(qcir::DataType type);
27 
28 flatbuffers::Offset<qcir::QuantizeParam> ToQuantizeParam(
29     const Qnn_Tensor_t& tensor,
30     flatbuffers::FlatBufferBuilder* builder);
31 Qnn_QuantizeParams_t ToQuantizeParam(const tensor_type& tensor);
32 
33 flatbuffers::Offset<qcir::Tensor> ToTensor(
34     const Qnn_Tensor_t& tensor,
35     flatbuffers::FlatBufferBuilder* builder);
36 Qnn_Tensor_t ToTensor(const tensor_type& tensor);
37 
38 } // namespace qnn
39 } // namespace backends
40 } // namespace executorch
41