Very simple SIMD programming

bearophile bearophileHUGS at lycos.com
Wed Oct 24 06:00:36 PDT 2012


Manu:

> D already has what's required to do some fairly nice (by 
> comparison) simd stuff with good supporting libraries.

After reading that paper I am not sure you are right. See how 
their language manages masks by itself. This is from page 3:


// vector length of context = 1; current_mask = T
int block[4] v = <0,3,4,1>;
int block[4] w = 3; // <3,3,3,3> via broadcast
bool block[4] m = v < w; // <T,F,F,T>
++v; // <1,4,5,2>
if (m) {
     // vector length of context = 4; current_mask = m
     v += 2; // <3,4,5,4>
} else {
     // vector length of context = 4; current_mask = ~m
     v += 3; // <3,7,8,4>
}
// vector length of context = 1; current_mask = T


(The simple benchmarks of the paper show a 5-15% performance loss 
compared to handwritten SIMD code.)

Bye,
bearophile


More information about the Digitalmars-d mailing list