Page MenuHomePhabricator

[OpenCL] Improve diagnostics for double type

Authored by echuraev on Dec 19 2016, 5:14 AM.



Diff Detail

Event Timeline

echuraev updated this revision to Diff 81939.Dec 19 2016, 5:14 AM
echuraev retitled this revision from to [OpenCL] Improve diagnostics for double type.
echuraev updated this object.
echuraev added a reviewer: Anastasia.
echuraev added subscribers: bader, cfe-commits, yaxunl.
yaxunl added inline comments.Dec 19 2016, 7:50 AM

Please update with clang ToT since OpenCLOptions has interface changes.

echuraev updated this revision to Diff 82094.Dec 20 2016, 4:42 AM
echuraev marked an inline comment as done.
Anastasia added inline comments.Dec 23 2016, 5:01 AM

Could this be merged with similar test in test/SemaOpenCL/ instyead of adding a new file?

This diagnostic was added in this commit:
It is something like that: "use of undeclared identifier 'double2'; did you mean 'double'?"
This message isn't clear enough and it is difficult to understand that I forgot to enable cl_khr_fp64 extension. May be it will be better to change this diagnostic message to something like that: "use of type 'double2' (vector of 2 'double' values) requires cl_khr_fp64 extension to be enabled"

echuraev abandoned this revision.Jan 26 2017, 2:14 AM

with the new pragma for associating types with extensions. This feature can be implemented by solely modify opencl-c.h by adding #pragma OPENCL EXTENSION cl_khr_fp64 : begin/end around vector double type definitions, e.g.

#pragma OPENCL EXTENSION cl_khr_fp64 : begin
typedef double double2 __attribute__((ext_vector_type(2)));
typedef double double3 __attribute__((ext_vector_type(3)));
typedef double double4 __attribute__((ext_vector_type(4)));
typedef double double8 __attribute__((ext_vector_type(8)));
typedef double double16 __attribute__((ext_vector_type(16)));
#pragma OPENCL EXTENSION cl_khr_fp64 : end
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable


#pragma OPENCL EXTENSION cl_khr_fp64 : enable

is for suppressing diagnostics due to using double type in builtin functions. Ideally they should also be surrounded by #pragma OPENCL EXTENSION cl_khr_fp64 : begin/end.