Skip to content

tsinghua-ideal/ANSMET

Repository files navigation

ANSMET

ANSMET is a HW-SW co-design that integrates near-data processing architectures with a novel hybrid partial-dimension/bit early termination strategy to accelerate approximate nearest neighbor search.

Getting Started

Prerequisites

  • The ANSMET simulator is built upon Ramulator 2.0 and hnswlib
  • A C++20 compatible compiler is required for building Ramulator 2.0

Setting up

Clone the repository:

  $ git clone https://github.com/tsinghua-ideal/ANSMET

Build up the executable:

  $ mkdir build
  $ cd build
  $ cmake ..
  $ make -j
  $ cd ..

This should generate a ramulator2 executable.

To run a testcase:

  $ cd run-template
  $ ./run.sh cpu.yaml # CPU baseline
  $ ./run.sh ansmet.yaml # ANSMET

If configured correctly, the terminal will display the execution output. You should see the simulated memory cycle improvement using ANSMET.

Dataset Preparation

We have incorporated a small dataset in datasets folder. Please refer to our paper for more dataset download links.

After downloaded, we use hnswlib to export to .bin file, please refer to https://github.com/nmslib/hnswlib/blob/master/examples/python/EXAMPLES.md

Test Case Management

Batch Execution

We provide shell scripts to automate testing across different datasets and parameters:

  $ ./run_k_1.sh # top_k = 1 
  $ ./run_k_5.sh # top_k = 5
  $ ./run_k_10.sh # top_k = 10

Note: The required YAML configuration files are automatically generated by ./yaml_generate/generate_yamls.py

Custom Test Cases

You can create custom test cases by modifying parameters in the YAML configuration files:

  • earlyExitEnable: Enables early termination when True

  • allowSample: Enables sampling and dual-granularity fetch when True

  • allowoutlier: Enables common prefix elimination when True

Citation

If you use this codebase, please cite:

@misc{ansmet_isca25,
    author = {Yiwei Li and Yuxin Jin and Boyu Tian and Huanchen Zhang and Mingyu Gao},
    title = {{ANSMET: Approximate Nearest Neighbor Search with Near-Memory Processing and Hybrid Early Termination}},
    booktitle = {52nd International Symposium on Computer Architecture (ISCA)},
    year = {2025},
    month = {Jun},
    location = {Tokyo, Japan},
}

About

An accelerator for high-dimensional approximate nearest neighbor search

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors