Skip to content

Commit 59daa3e

Browse files
Aelphyxnnpack-bot
authored andcommitted
Refactored xnn_indirection_init_subconv2d to not use operator object.
PiperOrigin-RevId: 728152402
1 parent 634f773 commit 59daa3e

File tree

3 files changed

+40
-21
lines changed

3 files changed

+40
-21
lines changed

src/indirection.c

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,26 +131,23 @@ void xnn_indirection_init_deconv2d(
131131
}
132132

133133
void xnn_indirection_init_subconv2d(
134-
xnn_operator_t op,
135134
size_t output_tile_size,
136-
uint32_t log2_element_size)
135+
const void** indirection_buffer,
136+
struct subconvolution_params* subconvolution_params,
137+
const void* input,
138+
const size_t input_pixel_stride,
139+
const void* zero,
140+
const size_t input_height,
141+
const size_t input_width,
142+
const size_t output_height,
143+
const size_t output_width,
144+
const size_t kernel_height,
145+
const size_t kernel_width,
146+
const size_t stride_height,
147+
const size_t stride_width,
148+
const size_t padding_top,
149+
const size_t padding_left)
137150
{
138-
const void** indirection_buffer = op->indirection_buffer;
139-
struct subconvolution_params* subconvolution_params = op->subconvolution_buffer;
140-
const void* input = op->input;
141-
const size_t input_pixel_stride = op->input_pixel_stride << log2_element_size;
142-
const void* zero = op->zero_buffer;
143-
const size_t input_height = op->input_height;
144-
const size_t input_width = op->input_width;
145-
const size_t output_height = op->output_height;
146-
const size_t output_width = op->output_width;
147-
const size_t kernel_height = op->kernel_height;
148-
const size_t kernel_width = op->kernel_width;
149-
const size_t stride_height = op->stride_height;
150-
const size_t stride_width = op->stride_width;
151-
const size_t padding_top = op->padding_top;
152-
const size_t padding_left = op->padding_left;
153-
154151
const size_t modulo_padding_top = padding_top % stride_height;
155152
const size_t modulo_padding_left = padding_left % stride_width;
156153
for (size_t offset_y = 0; offset_y < stride_height; offset_y++) {

src/operators/deconvolution-nhwc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,16 @@ static enum xnn_status reshape_subconv2d_path(
15621562
// Set a dummy input first, the actual input offset is calculated in setup when we have the input pointer.
15631563
// This offset must be aligned properly because inputs and input offsets need to be aligned.
15641564
deconvolution_op->input = (void*) ((uintptr_t) deconvolution_op->zero_buffer + XNN_ALLOCATION_ALIGNMENT);
1565-
xnn_indirection_init_subconv2d(deconvolution_op, mr, log2_input_element_size);
1565+
xnn_indirection_init_subconv2d(
1566+
mr, deconvolution_op->indirection_buffer,
1567+
deconvolution_op->subconvolution_buffer, deconvolution_op->input,
1568+
deconvolution_op->input_pixel_stride << log2_input_element_size,
1569+
deconvolution_op->zero_buffer, deconvolution_op->input_height,
1570+
deconvolution_op->input_width, deconvolution_op->output_height,
1571+
deconvolution_op->output_width, deconvolution_op->kernel_height,
1572+
deconvolution_op->kernel_width, deconvolution_op->stride_height,
1573+
deconvolution_op->stride_width, deconvolution_op->padding_top,
1574+
deconvolution_op->padding_left);
15661575

15671576
deconvolution_op->last_input = deconvolution_op->input;
15681577
deconvolution_op->last_input_height = input_height;

src/xnnpack/indirection.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,22 @@ XNN_INTERNAL void xnn_indirection_init_deconv2d(
123123
size_t padding_left);
124124

125125
XNN_INTERNAL void xnn_indirection_init_subconv2d(
126-
xnn_operator_t op,
127126
size_t output_tile_size,
128-
uint32_t log2_element_size);
127+
const void** indirection_buffer,
128+
struct subconvolution_params* subconvolution_params,
129+
const void* input,
130+
size_t input_pixel_stride,
131+
const void* zero,
132+
size_t input_height,
133+
size_t input_width,
134+
size_t output_height,
135+
size_t output_width,
136+
size_t kernel_height,
137+
size_t kernel_width,
138+
size_t stride_height,
139+
size_t stride_width,
140+
size_t padding_top,
141+
size_t padding_left);
129142

130143
XNN_INTERNAL void xnn_indirection_init_maxpool2d(
131144
const void** indirection_buffer,

0 commit comments

Comments
 (0)