Skip to content

Support device awareness of result_type and promote_types #1836

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

Open
wants to merge 183 commits into
base: main
Choose a base branch
from

Conversation

Marc-Jindra
Copy link
Collaborator

Due Diligence

  • General:
  • Implementation:
    • unit tests: all split configurations tested
    • unit tests: multiple dtypes tested
    • benchmarks: created for new functionality
    • benchmarks: performance improved or maintained
    • documentation updated where needed

Description

Apple MPS don't support double precision floats or complex numbers, so this PR introduces some checks for that in result_type and promote_types.

Issue/s resolved: #1820

Changes proposed:

  • result_type now checks whether an arrays device is mps and changes the dtype accordingly (float64 -> float32, complex128 -> complex64)
  • promote_types now takes an optional device argument and checks if that device is mps

Type of change

Bug fix (non-breaking change which fixes an issue)

Memory requirements

Performance

Does this change modify the behaviour of other functions? If so, which?

no

ClaudiaComito and others added 30 commits November 26, 2022 08:00
…:helmholtz-analytics/heat into features/1053-support-Apple-silicon-GPUs
@ClaudiaComito ClaudiaComito self-requested a review April 30, 2025 12:29
@ClaudiaComito ClaudiaComito marked this pull request as ready for review April 30, 2025 12:33
@ClaudiaComito ClaudiaComito added this to the 1.6 milestone Apr 30, 2025
@github-project-automation github-project-automation bot moved this to Todo in Roadmap Apr 30, 2025
@ClaudiaComito ClaudiaComito modified the milestones: 1.6, 1.7.0 Apr 30, 2025
Copy link
Contributor

Thank you for the PR!

Copy link

codecov bot commented Apr 30, 2025

Codecov Report

Attention: Patch coverage is 55.55556% with 12 lines in your changes missing coverage. Please review.

Project coverage is 88.95%. Comparing base (e12b24b) to head (fe3b7c3).

Files with missing lines Patch % Lines
heat/core/types.py 53.84% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1836      +/-   ##
==========================================
- Coverage   92.10%   88.95%   -3.16%     
==========================================
  Files          86       86              
  Lines       13144    13159      +15     
==========================================
- Hits        12106    11705     -401     
- Misses       1038     1454     +416     
Flag Coverage Δ
unit 88.95% <55.55%> (-3.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JuanPedroGHM JuanPedroGHM self-requested a review June 16, 2025 08:52
Copy link
Contributor

Thank you for the PR!

Copy link
Member

@JuanPedroGHM JuanPedroGHM left a comment

Choose a reason for hiding this comment

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

There are still a couple of instances where references to MPS need to be removed from the codebase. Some quick examples that I found:

  • _operations.py: _binary_op and _cum_op
  • arithmetics.py: hypot and hypot_

There might be more, but those are some I could find quickly that already use promote_type or result_type. The references to MPS should be removable.

Otherwise, great code. Thanks!

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Roadmap Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Support device awareness of result_type, promote_types
4 participants