xmrig / xmrig-amd

Monero AMD (OpenCL) miner
GNU General Public License v3.0
412 stars 226 forks source link

GCN optimized code for RandomX #270

Closed SChernykh closed 4 years ago

SChernykh commented 4 years ago

Optimized code works only on Vega and Polaris GPUs with Adrenaline drivers (Windows) or amdgpu-pro drivers (Linux). Vega 64 (1700/1100 MHz) does 1283 h/s on rx/test, 1296 h/s on rx/wow, 1124 h/s on rx/loki.

Bathmat commented 4 years ago

Tested and working on Polaris (RX470/570/480/580) in Win10. Core/Mem: 1200/2000 Hashrate: rx/loki: 350-390 h/s. rx/wow: 420-450 h/s

Used 1 thread per gpu. Tried various intensities to get the best result. More testing to follow.

SChernykh commented 4 years ago

@Bathmat there is a bug with 2 threads per GPU in this pull request - it allocates dataset 2 times, that's why it doesn't work on 4 GB GPUs and works poorly on 8 GB GPUs. I'll fix it soon.

Bathmat commented 4 years ago

@Bathmat there is a bug with 2 threads per GPU in this pull request - it allocates dataset 2 times, that's why it doesn't work on 4 GB GPUs and works poorly on 8 GB GPUs. I'll fix it soon.

That would explain why it was crashing when I tried 2 threads. Thanks. I just thought it was RandomX design to not be able to use 2 threads.

SChernykh commented 4 years ago

@Bathmat can you try https://github.com/xmrig/xmrig-amd/pull/271 with 2 threads per GPU? Try to find the best intensity, it's not always the highest possible.

Bathmat commented 4 years ago

Dual thread working now. Approx 7-8% boost in hashrate for rx/loki, 15-20% boost for rx/wow. rx/loki: 410-474 h/s rx/wow: 474-544 h/s

I just took the intensities I was using for single thread and halved them. So for rx/loki, I was using 768 for 470/570 and 864 for 480. For rx/wow, I was using double rx/loki, i.e., 1536 for 470/570 and 1728 for 480.

Anything over 832 total intensity would crash/very poor hashrate for 470/570 on rx/loki. Driver: 19.5.2

Bathmat commented 4 years ago

rx/loki

[2019-08-15 19:36:23] #00, GPU #00 Radeon RX 570 Series (Ellesmere), i:384 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:36:23]              0.75/3.75/4 GB
[2019-08-15 19:36:23] #01, GPU #00 Radeon RX 570 Series (Ellesmere), i:384 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:36:23]              0.75/3.75/4 GB
[2019-08-15 19:36:23] #02, GPU #01 Radeon (TM) RX 470 Graphics (Ellesmere), i:384 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:36:23]              0.75/3.75/4 GB
[2019-08-15 19:36:23] #03, GPU #01 Radeon (TM) RX 470 Graphics (Ellesmere), i:384 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:36:23]              0.75/3.75/4 GB
[2019-08-15 19:36:23] #04, GPU #02 Radeon (TM) RX 470 Graphics (Ellesmere), i:384 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:36:23]              0.75/3.75/4 GB
[2019-08-15 19:36:23] #05, GPU #02 Radeon (TM) RX 470 Graphics (Ellesmere), i:384 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:36:23]              0.75/3.75/4 GB
[2019-08-15 19:36:24] #06, GPU #03 Radeon (TM) RX 480 Graphics (Ellesmere), i:432 (8/256), si:1/2, u:8, cu:36
[2019-08-15 19:36:24]              0.84/3.75/4 GB
[2019-08-15 19:36:24] #07, GPU #03 Radeon (TM) RX 480 Graphics (Ellesmere), i:432 (8/256), si:1/2, u:8, cu:36
[2019-08-15 19:36:24]              0.84/3.75/4 GB
| THREAD | GPU | 10s H/s | 60s H/s | 15m H/s |
|      0 |   0 |   210.7 |     n/a |     n/a |
|      1 |   0 |   210.6 |     n/a |     n/a |
|      2 |   1 |   205.3 |     n/a |     n/a |
|      3 |   1 |   205.0 |     n/a |     n/a |
|      4 |   2 |   211.8 |     n/a |     n/a |
|      5 |   2 |   211.9 |     n/a |     n/a |
|      6 |   3 |   237.5 |     n/a |     n/a |
|      7 |   3 |   237.5 |     n/a |     n/a |
[2019-08-15 19:37:02] speed 10s/60s/15m 1730.3 n/a n/a H/s max 1722.6 H/s
Bathmat commented 4 years ago

rx/wow

[2019-08-15 19:41:36] #00, GPU #00 Radeon RX 570 Series (Ellesmere), i:768 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:41:36]              1.50/3.75/4 GB
[2019-08-15 19:41:36] #01, GPU #00 Radeon RX 570 Series (Ellesmere), i:768 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:41:36]              1.50/3.75/4 GB
[2019-08-15 19:41:36] #02, GPU #01 Radeon (TM) RX 470 Graphics (Ellesmere), i:768 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:41:36]              1.50/3.75/4 GB
[2019-08-15 19:41:37] #03, GPU #01 Radeon (TM) RX 470 Graphics (Ellesmere), i:768 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:41:37]              1.50/3.75/4 GB
[2019-08-15 19:41:37] #04, GPU #02 Radeon (TM) RX 470 Graphics (Ellesmere), i:768 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:41:37]              1.50/3.75/4 GB
[2019-08-15 19:41:37] #05, GPU #02 Radeon (TM) RX 470 Graphics (Ellesmere), i:768 (8/256), si:1/2, u:8, cu:32
[2019-08-15 19:41:37]              1.50/3.75/4 GB
[2019-08-15 19:41:37] #06, GPU #03 Radeon (TM) RX 480 Graphics (Ellesmere), i:864 (8/256), si:1/2, u:8, cu:36
[2019-08-15 19:41:37]              1.69/3.75/4 GB
[2019-08-15 19:41:37] #07, GPU #03 Radeon (TM) RX 480 Graphics (Ellesmere), i:864 (8/256), si:1/2, u:8, cu:36
[2019-08-15 19:41:37]              1.69/3.75/4 GB
| THREAD | GPU | 10s H/s | 60s H/s | 15m H/s |
|      0 |   0 |   242.6 |     n/a |     n/a |
|      1 |   0 |   242.4 |     n/a |     n/a |
|      2 |   1 |   237.1 |     n/a |     n/a |
|      3 |   1 |   236.7 |     n/a |     n/a |
|      4 |   2 |   243.7 |     n/a |     n/a |
|      5 |   2 |   244.8 |     n/a |     n/a |
|      6 |   3 |   271.7 |     n/a |     n/a |
|      7 |   3 |   272.2 |     n/a |     n/a |
[2019-08-15 19:42:33] speed 10s/60s/15m 1991.3 n/a n/a H/s max 1992.7 H/s