Skip to content

Request for NEON/SVE Optimized Implementations for ARM in HNSWlib #637

Open

Description

@ThatikondV

Hii,

I’m currently working on performance optimization of Milvus on ARM architectures, and since Milvus internally leverages Knowhere, which in turn uses HNSWlib for the HNSW index, I’ve been analyzing the end-to-end execution flow.

While going through the source code (particularly space_l2.h and space_ip.h), I noticed that:

  • HNSWlib currently does not contain any architecture-specific vectorized kernels (e.g., NEON or SVE for ARM).

  • The existing distance computation functions (for L2 and Inner Product) are implemented using scalar C++ loops, and rely purely on compiler auto-vectorization.

  • This leads to suboptimal performance on ARM compared to x86 builds, where other ecosystems (e.g., FAISS) sometimes include architecture-tuned kernels (SSE/AVX).

My questions:

  • Is there any plan to include NEON or SVE-optimized kernels for ARM platforms (especially for the distance functions inside space_l2.h and space_ip.h)?

  • If not yet planned, would the maintainers be open to a contribution/PR that introduces such ARM-specific optimizations (behind compile-time flags like __ARM_NEON / __ARM_FEATURE_SVE)?

  • Are there any ongoing discussions or design considerations around this that I can align with before starting the implementation?

Activity

  1. pmiloslavsky commented on May 14, 2026

    @pmiloslavsky

    See #668 The c code for inner product was slightly wrong and therefore arm could not generate SIMD but now it can.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions