Skip to content

Commit

Permalink
Merge pull request xmrig#27 from Spudz76/ocean-master-fixups
Browse files Browse the repository at this point in the history
Cleanup patchset
  • Loading branch information
MoneroOcean authored Jul 14, 2020
2 parents aaaaf5c + c4ff8c4 commit cb67ab4
Show file tree
Hide file tree
Showing 49 changed files with 2,093 additions and 2,236 deletions.
32 changes: 16 additions & 16 deletions cmake/randomx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ if (WITH_RANDOMX)
src/crypto/rx/RxDataset.cpp
src/crypto/rx/RxQueue.cpp
src/crypto/rx/RxVm.cpp
src/crypto/defyx/align.h
src/crypto/defyx/brg_endian.h
src/crypto/defyx/KangarooTwelve.c
src/crypto/defyx/KangarooTwelve.h
src/crypto/defyx/KeccakP-1600-reference.c
src/crypto/defyx/KeccakP-1600-SnP.h
src/crypto/defyx/KeccakSponge-common.h
src/crypto/defyx/KeccakSponge.inc
src/crypto/defyx/KeccakSpongeWidth1600.c
src/crypto/defyx/KeccakSpongeWidth1600.h
src/crypto/defyx/Phases.h
src/crypto/defyx/sha256.c
src/crypto/defyx/sha256.h
src/crypto/defyx/sysendian.h
src/crypto/defyx/yescrypt.h
src/crypto/defyx/yescrypt-best.c
src/crypto/randomx/defyx/align.h
src/crypto/randomx/defyx/brg_endian.h
src/crypto/randomx/defyx/KangarooTwelve.c
src/crypto/randomx/defyx/KangarooTwelve.h
src/crypto/randomx/defyx/KeccakP-1600-reference.c
src/crypto/randomx/defyx/KeccakP-1600-SnP.h
src/crypto/randomx/defyx/KeccakSponge-common.h
src/crypto/randomx/defyx/KeccakSponge.inc
src/crypto/randomx/defyx/KeccakSpongeWidth1600.c
src/crypto/randomx/defyx/KeccakSpongeWidth1600.h
src/crypto/randomx/defyx/Phases.h
src/crypto/randomx/defyx/sha256.c
src/crypto/randomx/defyx/sha256.h
src/crypto/randomx/defyx/sysendian.h
src/crypto/randomx/defyx/yescrypt.h
src/crypto/randomx/defyx/yescrypt-best.c
)

if (CMAKE_C_COMPILER_ID MATCHES MSVC)
Expand Down
18 changes: 9 additions & 9 deletions scripts/generate_cl.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ function cn_r()
}


function cn_gpu()
{
const cn_gpu = opencl_minify(addIncludes('cryptonight_gpu.cl', [ 'wolf-aes.cl', 'keccak.cl' ]));

// fs.writeFileSync('cryptonight_gpu_gen.cl', cn_gpu);
fs.writeFileSync('cryptonight_gpu_cl.h', text2h(cn_gpu, 'xmrig', 'cryptonight_gpu_cl'));
}


function rx()
{
let rx = addIncludes('randomx.cl', [
Expand Down Expand Up @@ -96,6 +87,15 @@ function kawpow()
}


function cn_gpu()
{
const cn_gpu = opencl_minify(addIncludes('cryptonight_gpu.cl', [ 'wolf-aes.cl', 'keccak.cl' ]));

// fs.writeFileSync('cryptonight_gpu_gen.cl', cn_gpu);
fs.writeFileSync('cryptonight_gpu_cl.h', text2h(cn_gpu, 'xmrig', 'cryptonight_gpu_cl'));
}


process.chdir(path.resolve('src/backend/opencl/cl/cn'));

cn();
Expand Down
18 changes: 5 additions & 13 deletions src/backend/cpu/CpuWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ bool xmrig::CpuWorker<N>::selfTest()
verify(Algorithm::CN_XAO, test_output_xao) &&
verify(Algorithm::CN_RTO, test_output_rto) &&
verify(Algorithm::CN_HALF, test_output_half) &&
# ifdef XMRIG_ALGO_CN_GPU
verify(Algorithm::CN_GPU, test_output_gpu) &&
# endif
verify2(Algorithm::CN_R, test_output_r) &&
verify(Algorithm::CN_RWZ, test_output_rwz) &&
verify(Algorithm::CN_ZLS, test_output_zls) &&
verify(Algorithm::CN_CCX, test_output_ccx) &&
# ifdef XMRIG_ALGO_CN_GPU
verify(Algorithm::CN_GPU, test_output_gpu) &&
# endif
verify(Algorithm::CN_DOUBLE, test_output_double);

# ifdef XMRIG_ALGO_CN_GPU
Expand Down Expand Up @@ -254,22 +254,14 @@ void xmrig::CpuWorker<N>::start()

if (first) {
first = false;
if (job.algorithm() == Algorithm::RX_DEFYX) {
defyx_calculate_hash_first(m_vm, tempHash, m_job.blob(), job.size());
} else {
randomx_calculate_hash_first(m_vm, tempHash, m_job.blob(), job.size());
}
randomx_calculate_hash_first(m_vm, tempHash, m_job.blob(), job.size(), job.algorithm());
}

if (!nextRound(m_job)) {
break;
}

if (job.algorithm() == Algorithm::RX_DEFYX) {
defyx_calculate_hash_next(m_vm, tempHash, m_job.blob(), job.size(), m_hash);
} else {
randomx_calculate_hash_next(m_vm, tempHash, m_job.blob(), job.size(), m_hash);
}
randomx_calculate_hash_next(m_vm, tempHash, m_job.blob(), job.size(), m_hash, job.algorithm());
}
else
# endif
Expand Down
12 changes: 6 additions & 6 deletions src/backend/cpu/platform/BasicCpuInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,6 @@ xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint3
return 1;
}

