-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
Problem statement
The dot kernel currently has no dedicated tests under tests/. While copy and swap are covered by test_copy.py and test_swap.py, there is no test_dot.py to verify that all backends compute
Without dot tests:
- regressions in any backend implementation may go unnoticed,
- CI cannot guarantee numerical equivalence between backends and the Python reference,
- the README BLAS table cannot mark the
Testcolumn fordotas complete.
Proposed solution
Add a dedicated pytest module for dot that follows the style of existing kernel tests and validates all backends.
Concretely:
- Introduce
tests/test_dot.pyalongside the existing tests. - For each backend (Python, PyTorch, Triton, CuTe when available), compare results against the Python
dotreference for multiple input sizes and dtypes. - Cover edge cases such as zero-length vectors, large values, and orthogonal vectors where the dot product is close to zero.
Alternatives considered
Ad-hoc or manual testing is not sufficient because it:
- is easy to skip during development,
- does not integrate with CI,
- lacks consistent regression coverage.
Implementation details
- Add
tests/test_dot.pyusing pytest patterns already used in the project. - Reuse any shared helpers for generating random vectors and comparing outputs.
- Parameterize tests over vector length, dtype, and value ranges.
- Gracefully skip backend-specific tests when a backend is not available or not yet implemented.
Use case
The dot tests will:
- validate correctness for all backend implementations of
dot, - support contributors in implementing and optimizing dot product kernels,
- reinforce the project’s emphasis on numerical equivalence across backends.
Related work
- Existing tests:
tests/test_copy.py,tests/test_swap.py. - BLAS
dottest suites in other numerical libraries.
Additional context
This issue is part of filling in the dot row of the README BLAS table, specifically the Test column.
Metadata
Metadata
Assignees
Labels
No labels