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

WIP: Make MPS default device for macOS M1 #2044

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

frankfliu
Copy link
Contributor

@frankfliu frankfliu commented Sep 28, 2022

Currently MPS has many limitations:

  1. mapLocation cannot be used to load model onto MPS
  2. module that serialized with MPS device cannot be loaded as is, it can only be loaded when mapLocation set to CPU and GPU
  3. Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64
  4. Observed crash in .toDevice(): _ZN2at6native3mps13copy_cast_mps

This PR is just used as a reference, will make MPS default device when it become stable

@frankfliu frankfliu changed the title Make MPS default device for macOS M1 WIP: Make MPS default device for macOS M1 Sep 28, 2022
@codecov-commenter
Copy link

Codecov Report

Base: 72.08% // Head: 69.61% // Decreases project coverage by -2.47% ⚠️

Coverage data is based on head (e3fdeb0) compared to base (bb5073f).
Patch coverage: 68.42% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2044      +/-   ##
============================================
- Coverage     72.08%   69.61%   -2.48%     
- Complexity     5126     5964     +838     
============================================
  Files           473      597     +124     
  Lines         21970    26510    +4540     
  Branches       2351     2884     +533     
============================================
+ Hits          15838    18456    +2618     
- Misses         4925     6664    +1739     
- Partials       1207     1390     +183     
Impacted Files Coverage Δ
api/src/main/java/ai/djl/modality/cv/Image.java 69.23% <ø> (-4.11%) ⬇️
...rc/main/java/ai/djl/modality/cv/MultiBoxPrior.java 76.00% <ø> (ø)
...rc/main/java/ai/djl/modality/cv/output/Joints.java 71.42% <ø> (ø)
.../main/java/ai/djl/modality/cv/output/Landmark.java 100.00% <ø> (ø)
...main/java/ai/djl/modality/cv/output/Rectangle.java 72.41% <0.00%> (ø)
...i/djl/modality/cv/translator/BigGANTranslator.java 21.42% <0.00%> (-5.24%) ⬇️
...odality/cv/translator/BigGANTranslatorFactory.java 33.33% <0.00%> (+8.33%) ⬆️
.../cv/translator/InstanceSegmentationTranslator.java 0.00% <0.00%> (-86.59%) ⬇️
...nslator/InstanceSegmentationTranslatorFactory.java 7.14% <0.00%> (-11.04%) ⬇️
.../cv/translator/SemanticSegmentationTranslator.java 0.00% <0.00%> (ø)
... and 511 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -1544,6 +1544,10 @@ public static PtSymbolBlock loadModule(
String[] extraFileKeys,
String[] extraFileValues) {
Device device = manager.getDevice();
// MPS doesn't support mapLocation
Copy link
Contributor

Choose a reason for hiding this comment

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

@frankfliu - Could you please add the changes that disable "mapLocation" for "mps" to the master? This will improve the current "mps" support.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created a PR: #2061

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.

3 participants