From c02bb43f76dcfc3e25831459c656e6e3c39d18ea Mon Sep 17 00:00:00 2001 From: chuanqiw Date: Sat, 8 Oct 2022 23:53:35 -0700 Subject: [PATCH] tests: benchdnn: graph: fix data init with sycl --- tests/benchdnn/graph/utils.hpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/benchdnn/graph/utils.hpp b/tests/benchdnn/graph/utils.hpp index 89f6c82f686..c89f6c7bd07 100644 --- a/tests/benchdnn/graph/utils.hpp +++ b/tests/benchdnn/graph/utils.hpp @@ -110,13 +110,18 @@ void fill_buffer(void *src, size_t total_size, int val) { } #ifdef DNNL_GRAPH_WITH_SYCL + +template +class init_kernel; + template void fill_buffer(sycl::queue &q, void *usm_buffer, size_t length, dtype value) { dtype *usm_buffer_casted = static_cast(usm_buffer); - q.parallel_for(sycl::range<1>(length), [=](sycl::id<1> i) { - int idx = (int)i[0]; - usm_buffer_casted[idx] = value; - }).wait(); + auto ker = [=](sycl::id<1> i) { + int idx = (int)i[0]; + usm_buffer_casted[idx] = value; + }; + q.parallel_for>(sycl::range<1>(length), ker).wait(); } #endif