Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make gpu(x) = gpu_device()(x) #2502

Merged
merged 11 commits into from
Oct 22, 2024
Merged

make gpu(x) = gpu_device()(x) #2502

merged 11 commits into from
Oct 22, 2024

Conversation

CarloLucibello
Copy link
Member

@CarloLucibello CarloLucibello commented Oct 20, 2024

As a follow-up to #2492, this removes every residual implementation for data movement between devices in favor of relying entirely on MLDataUtils.jl. The 2 PRs combined save us ~700 lines of code while also extending functionalities.

After this, gpu and cpu just create a gpu_device or cpu_device on the fly and apply it to the argument:

gpu(x) = gpu_device()(x)
cpu(x) = cpu_device()(x)

This also fixes the problem with transferring conv layers to amdgpu devices discussed in #2498 (comment)

TODO

  • revisit documentation
  • check that all functionality is retained

@CarloLucibello CarloLucibello marked this pull request as draft October 20, 2024 06:58
@CarloLucibello CarloLucibello marked this pull request as ready for review October 20, 2024 10:12
Copy link

codecov bot commented Oct 20, 2024

Codecov Report

Attention: Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.

Project coverage is 33.46%. Comparing base (31dccd1) to head (a216eb8).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
ext/FluxAMDGPUExt/functor.jl 40.00% 3 Missing ⚠️
src/deprecations.jl 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2502      +/-   ##
==========================================
- Coverage   34.58%   33.46%   -1.13%     
==========================================
  Files          35       31       -4     
  Lines        1995     1829     -166     
==========================================
- Hits          690      612      -78     
+ Misses       1305     1217      -88     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@CarloLucibello
Copy link
Member Author

The tests I temporarily marked as broken should be fixed by LuxDL/MLDataDevices.jl#88

Copy link
Member

@pxl-th pxl-th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me (once broken tests are working again), especially since conv cpu-gpu transfer for AMD GPU is working again.

@CarloLucibello CarloLucibello merged commit c9bab66 into master Oct 22, 2024
9 of 11 checks passed
@CarloLucibello
Copy link
Member Author

ops, should have waited LuxDL/MLDataDevices.jl#88 for unbreaking the tests. I'll wait for LuxDL/MLDataDevices.jl#88 before tagging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants