GPU Compute Software
Ask questions about Intel® Graphics Compute software technologies, such as OpenCL* GPU driver and oneAPI Level Zero
174 Discussions

Double-precision floating point on Iris Xe MAX

AB22
Beginner
4,449 Views

I am trying to use OpenCL (specifically the example/wrapper at https://github.com/ProjectPhysX/OpenCL-Wrapper), building with Visual Studio 2022 for an Iris Xe Max.  The example using "float" works fine, but if I try to change it to use "double" I get the error "error: use of type 'double' requires cl_khr_fp64 extension to be enabled".  There is a preprocessor directive as follows:

 

#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#endif

 

However, I think that it's not being activated, and if I remove the conditionals then it makes no apparent difference.

Should I expect to be able to use doubles with this hardware?  I've seen a mention (https://community.intel.com/t5/GPU-Compute-Software/Iris-Xe-Graphics-can-t-compute-double-precision-floating-point/m-p/1281976) that this isn't supported, but the device info (if I've read it correctly from the wrapper structure) says it should be.  What's the best way to confirm the capabilities of this hardware?  The information printed out about it by the example is:

 

| Device Name    | Intel(R) Iris(R) Xe MAX Graphics                          
| Device Vendor  | Intel(R) Corporation                                       
| Device Driver  | 27.20.100.9664                                             
| OpenCL Version | OpenCL C 1.2                                               
| Compute Units  | 96 at 1650 MHz (768 cores, 2.534 TFLOPs/s)                 
| Memory, Cache  | 3180 MB, 1024 KB global / 64 KB local                      
| Buffer Limits  | 1590 MB global, 1628568 KB constant                        

 

0 Kudos
1 Solution
Dunni_A_Intel
Moderator
4,239 Views

Hello,


  1. Please set environment variables OverrideDefaultFP64Settings=1 and IGC_EnableDPEmulation=1 to enable double-precision floating point (FP64) emulation. Note that FP64 emulation is only supported on Linux. For more information about FP64 emulation, please see https://github.com/intel/compute-runtime/blob/master/opencl/doc/FAQ.md#feature-double-precision-emulation-fp64.
  2. To check for double-precision floating point support, check whether the device supports cl_kht_fp64 extension. For instance, you will observe that your test will include cl_khr_fp64 as a supported extension on Iris Xe Max after the variables in 1 above are set. clinfo uses the same mechanism to report device floating point support.
  3. Given that double precision is not supported natively on Iris Xe Max, I agree that CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE should return 0 especially if the FP64 environment variables are not set. I have filed an issue for this.


I hope this answers your questions.


View solution in original post

0 Kudos
7 Replies
VarshaS_Intel
Moderator
4,422 Views

Hi,


Thanks for posting in Intel Communities.


Could you please let us know which compiler you use to run the code? And also, could you please let us know the Intel oneAPI version and Microsoft Visual Studio version you are using?


>>The example using "float" works fine, but if I try to change it to use "double"

Could you please let us know what changes you have made in the code? If possible, could you please provide a complete reproducer code to investigate more on your issue?


And also, could you please try running the code on Intel oneAPI Command Prompt and let us know if you are able to run it successfully?


Thanks & Regards,

Varsha


0 Kudos
AB22
Beginner
4,416 Views

Varsha

I am using the Visual Studio 2022 C++ compiler (v143, I think?) to compile the project from the solution in the Github link I provided.  It works fine as-is.  Performing a search-n-replace in kernel.cpp and main.cpp to swap all instances of "float" to "double" yields the error - these are the only changes I have made.

I don't have Intel oneAPI installed - so I don't have a version of this to report.

Alan

0 Kudos
AB22
Beginner
4,380 Views

Removing the use of the wrapper code and calling OpenCL C functions directly, I can see that there's an error when reading some of the device info - which maybe isn't being handled properly.  If there's actually no supported extensions, then that means that there's no fp64 support in the GPU.  Sorry for the confusion.

0 Kudos
AB22
Beginner
4,375 Views

Ah - there was an error because there are more extensions than I'd left space for.  I can see that cl_khr_fp64 isn't supported.  However, when requesting CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE I get a response of 1.  According to the spec, it says that this value should be 0 if double precision isn't supported.  I've used the following code (compiled with Visual Studio 2022) to print out the extensions and the supported values for the parameter:

#include <stdio.h>
#include <string.h>
#include <CL/cl.h>

#define MAX_PLATFORMS 10
#define MAX_DEVICES_PER_PLATFORM 10
#define VALUE_SIZE 10000

int main(void)
{
    cl_int err;
    cl_platform_id platforms[MAX_PLATFORMS];
    cl_uint numPlatforms;

    err = clGetPlatformIDs(MAX_PLATFORMS, platforms, &numPlatforms);
    if (CL_SUCCESS == err)
        printf("\nDetected OpenCL platforms: %d\n", numPlatforms);
    else
        printf("\nError calling clGetPlatformIDs. Error code: %d\n", err);

    cl_device_id desired_device;
    for (size_t i = 0; i < numPlatforms; i++) {
        cl_device_id devices[MAX_DEVICES_PER_PLATFORM];
        cl_uint num_devices;
        err = clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, MAX_DEVICES_PER_PLATFORM, devices, &num_devices);
        printf("%d devices on platform %d, err: %d\n", num_devices, (int)i, (int)err);

        for (size_t j = 0; j < num_devices; j++) {
            char response[VALUE_SIZE];
            cl_uint uint_response;
            size_t size_returned;
            err = clGetDeviceInfo(devices[j], CL_DEVICE_EXTENSIONS, VALUE_SIZE, response, &size_returned);
            if (0 == err) {
                printf("device %d returned a value of %s\n", (int)j, response);
            }
            else {
                printf("err response %d\n", (int)err);
            }
            err = clGetDeviceInfo(devices[j], CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, 10, &uint_response, &size_returned);
            if (0 == err) {
                printf("device %d returned a value of %d for CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE\n", (int)j, (int)uint_response);
            }
            else {
                printf("err response %d\n", (int)err);
            }
        }
    }
    return 0;
}

Is there an issue with my understanding of the spec, or of the reporting of the level of support for double precision numbers? 

0 Kudos
VarshaS_Intel
Moderator
4,346 Views

Hi,


We are working on your issue internally. We will get back to you soon.


Thanks & Regards,

Varsha


0 Kudos
AB22
Beginner
4,294 Views

Thank you - I look forward to any feedback you might have as to the cause of this discrepancy.

0 Kudos
Dunni_A_Intel
Moderator
4,240 Views

Hello,


  1. Please set environment variables OverrideDefaultFP64Settings=1 and IGC_EnableDPEmulation=1 to enable double-precision floating point (FP64) emulation. Note that FP64 emulation is only supported on Linux. For more information about FP64 emulation, please see https://github.com/intel/compute-runtime/blob/master/opencl/doc/FAQ.md#feature-double-precision-emulation-fp64.
  2. To check for double-precision floating point support, check whether the device supports cl_kht_fp64 extension. For instance, you will observe that your test will include cl_khr_fp64 as a supported extension on Iris Xe Max after the variables in 1 above are set. clinfo uses the same mechanism to report device floating point support.
  3. Given that double precision is not supported natively on Iris Xe Max, I agree that CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE should return 0 especially if the FP64 environment variables are not set. I have filed an issue for this.


I hope this answers your questions.


0 Kudos
Reply