opensearch-project / opensearch-project/neural-sparse-cpp

[FEATURE] Extend GPU build acceleration to the scalar-quantized Seismic indexes

Open
#57 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement untriaged
Dominant language
C++
Stars
2
Forks
7
Avg merge
15h 56m
Merged PRs (30d)
22

Description

Problem

GPU build acceleration only applies to SeismicIndex / DiskSeismicIndex. The scalar-quantized variants silently fall back to CPU, because both offloads are gated on float (U32) weights while quantized indexes store uint8/uint16 codes:

  • nsparse/cluster/kmeans_utils.cpp:176 — assignment offload requires element_size == U32.
  • nsparse/cluster/inverted_list_clusters.cpp:133summarize_with_gpu_<T>() bails unless T is float.

All four types share build_clustered_lists(), so nothing else blocks it. No warning is emitted, so the build looks GPU-enabled but runs on CPU.

Proposal
  1. Support U8/U16 in the assignment kernel (convert codes to float on upload, or use an integer SpMM).
  2. Templatize the max-pool kernel over code width (atomicMax on unsigned int replaces the __float_as_int trick).
  3. Keep bit-identical CPU parity and CPU fallback; add U8/U16 parity tests.
  4. Meanwhile, warn once when a GPU build sees quantized weights.

For scale: the float path gives ~6x on base_full (483s → 75s, L4 vs 32-core).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with nsparse/cluster/kmeans_utils.cpp:176 and nsparse/cluster/inverted_list_clusters.cpp:133, then trace the shared build_clustered_lists() path. Compare the existing float GPU path with scalar-quantized U8/U16 data and verify CPU parity, fallback behavior, and the requested one-time warning. Add parity coverage for both code widths and run the relevant build and test commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.