apache / apache/lucene

Should we separate Panama and Vectorization classes?

Open
#15,284 1 comment 0 reactions 1 assignee Claimed by @uschindler View on GitHub
type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

Java's Panama API was finalized in JDK22, which makes it possible to access both on and off-heap memory without special MR-JAR requirements in Lucene

However for vector search, our code for Panama + Vector API is tightly coupled (see [`PanamaVectorUtilSupport`](https://github.com/apache/lucene/blob/602bfbd9af0ee9027de45c1572527eee6b073841/lucene/core/src/java25/org/apache/lucene/internal/vectorization/PanamaVectorUtilSupport.java#L57)) -- so a user can only benefit from off-heap improvements when they have vectorization enabled (`--add-modules jdk.incubator.vector`)

Should we separate classes for the two? This would mean having all vector comparisons support on and off-heap versions, and only keeping functions related to vectorization in `java25/` (i.e. in an MR-JAR)

IMO it would provide a cleaner separation of functionality and simplify code a bit too (for e.g. we can move classes like [`Lucene99MemorySegmentByteVectorScorer`](https://github.com/apache/lucene/blob/602bfbd9af0ee9027de45c1572527eee6b073841/lucene/core/src/java25/org/apache/lucene/internal/vectorization/Lucene99MemorySegmentByteVectorScorer.java#L30) out of `java25/`) + users that do not enable vectorization can score vectors off-heap

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.