Skip to content

Commit

Permalink
Fix incorrect indirection size computation for DWCONV
Browse files Browse the repository at this point in the history
Slightly reduce memory footprint for depthwise convolutions

PiperOrigin-RevId: 283990702
  • Loading branch information
Maratyszcza authored and xnnpack-bot committed Dec 5, 2019
1 parent ad74a7b commit 03ff294
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bench/f32-dwconv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static void DWConvBenchmark(benchmark::State& state,
const size_t output_width = (input_width + padding_width - effective_kernel_width) / subsampling + 1;
const size_t output_size = output_height * output_width;
const size_t step_width = dilation == 1 ? subsampling : kernel_width;
const size_t step_height = kernel_size + (output_width * step_width - 1) * kernel_height;
const size_t step_height = kernel_size + (output_width - 1) * step_width * kernel_height;

const size_t c_stride = benchmark::utils::RoundUp<size_t>(channels, cr);

Expand Down
2 changes: 1 addition & 1 deletion src/convolution-nhwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ static enum xnn_status setup_convolution2d_nhwc(
const size_t output_height = convolution_op->output_height;
const size_t output_width = convolution_op->output_width;
const size_t step_width = convolution_op->dilation_width == 1 ? convolution_op->stride_width : kernel_width;
const size_t step_height = kernel_size + (output_width * step_width - 1) * kernel_height;
const size_t step_height = kernel_size + (output_width - 1) * step_width * kernel_height;
const size_t indirection_buffer_size = sizeof(void*) * batch_size * output_height * step_height;

const void** indirection_buffer =
Expand Down

0 comments on commit 03ff294

Please sign in to comment.