What determines SHA256 performance on different types of hardware?



I know the answers to many questions on here briefly touch on this point, but I'd like to get a consolidated answer that really touches on the key differences between different types of hardware which allows SHA256 to perform better, instead of the less-related tangents other questions discuss. While my immediate concern is with Bitcoin, I know that some other crypto-currencies use different algorithms, so feel free to reference them if it helps make your point.

  • Why does the Bitcoin hash algorithm, SHA256, perform better on different types of hardware? What makes an ASIC/FPGA capable of computing more H/s than a GPU, a GPU than a CPU, etc?

  • What is "the complexity of the cores?" Is this a reference to the number of cores, or to the actual die complexity? In both cases, why is this not a factor in SHA256 performance? Referencing David Perry's answer here:

It's important to note, by the way, that the one thing that won't buy you more hashes per second is the complexity of the cores. This is why Nvidia may make great cards for gaming purposes, but they suck for mining - games make better use of exotic new instructions than SHA256 does.

  • Can SHA256 be optimized at all to perform better on a per-architecture basis? Can any optimizations be made to the double-hashing process?

Adam Ebz

Posted 2013-04-15T20:17:23.553

Reputation: 141



Mining performance can be viewed as consisting of two factors. One is the total resources available. The other is what fraction of those resources you can usefully apply to mining.

ASICs and FPGAs excel at mining because you can effectively use a very high fraction of their available resources for mining. CPUs are terrible at mining because a huge fraction of their resources are useless for mining -- they're optimized for memory access, decision making, floating point math, and many other things that don't help with mining at all.

The "complexity of the cores" refers to how sophisticated the operations that the cores can do are. This doesn't help with mining, which only requires very simple operations, and thus just increases the fraction of the resources available that you can't use for mining.

SHA256 can be heavily optimized for every architecture. In the early days of mining, there was a huge "arms race" to micro-optimize mining for various architectures.

David Schwartz

Posted 2013-04-15T20:17:23.553

Reputation: 48 957


If I may, and this might be a little off but its around the right idea.

Continuing with Mr. Scwartz's answer.

Another major important role in H/s is OpenCL and CUDA. Each provide a means of communication/a protocol between manufacturers so different hardware can interact more readily. So as Schwartz said you need to utilize the computing power (resources) of the chip for it to be useful. OpenCL and CUDA allow software to utilize many different hardware pieces at once. So some of the steps to do mining might be performed on the CPU while others are performed on the GPU. Thanks to OpenCL, you can easily call one function and it will utilize the resources it has avalible. (I am not saying OpenCL has a function doHash() but more of something along the lines of if(elegantWork) useCPU; else if(bruteWork) useGPU;)

Also the computers machine language architecture would play a big role. The ISC (Instruction Set Computer) is a computer with a defined set of instructions its processor can perform. So there are many kinds. RISC, ARM, etc (Idk many of them or much about there differences) But certain ones have instructions that are useful to mining and some have ones that are not. There circuits in some chips that try to guess the future, so if it sees you are gonig to execute a branching statement, it might try to work ahead on each branch and then once it knows it will drop all others and continue on the right branch. Well there might not be a need for that in hashing, so the part of the chip is useless to us if we want to hash.

ASIC's and FPGA's are chips (Integrated Circuits) than are designed specifically for mining. They have circuits only that they need to hash, and a lot of them, and throw out the rest of the regular stuff. Thats why an ASIC is only good for hashing if that's its application (it only "knows" how to hash). FPGA is a Field Programmable Gate Array, it is a bunch of multi purpose gates (circuits) on a chip that can be programmed to do a specific task (like hashing), but it still has some other stuff there that is not useful; the other stuff is there so that it can be general purpose. (People write software so it utilizes resources good, HardwareDescriptionLanguage HDL describes physical circuits and it used to write code that will program FPGA's; So if you get a FPGA and want to mine, you have to find a HDL program that you can use to burn/write the chip with to do the hashing algorithm, then you run software that makes use of the circuits you just wrote to the chip)

So any given chips performance can be determined by, the instructions it can process, how well it can process those instructions, and how efficient it is (if you care). Since there is a myriad of unique problems in the world, that means we try to create a myriad of unique IC's with a myriad of abilities.


Posted 2013-04-15T20:17:23.553

Reputation: 481