[PATCH] D51341: [HEADER] Overloadable function candidates for half/double types

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 16 06:11:57 PST 2018


yaxunl added a comment.

In https://reviews.llvm.org/D51341#1301047, @sidorovd wrote:

> @Anastasia @yaxunl 
>  Hi, I am working on generalizing this patch and several questions have raised during this, so I want to discuss them with you:
>
> 1. Should #pragma OPENCL EXTENSION ext_name : begin enables the extension as well? For now I see it's not, as an example:
>
>   ``` #pragma OPENCL EXTENSION cl_khr_fp16 : enable half __attribute__((overloadable)) goo(half in1, half in2); // all ok #pragma OPENCL EXTENSION cl_khr_fp16 : disable
>
>   #pragma OPENCL EXTENSION cl_khr_fp16 : begin half __attribute__((overloadable)) goo(half in1, half in2); // declaring function parameter of type 'half' is not allowed; did you forget * ? #pragma OPENCL EXTENSION cl_khr_fp16 : end ```


#pragma OPENCL EXTENSION ext_name : begin should not enable the extension. There are cases that you want to declare functions and types associated with an extension but do not want to enable the extension.

> 2. As far as I understand, when declaring an extension we shall have 1 #pragma begin and 1 #pragma end. But here is a test called extension-begin and in its header one can see this construction:
> 
>   ``` #pragma OPENCL EXTENSION all : begin #pragma OPENCL EXTENSION all : end
> 
>   #pragma OPENCL EXTENSION my_ext : begin ///some code #pragma OPENCL EXTENSION my_ext : end #pragma OPENCL EXTENSION my_ext : end // why? } ``` so here my_ext has double ending. And in this way the test passes, but if I remove second ending (which is redundant from my perspective), I see following diagnostics: " OpenCL extension end directive mismatches begin directive - ignoring". Is it a bug or it's supposed to work that way?

It seems to be a bug.


https://reviews.llvm.org/D51341





More information about the cfe-commits mailing list