Skip to content

Commit

Permalink
ocl: make backend less verbose at termination (#789)
Browse files Browse the repository at this point in the history
ocl: make backend less verbose at termination

* Made OpenCL common/shared code/definitions available.
* Updated tuned parameters.
  • Loading branch information
hfp authored May 13, 2024
1 parent 317a3c4 commit 954815d
Show file tree
Hide file tree
Showing 4 changed files with 475 additions and 468 deletions.
2 changes: 1 addition & 1 deletion src/acc/opencl/acc_opencl.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ int c_dbcsr_acc_finalize(void) {
# endif
assert(c_dbcsr_acc_opencl_config.ndevices < ACC_OPENCL_MAXNDEVS);
if (0 != c_dbcsr_acc_opencl_config.ndevices && NULL != cleanup) {
if (0 != c_dbcsr_acc_opencl_config.verbosity) {
if (2 <= c_dbcsr_acc_opencl_config.verbosity || 0 > c_dbcsr_acc_opencl_config.verbosity) {
int d;
fprintf(stderr, "INFO ACC/OpenCL: pid=%u nthreads=%i", libxsmm_get_pid(), c_dbcsr_acc_opencl_config.nthreads);
if (NULL != c_dbcsr_acc_opencl_config.device.context &&
Expand Down
27 changes: 17 additions & 10 deletions src/acc/opencl/common/opencl_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@
# define UNROLL_AUTO
#endif

#if !defined(MIN)
# define MIN(A, B) ((A) < (B) ? (A) : (B))
#endif
#if !defined(MAX)
# define MAX(A, B) ((A) < (B) ? (B) : (A))
#endif
#if !defined(MAD)
# define MAD fma
#endif

#if !defined(LU) || (-1 == LU)
# define UNROLL_OUTER(N)
# define UNROLL(N)
Expand All @@ -48,4 +38,21 @@
# define UNROLL(N) UNROLL_FORCE(N)
#endif

#if !defined(MIN)
# define MIN(A, B) ((A) < (B) ? (A) : (B))
#endif
#if !defined(MAX)
# define MAX(A, B) ((A) < (B) ? (B) : (A))
#endif
#if !defined(MAD)
# define MAD fma
#endif

#define DIVUP(A, B) (((A) + (B) - 1) / (B))
#define NUP(N, UP) (DIVUP(N, UP) * (UP))
#define BLR(N, BN) (NUP(N, BN) - (N))

#define IDX(I, J, M, N) ((int)(I) * (N) + (J))
#define IDT(I, J, M, N) IDX(J, I, N, M)

#endif /*OPENCL_COMMON_H*/
16 changes: 8 additions & 8 deletions src/acc/opencl/smm/kernels/multiply.cl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#include "../../common/opencl_atomics.h"

#if !defined(AL) || (SM != SN) || (SM != BM) || (SN != SK) || (1 == BS)
# define ADX(M, K) adata[SM * K + M + a0] /* transposed */
# define BDX(K, N) bdata[SN * K + N + b0] /* linear */
# define CDX(M, N) cdata[SM * N + M + c0] /* transposed */
# define ADX(M, K) adata[IDT(M, K, SM, SK) + a0] /* transposed */
# define BDX(K, N) bdata[IDX(K, N, SK, SN) + b0] /* linear */
# define CDX(M, N) cdata[IDT(M, N, SM, SN) + c0] /* transposed */
#else
# define ADX(M, K) adata[SK * M + K + a0] /* linear */
# define BDX(K, N) bdata[SK * N + K + b0] /* transposed */
# define CDX(M, N) cdata[SN * M + N + c0] /* linear */
# define ADX(M, K) adata[IDX(M, K, SM, SK) + a0] /* linear */
# define BDX(K, N) bdata[IDT(K, N, SK, SN) + b0] /* transposed */
# define CDX(M, N) cdata[IDX(M, N, SM, SN) + c0] /* linear */
#endif

#if defined(SLM_A)
Expand Down Expand Up @@ -63,8 +63,8 @@
# define REPEAT 1
#endif

#define NBM ((SM + BM - 1) / BM)
#define NBN ((SN + BN - 1) / BN)
#define NBM DIVUP(SM, BM)
#define NBN DIVUP(SN, BN)
#define WRK (NBM * NBN)

#define UM (SM / BK)
Expand Down
Loading

0 comments on commit 954815d

Please sign in to comment.