[erlang-questions] Vector instructions

jm <>
Tue Apr 8 08:13:52 CEST 2008


Tony Rogvall wrote:

> 
> This is a more promising start! Today floats are allocated as separate 
> objects so there
> is no way to use SIMD instructions on tuple with floats anyway!!!
> 
> 
> I suggest first to implement the operation(s) you showed, possibly 
> adding alignment support
> to the allocation of the vectors since many SIMD instructions operates 
> best when given 16 bytes aligned
> pointers. Rough code ahead ;-)
> 
> Future binary comprehension could use an updated syntax to handle this 
> in a neat way.
> 
>     [  <<X+Y:32/float>> ||  <<X:32/float>> <- V1 ;  <<Y:32/float>> <- V2 ]
> 
> Note that the expression X+Y must have a special treat and that ; in 
> this comprehension expression means
> "parallel". This would basically be compiled to  vec:add(single, V1, V2).

That works for vectors. How about matricies?

The reason I initially stated vec:add/3 as an example is that this could 
be implemented as a C-port module. Then if this proves successful the 
atomic could be rolled into the VM eventually and the rest moved to a 
normal library. At which point any changes needed to erlang syntax would 
be readily apparent.

Where would you recommend starting? Any good references on parallel 
vector and matrix operations/algorithms?


Jeff.



More information about the erlang-questions mailing list