Skip to content

Commit

Permalink
unify cpu cryptonight implementations
Browse files Browse the repository at this point in the history
xmr-stak has several implementations for multi hash per thread.
The results into 3 intepedent implementations.
Each time the algorithm must be changed the possibility to introduce errors is very large.

- unify the different cryptonight CPU implementations
- simplify the function selection array to find the specilized cryptonight implementation
- add a intermediat pointer to access the large state (similar to the old multi hash implementation)

As side effect this change increases the speed of the single and multi hash algorithm.

my speed changes

now it is fast

human readable
  • Loading branch information
psychocrypt committed Sep 13, 2018
1 parent 23375bb commit bf5db85
Show file tree
Hide file tree
Showing 7 changed files with 357 additions and 1,059 deletions.
2 changes: 1 addition & 1 deletion xmrstak/backend/amd/minethd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void minethd::work_main()

*(uint32_t*)(bWorkBlob + 39) = results[i];

hash_fun(bWorkBlob, oWork.iWorkSize, bResult, cpu_ctx);
hash_fun(bWorkBlob, oWork.iWorkSize, bResult, &cpu_ctx);
if ( (*((uint64_t*)(bResult + 24))) < oWork.iTarget)
executor::inst()->push_event(ex_event(job_result(oWork.sJobID, results[i], bResult, iThreadNo, miner_algo), oWork.iPoolId));
else
Expand Down
2 changes: 1 addition & 1 deletion xmrstak/backend/amd/minethd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class minethd : public iBackend
static bool init_gpus();

private:
typedef void (*cn_hash_fun)(const void*, size_t, void*, cryptonight_ctx*);
typedef void (*cn_hash_fun)(const void*, size_t, void*, cryptonight_ctx**);

minethd(miner_work& pWork, size_t iNo, GpuContext* ctx, const jconf::thd_cfg cfg);

Expand Down
Loading

0 comments on commit bf5db85

Please sign in to comment.