Skip to content

Six Metal tests are tautological (numpy vs numpy) and one docstring describes a kernel that never existed #300

Description

@Ramdam17

Consequence of the resolver defect in the companion issue about optimization='metal'.

Because plv, ccorr, coh, imcoh, envcorr and powcorr have no Metal kernel and silently fall back to _compute_numpy, these six tests compare NumPy against NumPy. They pass unconditionally on any macOS with PyObjC installed, and would keep passing if a Metal kernel were added tomorrow and were completely wrong:

  • tests/test_sync.py:180 test_plv_metal_vs_numpy
  • tests/test_sync.py:287 test_ccorr_metal_vs_numpy
  • tests/test_sync.py:365 test_coh_metal_vs_numpy
  • tests/test_sync.py:440 test_imcoh_metal_vs_numpy
  • tests/test_sync.py:763 test_envcorr_metal_vs_numpy
  • tests/test_sync.py:839 test_powcorr_metal_vs_numpy

hypyp/sync/README.md:172-181 correctly marks Metal as -- for exactly these six metrics, so the tests contradict the documentation.

Additionally, tests/test_sync.py:290 documents a CCorr Metal shader that has never existed in any commit:

Uses Kahan summation with fastMath=OFF to preserve IEEE-754 compliance.

The strings Kahan and fastMath appear nowhere in hypyp/sync/kernels/, and there is no CCorr Metal shader in the history. This docstring is actively misleading — it is what makes the current state look like deleted work rather than a resolver bug.

Suggested fix: delete the six tests (or repurpose them as torch/MPS tests), remove the fabricated docstring, and — most importantly — add assert m._backend == 'metal' to the remaining real Metal value tests (pli, wpli, accorr). That assertion is what turns a silent fallback into a loud failure and prevents this class of vacuous test from reappearing.

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions