Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix uninitialized values involving in gemm computation #123

Open
wants to merge 1 commit into
base: v2.4_for_ie_master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/cpu/x64/gemm/gemm_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ static dnnl_status_t gemm_kernel_driver(int ithr, dim_t m, dim_t n, dim_t k,
if (mem_size > 0) {
mem = (char *)malloc(mem_size, 128);
if (!mem) return dnnl_out_of_memory;
memset(mem, 0, mem_size);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is actually fixes the issue.
I mean with this change we will definitely get rid of valgrind error, but this is not what we really want
Possible concerns:

  1. In general it is not required to default-initialize memory with some values (zeros in this case).
  2. After this change MVN node will read zeros from this piece of memory. Are we sure that this is ok and will not affect the computation results?
  3. That's great you have found that the root case is located in oneDNN code. We should try to check the latest oneDNN version and see if this issue is fixed there.

}

a_type *bufferA = (a_type *)align(mem, PAGE_4K);
Expand Down Expand Up @@ -813,6 +814,7 @@ static dnnl_status_t kernel_driver_parallel_acopiedbcopy(int ithr, dim_t m,
if (mem_size > 0) {
mem = (char *)malloc(mem_size, 128);
if (!mem) return dnnl_out_of_memory;
memset(mem, 0, mem_size);
}

b_type *bufferB = (b_type *)align(mem, PAGE_4K);
Expand Down Expand Up @@ -1409,6 +1411,8 @@ static dnnl_status_t parallel_a_copy(const int ithr, const int nthrs,
}

*p_shared_mem = (char *)malloc(mem_size, 128);
if (!p_shared_mem) return dnnl_out_of_memory;
memset(p_shared_mem, 0, mem_size);
}

dnnl_thr_barrier();
Expand All @@ -1418,8 +1422,6 @@ static dnnl_status_t parallel_a_copy(const int ithr, const int nthrs,

if (is_int8)
a_row_sum = (c_type *)align(bufferA + a_buf_nelems, PAGE_4K);

if (!mem) return dnnl_out_of_memory;
}

dnnl_status_t result = dnnl_success; // Return status
Expand Down