XFaiss
Faiss is Meta’s open-source library for efficient similarity search and clustering of dense vectors, widely used for large-scale ANN (approximate nearest neighbor) search.
XFaiss adds MU device acceleration on top of Faiss. Based on Faiss 1.13.0, it works as a drop-in replacement — accelerate search on MX1 with minimal code changes and existing .faiss index files. Internally, XFaiss uses libxvector-dev (the XVector API Reference) for device communication and kernel execution.
Supported Index Types
| Index | Base Class | Description |
|---|---|---|
| MuIndexIVFFlat | faiss::IndexIVFFlat | IVF-Flat with device-accelerated fine search |
| MuIndexIVFRaBitQ | faiss::IndexIVFRaBitQ | IVF-RaBitQ with device-accelerated fine search |
| MuIndexFlat | faiss::IndexFlat | Brute-force exact KNN with device-accelerated search |
| MuIndexHNSWFlat | faiss::IndexHNSWFlat | HNSW-Flat graph search on the device [experimental] |
How It Works
Faiss supports GPU offloading — wrapping a CPU index with a GPU index class to accelerate search on NVIDIA GPUs. XFaiss applies the same pattern for MU (MX1): wrap a CPU index with an MU index class to offload the compute-intensive fine search to the MU device.
| Faiss GPU | XFaiss MU | Role |
|---|---|---|
GpuResources | MuResources | Device resource management |
GpuIndexIVFFlat | MuIndexIVFFlat | IVF-Flat index with device acceleration |
index_cpu_to_gpu() | Constructor + syncToMuDevice() | Transfer index data to device |
Setup
Before search, the application initializes MU resources and transfers index data to the device:
makeMuResources()— connect to the MU device and load XVector kernels- Construct an MU index (e.g.,
MuIndexIVFFlat) from an existing Faiss CPU index syncToMuDevice()— copy index data from CPU memory to device memory
Future Work
In the future, indexes may be created directly in CXL memory, significantly reducing CPU-to-device copy overhead and making this step optional.
Once setup is complete, the MU index is ready to handle search requests.
Search
For the IVF indexes (MuIndexIVFFlat, MuIndexIVFRaBitQ), each search executes in two phases:
- Coarse search (CPU) — the Faiss quantizer selects the top-nprobe candidate clusters
- Fine search (MU device) — XVector kernels compute distances for all vectors within the selected clusters and return the top-k results
The non-IVF indexes run entirely on the device:
MuIndexFlat— a full brute-force scan over all vectors on the MU device.MuIndexHNSWFlat(experimental) — HNSW graph traversal on the MU device. The graph is built on the CPU duringadd()and uploaded bysyncToMuDevice(). The device kernel uses fixed-size trackers, so both k andefSearchmust be in the range [1, 256];efSearchis raised to at least k to match the CPU path.
Next Steps
- Quick Start — build, prepare data, and run benchmarks