[PATCH] D74387: [SYCL] Defer __float128 type usage diagnostics

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 6 11:19:55 PDT 2020


jdoerfert added a comment.

In D74387#1992682 <https://reviews.llvm.org/D74387#1992682>, @Fznamznon wrote:

> Okay, seems like OpenMP needs unsupported types diagnosing as well. I'm trying to adapt this patch for OpenMP, but it doesn't work out of the box because it diagnoses memcpy like operations, so with the current patch the code like this will cause diagnostics:
>
>    struct T {
>      char a;
>      __float128 f;
>      char c;
>      T() : a(12), f(15) {}
>   }
>  
>   #pragma omp declare target
>   T a = T();
>   #pragma omp end declare target
>
>
> It happens because member initialization in the constructor is still usage of `f` field which is marked unavailable because of type. I'm not sure that it is possible to understand how the unavailable declaration is used in the place where diagnostic about usage of unavailable declaration is actually emitted, so I will probably need some other place/solution for it.
>
> @jdoerfert , could you please help to understand how the diagnostic should work for OpenMP cases? Or you probably have some spec/requirements for it?
>  Understanding what exactly is needed will help with the implementation, I guess.


I missed this update, sorry.

I don't think we have a spec wording for this, it is up to the implementations.

In the example, a diagnostic is actually fine (IMHO). You cannot assign 15 to the __float128 on the device. It doesn't work. The following code however should go through without diagnostic:

  struct T {
     char a;
     __float128 f;
     char c;
     T() : a(12), c(15) {}
  }

and it should translate to

  struct T {
     char a;
     alignas(host_float128_alignment) char[16] __unavailable_f;
     char c;
     T() : a(12), c(15) {}
  }

Do you have other questions or examples we should discuss?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74387/new/

https://reviews.llvm.org/D74387





More information about the cfe-commits mailing list