mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1201] Abandon vtranspose_epi32 in pseudo-intrinsics.h #753
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#753
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 @lei-april on GitHub (Apr 12, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1201
Originally assigned to: @lei-april on GitHub.
vtranspose_epi32 is used to transpose a matrix held by an array of SIMD registers. The implementation gets more complex as the SIMD width doubles. I didn't figure out how to implement it for AVX512/MIC, and a guy on stackoverflow gave me an answer, which looks quite complex.
It will be even harder to implement this for AVX1024 or higher. Since currently this function is only used by one format (raw-sha1-ng), I think we might replace it with scalar code for better scalability.
@magnumripper commented on GitHub (Apr 12, 2015):
Sure, we can use scalar code for widths > 8 (at least for now). That SE table show some significant speedup though, especially for larger widths.
Perhaps there's a way to write the intrinsics version using arrays and loops, making the code shorter yet in the end end up with more or less the same resulting code?
I suspect this vtranspose_epi32() function (we should probably give it a better/more specific name) might have lots of future use - isn't this the same functionality that is done some other way when sse-intrinsics.c functions are called with SSEi_FLAT_IN? We should compare benchmarks on AVX2 using vector vs. scalar code and see real-world difference. But this will be influenced by unrelated bottlenecks.
@lei-april commented on GitHub (Apr 13, 2015):
If the matrix is transposed immediately after loaded from memory, which is the case in raw-sha1-ng, we may use the gather/scatter in AVX512/MIC to do the transposition with even fewer instructions, like this:
In this case, the 2-D array M is supposed to be stored continuously in memory.
The gather/scatter instructions should also be available in AVX1024 or higher, so we can use this scheme for all widths > 8. But if we have to do in-register transposition in future cases, we'd need another way.
@magnumripper commented on GitHub (Apr 13, 2015):
That's nice. So it only works on AVX512? I don't even get a google hit from "_mm512_gather_epi32"
@lei-april commented on GitHub (Apr 13, 2015):
Sorry, I made a typo. It's _mm512_i32gather_epi32. MIC supports it too. You can find it in the reference manual.
@magnumripper commented on GitHub (Apr 13, 2015):
OK that instruction is also in AVX2 but not lower.
@magnumripper commented on GitHub (Apr 13, 2015):
We have this in several places in sse-intrinsics.c
Perhaps you should try implementing
#elif __AVX512__ || __MIC__and#elif __AVX2__clauses for them? That would speed up some formats a lot (I think).@magnumripper commented on GitHub (Apr 13, 2015):
Btw obviously it would need to be
@lei-april commented on GitHub (Apr 13, 2015):
OK, I'll do it.
@magnumripper commented on GitHub (Apr 14, 2015):
Removed from pseudo_intrinsics.h in cec121c1