Ready for review: new std.uni

Walter Bright newshound2 at digitalmars.com
Sun Jan 13 23:21:58 PST 2013


On 1/13/2013 9:33 PM, David Nadlinger wrote:
> as other backends are gaining things
> like auto-vectorization to light up modern CPUs and ARM is gaining in importance.

I've done some research on auto-vectorization, i.e. "The Software Vectorization 
Handbook" by Bik.

My conclusion (Manu independently came to the same one, he's our resident SIMD 
expert) is that auto-vectorization is a disaster.

What it is is:

1. Reverse engineer a loop into a higher level construct
2. Recompile that construct using vector instructions

It's a disaster because (2) often fails in ways that are utterly mysterious to 
99% of programmers. The failure mode is to not auto-vectorize the loop. Hence, 
the failure is silent and the user just sees poor performance, if he notices it 
at all.

D's intended approach is completely different, and much more straightforward. 
The SIMD types are exposed to the front end, and you build vector operations 
like you would any other arithmetic operation. If a particular vector operation 
is not available for a particular SIMD type, then the compilation fails with an 
appropriate error message.

I.e. D's approach is to fix the language to support vector semantics, rather 
than trying to back-asswards fit it into the optimizer.



More information about the Digitalmars-d mailing list