mirror of
https://git.wownero.com/wownero/RandomWOW.git
synced 2024-12-22 07:48:54 +00:00
Support Dataset size larger than 4 GiB
Support arbitrary value of RANDOMX_DATASET_EXTRA_SIZE
This commit is contained in:
parent
378d5def38
commit
bc2aae0f61
@ -88,7 +88,7 @@ void randomx_vm::initialize() {
|
|||||||
config.readReg2 = 4 + (addressRegisters & 1);
|
config.readReg2 = 4 + (addressRegisters & 1);
|
||||||
addressRegisters >>= 1;
|
addressRegisters >>= 1;
|
||||||
config.readReg3 = 6 + (addressRegisters & 1);
|
config.readReg3 = 6 + (addressRegisters & 1);
|
||||||
datasetOffset = (program.getEntropy(13) & randomx::DatasetExtraItems) * randomx::CacheLineSize;
|
datasetOffset = (program.getEntropy(13) % (randomx::DatasetExtraItems + 1)) * randomx::CacheLineSize;
|
||||||
store64(&config.eMask[0], randomx::getFloatMask(program.getEntropy(14)));
|
store64(&config.eMask[0], randomx::getFloatMask(program.getEntropy(14)));
|
||||||
store64(&config.eMask[1], randomx::getFloatMask(program.getEntropy(15)));
|
store64(&config.eMask[1], randomx::getFloatMask(program.getEntropy(15)));
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ protected:
|
|||||||
randomx_cache* cachePtr = nullptr;
|
randomx_cache* cachePtr = nullptr;
|
||||||
randomx_dataset* datasetPtr;
|
randomx_dataset* datasetPtr;
|
||||||
};
|
};
|
||||||
uint32_t datasetOffset;
|
uint64_t datasetOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
@ -273,7 +273,7 @@ namespace randomx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class Allocator, bool softAes>
|
template<class Allocator, bool softAes>
|
||||||
void InterpretedVm<Allocator, softAes>::datasetRead(uint32_t address, int_reg_t(&r)[RegistersCount]) {
|
void InterpretedVm<Allocator, softAes>::datasetRead(uint64_t address, int_reg_t(&r)[RegistersCount]) {
|
||||||
uint64_t* datasetLine = (uint64_t*)(mem.memory + address);
|
uint64_t* datasetLine = (uint64_t*)(mem.memory + address);
|
||||||
for (int i = 0; i < RegistersCount; ++i)
|
for (int i = 0; i < RegistersCount; ++i)
|
||||||
r[i] ^= datasetLine[i];
|
r[i] ^= datasetLine[i];
|
||||||
|
@ -80,7 +80,7 @@ namespace randomx {
|
|||||||
void run(void* seed) override;
|
void run(void* seed) override;
|
||||||
void setDataset(randomx_dataset* dataset) override;
|
void setDataset(randomx_dataset* dataset) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void datasetRead(uint32_t blockNumber, int_reg_t(&r)[RegistersCount]);
|
virtual void datasetRead(uint64_t blockNumber, int_reg_t(&r)[RegistersCount]);
|
||||||
private:
|
private:
|
||||||
void execute();
|
void execute();
|
||||||
void precompileProgram(int_reg_t(&r)[RegistersCount], rx_vec_f128(&f)[RegisterCountFlt], rx_vec_f128(&e)[RegisterCountFlt], rx_vec_f128(&a)[RegisterCountFlt]);
|
void precompileProgram(int_reg_t(&r)[RegistersCount], rx_vec_f128(&f)[RegisterCountFlt], rx_vec_f128(&e)[RegisterCountFlt], rx_vec_f128(&a)[RegisterCountFlt]);
|
||||||
|
@ -38,7 +38,7 @@ namespace randomx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class Allocator, bool softAes>
|
template<class Allocator, bool softAes>
|
||||||
void InterpretedLightVm<Allocator, softAes>::datasetRead(uint32_t address, int_reg_t(&r)[8]) {
|
void InterpretedLightVm<Allocator, softAes>::datasetRead(uint64_t address, int_reg_t(&r)[8]) {
|
||||||
uint32_t itemNumber = address / CacheLineSize;
|
uint32_t itemNumber = address / CacheLineSize;
|
||||||
int_reg_t rl[8];
|
int_reg_t rl[8];
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace randomx {
|
|||||||
void setDataset(randomx_dataset* dataset) override { }
|
void setDataset(randomx_dataset* dataset) override { }
|
||||||
void setCache(randomx_cache* cache) override;
|
void setCache(randomx_cache* cache) override;
|
||||||
protected:
|
protected:
|
||||||
void datasetRead(uint32_t address, int_reg_t(&r)[8]) override;
|
void datasetRead(uint64_t address, int_reg_t(&r)[8]) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
using InterpretedLightVmDefault = InterpretedLightVm<AlignedAllocator<CacheLineSize>, true>;
|
using InterpretedLightVmDefault = InterpretedLightVm<AlignedAllocator<CacheLineSize>, true>;
|
||||||
|
Loading…
Reference in New Issue
Block a user