Skip to content

Commit

Permalink
src: cpu: avx2: add default case for jcp.nb_oc_blocking size
Browse files Browse the repository at this point in the history
    Fixes cases for `jcp.nb_oc % {3,2} != 0` which resulted in incorrect output
    or assert triggering seg-fault.
  • Loading branch information
msotoflo committed Sep 19, 2019
1 parent 9008d8a commit 6accb47
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/cpu/jit_avx2_conv_kernel_f32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,19 @@ status_t jit_avx2_conv_fwd_kernel_f32::init_conf(jit_conv_conf_t &jcp,
// adjust one of nb_oc_block, ur_w preserving to ur_w >= l_pad
if (jcp.ur_w > jcp.l_pad && jcp.ur_w > 1)
jcp.ur_w -= 1;
else
for (int b = 3; b > 1; b--)
else {
for (int b = 3; b > 1; b--) {
if (jcp.nb_oc % b == 0) {
jcp.nb_oc_blocking = b;
break;
}
}
if ((jcp.nb_oc_blocking + 1) * jcp.ur_w > num_avail_regs) {
// No optimal size for 'nb_oc_blocking' with regards to
// 'nb_oc', default to only unroll by 'ur_w'.
jcp.nb_oc_blocking = 1;
}
}
}
}

Expand Down

0 comments on commit 6accb47

Please sign in to comment.