Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and GDB*

Device Capability Query

jimdempseyatthecove
Black Belt
345 Views

I am aware that I can identify a device by name or vendor but is there a (generic) way to obtain:

a list (bitmap) of features supported by the device. In particular does it have native support for double precision floating point?

Having a uniform/generic method would help to future proof an application (as opposed to using a table of device/vendor names at the time of writing the application)

Jim Dempsey

0 Kudos
1 Solution
AbhishekD_Intel
Moderator
320 Views

Hi Jim,

 

Thanks for reaching out to us.

To get the details of the supported features you can query your particular selected device for all the supported features using the get_info member function. There are multiple device descriptors that will give details regarding a particular feature. Some of the examples of the descriptors are:

device_type, vendor_id, max_compute_units, max_work_item_sizes, max_work_group_size, preferred_vector_width_float, preferred_vector_width_double, native_vector_width_long, native_vector_width_float, native_vector_width_double, native_vector_width_half, max_clock_frequency, address_bits, max_mem_alloc_size, double_fp_config, global_mem_cache_type, global_mem_cache_line_size, global_mem_size, max_constant_buffer_size, max_constant_args, etc.

 

You can use these device descriptors to get the values of a particular feature and use them accordingly in the application. For more details please refer to the below link:

https://docs.oneapi.com/versions/latest/dpcpp/iface/device.html#device-info

 

Also please go through the below sample for simple usage.

#include <CL/sycl.hpp>
#include <iostream>

#define PROP_NAME(_x) #_x
#define PRINT_DEVICE_PROPERTY(dev, prop) \
  std::cout << PROP_NAME(prop) << ": " \
            << dev.get_info<cl::sycl::info::device::prop>() << std::endl;

int main(int, char**) {
      
        sycl::gpu_selector selector;
        sycl::device device = sycl::device(selector);
        auto& dev = device;
        PRINT_DEVICE_PROPERTY(dev, name);
        PRINT_DEVICE_PROPERTY(dev, vendor);
        PRINT_DEVICE_PROPERTY(dev, driver_version);
        PRINT_DEVICE_PROPERTY(dev, profile);
        PRINT_DEVICE_PROPERTY(dev, version);
        PRINT_DEVICE_PROPERTY(dev, opencl_c_version);
        PRINT_DEVICE_PROPERTY(dev, max_compute_units);
        PRINT_DEVICE_PROPERTY(dev, max_work_item_dimensions);
        PRINT_DEVICE_PROPERTY(dev, preferred_vector_width_short);
        PRINT_DEVICE_PROPERTY(dev, preferred_vector_width_int);
        PRINT_DEVICE_PROPERTY(dev, preferred_vector_width_double);
        PRINT_DEVICE_PROPERTY(dev, preferred_vector_width_half);
        PRINT_DEVICE_PROPERTY(dev, native_vector_width_char);
        PRINT_DEVICE_PROPERTY(dev, native_vector_width_int);
        PRINT_DEVICE_PROPERTY(dev, native_vector_width_float);
        PRINT_DEVICE_PROPERTY(dev, native_vector_width_double);
        PRINT_DEVICE_PROPERTY(dev, native_vector_width_half);
        PRINT_DEVICE_PROPERTY(dev, local_mem_size);
        PRINT_DEVICE_PROPERTY(dev, global_mem_cache_line_size);
        PRINT_DEVICE_PROPERTY(dev, global_mem_cache_size);
        PRINT_DEVICE_PROPERTY(dev, global_mem_size);
        PRINT_DEVICE_PROPERTY(dev, max_constant_buffer_size);
        PRINT_DEVICE_PROPERTY(dev, max_constant_args);

        return 0;
}

 

Hope the provided details will help you, also give us a confirmation on whether it's the same details that you are expecting.

 

 

Warm Regards,

Abhishek

 

View solution in original post

4 Replies
AbhishekD_Intel
Moderator
321 Views

Hi Jim,

 

Thanks for reaching out to us.

To get the details of the supported features you can query your particular selected device for all the supported features using the get_info member function. There are multiple device descriptors that will give details regarding a particular feature. Some of the examples of the descriptors are:

