Skip to content

[FEATURE REQUEST] geru test coverage and fixtures #29

@LoserCheems

Description

@LoserCheems

Problem statement

The geru kernel currently has no dedicated tests under tests/. There is no test_geru.py to validate that all backends correctly implement the rank-1 update $A = A + \alpha x y^\top$.

Without geru tests:

  • regressions or subtle bugs in any backend may go unnoticed,
  • CI cannot guarantee numerical equivalence with the Python reference,
  • the README BLAS table cannot mark the Test column for geru as complete.

Proposed solution

Add a dedicated pytest module for geru that validates all available backends against the Python reference implementation.

Concretely:

  • Introduce tests/test_geru.py alongside other kernel tests.
  • For each backend (Python, PyTorch, Triton, CuTe as available), compare outputs with the Python geru reference across various matrix sizes and vector shapes.
  • Cover edge cases such as zero scalars, small matrices, and large magnitude values.

Alternatives considered

Manual or informal testing is not sufficient because it:

  • is easy to skip,
  • does not integrate with CI,
  • fails to provide consistent regression coverage.

Implementation details

  • Add tests/test_geru.py using pytest conventions.
  • Reuse any shared helpers for random input generation and comparison.
  • Parameterize tests over matrix dimensions, dtypes, and scalar values.
  • Gracefully skip backend-specific tests when backends are unavailable or not yet implemented.

Use case

The geru tests will:

  • enforce correctness for geru across all backends,
  • support contributors implementing or optimizing rank-1 update kernels,
  • align with the project’s emphasis on numerical equivalence.

Related work

  • Existing tests: tests/test_copy.py, tests/test_swap.py.
  • BLAS geru test suites in other libraries.

Additional context

This issue is part of completing the geru row in the README BLAS table, especially the Test column.

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