// ================================================================================================= // 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 Xgemv kernel for matrix-vector multiplication. // // ================================================================================================= // 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"( // ================================================================================================= // Parameters set by the tuner or by the database. Here they are given a basic default value in case // this kernel file is used outside of the CLBlast library. // 1: For the full version of the kernel #ifndef WGS1 #define WGS1 64 // The local work-group size #endif #ifndef WPT1 #define WPT1 1 // The amount of work-per-thread #endif // 2: For the fast version #ifndef WGS2 #define WGS2 64 // The local work-group size #endif #ifndef WPT2 #define WPT2 1 // The amount of work-per-thread #endif #ifndef VW2 #define VW2 1 // Vector width of matrix A loads #endif // 3: For the fast rotated version #ifndef WGS3 #define WGS3 64 // The local work-group size #endif #ifndef WPT3 #define WPT3 1 // The amount of work-per-thread #endif #ifndef VW3 #define VW3 1 // Vector width of matrix A loads #endif // ================================================================================================= // Full version of the kernel __attribute__((reqd_work_group_size(WGS1, 1, 1))) __kernel void Xgemv(const int m, const int n, const real alpha, const real beta, const int a_rotated, const __global real* restrict agm, const int a_offset, const int a_ld, const __global real* restrict xgm, const int x_offset, const int x_inc, __global real* ygm, const int y_offset, const int y_inc, const int do_conjugate) { // Local memory for the vector X __local real xlm[WGS1]; // Initializes the accumulation register real acc[WPT1]; #pragma unroll for (int w=0; w 'm' and 'n' are multiples of WGS2 // --> 'a_offset' is 0 // --> 'a_ld' is a multiple of VW2 // --> 'a_rotated' is 0 // --> 'do_conjugate' is 0 __attribute__((reqd_work_group_size(WGS2, 1, 1))) __kernel void XgemvFast(const int m, const int n, const real alpha, const real beta, const int a_rotated, const __global realVF* restrict agm, const int a_offset, const int a_ld, const __global real* restrict xgm, const int x_offset, const int x_inc, __global real* ygm, const int y_offset, const int y_inc, const int do_conjugate) { // Local memory for the vector X __local real xlm[WGS2]; // Initializes the accumulation register real acc[WPT2]; #pragma unroll for (int w=0; w 'm' and 'n' are multiples of WGS3 // --> 'a_offset' is 0 // --> 'a_ld' is a multiple of VW3 // --> 'a_rotated' is 1 // --> 'do_conjugate' is 0 __attribute__((reqd_work_group_size(WGS3, 1, 1))) __kernel void XgemvFastRot(const int m, const int n, const real alpha, const real beta, const int a_rotated, const __global realVFR* restrict agm, const int a_offset, const int a_ld, const __global real* restrict xgm, const int x_offset, const int x_inc, __global real* ygm, const int y_offset, const int y_inc, const int do_conjugate) { // Local memory for the vector X __local real xlm[WGS3]; // Initializes the accumulation register real acc[WPT3]; #pragma unroll for (int w=0; w