JayDDee / cpuminer-opt

Optimized multi algo CPU miner
Other
775 stars 545 forks source link

AVX-512 Argon2d Not Recognized on 7820x #128

Closed JimCook57 closed 6 years ago

JimCook57 commented 6 years ago

I realized you haven't tested avx512 for argon2d yet. Just wanted to let you know that it isn't being recognized on a 7820x.

     **********  cpuminer-opt 3.8.6.1  *********** 
 A CPU miner with multi algo support and optimized for CPUs
 with AES_NI and AVX2 and SHA extensions.
 BTC donation address: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT

CPU: Intel(R) Core(TM) i7-7820X CPU @ 3.60GHz. SW built on Apr 7 2018 with GCC 5.4.0. CPU features: SSE2 AES SSE4.2 AVX AVX2. SW features: SSE2 AES SSE4.2 AVX AVX2. Algo features: SSE2 AVX2. Start mining with AVX2.

[2018-04-07 09:23:12] Starting Stratum on stratum+tcp://beastpool.com:4334 [2018-04-07 09:23:12] 16 miner threads started, using 'argon2d-crds' algorithm.

JayDDee commented 6 years ago

Thanks for reporting, It isn't listed because it isn't officialy supported yet.

The main questions are does it run correctly and what is the hashrate compared to a core-avx2 build and compared to the beastpool fork.

JayDDee commented 6 years ago

Here's a detailed test plan to confirm AVX512:

Goals: confirm AVX512 compiles, confirm AVX512 submits valid shares, compare performance between AVX2 & AVX512, confirm compile with AVX512 using native arch, confirm skylake-avx512 arch works.

  1. Compile with "-march=core-avx2" to get a baseline for AVX2 performance.

  2. Compile with "-march=core-avx2 -mavx512f". Comfirm successful compilation and do a speed test to get AVX512 baseline.

  3. Compile with "-march=native" and do a speed test to confirm native includes AVX512.

  4. Compile with "-march=slylake-avx512". Confirm successful compilation and do a speed test.

JimCook57 commented 6 years ago

Ok, here are some benchmarks for the 7820x:

3.8.6 = 60 kH/s 3.8.6.1 = 101 kH/s beastpool avx512f = 93 kH/s

So it looks good I think.

And I also got a nice bump going from 3.8.6 to 3.8.6.1 on a 64 core opteron 6380 system SSE2 going from 156 kH/s to 177 kH/s. Nice... and thank you!

An 8700K AVX2 went from 55kH/s (3.8.6) to 76kH/s (3.8.6.1).

I am happy to do your various compile testing if you want. Just want to confirm the commands to do so. For example would it be, for example for test case #4:

./configure CFLAGS="-march=slylake-avx512" ./build.sh

JayDDee commented 6 years ago

That's excellent. I expected a little better than beastpool but he deserves most of the credit.

If you run build.sh it will always build using -march=native. If you want to specify a particular arch just run make after ./configure: Essentailly you'd be running the same commands as build.sh does just changing the -march argument:

make clean CFLAGS="-O3 -march=skylake-avx512 -Wall" ./configure --with-curl make

Assuming your previous testing used build.sh, ie native, it looks like the compiler is detecting the correct architecture. It's not really necessary to test skylake-avx512.

I'm convinced AVX512 is working, and that gcc 5.4 supports it. I'll work now to report AVX512 as a feature, but it will only be supported for these algos for now. I'm desperately waiting for Cannonlake, Skylake-X is way too expensive for me.

Thank you very much for your testing, I look forward to being able to do my own AVX512 testing.

JayDDee commented 6 years ago

AVX512 should be reported in v3.8.7. Please test and close issue if everything is ok.

JimCook57 commented 6 years ago

Works great!

     **********  cpuminer-opt 3.8.7  *********** 
 A CPU miner with multi algo support and optimized for CPUs
 with AES_NI and AVX2 and SHA extensions.
 BTC donation address: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT

CPU: Intel(R) Core(TM) i7-7820X CPU @ 3.60GHz. SW built on Apr 9 2018 with GCC 5.4.0. CPU features: SSE2 AES SSE4.2 AVX2 AVX512. SW features: SSE2 AES SSE4.2 AVX2 AVX512. Algo features: SSE2 AVX2 AVX512. Start mining with AVX512.

[2018-04-09 22:42:06] Starting Stratum on stratum+tcp://beastpool.com:4335 [2018-04-09 22:42:06] 16 miner threads started, using 'argon2d500' algorithm.

Aliases are not recognized:

     **********  cpuminer-opt 3.8.7  *********** 
 A CPU miner with multi algo support and optimized for CPUs
 with AES_NI and AVX2 and SHA extensions.
 BTC donation address: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT

[2018-04-09 22:40:30] Unknown algo: argon2d-dyn

     **********  cpuminer-opt 3.8.7  *********** 
 A CPU miner with multi algo support and optimized for CPUs
 with AES_NI and AVX2 and SHA extensions.
 BTC donation address: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT

[2018-04-09 22:45:41] Unknown algo: argon2d-crds

JayDDee commented 6 years ago

Thanks. I can reproduce the unknown algo error but can't find an obvious problem with the aliases. Other aliases are working fine. If I can't figure it out I'll go back to the coin-based naming.

JayDDee commented 6 years ago

Aliases are fixed in 3.8.7.1.

JayDDee commented 6 years ago

CRDS works for me. I made the same change to both CRDS and DYN which should have had no effect on either. I don't have a DYN address but if you're willing to provide one I can test with it.

JimCook57 commented 6 years ago

I am sorry I was posting in the wrong issue. Don't know how I did that.

CRDS works for me too. Here is my DYN command issue.

./cpuminer -a argon2d-dyn -o stratum+tcp://beastpool.com:4335 -u DCeDPH7xVWcc4atB6m6ddZK38sjoQiicgP -p c=DYN -q

JayDDee commented 6 years ago

Confirmed, works in 3.8.7, broken in 3.8.7.1. I'll have to redo the changes one step at a time but it's getting late, it'll have to wait till tomorrow.

JimCook57 commented 6 years ago

No worries. I can run on 3.8.7

JayDDee commented 6 years ago

I found the problem, it's the crappy way the code handles argon2d version parameter. I was planning to rewrite it anyway, guess I have to now.

JayDDee commented 6 years ago

Everything should work in v3.8.7.2.

JimCook57 commented 6 years ago

Looks great! THANK YOU.