# ifdef XMRIG_ALGO_CN_GPU
if (algorithm == Algorithm::CN_GPU) {
return count;
}
# endif

# ifdef XMRIG_ALGO_CN_LITE
if (algorithm.family() == Algorithm::CN_LITE) {
return CpuThreads(count, 1);
Expand Down Expand Up @@ -278,6 +272,12 @@ xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint3
}
# endif

# ifdef XMRIG_ALGO_CN_GPU
if (algorithm == Algorithm::CN_GPU) {
return count;
}
# endif

return CpuThreads(std::max<size_t>(count / 2, 1), 1);
}

Expand Down
28 changes: 14 additions & 14 deletions src/backend/opencl/OclThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,6 @@ class OclThread
setIntensity(intensity);
}

# ifdef XMRIG_ALGO_CN_GPU
OclThread(uint32_t index, uint32_t intensity, uint32_t worksize, uint32_t threads, uint32_t unrollFactor) :
m_fields(0),
m_threads(threads, -1),
m_index(index),
m_memChunk(0),
m_stridedIndex(0),
m_unrollFactor(unrollFactor),
m_worksize(worksize)
{
setIntensity(intensity);
}
# endif

# ifdef XMRIG_ALGO_RANDOMX
OclThread(uint32_t index, uint32_t intensity, uint32_t worksize, uint32_t threads, bool gcnAsm, bool datasetHost, uint32_t bfactor) :
m_datasetHost(datasetHost),
Expand Down Expand Up @@ -109,6 +95,20 @@ class OclThread
}
# endif

# ifdef XMRIG_ALGO_CN_GPU
OclThread(uint32_t index, uint32_t intensity, uint32_t worksize, uint32_t threads, uint32_t unrollFactor) :
m_fields(0),
m_threads(threads, -1),
m_index(index),
m_memChunk(0),
m_stridedIndex(0),
m_unrollFactor(unrollFactor),
m_worksize(worksize)
{
setIntensity(intensity);
}
# endif

OclThread(const rapidjson::Value &value);

inline bool isAsm() const { return m_gcnAsm; }
Expand Down
14 changes: 8 additions & 6 deletions src/backend/opencl/OclWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,16 @@ xmrig::OclWorker::OclWorker(size_t id, const OclLaunchData &data) :
# endif
break;

case Algorithm::CN_GPU:
default:
# ifdef XMRIG_ALGO_CN_GPU
m_runner = new OclRyoRunner(id, data);
if (m_algorithm == Algorithm::CN_GPU) {
m_runner = new OclRyoRunner(id, data);
}
else
# endif
break;

default:
m_runner = new OclCnRunner(id, data);
{
m_runner = new OclCnRunner(id, data);
}
break;
}

Expand Down
8 changes: 4 additions & 4 deletions src/backend/opencl/cl/OclSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
#include "base/crypto/Algorithm.h"


#ifdef XMRIG_ALGO_CN_GPU
# include "backend/opencl/cl/cn/cryptonight_gpu_cl.h"
#endif

#ifdef XMRIG_ALGO_RANDOMX
# include "backend/opencl/cl/rx/randomx_cl.h"
#endif
Expand All @@ -45,6 +41,10 @@
# include "backend/opencl/cl/kawpow/kawpow_dag_cl.h"
#endif

#ifdef XMRIG_ALGO_CN_GPU
# include "backend/opencl/cl/cn/cryptonight_gpu_cl.h"
#endif


const char *xmrig::OclSource::get(const Algorithm &algorithm)
{
Expand Down
28 changes: 14 additions & 14 deletions src/backend/opencl/cl/cn/algorithm.cl
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@
#define ALGO_CN_RWZ 8
#define ALGO_CN_ZLS 9
#define ALGO_CN_DOUBLE 10
#define ALGO_CN_GPU 11
#define ALGO_CN_LITE_0 12
#define ALGO_CN_LITE_1 13
#define ALGO_CN_HEAVY_0 14
#define ALGO_CN_HEAVY_TUBE 15
#define ALGO_CN_HEAVY_XHV 16
#define ALGO_CN_PICO_0 17
#define ALGO_CN_PICO_TLO 18
#define ALGO_CN_CCX 19
#define ALGO_CN_LITE_0 11
#define ALGO_CN_LITE_1 12
#define ALGO_CN_HEAVY_0 13
#define ALGO_CN_HEAVY_TUBE 14
#define ALGO_CN_HEAVY_XHV 15
#define ALGO_CN_PICO_0 16
#define ALGO_CN_PICO_TLO 17
#define ALGO_CN_CCX 18
#define ALGO_CN_GPU 19
#define ALGO_RX_0 20
#define ALGO_RX_WOW 21
#define ALGO_RX_LOKI 22
#define ALGO_RX_ARQ 23
#define ALGO_RX_SFX 24
#define ALGO_RX_KEVA 25
#define ALGO_RX_DEFYX 26
#define ALGO_AR2_CHUKWA 27
#define ALGO_AR2_WRKZ 28
#define ALGO_ASTROBWT_DERO 29
#define ALGO_KAWPOW_RVN 30
#define ALGO_AR2_CHUKWA 26
#define ALGO_AR2_WRKZ 27
#define ALGO_ASTROBWT_DERO 28
#define ALGO_KAWPOW_RVN 29
#define ALGO_RX_DEFYX 30

#define FAMILY_UNKNOWN 0
#define FAMILY_CN 1
Expand Down
Loading

0 comments on commit cb67ab4

Please sign in to comment.