Add OpenCL support to MLDataDevices#1590
Conversation
Summary of ChangesHello @VarLad, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the MLDataDevices library by incorporating OpenCL as a new supported backend. This expansion allows users to leverage a broader range of GPU hardware for their machine learning computations, providing greater flexibility and accessibility. The changes involve adding necessary dependencies, implementing core OpenCL device functionalities, and updating the library's internal device management and testing infrastructure to seamlessly support OpenCL. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds OpenCL support to MLDataDevices, which is a great addition. The changes are mostly correct and follow the existing patterns for other GPU backends. I've found a few issues, mostly minor, including a copy-paste error in tests, a typo in a warning message, and a logic error in the test setup script. I've also pointed out a case of code duplication and a function that could be simplified for better maintainability. The most critical issues are in the test setup, which could lead to incorrect test execution or dependencies.
|
Not sure why but OpenCL tests are not working for me, as in, OpenCL doesn't get added by Pkg. |
|
I've bumped the minor version of the package, and formatted the file using Runic |
format with JuliaFormatter v1 |
|
The other files also need formatting https://github.com/LuxDL/Lux.jl/actions/runs/20070192836/job/57571219544?pr=1590 |
| function MLDataDevices.functional(::Union{OpenCLDevice,Type{<:OpenCLDevice}}) | ||
| return try | ||
| cl.device() | ||
| true | ||
| catch | ||
| false | ||
| end | ||
| end |
There was a problem hiding this comment.
Is there no nicer way than a try/catch?
There was a problem hiding this comment.
This was the most straightforward way to test for functionality, but the change in the latest commit should work good enough.
653fefa to
0f0e5b5
Compare
|
@VarLad I dont think any of the opencl tests are actually running see https://github.com/LuxDL/Lux.jl/actions/runs/20078551609/job/57599487282?pr=1590#step:12:883 |
|
@avik-pal I think the issue was that loading pocl_jll (and OpenCL.jl) before MLDataDevices causes issues. |
|
@avik-pal tests seem to pass locally for me. Would you like any other changes to this? |
This PR adds OpenCL support to MLDataDevices