Skip to content

Make one of the devices have a lower maximum float precision #64

Description

@betatim

As a follow up to #56: it would be useful to make one of the "devices" have a lower maximum float precision than the rest. To mirror what, for example, PyTorch's MPS device does (this is the "Apple silicon" GPU in modern MacBooks).

I think having a "lower maximum precision" device would be the last piece we'd need in scikit-learn to be able to find all "user errors" when writing array API code. This way people writing array API code don't need to have a GPU available to find and debug the errors you get when using a device that isn't a CPU.

What do people think?

cc @ogrisel

Activity

  1. asmeurer commented on Oct 3, 2024

    @asmeurer
    Member

    My thinking is that the default set of devices should cover the important use-cases (including this), but you should also be able to manually set what devices are active using the flags API.

  2. asmeurer commented on Oct 3, 2024

    @asmeurer
    Member

    This is related to #38

  3. ev-br commented on Dec 12, 2025

    @ev-br
    Member

    the last piece we'd need in scikit-learn to be able to find all "user errors" when writing array API code.

    Given that it's been a year (sigh), is it something scikit-learn feels as sorely missing @betatim ?

  4. betatim commented on Jan 5, 2026

    @betatim
    MemberAuthor

    It hasn't come up again as far as I remember. Using that as a yard stick: not super urgent/important.

    But I think in general this would be useful to have. Maybe the next step is to decide on what we want to implement to make this happen?

  5. ev-br commented on Jan 5, 2026

    @ev-br
    Member

    The very first question I suppose is this:

    In [11]: t = torch.as_tensor([1, 2, 3.0], device='mps')
    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
    Cell In[11], line 1
    ----> 1 t = torch.as_tensor([1, 2, 3.0], device='mps')
    
    TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.
    

    and the spec requires float64: A conforming implementation of the array API standard must provide and support the following data types ... float64.

    So strictly speaking, these "metal" backends are not compliant. This is similar to JAX, which is compliant in the X64 mode only.

    Given that array-api-strict is scrupulous in following the spec to the detail, and given that there clearly is interest in supporting these fancy "metal" frameworks (cf a recent scipy mention), maybe this is something to consider for the spec itself? array-api-strict will then happily follow.

  6. ev-br commented on Apr 24, 2026

    @ev-br
    Member

    Prompted by #70 (comment), here's a WIP PR to implement a float32-only device: #206

  7. betatim commented on Apr 27, 2026

    @betatim
    MemberAuthor

    (I just noticed and had to laugh: issue #64 is about less than float64 precision. Monday morning brain is easily entertained 😆 )

  8. added this to the 2.6 milestone on Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions