From 05a24078ec9dc03c10bccb5a18a9109556f4f73b Mon Sep 17 00:00:00 2001 From: Adarsh Yoga Date: Thu, 16 May 2024 16:53:04 +0000 Subject: [PATCH] l2_norm code difference fix --- dpbench/benchmarks/default/l2_norm/l2_norm_numba_dpex_p.py | 1 + dpbench/benchmarks/default/l2_norm/l2_norm_numba_mlir_p.py | 1 + dpbench/benchmarks/default/l2_norm/l2_norm_numba_npr.py | 1 + .../l2_norm_sycl_native_ext/l2_norm_sycl/_l2_norm_kernel.hpp | 1 + 4 files changed, 4 insertions(+) diff --git a/dpbench/benchmarks/default/l2_norm/l2_norm_numba_dpex_p.py b/dpbench/benchmarks/default/l2_norm/l2_norm_numba_dpex_p.py index 8b5df2de..5342a5c8 100644 --- a/dpbench/benchmarks/default/l2_norm/l2_norm_numba_dpex_p.py +++ b/dpbench/benchmarks/default/l2_norm/l2_norm_numba_dpex_p.py @@ -10,6 +10,7 @@ @dpjit def l2_norm(a, d): for i in nb.prange(a.shape[0]): + d[i] = 0.0 for k in range(a.shape[1]): d[i] += np.square(a[i, k]) d[i] = np.sqrt(d[i]) diff --git a/dpbench/benchmarks/default/l2_norm/l2_norm_numba_mlir_p.py b/dpbench/benchmarks/default/l2_norm/l2_norm_numba_mlir_p.py index eedd437c..5f2bdc1b 100644 --- a/dpbench/benchmarks/default/l2_norm/l2_norm_numba_mlir_p.py +++ b/dpbench/benchmarks/default/l2_norm/l2_norm_numba_mlir_p.py @@ -10,6 +10,7 @@ @nb.njit(parallel=True, fastmath=True) def _l2_norm(a, d): for i in numba.prange(a.shape[0]): + d[i] = 0.0 for k in range(a.shape[1]): d[i] += np.square(a[i, k]) d[i] = np.sqrt(d[i]) diff --git a/dpbench/benchmarks/default/l2_norm/l2_norm_numba_npr.py b/dpbench/benchmarks/default/l2_norm/l2_norm_numba_npr.py index db050ae6..48c42eb6 100644 --- a/dpbench/benchmarks/default/l2_norm/l2_norm_numba_npr.py +++ b/dpbench/benchmarks/default/l2_norm/l2_norm_numba_npr.py @@ -9,6 +9,7 @@ @nb.njit(parallel=True, fastmath=True) def l2_norm(a, d): for i in nb.prange(a.shape[0]): + d[i] = 0.0 for k in range(a.shape[1]): d[i] += np.square(a[i, k]) d[i] = np.sqrt(d[i]) diff --git a/dpbench/benchmarks/default/l2_norm/l2_norm_sycl_native_ext/l2_norm_sycl/_l2_norm_kernel.hpp b/dpbench/benchmarks/default/l2_norm/l2_norm_sycl_native_ext/l2_norm_sycl/_l2_norm_kernel.hpp index 8f13d972..6acfa123 100644 --- a/dpbench/benchmarks/default/l2_norm/l2_norm_sycl_native_ext/l2_norm_sycl/_l2_norm_kernel.hpp +++ b/dpbench/benchmarks/default/l2_norm/l2_norm_sycl_native_ext/l2_norm_sycl/_l2_norm_kernel.hpp @@ -22,6 +22,7 @@ void l2_norm_impl(queue Queue, .submit([&](handler &h) { h.parallel_for>(range<1>{npoints}, [=](id<1> myID) { size_t i = myID[0]; + d[i] = 0.0; for (size_t k = 0; k < dims; k++) { d[i] += a[i * dims + k] * a[i * dims + k]; }