Re: size value of vector_size attribute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm not the asked, but I would strongly prefer m256 if code could be
generated masking the unused lane for safe loads/stores, at least on
architectures where this is efficient (eg, Skylake-X).
This automatic masking would make writing SIMD code easier when you don't
have powers of 2, by saving the effort of passing the bitmask to each
operation (which is at least an option with intrimin.h, not sure about
GCC's built-in).

However, if the asker doesn't want this for SIMD code, but wants a
convenient vector to index for scalar code, I'd recommend defining your own
class. Indexing SIMD vectors is inefficient, and it may interfere with
optimizations like SROA. But I could be wrong; my experience is mostly with
Julia which uses LLVM. GCC may do better.

On Mon, Dec 16, 2019, 02:19 Marc Glisse <marc.glisse@xxxxxxxx wrote:

> On Mon, 16 Dec 2019, Xi Ruoyao wrote:
>
> > Is there any reason to enforce "x must be a power of 2" in
> > __attribute__((vector_size(x)))?
> >
> > I want to use this attribute in my source code to simplify coding
> > (instead of utilizing SIMD instructions, normally).  Someone may argue
> > that I should use std::valarray but it is stupidly slow.  Now with this
> > restriction on size value I may have to write something like
> > std::valarray but w/o dynamic allocation.
>
> See PR53024. One main reason is that supporting it would be some work, for
> not enough demand. Also, it can be done in user code, compiler support is
> not necessary (it would be convenient though). Even lowering an
> unsupported power of 2 to a set of smaller vectors still generates pretty
> bad code IIRC.
>
> By the way, for 3 double on x86, would you prefer __m128d+double, or
> __m256d with one slot ignored?
>
> --
> Marc Glisse
>



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux