Skip to content

Commit

Permalink
cpu: x64: fix applying non-zero offset to null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
dzarukin authored and vpirogov committed Aug 19, 2021
1 parent 3494b1e commit 5bab17c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
5 changes: 3 additions & 2 deletions src/cpu/x64/jit_avx512_common_1x1_convolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ void jit_avx512_common_1x1_convolution_fwd_t<src_type, wei_type,

p.output_data = jcp.with_dw_conv ? pbuf + (oh % jcp_dw_kh) * row_offset
: &dst[dst_off];
p.bias_data
= &bias[oc_off_idx * (is_dst_layout_nxc ? 1 : jcp.oc_block)];
p.bias_data = bias
? &bias[oc_off_idx * (is_dst_layout_nxc ? 1 : jcp.oc_block)]
: nullptr;

p.load_data
= &weights[pd()->with_groups() ? weights_d.blk_off(g, ocb, icb)
Expand Down
15 changes: 8 additions & 7 deletions src/cpu/x64/jit_brgemm_inner_product.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,13 +1131,14 @@ void brgemm_inner_product_bwd_weights_t<isa>::compute_diff_weights_and_bias(
+ a_buf_idx)
* jbgp.gemm_batch_size * jbgp.os_block
* jbgp.ic_block);
char *b_buffer = b_buffer_global
+ types::data_type_size(jbgp.dst_dt)
* ((ti->ithr * os_chunks_per_thr + b_buf_idx)
* jbgp.gemm_batch_size * jbgp.os_block
* jbgp.LDB
+ (ocb_l_idx % jbgp.nb_oc_blocking)
* jbgp.oc_block);
char *b_buffer = b_buffer_global ? b_buffer_global
+ types::data_type_size(jbgp.dst_dt)
* ((ti->ithr * os_chunks_per_thr + b_buf_idx)
* jbgp.gemm_batch_size
* jbgp.os_block * jbgp.LDB
+ (ocb_l_idx % jbgp.nb_oc_blocking)
* jbgp.oc_block)
: nullptr;

char *wsp_tile = is_amx_bf16 ? wsp_tile_global + ti->ithr * tile_size
: nullptr;
Expand Down
18 changes: 9 additions & 9 deletions src/cpu/x64/lrn/lrn_avx512_blocked_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class lrn_avx512_blocked_executor_fwd_t : public i_lrn_executor_t {
d_type>::jit_args_fwd_t args;
args.src = &src[offset];
args.dst = &dst[offset];
args.ws0 = &ws[ws_offset0];
args.ws1 = &ws[ws_offset1];
args.ws0 = ws ? &ws[ws_offset0] : nullptr;
args.ws1 = ws ? &ws[ws_offset1] : nullptr;

if (C16 == 1)
(*ker)(&args);
Expand All @@ -136,8 +136,8 @@ class lrn_avx512_blocked_executor_fwd_t : public i_lrn_executor_t {
d_type>::jit_args_fwd_t args;
args.src = &src[offset];
args.dst = &dst[offset];
args.ws0 = &ws[ws_offset0];
args.ws1 = &ws[ws_offset1];
args.ws0 = ws ? &ws[ws_offset0] : nullptr;
args.ws1 = ws ? &ws[ws_offset1] : nullptr;

if (C16 == 1)
(*ker)(&args);
Expand Down Expand Up @@ -248,8 +248,8 @@ class lrn_avx512_blocked_executor_bwd_t : public i_lrn_executor_t {
d_type>::jit_args_bwd_t args;
args.src = &src[offset];
args.diff_dst = &diff_dst[offset];
args.ws0 = &ws[ws_offset0];
args.ws1 = &ws[ws_offset1];
args.ws0 = ws ? &ws[ws_offset0] : nullptr;
args.ws1 = ws ? &ws[ws_offset1] : nullptr;
args.diff_src = &diff_src[offset];

if (C16 == 1)
Expand All @@ -276,8 +276,8 @@ class lrn_avx512_blocked_executor_bwd_t : public i_lrn_executor_t {
d_type>::jit_args_bwd_t args;
args.src = &src[offset];
args.diff_dst = &diff_dst[offset];
args.ws0 = &ws[ws_offset0];
args.ws1 = &ws[ws_offset1];
args.ws0 = ws ? &ws[ws_offset0] : nullptr;
args.ws1 = ws ? &ws[ws_offset1] : nullptr;
args.diff_src = &diff_src[offset];

if (C16 == 1)
Expand Down Expand Up @@ -314,4 +314,4 @@ class lrn_avx512_blocked_executor_bwd_t : public i_lrn_executor_t {
} // namespace impl
} // namespace dnnl

#endif
#endif

0 comments on commit 5bab17c

Please sign in to comment.