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

Dmitry Sidorov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 16 05:52:03 PST 2018


sidorovd added a comment.

@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

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 it's 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?


https://reviews.llvm.org/D51341





More information about the cfe-commits mailing list