I see, so the same doesn't apply to read only workflow though right?

private static int dot(int[] heap, int n, int a, int b) {
    var sum = 0;
    for (var ii = 0; ii < n; ++ii) {
         sum += heap[a + ii] * heap[b + ii];
    }
    return sum;
}

And one last question.

Can VarHandle byte array usage vectorize yet?

It seems to me it might be fastest to do something like:

private static void mul(byte[] heap, int n, int accum, int src) {
        int[] newSrc = copyToTempIntBuf(heap, src, n);
        int[] newAccum = copyToTempIntBuf(heap, accum, n);
        // c2 needs same indices to vectorise
        for (var ii = 0; ii < n; ++ii) {
                newAccum[ii] *= newSrc[ii];
        }
        freeTempBuf(newSrc);
        copyBack(heap, newAccum, n);
        freeTempBuf(newAccum);
}


But that is extremely circumlocutious and I doubt you can efficiently copy 
between byte arrays and int arrays without Unsafe anyway (even using byte 
array varhandles.)

-- 
You received this message because you are subscribed to the Google Groups 
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to