Skip to content

Conversation

@Ionizing
Copy link

Hi RSTSR maintainers,

As discussed in RESTGroup/rstsr-ffi#10, I was interested in exploring whether the Apple Accelerate Framework could serve as a BLAS/LAPACK backend for RSTSR. After some experimentation, I was able to get it working by reusing parts of the existing lapack-ffi, rstsr-openblas, and rstsr-blis implementations. With this PR, macOS users can enable Accelerate support simply by adding features = ["accelerate"] to rstsr and including rstsr-accelerate in their Cargo.toml—no custom build.rs required.

However, the current implementation still has a few limitations:

  1. Threading support
    Prior to macOS 15 (Sequoia), threading can only be controlled via environment variables, and explicit set_num_threads-style APIs are only available starting in macOS 15. For now, all threading-related functions are stubbed out, so set_num_threads is effectively a no-op.

  2. One failing LAPACK test
    Running

    cargo test -p rstsr-accelerate --features="linalg" -r

    results in a single test failure (output below). I'm not sure whether this is an Accelerate issue or something that requires adjustment on our side; possibly it should be reported to Apple.

    ---- test_driver_impl::lapack_solve_f64::test::test_dpotrf stdout ----
    fingerprint 35.17266259473024
    fingerprint -49.61056912811463
    
    thread 'test_driver_impl::lapack_solve_f64::test::test_dpotrf' panicked at crates-device/rstsr-accelerate/tests/test_driver_impl/lapack_solve_f64.rs:65:9:
    assertion failed: (fingerprint(&c) - -53.53353704132017).abs() < 1e-8
    
  3. No LAPACKE support
    Accelerate does not provide LAPACKE bindings, so the corresponding Cargo feature has been removed.

I’m not expecting this PR to be merged immediately—feedback, suggestions, and improvements are all very welcome.

Looking forward to your thoughts!

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