Skip to content

perf: optional FFI-backed BLAS backend for multiply/sum #11

Closed

Description

@lisachenko

The original README roadmap mentioned "native SSE/AVX assembly methods". A realistic modern take: bind libopenblas/cblas via FFI as an optional fast path for multiply() and sum() on large matrices, keeping the pure-PHP loops as the portable fallback (feature-detect the shared library at bootstrap).

Scope: experimental; should ship with a performance-group benchmark comparing both paths, and must not add a hard dependency — the library stays pure-PHP by default.

Activity

  1. lisachenko commented on Oct 19, 2026

    @lisachenko
    OwnerAuthor

    Delivered by #19, which shipped this as a full driver architecture: OpenBLAS over FFI (cblas_dgemm/daxpy/dscal) as the optional fast path for multiplication, addition, subtraction and scalar operations — plus a CLBlast/OpenCL GPU driver behind the same interface. Availability is feature-detected at runtime with a real 1×1 probe, the pure-PHP array loops remain the portable fallback (auto routing, with mid-operation fallback), system libraries are suggest-only so there is no hard dependency, and composer bench compares the paths — measured tables are in the README (up to ~×1,900 on 1024² GEMM).


    Generated by Claude Code

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions