-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Integrate the Incubating Panama Vector API #12311
Merged
+1,025
−179
Merged
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
a02161a
Include the Panama Vector API stubs in the generated 19/20 api jars
ChrisHegarty aad69f9
first dotProduct implementation
ChrisHegarty ab6300b
fix dimensions check
ChrisHegarty d49100c
merge Robert's dotProduct implementation
ChrisHegarty a714486
remove public
ChrisHegarty 39bbc4d
remove doPriv and restructure module lookup
ChrisHegarty 3edee15
remove unnecessary jvmArgs
ChrisHegarty 030babd
Move DefaultVectorUtilProvider to it's own top-level class - since it…
ChrisHegarty 927f1c7
refactor the provider and impl into a separate package
ChrisHegarty 99f7e41
move to non-exported internal package
ChrisHegarty 7b58a64
disable assertions in jdk.incubator.vector.LaneType
ChrisHegarty abb5979
revert assertion disablement. Check locale is workable
ChrisHegarty 45b660f
Make sure to use UTC timezone when creating ZIP, so file reproduces o…
uschindler 89bc0b5
Merge branch 'main' into panama_vector
uschindler 0779fcb
simplify locale sensitive check - as per Uwe's suggestion
ChrisHegarty d3fe388
move back into util package, and make package-private. Some minor ren…
ChrisHegarty 27ea8f2
Better filter classes and configure modules to include by java version
uschindler 568a0c0
Remove unused code
uschindler bd9f479
Remove comment
uschindler 74e6eb3
Only enable the vector module in Java 20
uschindler d6ff862
Further simplify extractor (and fix a bug where supers and interfaces…
uschindler 45c00ae
Use a TreeMap of class names instead of sorting files. This also make…
uschindler f0c36f7
Print error on misconfiguration
uschindler 3ed660f
Add warnings when vector module is note enabled or Lucene is running …
uschindler f1d4aad
tidy
uschindler afc3d55
speed up vector computation: more efficient reduction, 4x unrolling
rmuir b051a52
spotless
rmuir 3a6cb81
vectorize the dotproduct(byte[], byte[]), initial impl
rmuir 026091b
speed up dotproduct(byte[],byte[]) on 128bit vectors
rmuir 956d402
speed up avx512 dotproduct(byte[],byte[])
rmuir 83c26d8
add vectorized binary euclidean and cosine functions
rmuir 2ca381b
remove bad javadocs sentence
rmuir 38fe5c5
add vectorized float euclidean and cosine impls
rmuir 8708251
INT_SPECIES_PREFERRED_BIT_SIZE
ChrisHegarty 11e6634
remove comments
ChrisHegarty 97ebe5b
Cleanup and rename constants and move to top of class file
uschindler 919f0e4
Add a test comparing both providers (if available)
uschindler c8e5b6a
DELTA should be double to match signatures
uschindler 609fc9b
Fix wrongly-named test parameter
uschindler 74a9782
disable when vector bit size < 128
ChrisHegarty 32a2a58
Use a varhandle to read the preferred vector size (spares extra catch…
uschindler e174526
Change loglevel to INFO like MMapDir
uschindler 3007a61
Move success logging to after finding constructor (calling ctor canno…
uschindler 1681757
Move logging to constructor of provider (like in MMap)
uschindler f9711e9
Move all logic to the provider class. It thows UOE on constructor if …
uschindler 87348cf
try to prevent using vector api if c2 is disabled. untested, please d…
rmuir 2b57e7d
satisfy linter
rmuir 5d0206c
Add accesscontroller when reading sysprop; refactor code
uschindler fc0a79a
on CI builds don't disable C2 and pass no extra args to VM
uschindler 6ecf445
Remove check (we bail out in ctor already)
uschindler 6a18ba3
JDK-8301190 is fixed in 20.0.2, only disable prior to that update
ChrisHegarty 5a54f9e
spotless
ChrisHegarty e3ea49f
Restructure the "Turkish vector bug"
uschindler 1cd15f3
Remove throws clause (relic)
uschindler e898401
don't use integer vectors on x86 unless we have AVX2 or AVX3
rmuir 8da5432
Rename some gradle files and apijars
uschindler fe8abaf
Track references to superclasses and interfaces correctly
uschindler 8a6a33c
add changes
uschindler dd4eaac
Merge remote-tracking branch 'remotes/origin/main' into panama_vector
uschindler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
lucene/core/src/java20/org/apache/lucene/util/JDKVectorUtilProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.lucene.util; | ||
|
||
import jdk.incubator.vector.FloatVector; | ||
import jdk.incubator.vector.VectorOperators; | ||
import jdk.incubator.vector.VectorSpecies; | ||
|
||
public final class JDKVectorUtilProvider implements VectorUtil.VectorUtilProvider { | ||
ChrisHegarty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
static final VectorSpecies<Float> SPECIES = FloatVector.SPECIES_PREFERRED; | ||
|
||
public JDKVectorUtilProvider() {} | ||
|
||
@Override | ||
public float dotProduct(float[] a, float[] b) { | ||
var upperBound = SPECIES.loopBound(a.length); | ||
var sum = FloatVector.zero(SPECIES); | ||
var i = 0; | ||
for (; i < upperBound; i += SPECIES.length()) { | ||
var va = FloatVector.fromArray(SPECIES, a, i); | ||
var vb = FloatVector.fromArray(SPECIES, b, i); | ||
sum = va.fma(vb, sum); | ||
} | ||
var c = sum.reduceLanes(VectorOperators.ADD); | ||
for (; i < a.length; i++) { // tail loop | ||
c += a[i] * b[i]; | ||
} | ||
return c; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we can live with this. If so, then we should have a more suitable comment.
// just patch into java.base since that is already resolved and present
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.
I agree, it is a hack, but we should maybe say "it's ok because it works for compilation and has no effect on runtime or classfile output.
Renaming the apijars to be more general should be a separate PR as it needs aligning and conflict resolution with the already open java 21 one for mmap.