public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/96476] New: [Request] expose preferred vector width to preprocessor
@ 2020-08-05  3:45 evan@coeus-group.com
  2020-08-05  7:33 ` [Bug target/96476] " crazylht at gmail dot com
  2020-08-05  8:06 ` [Bug c/96476] " rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: evan@coeus-group.com @ 2020-08-05  3:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96476

            Bug ID: 96476
           Summary: [Request] expose preferred vector width to
                    preprocessor
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: evan@coeus-group.com
  Target Milestone: ---

It would be nice if the value passed to -mprefer-vector-width=* were exposed to
the preprocessor.  Something like `#define __PREFERRED_VECTOR_WIDTH 256` when
-mprefer-vector-width=256 is passed.

I'd be really happy if it was always present when vectorization is enabled
(i.e., 128 with SSE, 256 with AVX), but satisfied if it were only defined when
-mprefer-vector-width is specified.

I'm filing this under the "target" component since -mprefer-vector-width is
x86-specific according to the manual, but it seems like it could be useful
elsewhere, too.

My use case is a bit niche; I'd like to use it in SIMD Everywhere
(<https://github.com/simd-everywhere/simde>) to limit the vector size even when
you call "larger" functions.  For example, simde_mm512_add_ps would be
implemented with two calls to simde_mm256_add_ps with -mprefer-vector-width=256
even if AVX-512F support is enabled.

That said, I think this could be useful for any code which mixes
auto-vectorization with intrinsics.

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

* [Bug target/96476] [Request] expose preferred vector width to preprocessor
  2020-08-05  3:45 [Bug target/96476] New: [Request] expose preferred vector width to preprocessor evan@coeus-group.com
@ 2020-08-05  7:33 ` crazylht at gmail dot com
  2020-08-05  8:06 ` [Bug c/96476] " rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: crazylht at gmail dot com @ 2020-08-05  7:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96476

Hongtao.liu <crazylht at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crazylht at gmail dot com

--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
TARGET_CPU_CPP_BUILTINS?
It says 
---
This function-like macro expands to a block of code that defines built-in
preproces-
sor macros and assertions for the target CPU, using the functions
builtin_define,
builtin_define_std and builtin_assert. When the front end calls this macro it
provides a trailing semicolon, and since it has finished command line option
processing
your code can use those results freely.
----

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

* [Bug c/96476] [Request] expose preferred vector width to preprocessor
  2020-08-05  3:45 [Bug target/96476] New: [Request] expose preferred vector width to preprocessor evan@coeus-group.com
  2020-08-05  7:33 ` [Bug target/96476] " crazylht at gmail dot com
@ 2020-08-05  8:06 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-05  8:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96476

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |c
             Target|                            |x86_64-*-* i?86-*-*
           Severity|normal                      |enhancement

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Requestor wants it not for inside GCC but for inside a library.  But I, too,
think it should be general (if at all), not target specific.  We could
seed it from largest integer/float vector-mode that has an add optab for
example
if the target does not override it.

Note the distinction between FP and int makes it a bit awkward if you think
about AVX vs. AVX2 for example.  But then so is -mpreferred-vector-with
in that case.

FEs need to expose extra "generic" macros, so adjusting component accordingly.

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

end of thread, other threads:[~2020-08-05  8:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05  3:45 [Bug target/96476] New: [Request] expose preferred vector width to preprocessor evan@coeus-group.com
2020-08-05  7:33 ` [Bug target/96476] " crazylht at gmail dot com
2020-08-05  8:06 ` [Bug c/96476] " rguenth 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).