ColinLeeo opened a new pull request, #16795: URL: https://github.com/apache/lucene/pull/16795
### Description `NativeVectorUtilSupport` is normally exercised only when a native library is supplied explicitly. This adds Java-backed method handles so the regular core test suite can exercise native dispatch, argument and result handling, and fallback behavior without a C binary. This implements the Java-side scope agreed in https://github.com/apache/lucene/issues/15840#issuecomment-5637691541. Relates to #15840. - Group the 22 native function handles in an injectable `NativeFunctions` object and defer real library linking when test handles are supplied. - Reuse the existing vector tests with all, none, or a subset of native symbols available. Check the selected call path as well as results, length arguments, in-place updates, and propagation of invocation failures. Include the Float16 and `int4Unpack` fallback paths. - Correct the byte cosine descriptor and invocation to return `float`, with a fractional-result regression test. Fix the int4 square-distance boundary test that previously called dot-product operations. The Java-backed tests preserve the existing length conventions: pairwise helpers receive the first segment's byte size; the other operations receive their element counts or range bounds. They do not validate a C ABI. Real library loading, symbol resolution, FFM downcalls, and direct testing of the static `MemorySegment` entry points remain follow-up work. ### Validation On macOS AArch64 with Temurin 25.0.4.1, after merging `apache/lucene:main` at `d1f4b8243a`: ```sh ./gradlew :lucene:core:test \ --tests 'org.apache.lucene.internal.vectorization.*' \ --tests 'org.apache.lucene.util.TestVectorUtil' \ -Ptests.defaultvectorization=true ./gradlew :lucene:core:check -x test ``` - 1,838 tests, zero failures/errors, 65 expected skips: 64 even-dimension assumptions and one disabled monster test. Random seed: `431AD5E7D56CCBBD`. - Core checks passed, including Google Java Format, ECJ lint, forbidden APIs, licenses, and generated-file checksums. The full repository test suite has not been run locally. - A local JaCoCo report including the `main25` classes shows all 26 `VectorUtilSupport` instance methods and the invocation helpers fully covered for instructions and branches. This is not a claim of full-class coverage: the static segment entry points and native library holder remain uncovered by the Java-only suite. - Local validation used a temporary init script to include `main25` in the coverage report and supply an unchanged, checksum-verified Gradle plugin artifact after a local TLS download failure. No dependency versions or build configuration were changed in this PR. ### Review status Prepared with Codex assistance under the author's direction. This draft is for the author's review of the implementation, test results, and description before marking it ready for review. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
