Skip to content

Add sparse test backend as a densification detector (and eventual supported library) #938

Description

@mwcraig

Proposal

Add sparse (pydata/sparse) as a test backend — initially as a diagnostic for densification escapes, potentially graduating to a supported library (already listed as a welcome contribution in docs/array_api.rst).

Why: sparse raises RuntimeError on implicit densification by default (unless SPARSE_AUTO_DENSIFY=1), so it catches np.asarray-style escapes on the CPU — the same class of bug CuPy reports as Implicit conversion to a NumPy array is not allowed, without needing a GPU.

Caveats

  • sparse's array-API coverage is narrower than CuPy's (no general in-place mutation, gaps in reductions/sorting), so some failures will be false positives for the CuPy question. Treat a sparse pass as strong evidence and a sparse failure as needing triage — a diagnostic filter, not a CI gate, at first.
  • Keep the test images dense-valued so only protocol behavior differs, not numerics.

Work items


Follow-up to #909. Found during a review of the array API implementation from #885.

Activity

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions