Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added JIT CNV4 compiler for ppc64le, ppc64 and ppc #5540

Closed
wants to merge 11 commits into from
Closed

Added JIT CNV4 compiler for ppc64le, ppc64 and ppc #5540

wants to merge 11 commits into from

Conversation

nioroso-x3
Copy link
Contributor

Initial version of JIT compiler for PPC, ported from my fork of XMRIG. Still requires testing.

}\
else if (sizeof(void*) == sizeof(uint64_t)){\
tmp+=4088; \
}\
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could be tmp += 4096 - sizeof(void*);

}
}
if(idx >= INST_LEN){
printf("JIT BUFFER FILLED UP!\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MERROR

@@ -117,7 +223,82 @@ int v4_generate_JIT_code(const struct V4_Instruction* code, v4_random_math_JIT_f
__builtin___clear_cache((char*)buf, (char*)JIT_code);

return 0;
#elif defined __PPC__ || defined __PPC64__
printf("Started compiling PPC64 JIT at %p\n",buf);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MDEBUG

}
#endif

uint8_t regN[] = {4,5,6,7,8,9,10,11,12};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static const ?

uint8_t regN[] = {4,5,6,7,8,9,10,11,12};
uint8_t r0 = 0;
ppcJIT_load(JIT_code,prologue,INST_LEN);
for (uint32_t i = 0; i < 70; ++i)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does the 70 come from ?

else if(sizeof(void*) == sizeof(uint64_t)){
uint64_t* fP = (uint64_t*)JIT_code;
*(fP+l-1) = (uint64_t)JIT_code;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That can also be a single op.

@nioroso-x3
Copy link
Contributor Author

I'll fix this your comments and some extra bugs in a new pull, just reject this one.

@moneromooo-monero
Copy link
Collaborator

You should push if instead once you've fixed everything (and squash commits).

@nioroso-x3
Copy link
Contributor Author

Test project /monero-m/build/Linux/master/debug
Start 1: hash-target
1/19 Test #1: hash-target ...................... Passed 2.21 sec
Start 2: core_tests
2/19 Test #2: core_tests .......................***Exception: Child terminated 5.26 sec //killed by me
Start 3: cncrypto
3/19 Test #3: cncrypto .........................***Exception: Child terminated 7.59 sec //killed by me
Start 4: cnv4-jit
4/19 Test #4: cnv4-jit ......................... Passed 751.12 sec
Start 5: unit_tests
5/19 Test #5: unit_tests .......................***Exception: Child terminated212.90 sec //killed by me
Start 6: difficulty
6/19 Test #6: difficulty ....................... Passed 0.08 sec
Start 7: wide_difficulty
7/19 Test #7: wide_difficulty .................. Passed 24.66 sec
Start 8: block_weight
8/19 Test #8: block_weight ..................... Passed 108.16 sec
Start 9: hash-fast
9/19 Test #9: hash-fast ........................ Passed 0.04 sec
Start 10: hash-slow
10/19 Test #10: hash-slow ........................ Passed 0.63 sec
Start 11: hash-slow-1
11/19 Test #11: hash-slow-1 ...................... Passed 0.69 sec
Start 12: hash-slow-2
12/19 Test #12: hash-slow-2 ...................... Passed 1.75 sec
Start 13: hash-slow-4
13/19 Test #13: hash-slow-4 ...................... Passed 1.78 sec
Start 14: hash-tree
14/19 Test #14: hash-tree ........................ Passed 0.01 sec
Start 15: hash-extra-blake
15/19 Test #15: hash-extra-blake ................. Passed 0.02 sec
Start 16: hash-extra-groestl
16/19 Test #16: hash-extra-groestl ............... Passed 0.02 sec
Start 17: hash-extra-jh
17/19 Test #17: hash-extra-jh .................... Passed 0.02 sec
Start 18: hash-extra-skein
18/19 Test #18: hash-extra-skein ................. Passed 0.02 sec
Start 19: hash-variant2-int-sqrt
19/19 Test #19: hash-variant2-int-sqrt ........... Passed 462.76 sec

It's passing cnv4jit test and the hash_slow4 test now, and x86 is unaffected. I guess its ready for merging.

@moneromooo-monero
Copy link
Collaborator

How long did the jit test take before that ?

@nioroso-x3
Copy link
Contributor Author

Double the time. I haven’t implemented altivec yet. For reference my xmrig fork went from 2 hash/s/core to 60 hash/s/core after optimizations.

@moneromooo-monero
Copy link
Collaborator

Can you squash those commits please ?

@nioroso-x3
Copy link
Contributor Author

Hmm, how do I that? I just tried and it added two more commits.

@nioroso-x3
Copy link
Contributor Author

Meh, I'll just delete the repo and refork, dunno what I did wrong.

@moneromooo-monero
Copy link
Collaborator

+duplicate

of #5543

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants