wgtmac commented on code in PR #1375: URL: https://github.com/apache/orc/pull/1375#discussion_r1142898582
########## c++/src/Bpacking.hh: ########## @@ -0,0 +1,32 @@ +/** + * 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. + */ + +#ifndef ORC_BPACKING_HH +#define ORC_BPACKING_HH + +#include <cstdint> + +namespace orc { + class BitUnpack { + public: + static int readLongs(RleDecoderV2* decoder, int64_t* data, uint64_t offset, uint64_t len, Review Comment: nit: add forward declaration for `RleDecoderV2`. I am not sure if some compilers will complain or not. ########## c++/src/BpackingAvx512.hh: ########## @@ -0,0 +1,89 @@ +/** + * 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. + */ + +#ifndef ORC_BPACKINGAVX512_HH +#define ORC_BPACKINGAVX512_HH + +#include <stdlib.h> Review Comment: Can we use cstdlib? ########## c++/src/BpackingAvx512.hh: ########## @@ -0,0 +1,89 @@ +/** + * 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. + */ + +#ifndef ORC_BPACKINGAVX512_HH +#define ORC_BPACKINGAVX512_HH + +#include <stdlib.h> +#include <cstdint> + +#include "BpackingDefault.hh" + +namespace orc { + +#define MAX_VECTOR_BUF_8BIT_LENGTH 64 +#define MAX_VECTOR_BUF_16BIT_LENGTH 32 +#define MAX_VECTOR_BUF_32BIT_LENGTH 16 + + class UnpackAvx512 { + public: + UnpackAvx512(RleDecoderV2* dec); + ~UnpackAvx512(); + + void vectorUnpack1(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack2(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack3(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack4(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack5(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack6(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack7(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack9(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack10(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack11(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack12(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack13(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack14(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack15(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack16(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack17(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack18(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack19(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack20(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack21(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack22(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack23(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack24(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack26(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack28(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack30(int64_t* data, uint64_t offset, uint64_t len); + void vectorUnpack32(int64_t* data, uint64_t offset, uint64_t len); + + void plainUnpackLongs(int64_t* data, uint64_t offset, uint64_t len, uint64_t fbs, + uint64_t& startBit); + + private: + RleDecoderV2* decoder; + UnpackDefault unpackDefault; + + // Used by vectorially 1~8 bit-unpacking data + uint8_t vectorBuf8[MAX_VECTOR_BUF_8BIT_LENGTH + 1]; + // Used by vectorially 9~16 bit-unpacking data + uint16_t vectorBuf16[MAX_VECTOR_BUF_16BIT_LENGTH + 1]; + // Used by vectorially 17~32 bit-unpacking data + uint32_t vectorBuf32[MAX_VECTOR_BUF_32BIT_LENGTH + 1]; Review Comment: Can we consolidate them into a single buffer to reduce memory consumption? For example we can use the buffer of largest length and make three separate pointers to point to the buffer for different bit widths. ########## c++/src/BpackingDefault.hh: ########## @@ -0,0 +1,60 @@ +/** + * 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. + */ + +#ifndef ORC_BPACKINGDEFAULT_HH +#define ORC_BPACKINGDEFAULT_HH + +#include <stdlib.h> Review Comment: ditto ########## c++/src/CpuInfoUtil.hh: ########## @@ -0,0 +1,113 @@ +/** + * 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. + */ + +/** + * @file CpuInfoUtil.hh code borrowing from Review Comment: ```suggestion * @file CpuInfoUtil.hh is from Apache Arrow as of 2023-03-21 ``` ########## c++/src/CpuInfoUtil.hh: ########## @@ -0,0 +1,113 @@ +/** + * 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. + */ + +/** + * @file CpuInfoUtil.hh code borrowing from Review Comment: We can remove the link below because it may change in the future. ########## c++/src/BpackingAvx512.hh: ########## @@ -0,0 +1,89 @@ +/** + * 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. + */ + +#ifndef ORC_BPACKINGAVX512_HH +#define ORC_BPACKINGAVX512_HH + +#include <stdlib.h> +#include <cstdint> + +#include "BpackingDefault.hh" + +namespace orc { + +#define MAX_VECTOR_BUF_8BIT_LENGTH 64 +#define MAX_VECTOR_BUF_16BIT_LENGTH 32 +#define MAX_VECTOR_BUF_32BIT_LENGTH 16 + + class UnpackAvx512 { + public: + UnpackAvx512(RleDecoderV2* dec); Review Comment: same here, add forward declaration of RleDecoderV2 ########## c++/src/BpackingDefault.hh: ########## @@ -0,0 +1,60 @@ +/** + * 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. + */ + +#ifndef ORC_BPACKINGDEFAULT_HH +#define ORC_BPACKINGDEFAULT_HH + +#include <stdlib.h> +#include <cstdint> + +#include "RLEv2.hh" + +#include "Bpacking.hh" + Review Comment: ```suggestion #include "Bpacking.hh" #include "RLEv2.hh" ``` ########## c++/src/BpackingDefault.hh: ########## @@ -0,0 +1,60 @@ +/** + * 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. + */ + +#ifndef ORC_BPACKINGDEFAULT_HH +#define ORC_BPACKINGDEFAULT_HH + +#include <stdlib.h> +#include <cstdint> + +#include "RLEv2.hh" + +#include "Bpacking.hh" + Review Comment: BTW, we can also remote RLEv2.hh here and use forward declaration. ########## c++/src/CpuInfoUtil.hh: ########## @@ -0,0 +1,113 @@ +/** + * 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. + */ + +/** + * @file CpuInfoUtil.hh code borrowing from + * https://github.com/apache/arrow/blob/main/cpp/src/arrow/util/cpu_info.h + * @file CpuInfoUtil.cc code borrowing from + * https://github.com/apache/arrow/blob/main/cpp/src/arrow/util/cpu_info.cc Review Comment: Move this disclaimer to the cc file. -- 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]
