I have vega10 chip cards like vega56 or smilar returning CL_DEVICE_MAX_WORK_ITEM_SIZES seems wrong. My understand from the variables name is the max work item size corresponds to block size in cuda (No. of threads within a block) but that returns 3.
Makes no sense, can someone look at it?
CL_DEVICE_NAME: gfx900.
CL_DEVICE_VENDOR: Advanced Micro Devices, Inc..
CL_DEVICE_VERSION: OpenCL 2.0 AMD-APP (3004.5).
CL_DRIVER_VERSION: 3004.5 (PAL,HSAIL).
CL_DEVICE_GLOBAL_MEM_SIZE: 4211081216 (fb000000).
CL_DEVICE_LOCAL_MEM_SIZE: 00065536 (00010000).
CL_DEVICE_LOCAL_MEM_TYPE: 00 (00).
CL_DEVICE_MAX_CLOCK_FREQUENCY: 1138 (0472).
CL_DEVICE_MAX_COMPUTE_UNITS: 0056 (0038).
CL_DEVICE_MAX_WORK_GROUP_SIZE: 00000256 (00000100).
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 0003 (0003).
CL_DEVICE_MAX_WORK_ITEM_SIZES: 0003 (0003).
CL_DEVICE_TYPE: 00 (00).
CL_DEVICE_EXTENSIONS: cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_kh.
CL_DEVICE_MAX_PARAMETER_SIZE: 00001024 (00000400).
Here are the code snippet. I initially suspected that due to fact that CL_DEVICE_MAX_WORK_ITEM_SIZES is using size_t variables as opposed to other types like string, cl_uint but that is not the case. Because I print out another device parameter CL_DEVICE_MAX_PARAMETER_SIZE which also uses size_t and I use %x in printf and it prints fine. So there is no reason to think I am wrongly printing size_t used in either CL_DEVICE_MAX_PARAMETER_SIZE or CL_DEVICE_MAX_PARAMETER_SIZE
enum enum_device_info_types {DEVINFO_STRING=1, DEVINFO_USHORT=2, DEVINFO_UINT=3, DEVINFO_ULONG=4, DEVINFO_SIZE_T=5};
enum enum_device_info_types device_info_types[] = {
DEVINFO_STRING, \
DEVINFO_STRING, \
DEVINFO_STRING, \
DEVINFO_STRING, \
DEVINFO_ULONG, \
DEVINFO_ULONG, \
DEVINFO_USHORT, \
DEVINFO_UINT, \
DEVINFO_UINT, \
DEVINFO_SIZE_T, \
DEVINFO_UINT, \
DEVINFO_UINT, \
DEVINFO_USHORT, \
DEVINFO_STRING, \
DEVINFO_SIZE_T \
};
char *str_device_info[]={\
"CL_DEVICE_NAME", \
"CL_DEVICE_VENDOR", \
"CL_DEVICE_VERSION", \
"CL_DRIVER_VERSION", \
"CL_DEVICE_GLOBAL_MEM_SIZE", \
"CL_DEVICE_LOCAL_MEM_SIZE", \
"CL_DEVICE_LOCAL_MEM_TYPE", \
"CL_DEVICE_MAX_CLOCK_FREQUENCY", \
"CL_DEVICE_MAX_COMPUTE_UNITS", \
"CL_DEVICE_MAX_WORK_GROUP_SIZE", \
"CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS", \
"CL_DEVICE_MAX_WORK_ITEM_SIZES", \
"CL_DEVICE_TYPE", \
"CL_DEVICE_EXTENSIONS", \
"CL_DEVICE_MAX_PARAMETER_SIZE" \
};
cl_device_id device[CONFIG_MAX_DEVICES];
cl_device_info deviceInfos[]={\
CL_DEVICE_NAME, \
CL_DEVICE_VENDOR, \
CL_DEVICE_VERSION, \
CL_DRIVER_VERSION, \
CL_DEVICE_GLOBAL_MEM_SIZE, \
CL_DEVICE_LOCAL_MEM_SIZE, \
CL_DEVICE_LOCAL_MEM_TYPE, \
CL_DEVICE_MAX_CLOCK_FREQUENCY, \
CL_DEVICE_MAX_COMPUTE_UNITS, \
CL_DEVICE_MAX_WORK_GROUP_SIZE, \
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, \
CL_DEVICE_MAX_WORK_ITEM_SIZES, \
CL_DEVICE_TYPE, \
CL_DEVICE_EXTENSIONS, \
CL_DEVICE_MAX_PARAMETER_SIZE \
};
stat = clGetDeviceIDs( platforms[0], CL_DEVICE_TYPE_ALL, CONFIG_MAX_DEVICES, device, &devices_available);
printf("\nNo. of devices available: %d", devices_available);
for (int j = 0 ; j < devices_available; j++) {
for (int i = 0 ; i < sizeof(deviceInfos)/sizeof(cl_device_info); i ++ ) {
if (stat == 0) {
switch (device_info_types[i]) {
case DEVINFO_STRING:
clGetDeviceInfo(device[0], deviceInfos[i], sizeof(str1), str1, &strLen);
printf("\n%40s: %30s.", str_device_info[i], str1);
break;
case DEVINFO_USHORT:
clGetDeviceInfo(device[0], deviceInfos[i], sizeof(ushort), (void*)&ushort1, &strLen);
printf("\n%40s: %02u (%02x).", str_device_info[i], ushort1, ushort1);
break;
case DEVINFO_UINT:
clGetDeviceInfo(device[0], deviceInfos[i], sizeof(uint), (void*)&uint1, &strLen);
printf("\n%40s: %04u (%04x).", str_device_info[i], uint1, uint1);
break;
case DEVINFO_ULONG:
clGetDeviceInfo(device[0], deviceInfos[i], sizeof(ulong), (void*)&ulong1, &strLen);
printf("\n%40s: %08u (%08x).", str_device_info[i], ulong1, ulong1);
break;
case DEVINFO_SIZE_T:
clGetDeviceInfo(device[0], deviceInfos[i], sizeof(ulong), (void*)&ulong1, &strLen);
printf("\n%40s: %08u (%08x).", str_device_info[i], ulong1, ulong1);
break;
}
} else {
printf("\nclGetDevicesIDs FAIL.");
return 1;
}
}
}
Here is my system info:
ubuntu 1804
kernel: 5.3.0-53-generic
ii ocl-icd-opencl-dev:amd64 2.2.11-1ubuntu1 amd64 OpenCL development files
root@sriov-guest:/git.co/dev-learn/rocm/opencl/opencl-programming-guide# dpkg -l | grep -i opencl
ii clinfo 2.2.18.03.26-1 amd64 Query OpenCL system information
ii clinfo-amdgpu-pro 19.50-933261 amd64 AMD OpenCL info utility
ii libopencl1-amdgpu-pro:amd64 19.50-933261 amd64 AMD OpenCL ICD Loader library
ii ocl-icd-libopencl1:amd64 2.2.11-1ubuntu1 amd64 Generic OpenCL ICD Loader
ii ocl-icd-opencl-dev:amd64 2.2.11-1ubuntu1 amd64 OpenCL development files
ii opencl-amdgpu-pro-comgr 19.50-933261 amd64 non-free AMD OpenCL ICD Loaders
ii opencl-amdgpu-pro-icd 19.50-933261 amd64 non-free AMD OpenCL ICD Loaders
ii opencl-c-headers 2.2~2018.02.21-gb5c3680-1 all OpenCL (Open Computing Language) C header files
ii opencl-orca-amdgpu-pro-icd:amd64 19.50-933261 amd64 non-free AMD OpenCL ICD Loaders
ii rocm-clang-ocl 0.5.0.51-rocm-rel-3.5-30-74b3b81 amd64 OpenCL compilation with clang compiler.
ii rocm-opencl 2.0.20191 amd64 OpenCL: Open Computing Language on ROCclr
ii rocm-opencl-dev 2.0.20191 amd64 OpenCL: Open Co
00:06.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Vega 10 [Radeon Instinct MI25 MxGPU] (rev 05)