|
37 | 37 | # if !defined(OPENCL_LIBSMM_NLOCKS_SMM) |
38 | 38 | # define OPENCL_LIBSMM_NLOCKS_SMM 16 |
39 | 39 | # endif |
40 | | -# if !defined(OPENCL_LIBSMM_CMEM) && 1 |
41 | | -# define OPENCL_LIBSMM_CMEM |
42 | | -# endif |
43 | 40 | # if !defined(OPENCL_LIBSMM_TODO) && 0 |
44 | 41 | # define OPENCL_LIBSMM_TODO |
45 | 42 | # endif |
@@ -90,22 +87,6 @@ opencl_libsmm_acc_dbm_launch_fn_t opencl_libsmm_acc_dbm_launch_fn; |
90 | 87 | int opencl_libsmm_initialized; |
91 | 88 |
|
92 | 89 |
|
93 | | -int opencl_libsmm_use_cmem(cl_device_id device) { |
94 | | -# if defined(OPENCL_LIBSMM_CMEM) |
95 | | - int result = EXIT_SUCCESS; |
96 | | - cl_ulong size_maxalloc = 1, size_maxcmem = 0; |
97 | | - ACC_OPENCL_CHECK(result, clGetDeviceInfo(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof(cl_ulong), &size_maxalloc, NULL), |
98 | | - "retrieve maximum size of memory allocation"); |
99 | | - ACC_OPENCL_CHECK(result, clGetDeviceInfo(device, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, sizeof(cl_ulong), &size_maxcmem, NULL), |
100 | | - "retrieve maximum size of constant buffer"); |
101 | | - return (EXIT_SUCCESS == result ? (size_maxalloc <= size_maxcmem ? EXIT_SUCCESS : EXIT_FAILURE) : result); |
102 | | -# else |
103 | | - LIBXSMM_UNUSED(device); |
104 | | - return EXIT_FAILURE; |
105 | | -# endif |
106 | | -} |
107 | | - |
108 | | - |
109 | 90 | int opencl_libsmm_write_trans_params(FILE* stream, int only_key, const opencl_libsmm_transkey_t* key, |
110 | 91 | const opencl_libsmm_trans_t* config, const char* delim, const char* begin, const char* close) { |
111 | 92 | int result = 0; |
@@ -699,8 +680,8 @@ int libsmm_acc_transpose(const int* dev_trs_stack, int offset, int stack_size, v |
699 | 680 | const cl_device_id device_id = c_dbcsr_acc_opencl_config.devices[c_dbcsr_acc_opencl_config.device_id]; |
700 | 681 | const c_dbcsr_acc_opencl_device_t* const devinfo = &c_dbcsr_acc_opencl_config.device; |
701 | 682 | const char *const env_cl = OPENCL_LIBSMM_TRANSENV("BUILDOPTS"), *const env_bm = OPENCL_LIBSMM_TRANSENV("BM"); |
702 | | - const char* const cmem = (EXIT_SUCCESS != opencl_libsmm_use_cmem(device_id) ? "global" : "constant"); |
703 | | - const char* const build_format = "-DGLOBAL=%s -DINPLACE=%i -DFN=%s -DSM=%i -DSN=%i -DWG=%i -DT=%s"; |
| 683 | + const char* const cmem = (EXIT_SUCCESS != c_dbcsr_acc_opencl_use_cmem(devinfo) ? "global" : "constant"); |
| 684 | + const char* const build_format = "-DCONSTANT=%s -DINPLACE=%i -DFN=%s -DSM=%i -DSN=%i -DWG=%i -DT=%s"; |
704 | 685 | const char *const env_inplace = OPENCL_LIBSMM_TRANSENV("INPLACE"), *tname = ""; |
705 | 686 | # if defined(OPENCL_LIBSMM_TRANS_INPLACE) |
706 | 687 | const int inplace = ((m == n) && (NULL == env_inplace ? 1 : ('0' != *env_inplace))); |
@@ -1079,15 +1060,15 @@ int opencl_libsmm_acc_process(const int* host_param_stack, const int* dev_param_ |
1079 | 1060 | new_config.wgsize[kernel_idx] = (2 > new_config.wg ? (nbm * nbn) : ((int)LIBXSMM_UP2POT(nbm * nbn))); |
1080 | 1061 | } |
1081 | 1062 | if (new_config.wgsize[kernel_idx] <= devinfo->wgsize[0]) { /* SMM can be handled by device */ |
1082 | | - const char* const cmem = (EXIT_SUCCESS != opencl_libsmm_use_cmem(device_id) ? "global" : "constant"); |
| 1063 | + const char* const cmem = (EXIT_SUCCESS != c_dbcsr_acc_opencl_use_cmem(devinfo) ? "global" : "constant"); |
1083 | 1064 | const char* const env_nrepeat = getenv("NREPEAT_SMM"); |
1084 | 1065 | const int typesize = OPENCL_LIBSMM_TYPESIZE(datatype); |
1085 | 1066 | const int slm_a = (1 != new_config.aa ? 0 : (LIBXSMM_ISPOT(k_max * typesize) + 1)); |
1086 | 1067 | const int slm_b = (1 != new_config.ab ? 0 : (LIBXSMM_ISPOT(k_max * typesize) + 1)); |
1087 | 1068 | const int slm_c = (1 != new_config.ac ? 0 : (LIBXSMM_ISPOT(m_max * typesize) + 1)); |
1088 | 1069 | /* compose build parameters and flags */ |
1089 | 1070 | nchar = LIBXSMM_SNPRINTF(build_params, sizeof(build_params), |
1090 | | - "-DT=%s -DGPU=%u -DGLOBAL=%s -DWG=%i -DSG=%i -DFN=%s -DREPEAT=%i -DLU=%i " |
| 1071 | + "-DT=%s -DGPU=%u -DCONSTANT=%s -DWG=%i -DSG=%i -DFN=%s -DREPEAT=%i -DLU=%i " |
1091 | 1072 | "-DSM=%i -DSN=%i -DSK=%i -DBS=%i -DVL=%i %s -DBM=%i -DBN=%i -DBK=%i " |
1092 | 1073 | "%s %s %s %s %s %s %s %s ", /* space! */ |
1093 | 1074 | tname, CL_DEVICE_TYPE_GPU == devinfo->type, cmem, (int)new_config.wgsize[kernel_idx], (int)sgs, fname, |
|
0 commit comments