xref: /aosp_15_r20/external/XNNPACK/src/xnnpack/conv.h (revision 4bdc94577ba0e567308109d787f7fec7b531ce36)
1 // Copyright (c) Facebook, Inc. and its affiliates.
2 // All rights reserved.
3 //
4 // Copyright 2019 Google LLC
5 //
6 // This source code is licensed under the BSD-style license found in the
7 // LICENSE file in the root directory of this source tree.
8 
9 #pragma once
10 
11 #include <stddef.h>
12 #include <stdint.h>
13 
14 #include <xnnpack/common.h>
15 #include <xnnpack/microparams.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 
22 #define DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(fn_name) \
23   XNN_INTERNAL void fn_name(                           \
24       size_t input_height,                             \
25       size_t input_width,                              \
26       size_t output_y_start,                           \
27       size_t output_y_end,                             \
28       const float* input,                              \
29       const float* zero,                               \
30       const float* weights,                            \
31       float* output,                                   \
32       size_t input_padding_top,                        \
33       size_t output_channels,                          \
34       size_t output_height_stride,                     \
35       size_t output_width_stride,                      \
36       const union xnn_f32_minmax_params* params);
37 
38 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p1c3x4__neon_2x1)
39 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p1c3x4__neon_2x2)
40 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p1c3x4__neonfma_2x1)
41 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p1c3x4__neonfma_2x2)
42 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p1c3x4__scalar_1x1)
43 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p1c3x8__neon_2x1)
44 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p1c3x8__neon_2x2)
45 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p1c3x8__neonfma_2x1)
46 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p1c3x8__neonfma_2x2)
47 
48 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p0p1c3x4__neon_2x1)
49 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p0p1c3x4__neon_2x2)
50 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p0p1c3x4__neonfma_2x1)
51 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p0p1c3x4__neonfma_2x2)
52 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p0p1c3x4__scalar_1x1)
53 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p0p1c3x8__neon_2x1)
54 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p0p1c3x8__neon_2x2)
55 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p0p1c3x8__neonfma_2x1)
56 DECLARE_F32_CONV_HWC_UKERNEL_FUNCTION(xnn_f32_conv_hwc_ukernel_3x3s2p0p1c3x8__neonfma_2x2)
57 
58 
59 #define DECLARE_F32_CONV_HWC2CHW_UKERNEL_FUNCTION(fn_name) \
60   XNN_INTERNAL void fn_name(                                 \
61       size_t input_height,                                   \
62       size_t input_width,                                    \
63       size_t output_y_start,                                 \
64       size_t output_y_end,                                   \
65       const float* input,                                    \
66       const float* zero,                                     \
67       const float* weights,                                  \
68       float* output,                                         \
69       size_t input_padding_top,                              \
70       size_t output_channels,                                \
71       size_t output_height_stride,                           \
72       size_t output_channel_stride,                          \
73       const union xnn_f32_minmax_params* params);
74 
75 DECLARE_F32_CONV_HWC2CHW_UKERNEL_FUNCTION(xnn_f32_conv_hwc2chw_ukernel_3x3s2p1c3x4__neon_2x2)
76 DECLARE_F32_CONV_HWC2CHW_UKERNEL_FUNCTION(xnn_f32_conv_hwc2chw_ukernel_3x3s2p1c3x4__neonfma_2x2)
77 DECLARE_F32_CONV_HWC2CHW_UKERNEL_FUNCTION(xnn_f32_conv_hwc2chw_ukernel_3x3s2p1c3x4__scalar_1x1)
78 DECLARE_F32_CONV_HWC2CHW_UKERNEL_FUNCTION(xnn_f32_conv_hwc2chw_ukernel_3x3s2p1c3x4__sse_1x1)
79 DECLARE_F32_CONV_HWC2CHW_UKERNEL_FUNCTION(xnn_f32_conv_hwc2chw_ukernel_3x3s2p1c3x4__sse_2x2)
80 DECLARE_F32_CONV_HWC2CHW_UKERNEL_FUNCTION(xnn_f32_conv_hwc2chw_ukernel_3x3s2p1c3x4__wasmsimd_2x2)
81 
82 #define DECLARE_F16_CONV_HWC2CHW_UKERNEL_FUNCTION(fn_name) \
83   XNN_INTERNAL void fn_name(                                 \
84       size_t input_height,                                   \
85       size_t input_width,                                    \
86       size_t output_y_start,                                 \
87       size_t output_y_end,                                   \
88       const void* input,                                     \
89       const void* zero,                                      \
90       const void* weights,                                   \
91       void* output,                                          \
92       size_t input_padding_top,                              \
93       size_t output_channels,                                \
94       size_t output_height_stride,                           \
95       size_t output_channel_stride,                          \
96       const union xnn_f16_minmax_params* params);
97 
98 DECLARE_F16_CONV_HWC2CHW_UKERNEL_FUNCTION(xnn_f16_conv_hwc2chw_ukernel_3x3s2p1c3x4__neonfp16arith_2x2)
99 
100 #ifdef __cplusplus
101 }  // extern "C"
102 #endif
103