Skip to content

space convert and codestyle fix - #292

Merged
mrbrdo merged 2 commits into
sgminer-dev:v5_0from
elbandi:v5_0
Jul 3, 2014
Merged

mrbrdo merged 2 commits into
sgminer-dev:v5_0from
elbandi:v5_0

Conversation

@elbandi

@elbandi elbandi commented Jun 27, 2014

Copy link
Copy Markdown
Contributor

First commit convert the indent tabs to spaces.
The second commit fix soem code style:
every hash pieces move to a own {} block, so this looks fine, and hash variables are "local", and cannot conflict each.

Anyway, animecoin and quarkcoin got a little speed tuning.

@mrbrdo

mrbrdo commented Jun 30, 2014

Copy link
Copy Markdown
Contributor

Anyone have something against this?

I didn't understand your comment about animecoin/quarkcoin, are these 2 commits only syntax/indentation changes or also actual logic/code changes?

@elbandi

elbandi commented Jun 30, 2014

Copy link
Copy Markdown
Contributor Author

I you look the quarkhash function, there is something like this pseudo code:

...
// https://github.com/sgminer-dev/sgminer/blob/v5_0/algorithm/quarkcoin.c#L76
if (hash[0] & 0x8)
{
  hash = groestl512(hash);
}
else
{
  hash = skein512(hash);
}
...

If you look into the quark kernel, the pseudo code is:

// https://github.com/sgminer-dev/sgminer/blob/v5_0/kernel/quarkcoin.cl#L207
dec = hash[0] & 0x8
{
   newhash = groestl512(hash);
   // https://github.com/sgminer-dev/sgminer/blob/v5_0/kernel/quarkcoin.cl#L251
   hash = dec ? newhash : hash;
}
{
   newhash = skein512(hash);
   // https://github.com/sgminer-dev/sgminer/blob/v5_0/kernel/quarkcoin.cl#L274
   hash = !dec ? newhash : hash;
}

This basecly good and works, but if dec == 1, skein512 hash is calculated unnecessarily:
the newhash value is dropped (hash = !dec ? newhash : hash)
and same, if dec == 0, groestl512 hash is calculated unnecessarily:
hash = dec ? newhash : hash

I changed the code to the right: skip the skein512 if dec == 1, and skip the groestl512 if dec == 0.

In my test rig, i got +200k to my ~3M hashpower

@mrbrdo

mrbrdo commented Jul 2, 2014

Copy link
Copy Markdown
Contributor

Okay cool. Could you please rebase on latest v5_0, there have been some conflicting changes in darkcoin-mod.cl for example, and since I do not know that code well it is better that you resolve those conflicts.

@mrbrdo mrbrdo added this to the 5.0 milestone Jul 2, 2014
@mrbrdo mrbrdo added kernels and removed kernels labels Jul 2, 2014
mrbrdo added a commit that referenced this pull request Jul 3, 2014
space convert and codestyle fix
@mrbrdo
mrbrdo merged commit e8f1089 into sgminer-dev:v5_0 Jul 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants