-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Added Gating so VectorScorerInt4BenchmarkTests and VectorScorerInt4BulkBenchmarkTests Ignored on Java 21 #145060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,8 @@ | |
|
|
||
| import java.util.Arrays; | ||
|
|
||
| import static org.elasticsearch.benchmark.vector.scorer.BenchmarkUtils.supportsHeapSegments; | ||
|
|
||
| public class VectorScorerInt4BenchmarkTests extends ESTestCase { | ||
|
|
||
| private final double delta = 1e-3; | ||
|
|
@@ -48,17 +50,25 @@ public void testScores() throws Exception { | |
| for (int i = 0; i < 100; i++) { | ||
| var data = new VectorScorerInt4Benchmark.VectorData(dims); | ||
| var scalar = createBench(VectorImplementation.SCALAR, data); | ||
| var lucene = createBench(VectorImplementation.LUCENE, data); | ||
| var nativeBench = createBench(VectorImplementation.NATIVE, data); | ||
| VectorScorerInt4Benchmark lucene = null; | ||
| VectorScorerInt4Benchmark nativeBench = null; | ||
| if (supportsHeapSegments()) { | ||
| lucene = createBench(VectorImplementation.LUCENE, data); | ||
| nativeBench = createBench(VectorImplementation.NATIVE, data); | ||
| } | ||
|
|
||
| try { | ||
| float expected = scalar.score(); | ||
| assertEquals("LUCENE score", expected, lucene.score(), delta); | ||
| assertEquals("NATIVE score", expected, nativeBench.score(), delta); | ||
| if (supportsHeapSegments()) { | ||
| assertEquals("LUCENE score", expected, lucene.score(), delta); | ||
| assertEquals("NATIVE score", expected, nativeBench.score(), delta); | ||
| } | ||
| } finally { | ||
| scalar.teardown(); | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| if (supportsHeapSegments()) { | ||
| lucene.teardown(); | ||
|
Comment on lines
61
to
+69
|
||
| nativeBench.teardown(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -67,17 +77,25 @@ public void testQueryScores() throws Exception { | |
| for (int i = 0; i < 100; i++) { | ||
| var data = new VectorScorerInt4Benchmark.VectorData(dims); | ||
| var scalar = createBench(VectorImplementation.SCALAR, data); | ||
| var lucene = createBench(VectorImplementation.LUCENE, data); | ||
| var nativeBench = createBench(VectorImplementation.NATIVE, data); | ||
| VectorScorerInt4Benchmark lucene = null; | ||
| VectorScorerInt4Benchmark nativeBench = null; | ||
| if (supportsHeapSegments()) { | ||
| lucene = createBench(VectorImplementation.LUCENE, data); | ||
| nativeBench = createBench(VectorImplementation.NATIVE, data); | ||
| } | ||
|
|
||
| try { | ||
| float expected = scalar.scoreQuery(); | ||
| assertEquals("LUCENE scoreQuery", expected, lucene.scoreQuery(), delta); | ||
| assertEquals("NATIVE scoreQuery", expected, nativeBench.scoreQuery(), delta); | ||
| if (supportsHeapSegments()) { | ||
| assertEquals("LUCENE scoreQuery", expected, lucene.scoreQuery(), delta); | ||
| assertEquals("NATIVE scoreQuery", expected, nativeBench.scoreQuery(), delta); | ||
| } | ||
| } finally { | ||
| scalar.teardown(); | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| if (supportsHeapSegments()) { | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,8 @@ | |
|
|
||
| import java.util.Arrays; | ||
|
|
||
| import static org.elasticsearch.benchmark.vector.scorer.BenchmarkUtils.supportsHeapSegments; | ||
|
|
||
| public class VectorScorerInt4BulkBenchmarkTests extends ESTestCase { | ||
|
|
||
| private final VectorSimilarityType function; | ||
|
|
@@ -52,17 +54,25 @@ public void testSequential() throws Exception { | |
| for (int i = 0; i < 100; i++) { | ||
| var vectorData = new VectorScorerInt4BulkBenchmark.VectorData(dims, 1000, 200); | ||
| var scalar = createBench(VectorImplementation.SCALAR, vectorData); | ||
| var lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| var nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| VectorScorerInt4BulkBenchmark lucene = null; | ||
| VectorScorerInt4BulkBenchmark nativeBench = null; | ||
| if (supportsHeapSegments()) { | ||
| lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| } | ||
|
|
||
| try { | ||
| float[] expected = scalar.scoreMultipleSequential(); | ||
| assertArrayEquals("LUCENE sequential", expected, lucene.scoreMultipleSequential(), delta); | ||
| assertArrayEquals("NATIVE sequential", expected, nativeBench.scoreMultipleSequential(), delta); | ||
| if (supportsHeapSegments()) { | ||
| assertArrayEquals("LUCENE sequential", expected, lucene.scoreMultipleSequential(), delta); | ||
| assertArrayEquals("NATIVE sequential", expected, nativeBench.scoreMultipleSequential(), delta); | ||
| } | ||
| } finally { | ||
| scalar.teardown(); | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| if (supportsHeapSegments()) { | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -71,17 +81,25 @@ public void testRandom() throws Exception { | |
| for (int i = 0; i < 100; i++) { | ||
| var vectorData = new VectorScorerInt4BulkBenchmark.VectorData(dims, 1000, 200); | ||
| var scalar = createBench(VectorImplementation.SCALAR, vectorData); | ||
| var lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| var nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| VectorScorerInt4BulkBenchmark lucene = null; | ||
| VectorScorerInt4BulkBenchmark nativeBench = null; | ||
| if (supportsHeapSegments()) { | ||
| lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| } | ||
|
|
||
| try { | ||
| float[] expected = scalar.scoreMultipleRandom(); | ||
| assertArrayEquals("LUCENE random", expected, lucene.scoreMultipleRandom(), delta); | ||
| assertArrayEquals("NATIVE random", expected, nativeBench.scoreMultipleRandom(), delta); | ||
| if (supportsHeapSegments()) { | ||
| assertArrayEquals("LUCENE random", expected, lucene.scoreMultipleRandom(), delta); | ||
| assertArrayEquals("NATIVE random", expected, nativeBench.scoreMultipleRandom(), delta); | ||
| } | ||
| } finally { | ||
| scalar.teardown(); | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| if (supportsHeapSegments()) { | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -90,17 +108,25 @@ public void testQueryRandom() throws Exception { | |
| for (int i = 0; i < 100; i++) { | ||
| var vectorData = new VectorScorerInt4BulkBenchmark.VectorData(dims, 1000, 200); | ||
| var scalar = createBench(VectorImplementation.SCALAR, vectorData); | ||
| var lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| var nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| VectorScorerInt4BulkBenchmark lucene = null; | ||
| VectorScorerInt4BulkBenchmark nativeBench = null; | ||
| if (supportsHeapSegments()) { | ||
| lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| } | ||
|
|
||
| try { | ||
| float[] expected = scalar.scoreQueryMultipleRandom(); | ||
| assertArrayEquals("LUCENE queryRandom", expected, lucene.scoreQueryMultipleRandom(), delta); | ||
| assertArrayEquals("NATIVE queryRandom", expected, nativeBench.scoreQueryMultipleRandom(), delta); | ||
| if (supportsHeapSegments()) { | ||
| assertArrayEquals("LUCENE queryRandom", expected, lucene.scoreQueryMultipleRandom(), delta); | ||
| assertArrayEquals("NATIVE queryRandom", expected, nativeBench.scoreQueryMultipleRandom(), delta); | ||
| } | ||
| } finally { | ||
| scalar.teardown(); | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| if (supportsHeapSegments()) { | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -109,17 +135,25 @@ public void testSequentialBulk() throws Exception { | |
| for (int i = 0; i < 100; i++) { | ||
| var vectorData = new VectorScorerInt4BulkBenchmark.VectorData(dims, 1000, 200); | ||
| var scalar = createBench(VectorImplementation.SCALAR, vectorData); | ||
| var lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| var nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| VectorScorerInt4BulkBenchmark lucene = null; | ||
| VectorScorerInt4BulkBenchmark nativeBench = null; | ||
| if (supportsHeapSegments()) { | ||
| lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| } | ||
|
|
||
| try { | ||
| float[] expected = scalar.scoreMultipleSequentialBulk(); | ||
| assertArrayEquals("LUCENE sequentialBulk", expected, lucene.scoreMultipleSequentialBulk(), delta); | ||
| assertArrayEquals("NATIVE sequentialBulk", expected, nativeBench.scoreMultipleSequentialBulk(), delta); | ||
| if (supportsHeapSegments()) { | ||
| assertArrayEquals("LUCENE sequentialBulk", expected, lucene.scoreMultipleSequentialBulk(), delta); | ||
| assertArrayEquals("NATIVE sequentialBulk", expected, nativeBench.scoreMultipleSequentialBulk(), delta); | ||
| } | ||
| } finally { | ||
| scalar.teardown(); | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| if (supportsHeapSegments()) { | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -128,36 +162,53 @@ public void testRandomBulk() throws Exception { | |
| for (int i = 0; i < 100; i++) { | ||
| var vectorData = new VectorScorerInt4BulkBenchmark.VectorData(dims, 1000, 200); | ||
| var scalar = createBench(VectorImplementation.SCALAR, vectorData); | ||
| var lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| var nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| VectorScorerInt4BulkBenchmark lucene = null; | ||
| VectorScorerInt4BulkBenchmark nativeBench = null; | ||
| if (supportsHeapSegments()) { | ||
| lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| } | ||
|
|
||
| try { | ||
| float[] expected = scalar.scoreMultipleRandomBulk(); | ||
| assertArrayEquals("LUCENE randomBulk", expected, lucene.scoreMultipleRandomBulk(), delta); | ||
| assertArrayEquals("NATIVE randomBulk", expected, nativeBench.scoreMultipleRandomBulk(), delta); | ||
| if (supportsHeapSegments()) { | ||
| assertArrayEquals("LUCENE randomBulk", expected, lucene.scoreMultipleRandomBulk(), delta); | ||
| assertArrayEquals("NATIVE randomBulk", expected, nativeBench.scoreMultipleRandomBulk(), delta); | ||
| } | ||
| } finally { | ||
| scalar.teardown(); | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| if (supportsHeapSegments()) { | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public void testQueryRandomBulk() throws Exception { | ||
|
|
||
| for (int i = 0; i < 100; i++) { | ||
| var vectorData = new VectorScorerInt4BulkBenchmark.VectorData(dims, 1000, 200); | ||
| var scalar = createBench(VectorImplementation.SCALAR, vectorData); | ||
| var lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| var nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| VectorScorerInt4BulkBenchmark lucene = null; | ||
| VectorScorerInt4BulkBenchmark nativeBench = null; | ||
| if (supportsHeapSegments()) { | ||
| lucene = createBench(VectorImplementation.LUCENE, vectorData); | ||
| nativeBench = createBench(VectorImplementation.NATIVE, vectorData); | ||
| } | ||
|
|
||
| try { | ||
| float[] expected = scalar.scoreQueryMultipleRandomBulk(); | ||
| assertArrayEquals("LUCENE queryRandomBulk", expected, lucene.scoreQueryMultipleRandomBulk(), delta); | ||
| assertArrayEquals("NATIVE queryRandomBulk", expected, nativeBench.scoreQueryMultipleRandomBulk(), delta); | ||
| if (supportsHeapSegments()) { | ||
| assertArrayEquals("LUCENE queryRandomBulk", expected, lucene.scoreQueryMultipleRandomBulk(), delta); | ||
| assertArrayEquals("NATIVE queryRandomBulk", expected, nativeBench.scoreQueryMultipleRandomBulk(), delta); | ||
| } | ||
|
Comment on lines
188
to
+205
|
||
| } finally { | ||
| scalar.teardown(); | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| if (supportsHeapSegments()) { | ||
| lucene.teardown(); | ||
| nativeBench.teardown(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR title/description says these tests are "ignored on Java 21", but this change only conditionally skips creating lucene/native benches and assertions; the test methods still execute and will report as passing rather than skipped on Java 21. If the intent is to truly ignore/skip on Java 21, consider using an assumption (assumeTrue/assumeFalse) or a JUnit ignore/conditional mechanism so CI reflects the tests as skipped.