Thanks your comments, I'll send v2. -----Original Message----- From: Song, Ruiling Sent: Wednesday, November 04, 2015 3:17 PM To: Meng, Mengmeng; beignet@lists.freedesktop.org Cc: Meng, Mengmeng Subject: RE: [Beignet] [PATCH 1/2] add benckmark for copy data from buffer to buffer
> -----Original Message----- > From: Beignet [mailto:beignet-boun...@lists.freedesktop.org] On Behalf > Of Meng Mengmeng > Sent: Monday, November 2, 2015 2:29 PM > To: beignet@lists.freedesktop.org > Cc: Meng, Mengmeng > Subject: [Beignet] [PATCH 1/2] add benckmark for copy data from buffer > to buffer > > Set the data format as 1920 * 1080 four channels and type as char,short and > int. > > Signed-off-by: Meng Mengmeng <mengmeng.m...@intel.com> > --- > benchmark/CMakeLists.txt | 3 ++- > benchmark/benchmark_copy_buffer.cpp | 52 > +++++++++++++++++++++++++++++++++++++ > kernels/bench_copy_buffer.cl | 21 +++++++++++++++ > 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 > benchmark/benchmark_copy_buffer.cpp > create mode 100644 kernels/bench_copy_buffer.cl > > diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index > 3e43a21..03a56f2 100644 > --- a/benchmark/CMakeLists.txt > +++ b/benchmark/CMakeLists.txt > @@ -16,7 +16,8 @@ set (benchmark_sources > benchmark_read_buffer.cpp > benchmark_read_image.cpp > benchmark_copy_buffer_to_image.cpp > - benchmark_copy_image_to_buffer.cpp) > + benchmark_copy_image_to_buffer.cpp > + benchmark_copy_buffer.cpp) > > > SET(CMAKE_CXX_FLAGS "-DBUILD_BENCHMARK ${CMAKE_CXX_FLAGS}") diff > --git a/benchmark/benchmark_copy_buffer.cpp > b/benchmark/benchmark_copy_buffer.cpp > new file mode 100644 > index 0000000..68b9870 > --- /dev/null > +++ b/benchmark/benchmark_copy_buffer.cpp > @@ -0,0 +1,52 @@ > +#include "utests/utest_helper.hpp" > +#include <sys/time.h> > + > +#define BENCH_COPY_BUFFER(T, K, M) \ > +double benchmark_copy_buffer_ ##T(void) \ { \ > + struct timeval start,stop; \ > + \ > + const size_t n = 1920 * 1080; \ > + const size_t sz = 4 * n ; \ > + \ > + OCL_CREATE_BUFFER(buf[0], 0, sz * sizeof(M), NULL); \ > + OCL_CREATE_BUFFER(buf[1], 0, sz * sizeof(M), NULL); \ \ > + OCL_CREATE_KERNEL_FROM_FILE("bench_copy_buffer",K); \ \ > + OCL_MAP_BUFFER(0); \ > + for (size_t i = 0; i < sz; i ++) { \ > + ((M *)(buf_data[0]))[i] = rand(); \ > + } \ > + OCL_UNMAP_BUFFER(0); \ > + \ > + OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); \ > + OCL_SET_ARG(1, sizeof(cl_mem), &buf[1]); \ \ > + globals[0] = 1920 * 1080; \ > + locals[0] = 64; \ Please use same work-group setting as copy-image. So we can compare them. globals[0] = w; \ globals[1] = h; \ locals[0] = 16; \ locals[1] = 4; \ _______________________________________________ Beignet mailing list Beignet@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/beignet