xref: /aosp_15_r20/external/XNNPACK/src/xnnpack/indirection.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 #include <stdbool.h>
14 
15 #include <xnnpack.h>
16 #include <xnnpack/common.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 XNN_INTERNAL void xnn_indirection_init_conv2d(
23   xnn_operator_t op,
24   size_t output_tile_size,
25   uint32_t log2_element_size);
26 
27 XNN_INTERNAL void xnn_indirection_init_dwconv2d(
28   xnn_operator_t op,
29   size_t step_height,
30   size_t step_width,
31   size_t primary_tile,
32   uint32_t log2_element_size);
33 
34 XNN_INTERNAL void xnn_indirection_init_deconv2d(
35   xnn_operator_t op,
36   size_t output_tile_size,
37   uint32_t log2_element_size);
38 
39 XNN_INTERNAL void xnn_indirection_init_subconv2d(
40   xnn_operator_t op,
41   size_t output_tile_size,
42   uint32_t log2_element_size);
43 
44 XNN_INTERNAL void xnn_indirection_init_maxpool2d(
45   xnn_operator_t op,
46   size_t step_height,
47   size_t step_width,
48   uint32_t log2_element_size);
49 
50 typedef void (*xnn_indirection_init_resize_bilinear2d_hwc_fn)(
51   size_t input_pixel_stride,
52   size_t input_height,
53   size_t input_width,
54   size_t output_height,
55   size_t output_width,
56   const void* input,
57   const void** indirection_buffer,
58   void* packed_weights,
59   bool align_corners,
60   bool tensorflow_legacy);
61 
62 XNN_INTERNAL void xnn_indirection_init_resize_bilinear2d_hwc_f16(
63   size_t input_pixel_stride,
64   size_t input_height,
65   size_t input_width,
66   size_t output_height,
67   size_t output_width,
68   const void* input,
69   const void** indirection_buffer,
70   void* packed_weights,
71   bool align_corners,
72   bool tensorflow_legacy);
73 
74 XNN_INTERNAL void xnn_indirection_init_resize_bilinear2d_hwc_f32(
75   size_t input_pixel_stride,
76   size_t input_height,
77   size_t input_width,
78   size_t output_height,
79   size_t output_width,
80   const void* input,
81   const void** indirection_buffer,
82   float* packed_weights,
83   bool align_corners,
84   bool tensorflow_legacy);
85 
86 XNN_INTERNAL void xnn_indirection_init_resize_bilinear2d_hwc_q11(
87   size_t input_pixel_stride,
88   size_t input_height,
89   size_t input_width,
90   size_t output_height,
91   size_t output_width,
92   const void* input,
93   const void** indirection_buffer,
94   int16_t* packed_weights,
95   bool align_corners,
96   bool tensorflow_legacy);
97 
98 XNN_INTERNAL void xnn_indirection_init_resize_bilinear2d_chw_f16(
99   size_t input_pixel_stride,
100   size_t input_height,
101   size_t input_width,
102   size_t output_height,
103   size_t output_width,
104   const void* input,
105   const void** indirection_buffer,
106   void* packed_weights,
107   bool align_corners,
108   bool tensorflow_legacy);
109 
110 XNN_INTERNAL void xnn_indirection_init_resize_bilinear2d_chw_f32(
111   size_t input_pixel_stride,
112   size_t input_height,
113   size_t input_width,
114   size_t output_height,
115   size_t output_width,
116   const void* input,
117   const void** indirection_buffer,
118   float* packed_weights,
119   bool align_corners,
120   bool tensorflow_legacy);
121 
122 XNN_INTERNAL void xnn_indirection_init_unpool2d(
123   xnn_operator_t op,
124   size_t batch_start,
125   uint32_t log2_element_size);
126 
127 typedef void (*xnn_indirection_init_pavgpool2d_fn)(
128   size_t input_height,
129   size_t input_width,
130   size_t output_height,
131   size_t output_width,
132   size_t pooling_height,
133   size_t pooling_width,
134   size_t stride_height,
135   size_t stride_width,
136   size_t padding_top,
137   size_t padding_left,
138   void* pixelwise_buffer);
139 
140 XNN_INTERNAL void xnn_indirection_init_pavgpool2d_f16(
141   size_t input_height,
142   size_t input_width,
143   size_t output_height,
144   size_t output_width,
145   size_t pooling_height,
146   size_t pooling_width,
147   size_t stride_height,
148   size_t stride_width,
149   size_t padding_top,
150   size_t padding_left,
151   uint16_t* pixelwise_buffer);
152 
153 XNN_INTERNAL void xnn_indirection_init_pavgpool2d_f32(
154   size_t input_height,
155   size_t input_width,
156   size_t output_height,
157   size_t output_width,
158   size_t pooling_height,
159   size_t pooling_width,
160   size_t stride_height,
161   size_t stride_width,
162   size_t padding_top,
163   size_t padding_left,
164   float* pixelwise_buffer);
165 
166 #ifdef __cplusplus
167 }  // extern "C"
168 #endif
169