memberapp / Membercoin

Membercoin
http://www.bitcoinunlimited.info/download.html
MIT License
1 stars 3 forks source link

Improve Blake 3 performance using compiler flags #1

Open FreeTrade opened 2 years ago

FreeTrade commented 2 years ago

All compiler flags are switched off for lowest common denominator compile. Should be possible to improve mining and validation performance by improving make files to switch on compiler flags where appropriate.

FreeTrade commented 2 years ago

have a look in config.ac - this is the line that switches the flags off -

CFLAGS="$CFLAGS -DBLAKE3_NO_SSE2 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_AVX512"

bitRiderproject commented 2 years ago

Ok removed it and start to compile as for now its ok

bitRiderproject commented 2 years ago

fails all time I think it is related to files inside blake3 folder

FreeTrade commented 2 years ago

Yes, I was only able to get it to compile by putting this kludge in the make file. I'm sure a make file wizard could have this compiling to a single binary with all the optimizations that only kick-in when the required CPU features are available. It's beyond my skills though.

FreeTrade commented 2 years ago

hmmm, i was able to get it to compile by using the

CFLAGS="-march=skylake-avx512"

with CONFIG_SITE=

However the miner crashes running it on different hardware, so i guess this will compile with the optimizations, but will crash on a computer that doesn't have the CPU instructions.

Miners may be able to gain optimizations by compiling it on the machine they are running it with and compiling with CFLAGS="-march=native"

more details on compiling here - looks like each of the files needs to be compiled with different processor switches. https://github.com/BLAKE3-team/BLAKE3/blob/master/c/README.md#x86

FreeTrade commented 2 years ago

Could handle this by either setting make file to compile each blake3 file with the correct compiler option OR compiling the blake3 into a shared library (easy to do), then having the miner use that shared library (couldn't get that to work)

FreeTrade commented 2 years ago

left sse and avx2 flags on. possible additional gains if avx512 switch properly added.