Vectorization examples

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 20 13:09:30 PDT 2015


Walter Bright:

> Use arrays of double2, float4, int4, etc., declared in 
> core.simd. Those will be aligned appropriately.

Is the GC able to give memory aligned to 32 bytes for new 
architectures with 512 bits wide SIMD?


>> and a way to tell
>> the type system that some array slices are fully distinct (the 
>> __restrict seen
>> here, I think this information doesn't need to be part of a 
>> type).
>
> A runtime test is sufficient.

One of the points of having a type system is to rule out certain 
classes of bugs caused by programmers. The compiler could use the 
type system to add those runtime tests where needed. And even 
better sometimes is to avoid the time used by run time tests, as 
shown in that video, using the static information inserted in the 
code (he shows assembly code that contains run time tests).

Another example of missing static information in D is shown near 
the end of the video, where he shows an annotation to compile 
functions for different CPUs, where the compiler updates function 
pointers inside the binary according to the CPU you are using, 
making the code safe and efficient.

Bye,
bearophile


More information about the Digitalmars-d mailing list