From a6621f12416f0b854f2fd73bb68f89f29ea3d93d Mon Sep 17 00:00:00 2001 From: Harihara Sudhan S Date: Thu, 4 May 2023 10:44:15 +0530 Subject: [PATCH] Incorrect accumulation of results in DDOTV - When the number of threads launched is not equal to the number of threads requested the garbage value in the created buffer will not be overwritten by valid values. - To handle the above scenario, the created temporary buffer is initialized with zeroes. AMD-Internal: [CPUPL-3268] Change-Id: I439a1da18eb1b380491fea14f42b0ede05ccf5a9 --- frame/compat/bla_dot_amd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frame/compat/bla_dot_amd.c b/frame/compat/bla_dot_amd.c index 213fd14a4..0b6651d8f 100644 --- a/frame/compat/bla_dot_amd.c +++ b/frame/compat/bla_dot_amd.c @@ -452,6 +452,19 @@ double ddot_blis_impl if ((bli_mem_is_alloc(&mem_buf_rho))) { rho_temp = bli_mem_buffer(&mem_buf_rho); + + /* + This is done to handle cases when the + number of threads launched is not equal + to the number of threads requested. In + such cases, the garbage value in the created + buffer will not be overwritten by valid values. + + This will ensure that garbage value will + not get accumulated with the final result. + */ + for (dim_t i = 0; i < nt; i++) + rho_temp[i] = 0.0; } else {