From ff0c54c3865b45eff807315262e73d3f01cb19c3 Mon Sep 17 00:00:00 2001 From: CNugteren Date: Sat, 22 Aug 2015 17:11:20 +0200 Subject: Added the XSWAP, XSCAL and XCOPY level-1 routines --- src/kernels/level1/xcopy.opencl | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/kernels/level1/xcopy.opencl (limited to 'src/kernels/level1/xcopy.opencl') diff --git a/src/kernels/level1/xcopy.opencl b/src/kernels/level1/xcopy.opencl new file mode 100644 index 00000000..97c27ccf --- /dev/null +++ b/src/kernels/level1/xcopy.opencl @@ -0,0 +1,57 @@ + +// ================================================================================================= +// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This +// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- +// width of 100 characters per line. +// +// Author(s): +// Cedric Nugteren +// +// This file contains the Xcopy kernel. It contains one fast vectorized version in case of unit +// strides (incx=incy=1) and no offsets (offx=offy=0). Another version is more general, but doesn't +// support vector data-types. +// +// This kernel uses the level-1 BLAS common tuning parameters. +// +// ================================================================================================= + +// Enables loading of this file using the C++ pre-processor's #include (C++11 standard raw string +// literal). Comment-out this line for syntax-highlighting when developing. +R"( + +// ================================================================================================= + +// Full version of the kernel with offsets and strided accesses +__attribute__((reqd_work_group_size(WGS, 1, 1))) +__kernel void Xcopy(const int n, + const __global real* restrict xgm, const int x_offset, const int x_inc, + __global real* ygm, const int y_offset, const int y_inc) { + + // Loops over the work that needs to be done (allows for an arbitrary number of threads) + #pragma unroll + for (int id = get_global_id(0); id