ChrisHegarty commented on code in PR #12417: URL: https://github.com/apache/lucene/pull/12417#discussion_r1254852005
########## lucene/core/src/java20/org/apache/lucene/internal/vectorization/PanamaForUtil90.java: ########## @@ -0,0 +1,8994 @@ +// This file has been automatically generated, DO NOT EDIT + +/* + * 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.internal.vectorization; + +import java.io.IOException; +import jdk.incubator.vector.IntVector; +import jdk.incubator.vector.VectorOperators; +import jdk.incubator.vector.VectorSpecies; +import org.apache.lucene.store.DataInput; +import org.apache.lucene.store.DataOutput; + +final class PanamaForUtil90 implements ForUtil90 { + private final int[] tmp = new int[BLOCK_SIZE]; + + private final int[] decoded = new int[BLOCK_SIZE]; + + private static final int totalBits = 32; + private static final VectorSpecies<Integer> SPECIES_128 = IntVector.SPECIES_128; + + /** Encode 128 integers from {@code input} into {@code out}. */ + @Override + public void encode(int[] input, int bitsPerValue, DataOutput out) throws IOException { + if (bitsPerValue == 32) { Review Comment: If I'm not mistaken, then I don't think that we can ever get here with bitsPerValue == 32. If so, then this can be removed. ########## lucene/core/src/java20/org/apache/lucene/internal/vectorization/PanamaForUtil90.java: ########## @@ -0,0 +1,8994 @@ +// This file has been automatically generated, DO NOT EDIT + +/* + * 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.internal.vectorization; + +import java.io.IOException; +import jdk.incubator.vector.IntVector; +import jdk.incubator.vector.VectorOperators; +import jdk.incubator.vector.VectorSpecies; +import org.apache.lucene.store.DataInput; +import org.apache.lucene.store.DataOutput; + +final class PanamaForUtil90 implements ForUtil90 { + private final int[] tmp = new int[BLOCK_SIZE]; + + private final int[] decoded = new int[BLOCK_SIZE]; + + private static final int totalBits = 32; + private static final VectorSpecies<Integer> SPECIES_128 = IntVector.SPECIES_128; + + /** Encode 128 integers from {@code input} into {@code out}. */ + @Override + public void encode(int[] input, int bitsPerValue, DataOutput out) throws IOException { + if (bitsPerValue == 32) { + for (int i = 0; i < 128; i++) { + out.writeInt(input[i]); + } + return; + } + switch (bitsPerValue) { + case 1: + fastPack1(input, tmp); + break; + case 2: + fastPack2(input, tmp); + break; + case 3: + fastPack3(input, tmp); + break; + case 4: + fastPack4(input, tmp); + break; + case 5: + fastPack5(input, tmp); + break; + case 6: + fastPack6(input, tmp); + break; + case 7: + fastPack7(input, tmp); + break; + case 8: + fastPack8(input, tmp); + break; + case 9: + fastPack9(input, tmp); + break; + case 10: + fastPack10(input, tmp); + break; + case 11: + fastPack11(input, tmp); + break; + case 12: + fastPack12(input, tmp); + break; + case 13: + fastPack13(input, tmp); + break; + case 14: + fastPack14(input, tmp); + break; + case 15: + fastPack15(input, tmp); + break; + case 16: + fastPack16(input, tmp); + break; + case 17: + fastPack17(input, tmp); + break; + case 18: + fastPack18(input, tmp); + break; + case 19: + fastPack19(input, tmp); + break; + case 20: + fastPack20(input, tmp); + break; + case 21: + fastPack21(input, tmp); + break; + case 22: + fastPack22(input, tmp); + break; + case 23: + fastPack23(input, tmp); + break; + case 24: + fastPack24(input, tmp); + break; + case 25: + fastPack25(input, tmp); + break; + case 26: + fastPack26(input, tmp); + break; + case 27: + fastPack27(input, tmp); + break; + case 28: + fastPack28(input, tmp); + break; + case 29: + fastPack29(input, tmp); + break; + case 30: + fastPack30(input, tmp); + break; + case 31: + fastPack31(input, tmp); + break; + default: + throw new UnsupportedOperationException(); + } + + for (int i = 0; i < 4 * bitsPerValue; ++i) { + out.writeInt(tmp[i]); + } + } + + /** Decode 128 integers into {@code output}. */ + @Override + public void decode(int bitsPerValue, DataInput in, int[] output) throws IOException { + in.readInts(tmp, 0, 4 * bitsPerValue); + if (bitsPerValue == 32) { Review Comment: (Same as above) - If I'm not mistaken, then I don't think that we can ever get here with bitsPerValue == 32. If so, then this can be removed. -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org