opensearch-project / opensearch-project/neural-sparse-cpp
[FEATURE] Extend GPU build acceleration to the scalar-quantized Seismic indexes
Nobody has claimed this yet.
- 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 requireselement_size == U32.nsparse/cluster/inverted_list_clusters.cpp:133—summarize_with_gpu_<T>()bails unlessTisfloat.
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
- Support
U8/U16in the assignment kernel (convert codes to float on upload, or use an integer SpMM). - Templatize the max-pool kernel over code width (
atomicMaxonunsigned intreplaces the__float_as_inttrick). - Keep bit-identical CPU parity and CPU fallback; add
U8/U16parity tests. - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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