MoneroOcean / xmrig

Monero (rx/0, rx/wow, rx/loki, defyx, rx/arq, rx/sfx, rx/keva, cn/0, cn/1, cn/2, cn/r, cn/fast, cn/half, cn/xao, cn/rto, cn/rwz, cn/zls, cn/double, cn/gpu, cn-lite/0, cn-lite/1, cn-heavy/0, cn-heavy/tube, cn-heavy/xhv, cn-pico, cn-pico/tlo, argon2/chukwa, argon2/wrkz, astrobwt) CPU/GPU miner
https://moneroocean.stream
GNU General Public License v3.0
274 stars 84 forks source link

(Certain) Cryptonight algorithms broken on VAES-supporting CPUs #82

Closed theAeon closed 2 years ago

theAeon commented 2 years ago

Describe the bug XMRig throws "thread #x self-test failed and fails to start mining.

To Reproduce Mine cn/ccx, cn-lite/1, cn, cn/r, cn/2, cn/pico or cn/gpu (possibly others) on a CPPU that supports VAES instructions. (Zen 3, Ice Lake, Tiger Lake, Alder Lake)

Expected behavior It mines.

Required data

Additional context Problem is exclusive to the MO fork. Vanilla xmrig works fine.

EDIT: it should go without saying as vaes isn't implemented until 6.16, but i figured i'd clarify, it works fine in 6.15.3.

trevor-powdrell commented 2 years ago

Describe the bug XMRig throws "thread #x self-test failed and fails to start mining.

To Reproduce Start XMRIG on Zen 3 (AMD Ryzen 5 5600G) on v6.16.1-mo2

Expected behavior It mines

Required data

xmrig.log

theAeon commented 2 years ago

Would like to note that I personally tested this on a 5600x and a 1065G7.

bkuhls commented 2 years ago

Same here (Debian, 5950X, 6.16.1-mo2 as of git rev 3800f67e)

ataa commented 2 years ago

Facing the same issues on 5950X, 5900X and 5600X. Built MO Xmrig from source using MSYS. (3800f67, Windows 10). Cuda seems to be broken as well. reverting back to older version fixed the issue for me.

trevor-powdrell commented 2 years ago

Quick update. Changing config.json in the cpu section "hw-aes": false lets the benchmarking complete and to start running. So this does seem to be related to the hw-aes code.

theAeon commented 2 years ago

Do you have any idea if its invoking the VAES code when AES is off? Theoretically it shouldn't depend on AES proper being enabled. If the performance didn't tank when you disabled AES, that's probably the case.

Means whatever the issue is is probably related to xmrig attempting to run both pathways.

bkuhls commented 2 years ago

Fixed by https://github.com/xmrig/xmrig/pull/2772 ?

theAeon commented 2 years ago

Fixed by xmrig#2772 ?

is that an "is this fixed" or is that a "this is fixed"

bkuhls commented 2 years ago

Fixed by xmrig#2772 ?

is that an "is this fixed" or is that a "this is fixed"

It is an "is this fixed"-question. Cleanly backporting the commit is not possible due to xmrig-mo specific changes so as a user I will wait for the next rebase with https://github.com/xmrig/xmrig/releases/tag/v6.16.2

bkuhls commented 2 years ago

Describe the bug XMRig throws "thread #x self-test failed and fails to start mining.

Still broken with xmrig-mo as of git rev 615715e2152db758747014abe40a5b2d4a74c13e

 * ABOUT        XMRig/6.16.2-mo1 gcc/10.2.1
 * LIBS         libuv/1.40.0 OpenSSL/1.1.1k hwloc/2.4.1
 * HUGE PAGES   supported
 * 1GB PAGES    supported
 * CPU          AMD Ryzen 9 5950X 16-Core Processor (1) 64-bit AES
[...]
[2021-12-02 16:56:59.470]  benchmk   STARTING ALGO PERFORMANCE CALIBRATION (with 10 seconds round) 
[2021-12-02 16:56:59.470]  benchmk   Algo ghostrider Preparation 
[2021-12-02 16:56:59.470]  msr      register values for "ryzen_19h" preset have been set successfully (1 ms)
[2021-12-02 16:57:00.529]  cpu      use profile  ghostrider  (16 threads) scratchpad 2048 KB
[2021-12-02 16:57:00.626]  cpu      GhostRider algo 1: cn/dark (512 KB)
[2021-12-02 16:57:00.626]  cpu      GhostRider algo 2: cn/fast (2 MB)
[2021-12-02 16:57:00.626]  cpu      GhostRider algo 3: cn/turtle (256 KB)
[2021-12-02 16:57:00.654]  cpu      READY threads 32/32 (128) huge pages 100% 128/128 memory 262144 KB (125 ms)
[2021-12-02 16:57:00.828]  benchmk   Algo ghostrider Starting test 
[2021-12-02 16:57:10.880]  benchmk   Algo ghostrider hashrate: 3596.931806 
[2021-12-02 16:57:10.880]  benchmk   Algo cn/r Preparation 
[2021-12-02 16:57:10.912]  cpu      stopped (32 ms)
[2021-12-02 16:57:10.912]  cpu      use profile  cn/2  (32 threads) scratchpad 2048 KB
[2021-12-02 16:57:11.284]  cpu      thread #22 self-test failed
SChernykh commented 2 years ago

It's broken on CN_GPU because of https://github.com/MoneroOcean/xmrig/blob/master/src/crypto/cn/CryptoNight_x86.h#L412 and https://github.com/MoneroOcean/xmrig/blob/master/src/crypto/cn/CryptoNight_x86.h#L419 and other places where props.isHeavy() is used without also checking for CN_GPU.

bkuhls commented 2 years ago

It's broken on CN_GPU

Can confirm that a build with -DWITH_CN_GPU=OFF does not crash anymore.

MoneroOcean commented 2 years ago

@SChernykh v6.16.2-mo2 will hopefully have this fixed.

Can not test this myself, so I would appreciate if it someone will do it here :)

bkuhls commented 2 years ago

@SChernykh v6.16.2-mo2 will hopefully have this fixed.

Can not test this myself, so I would appreciate if it someone will do it here :)

Yes, v6.16.2-mo2 fixes the problem, no cmake options are needed for a working build anymore, thanks!

MoneroOcean commented 2 years ago

Great!