Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Auto-vectorization

Name: Anonymous 2007-02-03 23:05

So I decided to mess around with the auto-vectorization in gcc and I must say, it sucks balls. I certainly didn't expect it to generate decent code, but I kinda expected to, you know, vectorize easily vectorizable loops? Like

for(i=0; i<512; i++)
    samples[i] *= window[i];

Seriously, it doesn't get much simpler than this. And gcc leaves it as scalar. So, /prog/, is auto-vectorization good for anything now other than marketing fodder?

Name: Anonymous 2007-02-03 23:34

>>1
If it didn't vectorize that, you fucked something up.

Name: Anonymous 2007-02-04 1:42

>>2
It looks like gcc will happily vectorize the loop when it's

for(i=0; i<512; i++)
    samples[i] = window[i] * 2;

Is there some good reason why gcc can't vectorize it when samples[i] is on both the left and right of the assignment?

Name: Anonymous 2007-02-04 2:52

What the fuck is vectorization?

Name: Anonymous 2007-02-04 3:59

>>4
Making the compiler unroll your loops into SSE instructions.

Name: Anonymous 2007-02-04 5:42

>>1-5
VROOM VROOM CFLAGS JUST KICKED IN YO

Real men run with -O0 and enjoy their rock-solid binaries.

Name: Anonymous 2007-02-04 5:57

Thanks to Cs pointer arithmetic, vectorization is pretty hard. Use Ocaml instead.

Name: Anonymous 2007-02-04 13:37

>>5
Altivec too, if you're on PPC like me.

>>7
I haven't used Ocaml before, but from my googling, I've only found stuff that indicates that Ocaml doesn't do any vectorization. Do you have any links to show it does?

Rewriting the library to Ocaml isn't really feasible though, I was only really interested in auto-vectorization because I found that writing a bunch of simple loops like the one in >>1 in Altivec resulted in a 20% speed gain (more including some complex loops that I wouldn't expect any compiler to vectorize well), so I figured that if gcc could vectorize them, I'd have most of the speed gain without cluttering the source with both SSE and Altivec code for each simple loop. But if I have to spend a ton of time coaxing the C code into a form that gcc will recognize as vectorizable, I might as well just write the vector code myself.

Name: Anonymous 2007-02-04 16:28

>>8
ocaml is a language, it doesn't do anything moron, its implementation does vectorization or not, noob

Name: Anonymous 2007-02-04 16:43

>>9
C is a language, it doesn't do anything moron, its implementation does vectorization or not, noob

Name: Anonymous 2007-02-04 17:00

>>10
Ugh, you tard.

Name: Anonymous 2007-02-04 17:22

Same to you, >>11

Telling someone to use Ocaml instead of GCC because of autovectorization, when the only Ocaml compiler out there doesn't do such a thing, is pretty fucking stupid.

Oh, I'm sorry, the semantics will automagically make it happen right now.

Name: Anonymous 2007-02-05 9:19

Ocaml fap fap fap Ocaml

Name: Anonymous 2007-02-05 15:16

>>11
ugh what? no examples? so I won then? well, gtfo if I won.

Name: Anonymous 2007-02-05 15:49

Name: Anonymous 2007-02-06 0:50

You need to use "restrict" pointers in C (C99, to be precise) to get any autovectorization. Like this:

    void shit_sucks(float * restrict result, const float * restrict source)
    {
        for(int i=0; i<32; i++) result[i] *= source[i];
    }

But really, profile first. "-ftree-vectorizer-verbose=5" is your friend, too. If after that you're still hurting for speed, use SSE intrinsics or the altivec vec_blah() etc. functions and fucking re-do your shit. It's not really all that hard.

Name: Anonymous 2007-02-06 3:00

>>16
we have winnar

Name: Anonymous 2010-11-15 20:04

Name: Anonymous 2012-03-23 23:37

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

Name: Sgt.Kabu퇷더kimanꕈ撌 2012-05-28 22:17

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Name: Anonymous 2013-04-19 16:46

>>4
But C++11 has lambdas!
YA AINT RED DA FUKKIN STANDARD!

Don't change these.
Name: Email:
Entire Thread Thread List