OpenCL: Common support for multiple devices
Open
Nobody has claimed this yet.
enhancement
RFC / discussion
- Dominant language
- C
- Stars
- 13.6k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
RFC @claudioandre @Sayantan2048
We should figure out a KISS way of supporting multi-device use for more formats, with as little effort as possible (I'm lazy).
Brainstorming:
- All common OpenCL variables/functions should work on arrays. Some already do. For example, local_work_size, global_work_size, crypt_kernel and so on should all be arrays of [MAX_GPU_DEVICES].
- A format calling opencl_init would init all devices specified (I think this already happens)
- Auto-tune should be made for all chosen devices, storing LWS/GWS results per device. Note: If we deem two or more devices identical, we should obviously just re-use the values and not test again.
- Auto-tune can (already) aim for a duration time, eg. 200ms.
- Say we end up with a global_work_size[0] of 1024 and global_work_size[1] of 2048. We'd simply set max_keys_per_crypt to 3072.
- set_salt would send same salt to each device.
- crypt_all() would iterate through the device list and send the number of keys to each device that corresponds with its global_work_size. Then launch each kernel, and so on.
That's about it, I think.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the OpenCL entry points named in the issue: opencl_init, set_salt, and crypt_all, along with shared variables such as local_work_size and global_work_size. Determine how device lists and auto-tuning currently work; done would mean a settled, tested design for distributing work and tuning across multiple devices.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100