public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/55457] New: Having some predefined macros to get more information about gcc vector extensions capabilities would be nice
@ 2012-11-24 16:13 siarhei.siamashka at gmail dot com
  2012-12-09  1:39 ` [Bug c/55457] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: siarhei.siamashka at gmail dot com @ 2012-11-24 16:13 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55457

             Bug #: 55457
           Summary: Having some predefined macros to get more information
                    about gcc vector extensions capabilities would be nice
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: siarhei.siamashka@gmail.com


One practical problem is how to identify whether vector extensions are
beneficial or a fallback to the standard C code is better to be taken. In the
case of OpenCL, there are param values such as
CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT,
etc.

   
http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clGetDeviceInfo.html

If gcc could have some sort of predefined macro telling that "preferred vector
width is 1", it could be used in the code to avoid getting performance penalty
by just using normal C code when compiling for non-SIMD capable platforms.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/55457] Having some predefined macros to get more information about gcc vector extensions capabilities would be nice
  2012-11-24 16:13 [Bug c/55457] New: Having some predefined macros to get more information about gcc vector extensions capabilities would be nice siarhei.siamashka at gmail dot com
@ 2012-12-09  1:39 ` pinskia at gcc dot gnu.org
  2012-12-09  2:33 ` siarhei.siamashka at gmail dot com
  2012-12-09 23:03 ` hp at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-12-09  1:39 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55457

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-12-09 01:39:39 UTC ---
The whole point of the gcc vector extensions is that you don't need to depend
on what the hardware can do under neath as it should produce good code in
either case.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/55457] Having some predefined macros to get more information about gcc vector extensions capabilities would be nice
  2012-11-24 16:13 [Bug c/55457] New: Having some predefined macros to get more information about gcc vector extensions capabilities would be nice siarhei.siamashka at gmail dot com
  2012-12-09  1:39 ` [Bug c/55457] " pinskia at gcc dot gnu.org
@ 2012-12-09  2:33 ` siarhei.siamashka at gmail dot com
  2012-12-09 23:03 ` hp at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: siarhei.siamashka at gmail dot com @ 2012-12-09  2:33 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55457

--- Comment #2 from Siarhei Siamashka <siarhei.siamashka at gmail dot com> 2012-12-09 02:33:24 UTC ---
(In reply to comment #1)
> The whole point of the gcc vector extensions is that you don't need to depend
> on what the hardware can do under neath as it should produce good code in
> either case.

I think that you are a bit too idealistic and overlooking some practical
implications:
1. GCC just does not generate really good code with vector extensions when
there is no real SIMD backend.
2. There may be some high level algorithmic optimizations possible. For
example, branches to skip calculations for some special cases. We really want
to have these branches in scalar code, while SIMD can sacrifice the branches
and gain a lot more performance from parallel processing.

So right now GCC is forcing me and the other users to infest the code with
ifdefs checking for __x86__, __amd64__, __arm__, __powerpc__, __SSE2__,
__ALTIVEC__, __ARM_NEON__, etc. to disable the use of vector extensions when
there is actually no real SIMD. It kinda defeats the purpose, because turns out
that I need to know about the existence of all the CPU architectures supported
by GCC and their SIMD implementations before I can expect that the code will
work reasonably fast everywhere.

Relying just on GCC vector extensions means non-portable code, which will not
work with the other compilers. So in any case, everyone is likely to already
have an alternative implementation written in standard C. Having two
alternative implementations to select from, we want to be able to make a
reasonably good guess about which implementation is going to be preferable for
this particular build.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/55457] Having some predefined macros to get more information about gcc vector extensions capabilities would be nice
  2012-11-24 16:13 [Bug c/55457] New: Having some predefined macros to get more information about gcc vector extensions capabilities would be nice siarhei.siamashka at gmail dot com
  2012-12-09  1:39 ` [Bug c/55457] " pinskia at gcc dot gnu.org
  2012-12-09  2:33 ` siarhei.siamashka at gmail dot com
@ 2012-12-09 23:03 ` hp at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: hp at gcc dot gnu.org @ 2012-12-09 23:03 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55457

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-12-09
     Ever Confirmed|0                           |1

--- Comment #3 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2012-12-09 23:03:34 UTC ---
I agree with the poster, mostly, but note that a set of macros stating native
SIMD vector sizes or "preferred size", still says nothing about what operations
are supported natively as SIMD.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-09 23:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-24 16:13 [Bug c/55457] New: Having some predefined macros to get more information about gcc vector extensions capabilities would be nice siarhei.siamashka at gmail dot com
2012-12-09  1:39 ` [Bug c/55457] " pinskia at gcc dot gnu.org
2012-12-09  2:33 ` siarhei.siamashka at gmail dot com
2012-12-09 23:03 ` hp at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).