[Bug c/80502] Provide macro to indicate OpenMP SIMD support

2019-05-20 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80502

--- Comment #4 from Eric Gallager  ---
(In reply to Evan Nemerson from comment #3)
> (In reply to Jakub Jelinek from comment #2)
> > _OPENMP_SIMD is a bad idea, that namespace is reserved for OpenMP, so unless
> > it shows up in the OpenMP standard, it shouldn't be added.
> 
> Fair enough, I'll propose it to the OpenMP people:
> http://forum.openmp.org/forum/viewtopic.php?f=23=2031
> 
> > Why do you need a macro?  Just use #pragma omp simd etc. unconditionally,
> > compilers that don't have support for such pragmas will just ignore those.
> 
> Not necessarily; often they'll emit warnings (for GCC, -Wall even includes
> -Wunknown-pragmas). I'd much rather use the preprocessor in my code than
> teach people to disable warnings.
> 

Does Michael Klemm from that discussion have an account here on this bugzilla?

> I need to support alternatives in my code. For example, for SIMDe
> (), I try to support OpenMP SIMD and Cilk
> Plus, as well as compiler-specific pragmas for GCC (GCC ivdep), ICC (simd),
> and clang (clang loop ...), and I'd be happy to add more as necessary. I'd
> rather not end up with something like
> 
>   #pragma omp simd
>   #pragma simd
>   #pragma GCC ivdep
>   #pragma clang loop vectorize(enable)
>   for (...) { ... }
> 
> I'd much rather just have a few macros which will expand to the right pragma
> based on preprocessor macros. Right now I'm stuck using the much less
> expressive ivdep syntax for GCC unless *full* OpenMP support is enabled (or
> someone defines a macro manually to indicate OpenMP SIMD support).

[Bug c/80502] Provide macro to indicate OpenMP SIMD support

2018-02-20 Thread e...@coeus-group.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80502

--- Comment #3 from Evan Nemerson  ---
(In reply to Jakub Jelinek from comment #2)
> _OPENMP_SIMD is a bad idea, that namespace is reserved for OpenMP, so unless
> it shows up in the OpenMP standard, it shouldn't be added.

Fair enough, I'll propose it to the OpenMP people:
http://forum.openmp.org/forum/viewtopic.php?f=23=2031

> Why do you need a macro?  Just use #pragma omp simd etc. unconditionally,
> compilers that don't have support for such pragmas will just ignore those.

Not necessarily; often they'll emit warnings (for GCC, -Wall even includes
-Wunknown-pragmas). I'd much rather use the preprocessor in my code than teach
people to disable warnings.

I need to support alternatives in my code. For example, for SIMDe
(), I try to support OpenMP SIMD and Cilk
Plus, as well as compiler-specific pragmas for GCC (GCC ivdep), ICC (simd), and
clang (clang loop ...), and I'd be happy to add more as necessary. I'd rather
not end up with something like

  #pragma omp simd
  #pragma simd
  #pragma GCC ivdep
  #pragma clang loop vectorize(enable)
  for (...) { ... }

I'd much rather just have a few macros which will expand to the right pragma
based on preprocessor macros. Right now I'm stuck using the much less
expressive ivdep syntax for GCC unless *full* OpenMP support is enabled (or
someone defines a macro manually to indicate OpenMP SIMD support).

[Bug c/80502] Provide macro to indicate OpenMP SIMD support

2017-08-01 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80502

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
_OPENMP_SIMD is a bad idea, that namespace is reserved for OpenMP, so unless it
shows up in the OpenMP standard, it shouldn't be added.
Why do you need a macro?  Just use #pragma omp simd etc. unconditionally,
compilers that don't have support for such pragmas will just ignore those.

[Bug c/80502] Provide macro to indicate OpenMP SIMD support

2017-08-01 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80502

Eric Gallager  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-08-01
 CC||egallager at gcc dot gnu.org
 Ever confirmed|0   |1
   Severity|normal  |enhancement

--- Comment #1 from Eric Gallager  ---
(In reply to Evan Nemerson from comment #0)
> Created attachment 41250 [details]
> define _OPENMP_SIMD when -fopenmp-simd or -fopenmp is passed
> 
> _OPENMP is (correctly) only defined for full OpenMP; when only -fopenmp-simd
> is used there doesn't seem to be any way to detect in the preprocessor that
> the compiler supports OpenMP SIMD pragmas.
> 
> It would be nice if there were a macro to determine whether they are
> supported so we could do something like
> 
>   #if (defined(_OPENMP) && (_OPENMP >= 201307L)) || \
> (defined(_OPENMP_SIMD) && (_OPENMP_SIMD >= 201307L))
>   #pragma omp simd
>   #endif
> 
> AFAIK ICC is the only compiler with a feature like -fopenmp-simd (they call
> it -openmp-simd), and they don't define anything either.  I've reported the
> issue to them, but in the meantime it seems GCC can choose whatever it wants
> without creating any compatibility issues.  Defining _OPENMP_SIMD to the
> version of OpenMP supported (just like _OPENMP does) seems logicial to me. 
> I've attached a fairly trivial patch.

Patches go to the gcc-patches mailing list. Confirming as an enhancement.