device_type, vendor_id, max_compute_units, max_work_item_sizes, max_work_group_size, preferred_vector_width_float, preferred_vector_width_double, native_vector_width_long, native_vector_width_float, native_vector_width_double, native_vector_width_half, max_clock_frequency, address_bits, max_mem_alloc_size, double_fp_config, global_mem_cache_type, global_mem_cache_line_size, global_mem_size, max_constant_buffer_size, max_constant_args, etc.

 

You can use these device descriptors to get the values of a particular feature and use them accordingly in the application. For more details please refer to the below link:

https://docs.oneapi.com/versions/latest/dpcpp/iface/device.html#device-info

 

Also please go through the below sample for simple usage.

#include <CL/sycl.hpp>
#include <iostream>

#define PROP_NAME(_x) #_x
#define PRINT_DEVICE_PROPERTY(dev, prop) \
  std::cout << PROP_NAME(prop) << ": " \
            << dev.get_info<cl::sycl::info::device::prop>() << std::endl;

int main(int, char**) {
      
        sycl::gpu_selector selector;
        sycl::device device = sycl::device(selector);
        auto& dev = device;
        PRINT_DEVICE_PROPERTY(dev, name);
        PRINT_DEVICE_PROPERTY(dev, vendor);
        PRINT_DEVICE_PROPERTY(dev, driver_version);
        PRINT_DEVICE_PROPERTY(dev, profile);
        PRINT_DEVICE_PROPERTY(dev, version);
        PRINT_DEVICE_PROPERTY(dev, opencl_c_version);
        PRINT_DEVICE_PROPERTY(dev, max_compute_units);
        PRINT_DEVICE_PROPERTY(dev, max_work_item_dimensions);
        PRINT_DEVICE_PROPERTY(dev, preferred_vector_width_short);
        PRINT_DEVICE_PROPERTY(dev, preferred_vector_width_int);
        PRINT_DEVICE_PROPERTY(dev, preferred_vector_width_double);
        PRINT_DEVICE_PROPERTY(dev, preferred_vector_width_half);
        PRINT_DEVICE_PROPERTY(dev, native_vector_width_char);
        PRINT_DEVICE_PROPERTY(dev, native_vector_width_int);
        PRINT_DEVICE_PROPERTY(dev, native_vector_width_float);
        PRINT_DEVICE_PROPERTY(dev, native_vector_width_double);
        PRINT_DEVICE_PROPERTY(dev, native_vector_width_half);
        PRINT_DEVICE_PROPERTY(dev, local_mem_size);
        PRINT_DEVICE_PROPERTY(dev, global_mem_cache_line_size);
        PRINT_DEVICE_PROPERTY(dev, global_mem_cache_size);
        PRINT_DEVICE_PROPERTY(dev, global_mem_size);
        PRINT_DEVICE_PROPERTY(dev, max_constant_buffer_size);
        PRINT_DEVICE_PROPERTY(dev, max_constant_args);

        return 0;
}

 

Hope the provided details will help you, also give us a confirmation on whether it's the same details that you are expecting.

 

 

Warm Regards,

Abhishek

 

jimdempseyatthecove
Black Belt
292 Views

One additional issue (until the next one) is if double precision is implemented in hardware as opposed to a software implementation. For example, some of the older GPUs (though I suppose will not be supported by SYCL) had limited or no DP support. I am just guessing that some of the newer ones have better, but yet limited support. For example lacking hardware sqrt, sin, cos, etc...

Jim Dempsey

jimdempseyatthecove
Black Belt
290 Views

I do see sycl::info::fp_config has fp_config for half_fp_config, single_fp_config and double_fp_config.

Does the bit field soft_float indicate that the selected class of fp is performed via software as opposed to hardware?

While fma is included, the other feature sets, as provided say by AVX... are not detectable.

Jim Dempsey

AbhishekD_Intel
Moderator
300 Views

Hi Jim,


Thanks for the confirmation, glad to know that the provided details helped you.

As the issue is resolved we will no longer monitor this thread. Please post a new thread if you have any other issues.



Warm Regards,

Abhishek


Reply