djl icon indicating copy to clipboard operation
djl copied to clipboard

WIP: Make MPS default device for macOS M1

Open frankfliu opened this issue 3 years ago • 1 comments
trafficstars

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 avatar Sep 28 '22 21:09 frankfliu

Codecov Report

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

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%) :arrow_down:
...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%) :arrow_down:
...odality/cv/translator/BigGANTranslatorFactory.java 33.33% <0.00%> (+8.33%) :arrow_up:
.../cv/translator/InstanceSegmentationTranslator.java 0.00% <0.00%> (-86.59%) :arrow_down:
...nslator/InstanceSegmentationTranslatorFactory.java 7.14% <0.00%> (-11.04%) :arrow_down:
.../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.

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

codecov-commenter avatar Sep 28 '22 22:09 codecov-commenter