SHL 2.2.x
Loading...
Searching...
No Matches
shl_c920.h
1/*
2 * Copyright (C) 2016-2023 T-Head Semiconductor Co., Ltd. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19/* SHL version 2.2.x */
20
21#ifndef INCLUDE_SHL_C920_H_
22#define INCLUDE_SHL_C920_H_
23
24#include "csi_nn.h"
25#include "shl_gref.h"
26#include "shl_ref.h"
27#include "shl_thead_rvv.h"
28
29/*********************************** initialization ***********************************/
30int shl_c920_conv2d_init_fp32(struct csinn_tensor *input, struct csinn_tensor *output,
31 struct csinn_tensor *kernel, struct csinn_tensor *bias,
32 struct csinn_conv2d_params *params);
33int shl_c920_conv2d_init_fp16(struct csinn_tensor *input, struct csinn_tensor *output,
34 struct csinn_tensor *kernel, struct csinn_tensor *bias,
35 struct csinn_conv2d_params *params);
36
37int shl_c920_conv_im2col_gemm_packn_fp32(struct csinn_tensor *input, struct csinn_tensor *output,
38 struct csinn_tensor *kernel, struct csinn_tensor *bias,
39 struct csinn_conv2d_params *params);
40int shl_c920_conv_im2col_gemm_packn_fp16(struct csinn_tensor *input, struct csinn_tensor *output,
41 struct csinn_tensor *kernel, struct csinn_tensor *bias,
42 struct csinn_conv2d_params *params);
43
44int shl_c920_conv1x1s1_gemm_packn_fp32(struct csinn_tensor *input, struct csinn_tensor *output,
45 struct csinn_tensor *kernel, struct csinn_tensor *bias,
46 struct csinn_conv2d_params *params);
47int shl_c920_conv1x1s1_gemm_packn_fp16(struct csinn_tensor *input, struct csinn_tensor *output,
48 struct csinn_tensor *kernel, struct csinn_tensor *bias,
49 struct csinn_conv2d_params *params);
50
51int shl_c920_wg_b4f3s1_packn_fp32(struct csinn_tensor *input, struct csinn_tensor *output,
52 struct csinn_tensor *kernel, struct csinn_tensor *bias,
53 struct csinn_conv2d_params *params);
54int shl_c920_wg_b6f3s1_packn_fp32(struct csinn_tensor *input, struct csinn_tensor *output,
55 struct csinn_tensor *kernel, struct csinn_tensor *bias,
56 struct csinn_conv2d_params *params);
57int shl_c920_wg_b4f3s1_packn_fp16(struct csinn_tensor *input, struct csinn_tensor *output,
58 struct csinn_tensor *kernel, struct csinn_tensor *bias,
59 struct csinn_conv2d_params *params);
60int shl_c920_wg_b6f3s1_packn_fp16(struct csinn_tensor *input, struct csinn_tensor *output,
61 struct csinn_tensor *kernel, struct csinn_tensor *bias,
62 struct csinn_conv2d_params *params);
63
64void shl_c920_ncxhwx_gemm_8xpack2n_fp32(float *dst, const float *sa, const float *sb, float *bias,
65 int m, int k, int n, int ldc);
66void shl_c920_ncxhwx_gemm_8xpack2n_fp16(__fp16 *dst, const __fp16 *sa, const __fp16 *sb,
67 __fp16 *bias, int m, int k, int n, int ldc);
68
69void shl_c920_u8_to_f32(const uint8_t *input, float *output, int32_t offset, float *scale,
70 uint32_t length);
71void shl_c920_i8_to_f32(const int8_t *input, float *output, int32_t offset, float *scale,
72 uint32_t length);
73void shl_c920_f32_to_u8(const float *input, uint8_t *output, int32_t offset, float *scale,
74 uint32_t length);
75void shl_c920_f32_to_i8(const float *input, int8_t *output, int32_t offset, float *scale,
76 uint32_t length);
77
78void *shl_c920_f32_to_input_dtype(uint32_t index, float *data, struct csinn_session *sess);
79float *shl_c920_output_to_f32_dtype(uint32_t index, void *data, struct csinn_session *sess);
80struct shl_c920_option {
81 struct shl_rvv_option base;
82};
83
84int shl_c920_set_packn_layout(struct csinn_session *sess, bool packn_layout);
85struct shl_c920_option *shl_c920_get_graph_option(struct csinn_session *sess);
86bool shl_c920_get_binary_model_op_init(struct csinn_session *sess);
87void shl_c920_set_binary_model_op_init(struct csinn_session *sess, bool value);
88
89#endif // INCLUDE_SHL_C920_H_
Definition: csinn_data_structure.h:553
Definition: csinn_data_structure.h:502
Definition: csinn_data_structure.h:475