mirror of
https://github.com/openwall/john.git
synced 2026-12-03 20:43:49 +07:00
[GH-ISSUE #1720] Optimize intrinsic functions with pre-processor-fu #1137
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#1137
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @magnumripper on GitHub (Aug 29, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1720
I'm pretty sure we can drop most branches in the SIMD functions using some clever rewrites and macros. The OpenCL functions does that. Well, that's not really a fair comparison since everything is always inlined but anyway.
@magnumripper commented on GitHub (Aug 29, 2015):
Example: The actual MD4 function would be
SIMD_MD4(w, a, b, c, d). Everything else would be preprocessor stuff and at compile time most of it would disappear and there would be NO branches. I'm pretty sure the boost would be noticable.@magnumripper commented on GitHub (Aug 29, 2015):
One thing that complicates things is that macros can't contain macros. So we can't put pseudo-intrinsics in macros...
@jfoug commented on GitHub (Aug 29, 2015):
Debuggging is also very hard with macro usages like this. I am seeing this in parts of dyna. You want to be DAMN sure things are correct before macro-izing things, and have a fall back to allow debugging.
@magnumripper commented on GitHub (Aug 31, 2015):
BTW this is very interesting:
Using our CPU intrinsics format, and AVX2 (all this is on well):
Same hardware, but using our OpenCL code (and an AVX2-aware CPU driver):
Above, the device asked for scalar code so we served it that, then it was auto-vectorized and actually faster than our intrinsics.
Here's forcing 8x vector source code:
Slightly slower than auto-vectorized in this case, but still faster than our CPU format.
We don't get this good results for OpenCL with all formats, yet. But some day, we may. Scalar OpenCL is very easy to write, much much easier than writing plain CPU code using intrinsics.
@magnumripper commented on GitHub (Sep 5, 2015):
This is not correct. They can, but you'll need to be careful.
@jfoug commented on GitHub (Sep 5, 2015):
How do you define a macro in a macro? This shortfall was why I did the dynamic-big-hash.c the way I did (using an external script to do my macro expansions).
@magnumripper commented on GitHub (Sep 5, 2015):
You can not define a macro in a macro, but you can call a macro from a macro. Actually in as many levels as you want.
http://stackoverflow.com/questions/7972785/can-a-c-macro-definition-refer-to-other-macros
@magnumripper commented on GitHub (Sep 7, 2015):
A little experiment is now in the cpp-intrinsics topic branch. Specifically 51f3fe6 for now.
Currently only MD4 & MD5 are done, and not completely. What is done, is there are now (behind the curtain) two different functions - one for a single/first block and another for "reload". Also, the "flat to interleaved" is moved to a separate function but that is also hidden by PP macros (mosty optimized away since SSEi_flags are constants).
Boost is 5-10% depending on format. Still, I'm not quite sure we want to walk this path.