Post
Topic
Board CPU/GPU Bitcoin mining hardware
Re: Official DiabloMiner GPU Miner Thread (now with Long Poll and BFI_INT support)
by
DiabloD3
on 22/06/2011, 18:01:15 UTC
I'm having a look at your code because i would like to understand how a miner works.
I have a few questions.
Where i can find how is stored the data contained in the work sent to the miner from the server ?
Also could you explain a little bit in few words what happens in lines of code between 888 and 944?
Here:
Code:
bufferIndex = (bufferIndex == 0) ? 1 : 0;

          workSizeTemp.put(0, workSize);
          currentWork.update(workSizeTemp.get(0) * loops * vectors);

          System.arraycopy(currentWork.midstate, 0, midstate2, 0, 8);

          sharound(midstate2, 0, 1, 2, 3, 4, 5, 6, 7, currentWork.data[16], 0x428A2F98);
          sharound(midstate2, 7, 0, 1, 2, 3, 4, 5, 6, currentWork.data[17], 0x71374491);
          sharound(midstate2, 6, 7, 0, 1, 2, 3, 4, 5, currentWork.data[18], 0xB5C0FBCF);

          int fW0 = currentWork.data[16] + (rot(currentWork.data[17], 7) ^ rot(currentWork.data[17], 18) ^
                    (currentWork.data[17] >>> 3));
          int fW1 = currentWork.data[17] + (rot(currentWork.data[18], 7) ^ rot(currentWork.data[18], 18) ^
                    (currentWork.data[18] >>> 3)) + 0x01100000;
          int fW2 = currentWork.data[18] + (rot(fW0, 17) ^ rot(fW0, 19) ^ (fW0 >>> 10));
          int fW3 = 0x11002000 + (rot(fW1, 17) ^ rot(fW1, 19) ^ (fW1 >>> 10));
          int fW15 = 0x00000280 + (rot(fW0, 7) ^ rot(fW0, 18) ^ (fW0 >>> 3));
          int fW01r = fW0 + (rot(fW1, 7) ^ rot(fW1, 18) ^ (fW1 >>> 3));

          int fcty_e = currentWork.midstate[4] + (rot(midstate2[1], 6) ^ rot(midstate2[1], 11) ^ rot(midstate2[1], 25)) +
                       (midstate2[3] ^ (midstate2[1] & (midstate2[2] ^ midstate2[3]))) + 0xe9b5dba5;
          int fcty_e2 = (rot(midstate2[5], 2) ^ rot(midstate2[5], 13) ^ rot(midstate2[5], 22)) + ((midstate2[5] & midstate2[6]) |
                        (midstate2[7] & (midstate2[5] | midstate2[6])));

          int fcty_e_plus_e2 = fcty_e + fcty_e2;
          int fcty_e_plus_state0 = fcty_e + currentWork.midstate[0];
I also noticed that i get 'Spurious CL_INVALID_KERNEL_ARGS error, ignoring' when running with -d enabled, what could it be ?
Thanks for the patience Cheesy

884 through 903 use shortcuts to do less math in the OpenCL kernel (because the math is the same for all the runs). The rest of 903 through 944 just executes the kernel, checks for errors, and then sets up a blocking buffer read.

As for that warning, it indicates a driver bug. As long as it happens only once in awhile, you're fine.