mirror of
https://github.com/xmrig/xmrig.git
synced 2024-10-30 13:07:46 +00:00
Merge pull request #2386 from SChernykh/dev
Enabled IMUL_RCP optimization for light mode mining
This commit is contained in:
commit
3ac8f6b23a
6 changed files with 8 additions and 14 deletions
|
@ -7,4 +7,4 @@
|
||||||
xor r13, qword ptr [rsp+16]
|
xor r13, qword ptr [rsp+16]
|
||||||
xor r14, qword ptr [rsp+8]
|
xor r14, qword ptr [rsp+8]
|
||||||
xor r15, qword ptr [rsp+0]
|
xor r15, qword ptr [rsp+0]
|
||||||
add rsp, 72
|
add rsp, 200
|
|
@ -1,4 +1,4 @@
|
||||||
sub rsp, 72
|
sub rsp, 200
|
||||||
mov qword ptr [rsp+64], rbx
|
mov qword ptr [rsp+64], rbx
|
||||||
mov qword ptr [rsp+56], r8
|
mov qword ptr [rsp+56], r8
|
||||||
mov qword ptr [rsp+48], r9
|
mov qword ptr [rsp+48], r9
|
||||||
|
|
|
@ -320,7 +320,7 @@ namespace randomx {
|
||||||
|
|
||||||
vm_flags = flags;
|
vm_flags = flags;
|
||||||
|
|
||||||
generateProgramPrologue(prog, pcfg, false);
|
generateProgramPrologue(prog, pcfg);
|
||||||
|
|
||||||
uint8_t* p;
|
uint8_t* p;
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
|
@ -339,8 +339,8 @@ namespace randomx {
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompilerX86::generateProgramLight(Program& prog, ProgramConfiguration& pcfg, uint32_t datasetOffset) {
|
void JitCompilerX86::generateProgramLight(Program& prog, ProgramConfiguration& pcfg, uint32_t datasetOffset) {
|
||||||
generateProgramPrologue(prog, pcfg, true);
|
generateProgramPrologue(prog, pcfg);
|
||||||
emit(RandomX_CurrentConfig.codeReadDatasetLightSshInitTweaked, readDatasetLightInitSize, code, codePos);
|
emit(codeReadDatasetLightSshInit, readDatasetLightInitSize, code, codePos);
|
||||||
*(uint32_t*)(code + codePos) = 0xc381;
|
*(uint32_t*)(code + codePos) = 0xc381;
|
||||||
codePos += 2;
|
codePos += 2;
|
||||||
emit32(datasetOffset / CacheLineSize, code, codePos);
|
emit32(datasetOffset / CacheLineSize, code, codePos);
|
||||||
|
@ -415,7 +415,7 @@ namespace randomx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompilerX86::generateProgramPrologue(Program& prog, ProgramConfiguration& pcfg, bool light) {
|
void JitCompilerX86::generateProgramPrologue(Program& prog, ProgramConfiguration& pcfg) {
|
||||||
codePos = ADDR(randomx_program_prologue_first_load) - ADDR(randomx_program_prologue);
|
codePos = ADDR(randomx_program_prologue_first_load) - ADDR(randomx_program_prologue);
|
||||||
*(uint32_t*)(code + codePos + 4) = RandomX_CurrentConfig.ScratchpadL3Mask64_Calculated;
|
*(uint32_t*)(code + codePos + 4) = RandomX_CurrentConfig.ScratchpadL3Mask64_Calculated;
|
||||||
*(uint32_t*)(code + codePos + 14) = RandomX_CurrentConfig.ScratchpadL3Mask64_Calculated;
|
*(uint32_t*)(code + codePos + 14) = RandomX_CurrentConfig.ScratchpadL3Mask64_Calculated;
|
||||||
|
@ -429,7 +429,7 @@ namespace randomx {
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
imul_rcp_storage = code + (ADDR(randomx_program_imul_rcp_store) - codePrologue) + 2;
|
imul_rcp_storage = code + (ADDR(randomx_program_imul_rcp_store) - codePrologue) + 2;
|
||||||
imul_rcp_storage_used = light ? 0xFFFFFFFFUL : 0;
|
imul_rcp_storage_used = 0;
|
||||||
|
|
||||||
memcpy(imul_rcp_storage - 34, &pcfg.eMask, sizeof(pcfg.eMask));
|
memcpy(imul_rcp_storage - 34, &pcfg.eMask, sizeof(pcfg.eMask));
|
||||||
codePos = codePosFirst;
|
codePos = codePosFirst;
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace randomx {
|
||||||
uint8_t* imul_rcp_storage = nullptr;
|
uint8_t* imul_rcp_storage = nullptr;
|
||||||
uint32_t imul_rcp_storage_used = 0;
|
uint32_t imul_rcp_storage_used = 0;
|
||||||
|
|
||||||
void generateProgramPrologue(Program&, ProgramConfiguration&, bool light);
|
void generateProgramPrologue(Program&, ProgramConfiguration&);
|
||||||
void generateProgramEpilogue(Program&, ProgramConfiguration&);
|
void generateProgramEpilogue(Program&, ProgramConfiguration&);
|
||||||
template<bool rax>
|
template<bool rax>
|
||||||
static void genAddressReg(const Instruction&, const uint32_t src, uint8_t* code, uint32_t& codePos);
|
static void genAddressReg(const Instruction&, const uint32_t src, uint8_t* code, uint32_t& codePos);
|
||||||
|
|
|
@ -177,11 +177,6 @@ RandomX_ConfigurationBase::RandomX_ConfigurationBase()
|
||||||
memcpy(codeReadDatasetRyzenTweaked, a, b - a);
|
memcpy(codeReadDatasetRyzenTweaked, a, b - a);
|
||||||
codeReadDatasetRyzenTweakedSize = b - a;
|
codeReadDatasetRyzenTweakedSize = b - a;
|
||||||
}
|
}
|
||||||
{
|
|
||||||
const uint8_t* a = addr(randomx_program_read_dataset_sshash_init);
|
|
||||||
const uint8_t* b = addr(randomx_program_read_dataset_sshash_fin);
|
|
||||||
memcpy(codeReadDatasetLightSshInitTweaked, a, b - a);
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
const uint8_t* a = addr(randomx_prefetch_scratchpad);
|
const uint8_t* a = addr(randomx_prefetch_scratchpad);
|
||||||
const uint8_t* b = addr(randomx_prefetch_scratchpad_end);
|
const uint8_t* b = addr(randomx_prefetch_scratchpad_end);
|
||||||
|
|
|
@ -129,7 +129,6 @@ struct RandomX_ConfigurationBase
|
||||||
uint32_t codeReadDatasetTweakedSize;
|
uint32_t codeReadDatasetTweakedSize;
|
||||||
uint8_t codeReadDatasetRyzenTweaked[72];
|
uint8_t codeReadDatasetRyzenTweaked[72];
|
||||||
uint32_t codeReadDatasetRyzenTweakedSize;
|
uint32_t codeReadDatasetRyzenTweakedSize;
|
||||||
uint8_t codeReadDatasetLightSshInitTweaked[68];
|
|
||||||
uint8_t codePrefetchScratchpadTweaked[32];
|
uint8_t codePrefetchScratchpadTweaked[32];
|
||||||
|
|
||||||
uint32_t AddressMask_Calculated[4];
|
uint32_t AddressMask_Calculated[4];
|
||||||
|
|
Loading…
Reference in a new issue