Skip to content

Multi-vendor GPU (PR3): port PDM, CE, String-Length, MHAOV, TLS to torch - #11

Merged
tjayasinghe merged 1 commit into
dev/multi-vendor-gpufrom
feat/torch-bonus-methods
Jun 30, 2026
Merged

Multi-vendor GPU (PR3): port PDM, CE, String-Length, MHAOV, TLS to torch#11
tjayasinghe merged 1 commit into
dev/multi-vendor-gpufrom
feat/torch-bonus-methods

Conversation

@tjayasinghe

Copy link
Copy Markdown
Owner

…ackend

Extends the portable array-API path from GLS/BLS (PR1) to the remaining five
methods, so all seven now run on any torch device (CUDA/ROCm/MPS/XPU/CPU) with
the NVIDIA fast paths untouched.

- CE / PDM: vectorized histogram/box kernels re-spelled to array-API ops
  (scatter_add shim, xp.astype/remainder/clip, dtype-following-periods); numpy +
  torch flow through array_api_compat namespaces. cupy RawKernels unchanged.
- String-Length: sort/gather re-spelled with fancy indexing + slicing (no
  take_along_axis/diff, which aren't in every namespace).
- MHAOV: einsum + linalg.solve are available in the compat namespaces, so the
  torch path is a thin add; raw numpy/cupy keep einsum.
- TLS: matched filter re-spelled (notably explicit float dtype on every zeros(),
  since torch defaults to float32; clip instead of minimum-with-scalar, which
  torch rejects).
- config: device/precision mixin + "torch" backend on all five settings.
- New tests/test_torch_bonus.py: torch:cpu vs numpy parity + period recovery for
  all five (harmonic-aware, since String-Length/MHAOV legitimately lock onto a
  harmonic identically on both backends).

Validated on torch:cpu: CE 1.3e-15, String-Length 2.8e-14, PDM 0.0, TLS 0.0
(bit-identical); MHAOV 2.7e-10 relative (linalg.solve rounding, peak unaffected).
160 passed, 8 skipped (CUDA-only); ruff + mypy clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tjayasinghe
tjayasinghe changed the base branch from feat/arrayapi-foundations to dev/multi-vendor-gpu June 30, 2026 21:55
@tjayasinghe
tjayasinghe merged commit d0acdce into dev/multi-vendor-gpu Jun 30, 2026
2 of 6 checks passed
@tjayasinghe
tjayasinghe deleted the feat/torch-bonus-methods branch August 14, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant