my opencl code needs to use the stream processor number to estimate a default workgroup/workitem configurations. Using CL_DEVICE_MAX_COMPUTE_UNITS and CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD, I was able to estimate the core counts in AMD GPUs, but I found the CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD call returns 0 in the latest Linux driver (amdgpu-pro 17.70), here is the code
mcxcl/mcx_host.cpp at master · fangq/mcxcl · GitHub
I am wondering if this is expected behavior. If CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD is no longer valid, what other approach I can use to estimate core numbers?
Hi,
Thanks for reporting this. AFAIK, OCL run-time should support this query as long as cl_amd_device_attribute_query is reported. If the extension was reported, but the value was still 0, then there might be a problem with the driver. Please share the clinfo output and setup details.
Btw, did you observe the problem with earlier versions of amdgpu-pro or just for this version only?
Regards,
I did not have this issue with amdgpu-pro 16.30 on another Ubuntu 14.04 box, which has a R9 nano and RX 480.
A correction, the problematic amdgpu-pro driver is 17.40, the OS is Ubuntu 16.04. I uninstalled the amdgpu-pro driver yesterday and installed rocm 1.6 (which has a module rocm-amdgpu-pro with version 17.40-492261), I can see the same problem where CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD returns 0.
the clinfo output is attached below:
fangq@pangu:$ clinfo
Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.0 AMD-APP (2508.0)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_amd_event_callback
Platform Extensions function suffix AMD
Platform Name AMD Accelerated Parallel Processing
Number of devices 1
Device Name gfx900
Device Vendor Advanced Micro Devices, Inc.
Device Vendor ID 0x1002
Device Version OpenCL 1.2
Driver Version 1.1 (HSA,LC)
Device OpenCL C Version OpenCL C 2.0
Device Type GPU
Device Profile FULL_PROFILE
Max compute units 64
Max clock frequency 1630MHz
Device Partition (core)
Max number of sub-devices 64
Supported partition types none specified
Max work item dimensions 3
Max work item sizes 1024x1024x1024
Max work group size 256
Preferred work group size multiple 64
Preferred / native vector sizes
char 4 / 4
short 2 / 2
int 1 / 1
long 1 / 1
half 1 / 1 (cl_khr_fp16)
float 1 / 1
double 1 / 1 (cl_khr_fp64)
Half-precision Floating-point support (cl_khr_fp16)
Denormals No
Infinity and NANs No
Round to nearest No
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Single-precision Floating-point support (core)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero Yes
Round to infinity Yes
IEEE754-2008 fused multiply-add Yes
Support is emulated in software No
Correctly-rounded divide and sqrt operations Yes
Double-precision Floating-point support (cl_khr_fp64)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero Yes
Round to infinity Yes
IEEE754-2008 fused multiply-add Yes
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Address bits 64, Little-Endian
Global memory size 8573157376 (7.984GiB)
Error Correction support No
Max memory allocation 7287183769 (6.787GiB)
Unified memory for Host and Device No
Minimum alignment for any data type 128 bytes
Alignment of base address 1024 bits (128 bytes)
Global Memory cache type Read/Write
Global Memory cache size 16384
Global Memory cache line 64 bytes
Image support Yes
Max number of samplers per kernel 26751
Max size for 1D images from buffer 65536 pixels
Max 1D or 2D image array size 2048 images
Max 2D image size 16384x16384 pixels
Max 3D image size 2048x2048x2048 pixels
Max number of read image args 128
Max number of write image args 8
Local memory type Local
Local memory size 65536 (64KiB)
Max constant buffer size 7287183769 (6.787GiB)
Max number of constant args 8
Max size of kernel argument 1024
Queue properties
Out-of-order execution No
Profiling Yes
Prefer user sync for interop Yes
Profiling timer resolution 1ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels No
printf() buffer size 4194304 (4MiB)
Built-in kernels
Device Available Yes
Compiler Available Yes
Linker Available Yes
Device Extensions cl_khr_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_media_ops cl_amd_media_ops2 cl_khr_subgroups cl_khr_depth_images cl_amd_liquid_flash cl_amd_copy_buffer_p2p
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) AMD Accelerated Parallel Processing
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [AMD]
clCreateContext(NULL, ...) [default] Success [AMD]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name AMD Accelerated Parallel Processing
Device Name gfx900
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) Success (1)
Platform Name AMD Accelerated Parallel Processing
Device Name gfx900
ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.8
ICD loader Profile OpenCL 1.2
NOTE: your OpenCL library declares to support OpenCL 1.2,
but it seems to support up to OpenCL 2.1 too.
Thanks for sharing the above details.
As per the clinfo output, it looks like "cl_amd_device_attribute_query", which provides a means to query AMD specific device attributes, is missing from the device extensions. That might be the reason for returning 0 against CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD. This extension should be checked before querying any such AMD specific device parameters. Please check clinfo output of the earlier drivers where the query worked. I think, the extension was present there.
Regards,
sorry for the late reply. yes, I was able to see the cl_amd_device_attribute_query extension on a Ubuntu box with amdgpu-pro 16.30 as expected.
so does this mean the latest 17.40 amdgpu driver has a bug?
Technically, we can't say it as a bug because the required extension, which enables to query device specific attributes, was not reported by amdgpu-pro 17.40. If the extension was reported, but the value was still 0, then there might be a problem with the driver.
if it is not amdgpu-pro's bug, then what other module is responsible for enabling this extension?
First of all, let me clear my earlier point. cl_amd_device_attribute_query is a vendor specific optional extension, not a required one. So, it would be inappropriate to mark this as a bug if the optional extension is not reported. At this moment, I can't say the reason for not reporting the extension and/or when it will be enabled again. AFAIK, OCL runtime reports it as supported by the base driver. I'll check if I can get more information about its current status.