SIMD benchmark

a a at a.com
Tue Jan 17 18:43:28 PST 2012


On Wednesday, 18 January 2012 at 01:50:00 UTC, Timon Gehr wrote:

> Anyway, I was after a general matrix*matrix multiplication, 
> where the operands can get arbitrarily large and where any 
> potential use of __restrict is rendered unnecessary by array 
> vector ops.

Here you go. But I agree there are use cases for restrict where 
vector operations don't help

void matmul(A,B,C)(A a, B b, C c, size_t n, size_t m, size_t l)
{
    for(size_t i = 0; i < n; i++)
    {
        c[i*l..i*l + l] = 0;
        for(size_t j = 0; j < m; j++)
            c[i*l..i*l + l] += a[i*m + j] * b[j*l..j*l + l];
    }
}




More information about the Digitalmars-d mailing list