Implemented Dataset size increase per epoch

This commit is contained in:
tevador
2019-03-10 23:14:03 +01:00
parent e65d9da66c
commit 2edf05cedc
15 changed files with 157 additions and 163 deletions
+10 -20
View File
@@ -23,8 +23,7 @@ along with RandomX. If not, see<http://www.gnu.org/licenses/>.
namespace RandomX {
template<bool softAes>
LightClientAsyncWorker<softAes>::LightClientAsyncWorker(const Cache* c) : ILightClientAsyncWorker(c), output(nullptr), hasWork(false),
LightClientAsyncWorker::LightClientAsyncWorker(const Cache& c) : ILightClientAsyncWorker(c), output(nullptr), hasWork(false),
#ifdef TRACE
sw(true),
#endif
@@ -32,8 +31,7 @@ namespace RandomX {
}
template<bool softAes>
void LightClientAsyncWorker<softAes>::prepareBlock(addr_t addr) {
void LightClientAsyncWorker::prepareBlock(addr_t addr) {
#ifdef TRACE
std::cout << sw.getElapsed() << ": prepareBlock-enter " << addr / CacheLineSize << std::endl;
#endif
@@ -50,14 +48,13 @@ namespace RandomX {
notifier.notify_one();
}
template<bool softAes>
const uint64_t* LightClientAsyncWorker<softAes>::getBlock(addr_t addr) {
const uint64_t* LightClientAsyncWorker::getBlock(addr_t addr) {
#ifdef TRACE
std::cout << sw.getElapsed() << ": getBlock-enter " << addr / CacheLineSize << std::endl;
#endif
uint32_t currentBlock = addr / CacheLineSize;
if (currentBlock != startBlock || output != currentLine.data()) {
initBlock(cache->getCache(), (uint8_t*)currentLine.data(), currentBlock);
initBlock(cache, (uint8_t*)currentLine.data(), currentBlock);
}
else {
sync();
@@ -68,8 +65,7 @@ namespace RandomX {
return currentLine.data();
}
template<bool softAes>
void LightClientAsyncWorker<softAes>::prepareBlocks(void* out, uint32_t startBlock, uint32_t blockCount) {
void LightClientAsyncWorker::prepareBlocks(void* out, uint32_t startBlock, uint32_t blockCount) {
#ifdef TRACE
std::cout << sw.getElapsed() << ": prepareBlocks-enter " << startBlock << "/" << blockCount << std::endl;
#endif
@@ -83,21 +79,18 @@ namespace RandomX {
}
}
template<bool softAes>
void LightClientAsyncWorker<softAes>::getBlocks(void* out, uint32_t startBlock, uint32_t blockCount) {
void LightClientAsyncWorker::getBlocks(void* out, uint32_t startBlock, uint32_t blockCount) {
for (uint32_t i = 0; i < blockCount; ++i) {
initBlock(cache->getCache(), (uint8_t*)out + CacheLineSize * i, startBlock + i);
initBlock(cache, (uint8_t*)out + CacheLineSize * i, startBlock + i);
}
}
template<bool softAes>
void LightClientAsyncWorker<softAes>::sync() {
void LightClientAsyncWorker::sync() {
std::unique_lock<std::mutex> lk(mutex);
notifier.wait(lk, [this] { return !hasWork; });
}
template<bool softAes>
void LightClientAsyncWorker<softAes>::runWorker() {
void LightClientAsyncWorker::runWorker() {
#ifdef TRACE
std::cout << sw.getElapsed() << ": runWorker-enter " << std::endl;
#endif
@@ -108,7 +101,7 @@ namespace RandomX {
std::cout << sw.getElapsed() << ": runWorker-getBlocks " << startBlock << "/" << blockCount << std::endl;
#endif
//getBlocks(output, startBlock, blockCount);
initBlock(cache->getCache(), (uint8_t*)output, startBlock);
initBlock(cache, (uint8_t*)output, startBlock);
hasWork = false;
#ifdef TRACE
std::cout << sw.getElapsed() << ": runWorker-finished " << startBlock << "/" << blockCount << std::endl;
@@ -117,7 +110,4 @@ namespace RandomX {
notifier.notify_one();
}
}
template class LightClientAsyncWorker<true>;
template class LightClientAsyncWorker<false>;
}