tevador / RandomX

Proof of work algorithm based on random code execution

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How is --mine working on ARM?

MarcKarasek opened this issue · comments

I have not been abel to figure out how this is working on ARM (--mine option).

The void generateDatasetInitCode() {} does not copy any dataset_init() code. So when this is run via
jit.getDatasetInitFunc()(cache, (uint8_t*)&datasetItem, 0, 1);
It crashes?? since no code is there?

Caveat I do not have an ARM platform to test on. I am porting RandomX over to another processor and was using ARM as the template. It crashes at this spot due to no dataset_init() code being present and the generateDatasetInitCode() doing nothing.

Under x86 I see that the generate() function copies code over, etc..

I wrote the ARM code and it's how it works there. generateDatasetInitCode() is empty because the code is already there and doesn't need to be generated, see JitCompilerA64::getDatasetInitFunc(). The naming of functions is probably not good because actual dataset init code is generated in generateSuperscalarHash.

I see that when the jit is created this copies the code over..
Yeah not too clear as to what is going on ..

The whole ARM code is in jit_compiler_a64_static.S and generateSuperscalarHash just overwrites the part that starts at randomx_calc_dataset_item_aarch64 IIRC

madd x0, x2, x12, x12 calculates itemNumber * superscalarMul0 + superscalarMul0 which is the same.

It is the same. I don't remember, but I think it's 5th grade math. (a+1)*b = a*b + b

SuperscalarHash uses registers x0-x7 unlike the main RandomX loop.