[GH-ISSUE #1831] Implement a function to get a very rough "speed index" for an OpenCL device #1215

Closed
opened 2026-10-14 03:39:31 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @magnumripper on GitHub (Oct 14, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1831

Originally assigned to: @magnumripper on GitHub.

See #1829 and https://github.com/magnumripper/JohnTheRipper/issues/1822#issuecomment-147900124

This doesn't have to be fully proper, just a best-effort guess.

I'd rather not make a hard-coded list. I hate them. My initial idea was to execute a simple test kernel (eg. one that takes 300ms on a very weak device) and profile it.

However, here's food for thought:

CARD clock cores SP's index1 index2
AVX CPU 2300MHz 8 4 18400 73600
AVX2 CPU 2300MHz 8 8 18400 147200
Intel HD4000 1200MHz 16 N/A 19200 N/A
Intel HD5000 1250MHz 20 N/A 25000 N/A
Intel MIC 1052MHz 236 N/A 248272 N/A
GT650M 900MHz 2 192 1800 345600
GTX570 1600MHz 15 32 24000 768000
Titan 954MHz 14 192 13356 2564352
Titan X 1076MHz 24 128 25824 3305472
Juniper 700MHz 9 80 6300 504000
Tahiti 1050MHz 32 64 33600 2150400

We can always get "index1" (clock x cores) but "index2" would be much better (clock x cores x SP's). The problem is we don't always know the SP figure (it actually comes from more or less a hard-coded list, doh). In this list, the "native vector width" for 'int' is used as SP count for CPUs.

Originally created by @magnumripper on GitHub (Oct 14, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1831 Originally assigned to: @magnumripper on GitHub. See #1829 and https://github.com/magnumripper/JohnTheRipper/issues/1822#issuecomment-147900124 This doesn't have to be fully proper, just a best-effort guess. I'd rather not make a hard-coded list. I hate them. My initial idea was to execute a simple test kernel (eg. one that takes 300ms on a **very** weak device) and profile it. However, here's food for thought: | CARD | clock | cores | SP's | index1 | index2 | | --- | --- | --- | --- | --- | --- | | AVX CPU | 2300MHz | 8 | 4 | 18400 | 73600 | | AVX2 CPU | 2300MHz | 8 | 8 | 18400 | 147200 | | Intel HD4000 | 1200MHz | 16 | N/A | 19200 | N/A | | Intel HD5000 | 1250MHz | 20 | N/A | 25000 | N/A | | Intel MIC | 1052MHz | 236 | N/A | 248272 | N/A | | GT650M | 900MHz | 2 | 192 | 1800 | 345600 | | GTX570 | 1600MHz | 15 | 32 | 24000 | 768000 | | Titan | 954MHz | 14 | 192 | 13356 | 2564352 | | Titan X | 1076MHz | 24 | 128 | 25824 | 3305472 | | Juniper | 700MHz | 9 | 80 | 6300 | 504000 | | Tahiti | 1050MHz | 32 | 64 | 33600 | 2150400 | We can always get "index1" (clock x cores) but "index2" would be much better (clock x cores x SP's). The problem is we don't always know the SP figure (it actually comes from more or less a hard-coded list, doh). In this list, the "native vector width" for 'int' is used as SP count for CPUs.
bsakaguchi 2026-10-14 03:39:31 +07:00
Author
Owner

@magnumripper commented on GitHub (Oct 14, 2015):

We could use index2 if available, and fall-back to index1 if we don't know number of SP's.

Or we could always calculate index2, using SP=x1 if unknown. BTW I think it actually is 1 for all unknowns in the sample table above.

Come to think of it, these two alternatives are the same thing, LOL.

<!-- gh-comment-id:148177865 --> @magnumripper commented on GitHub (Oct 14, 2015): We could use index2 if available, and fall-back to index1 if we don't know number of SP's. Or we could always calculate index2, using SP=x1 if unknown. BTW I think it actually **is** 1 for all unknowns in the sample table above. Come to think of it, these two alternatives are the same thing, LOL.
Author
Owner

@magnumripper commented on GitHub (Oct 14, 2015):

Simply using index2 / 100 (for the fastest formats, eg. NT) would mean a mask_int_cand_target of 33054 for Titan X but only 5040 for Juniper. That sounds pretty sane, doesn't it? Assuming SP of x1 It would be only 192 for HD 4000 but that's probably fine too.

<!-- gh-comment-id:148179335 --> @magnumripper commented on GitHub (Oct 14, 2015): Simply using `index2 / 100` (for the fastest formats, eg. NT) would mean a mask_int_cand_target of 33054 for Titan X but only 5040 for Juniper. That sounds pretty sane, doesn't it? Assuming SP of x1 It would be only 192 for HD 4000 but that's probably fine too.
Author
Owner

@magnumripper commented on GitHub (Oct 14, 2015):

I ended up using index2 / 300 for the fastest formats. Seems to work like a champ.

<!-- gh-comment-id:148208961 --> @magnumripper commented on GitHub (Oct 14, 2015): I ended up using `index2 / 300` for the fastest formats. Seems to work like a champ.
Author
Owner

@magnumripper commented on GitHub (Oct 14, 2015):

This function can be used for other things too. For example, we could vary the number of calls to (and iterations in) a "split kernel" depending on how much pow(d)er we have, reducing overhead for flagship devices.

<!-- gh-comment-id:148220540 --> @magnumripper commented on GitHub (Oct 14, 2015): This function can be used for other things too. For example, we could vary the number of calls to (and iterations in) a "split kernel" depending on how much pow(d)er we have, reducing overhead for flagship devices.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1215
No description provided.