-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Decode doc ids in BKD leaves with auto-vectorized loops #14203
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
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
97af1d2
bpv24
gf2121 617cec7
only reduce virtual call
gf2121 c72f9f4
iter
gf2121 4446855
jmh
gf2121 b031449
iter
gf2121 e7a3056
stash
gf2121 10511a2
e2e benchmark
gf2121 bb1b923
bwc issue
gf2121 28cb597
jmh fix
gf2121 62c214f
fix
gf2121 d977c02
iter
gf2121 c5653f6
license
gf2121 9bf0870
iter
gf2121 3c91bf3
add license
gf2121 a474043
add java doc
gf2121 5c4e1e9
private
gf2121 6f8fc2b
simplify
gf2121 654f0a6
add CHANGES
gf2121 6273aa9
iter
gf2121 285ae58
Merge branch 'main' into vector_bpv24
gf2121 5ee86c9
iter
gf2121 decf31b
iter
gf2121 114d677
iter
gf2121 4b5e2f2
iter
gf2121 ae65f61
inner loop
gf2121 5eea20a
profile
gf2121 bac612b
tidy
gf2121 da73235
inner loop iter
gf2121 158b939
stash
gf2121 7c21d47
refactor to inner loop
gf2121 6de960c
unnecessary diff
gf2121 7d3adf3
fix test
gf2121 38c2ef0
show benchmark code
gf2121 ec87c3c
specialized decoding for DEFAULT_MAX_POINTS_IN_LEAF_NODE
gf2121 3766875
unnecessary diff
gf2121 908de60
drop BKDCodecBenchmark as well
gf2121 eb14ddd
add more chance to test BKDConfig.DEFAULT_MAX_POINTS_IN_LEAF_NODE
gf2121 346210c
no more public
gf2121 be09930
review iter
gf2121 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -85,7 +85,8 @@ public class BKDWriter implements Closeable { | |
public static final int VERSION_SELECTIVE_INDEXING = 6; | ||
public static final int VERSION_LOW_CARDINALITY_LEAVES = 7; | ||
public static final int VERSION_META_FILE = 9; | ||
public static final int VERSION_CURRENT = VERSION_META_FILE; | ||
public static final int VERSION_VECTORIZED_DOCID = 10; | ||
public static final int VERSION_CURRENT = VERSION_VECTORIZED_DOCID; | ||
|
||
/** Number of splits before we compute the exact bounding box of an inner node. */ | ||
private static final int SPLITS_BEFORE_EXACT_BOUNDS = 4; | ||
|
@@ -103,6 +104,7 @@ public class BKDWriter implements Closeable { | |
final TrackingDirectoryWrapper tempDir; | ||
final String tempFileNamePrefix; | ||
final double maxMBSortInHeap; | ||
final int version; | ||
|
||
final byte[] scratchDiff; | ||
final byte[] scratch; | ||
|
@@ -139,6 +141,29 @@ public BKDWriter( | |
BKDConfig config, | ||
double maxMBSortInHeap, | ||
long totalPointCount) { | ||
this( | ||
maxDoc, | ||
tempDir, | ||
tempFileNamePrefix, | ||
config, | ||
maxMBSortInHeap, | ||
totalPointCount, | ||
BKDWriter.VERSION_CURRENT); | ||
} | ||
|
||
/** This ctor should be only used for testing with older versions. */ | ||
public BKDWriter( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add javadocs that this ctor should be only used for testing with older versions? |
||
int maxDoc, | ||
Directory tempDir, | ||
String tempFileNamePrefix, | ||
BKDConfig config, | ||
double maxMBSortInHeap, | ||
long totalPointCount, | ||
int version) { | ||
if (version < VERSION_START || version > VERSION_CURRENT) { | ||
throw new IllegalArgumentException("Version out of range: " + version); | ||
} | ||
this.version = version; | ||
verifyParams(maxMBSortInHeap, totalPointCount); | ||
// We use tracking dir to deal with removing files on exception, so each place that | ||
// creates temp files doesn't need crazy try/finally/sucess logic: | ||
|
@@ -165,7 +190,7 @@ public BKDWriter( | |
|
||
// Maximum number of points we hold in memory at any time | ||
maxPointsSortInHeap = (int) ((maxMBSortInHeap * 1024 * 1024) / (config.bytesPerDoc())); | ||
docIdsWriter = new DocIdsWriter(config.maxPointsInLeafNode()); | ||
docIdsWriter = new DocIdsWriter(config.maxPointsInLeafNode(), version); | ||
// Finally, we must be able to hold at least the leaf node in heap during build: | ||
if (maxPointsSortInHeap < config.maxPointsInLeafNode()) { | ||
throw new IllegalArgumentException( | ||
|
@@ -1245,7 +1270,7 @@ private void writeIndex( | |
byte[] packedIndex, | ||
long dataStartFP) | ||
throws IOException { | ||
CodecUtil.writeHeader(metaOut, CODEC_NAME, VERSION_CURRENT); | ||
CodecUtil.writeHeader(metaOut, CODEC_NAME, version); | ||
metaOut.writeVInt(config.numDims()); | ||
metaOut.writeVInt(config.numIndexDims()); | ||
metaOut.writeVInt(countPerLeaf); | ||
|
Oops, something went wrong.
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.
let's make all constructors that take a version pkg-private?