Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 9 Jun 2013 02:35:57 +0200
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
Subject: Re: sha3-opencl

On 9 Jun, 2013, at 0:07 , Lukas Odzioba <lukas.odzioba@...il.com> wrote:
> 2) We can add #pragma unroll N where N is constant, for example:
> // keccak::get()
> #pragma unroll 32
> for (i = 0; i < 32; ++i) {
> We're not getting any c/s improvement by doing this (now), but for
> purity it is good to do that and do not care later.

I have yet to see a case where such trivial loops are not unrolled anyway. I prefer trusting the optimizer and just experiment with #pragma unroll in specific cases. And in some of these cases, I have seen regression from using pragma unroll (so the optimizer did right when not unrolling).

However if N is *not* constant but you know it's always a multiple of, say, 4, this might be a good idea:

#pragma unroll 4
for (i = 0; i < length; ++i) {
...

But personally I use to unroll manually in these cases.

magnum

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.