kou commented on code in PR #14585: URL: https://github.com/apache/arrow/pull/14585#discussion_r1048070297
########## cpp/src/arrow/util/qpl_job_pool.cc: ########## @@ -0,0 +1,122 @@ +// 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. + +#include "arrow/util/qpl_job_pool.h" +#include "arrow/status.h" + +#ifdef ARROW_WITH_QPL + +namespace arrow { +namespace util { +namespace internal { + +std::array<qpl_job*, QplJobHWPool::MAX_JOB_NUMBER> QplJobHWPool::hw_job_ptr_pool; +std::array<std::atomic_bool, QplJobHWPool::MAX_JOB_NUMBER> QplJobHWPool::job_ptr_locks; +bool QplJobHWPool::iaa_job_ready = false; +std::unique_ptr<uint8_t[]> QplJobHWPool::hw_jobs_buffer; + +QplJobHWPool& QplJobHWPool::GetInstance() { + static QplJobHWPool pool; + return pool; +} + +QplJobHWPool::QplJobHWPool() + : random_engine(std::random_device()()), distribution(0, MAX_JOB_NUMBER - 1) { + (void)AllocateQPLJob(); +} + +QplJobHWPool::~QplJobHWPool() { + for (uint32_t i = 0; i < MAX_JOB_NUMBER; ++i) { + if (hw_job_ptr_pool[i]) { + qpl_fini_job(hw_job_ptr_pool[i]); + hw_job_ptr_pool[i] = nullptr; + } + } + iaa_job_ready = false; +} + +arrow::Status QplJobHWPool::AllocateQPLJob() { + uint32_t job_size = 0; + + /// Get size required for saving a single qpl job object + qpl_get_job_size(qpl_path_hardware, &job_size); + /// Allocate entire buffer for storing all job objects + hw_jobs_buffer = std::make_unique<uint8_t[]>(job_size * MAX_JOB_NUMBER); + /// Initialize pool for storing all job object pointers + /// Reallocate buffer by shifting address offset for each job object. + for (uint32_t index = 0; index < MAX_JOB_NUMBER; ++index) { + qpl_job* qpl_job_ptr = + reinterpret_cast<qpl_job*>(hw_jobs_buffer.get() + index * job_size); + if (qpl_init_job(qpl_path_hardware, qpl_job_ptr) != QPL_STS_OK) { + iaa_job_ready = false; + return arrow::Status::Invalid( + "Initialization of hardware IAA failed." + " Please check if Intel In-Memory Analytics Accelerator (IAA) " + "is properly set up!"); + } + hw_job_ptr_pool[index] = qpl_job_ptr; + job_ptr_locks[index].store(false); + } + + iaa_job_ready = true; + return arrow::Status::OK(); +} + +qpl_job* QplJobHWPool::AcquireJob(uint32_t& job_id) { + if (!job_ready()) { + return nullptr; + } + uint32_t retry = 0; + auto index = distribution(random_engine); Review Comment: Why do we use `distribution()` to find a free job? Is it efficient? ########## cpp/src/arrow/util/qpl_job_pool.h: ########## @@ -0,0 +1,79 @@ +// 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. + +#pragma once + +#include <cstdint> +#include <memory> +#include <random> +#include <utility> +#include <vector> +#include "arrow/config.h" +#include "arrow/status.h" + +#ifdef ARROW_WITH_QPL +#include "qpl/qpl.h" +#include "qpl/qpl.hpp" + +namespace arrow { +namespace util { +namespace internal { + +/// QplJobHWPool is resource pool to provide the job objects, which is +/// used for storing context information during. +/// Memory for QPL job will be allocated when the QPLJobHWPool instance is created +/// +// QPL job can offload RLE-decoding/Filter/(De)compression works to hardware accelerator. +class QplJobHWPool { + public: + static QplJobHWPool& GetInstance(); + + /// Acquire QPL job + /// + /// @param job_id QPL job id, used when release QPL job + /// \return Pointer to the QPL job. If acquire job failed, return nullptr. + qpl_job* AcquireJob(uint32_t& job_id); + + /// \brief Release QPL job by the job_id. + void ReleaseJob(uint32_t job_id); + + /// \brief Return if the QPL job is allocated sucessfully. + const bool& job_ready() { return iaa_job_ready; } Review Comment: Do we need `&` here? ########## cpp/src/arrow/util/qpl_job_pool.cc: ########## @@ -0,0 +1,122 @@ +// 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. + +#include "arrow/util/qpl_job_pool.h" +#include "arrow/status.h" + +#ifdef ARROW_WITH_QPL + +namespace arrow { +namespace util { +namespace internal { + +std::array<qpl_job*, QplJobHWPool::MAX_JOB_NUMBER> QplJobHWPool::hw_job_ptr_pool; +std::array<std::atomic_bool, QplJobHWPool::MAX_JOB_NUMBER> QplJobHWPool::job_ptr_locks; +bool QplJobHWPool::iaa_job_ready = false; +std::unique_ptr<uint8_t[]> QplJobHWPool::hw_jobs_buffer; + +QplJobHWPool& QplJobHWPool::GetInstance() { + static QplJobHWPool pool; + return pool; +} + +QplJobHWPool::QplJobHWPool() + : random_engine(std::random_device()()), distribution(0, MAX_JOB_NUMBER - 1) { + (void)AllocateQPLJob(); +} + +QplJobHWPool::~QplJobHWPool() { + for (uint32_t i = 0; i < MAX_JOB_NUMBER; ++i) { + if (hw_job_ptr_pool[i]) { + qpl_fini_job(hw_job_ptr_pool[i]); + hw_job_ptr_pool[i] = nullptr; + } + } + iaa_job_ready = false; +} + +arrow::Status QplJobHWPool::AllocateQPLJob() { + uint32_t job_size = 0; + + /// Get size required for saving a single qpl job object + qpl_get_job_size(qpl_path_hardware, &job_size); + /// Allocate entire buffer for storing all job objects + hw_jobs_buffer = std::make_unique<uint8_t[]>(job_size * MAX_JOB_NUMBER); + /// Initialize pool for storing all job object pointers + /// Reallocate buffer by shifting address offset for each job object. + for (uint32_t index = 0; index < MAX_JOB_NUMBER; ++index) { + qpl_job* qpl_job_ptr = + reinterpret_cast<qpl_job*>(hw_jobs_buffer.get() + index * job_size); + if (qpl_init_job(qpl_path_hardware, qpl_job_ptr) != QPL_STS_OK) { + iaa_job_ready = false; + return arrow::Status::Invalid( + "Initialization of hardware IAA failed." + " Please check if Intel In-Memory Analytics Accelerator (IAA) " + "is properly set up!"); + } + hw_job_ptr_pool[index] = qpl_job_ptr; + job_ptr_locks[index].store(false); + } + + iaa_job_ready = true; + return arrow::Status::OK(); +} + +qpl_job* QplJobHWPool::AcquireJob(uint32_t& job_id) { + if (!job_ready()) { + return nullptr; + } + uint32_t retry = 0; + auto index = distribution(random_engine); + while (!tryLockJob(index)) { + index = distribution(random_engine); + retry++; + if (retry > MAX_JOB_NUMBER) { + return nullptr; + } + } + job_id = MAX_JOB_NUMBER - index; Review Comment: Why do we need to use different value for `index` and `job_id`? ########## cpp/src/arrow/util/rle_encoding.h: ########## @@ -598,6 +605,83 @@ inline int RleDecoder::GetBatchWithDict(const T* dictionary, int32_t dictionary_ return values_read; } +#ifdef ARROW_WITH_QPL +template <typename T, typename V> +inline void CopyValues(const T* dictionary, std::vector<uint8_t>* destination, T* values, + int batch_size) { + auto* out = values; + auto* indices = reinterpret_cast<V*>(destination->data()); + for (int j = 0; j < batch_size; j++) { + auto idx = indices[j]; + T val = dictionary[idx]; + std::fill(out, out + 1, val); + out++; + } + return; +} + +template <typename T> +inline int RleDecoder::GetBatchWithDictIAA(const T* dictionary, int32_t dictionary_length, + T* values, int batch_size) { + if (batch_size <= 0) { + return batch_size; + } + if (!::arrow::util::internal::QplJobHWPool::GetInstance().job_ready() || + bit_width_ <= 1) { + return GetBatchWithDict(dictionary, dictionary_length, values, batch_size); + } + uint32_t job_id = 0; + qpl_job* job = ::arrow::util::internal::QplJobHWPool::GetInstance().AcquireJob(job_id); + if (job == NULL) { + return -1; Review Comment: Sorry. I couldn't understand. If we return `-1` here, decoding Parquet data is succeeded? (I thought decoding Parquet data is failed.) ########## cpp/src/arrow/util/bit_stream_utils.h: ########## @@ -398,6 +412,27 @@ inline int BitReader::GetBatch(int num_bits, T* v, int batch_size) { return batch_size; } +#ifdef ARROW_WITH_QPL +inline bool BitReader::GetBatchWithQpl(int batch_size, qpl_job* job) { + if (!job) { + return false; + } + job->param_low = value_offset_; + job->param_high = batch_size + value_offset_; + job->num_input_elements = batch_size + value_offset_; + + job->next_in_ptr = const_cast<uint8_t*>(buffer_ - 1); Review Comment: Why do we need `- 1` here? Does it touch invalid memory? ########## cpp/src/arrow/util/bit_stream_utils.h: ########## @@ -398,6 +412,27 @@ inline int BitReader::GetBatch(int num_bits, T* v, int batch_size) { return batch_size; } +#ifdef ARROW_WITH_QPL +inline bool BitReader::GetBatchWithQpl(int batch_size, qpl_job* job) { + if (!job) { + return false; + } + job->param_low = value_offset_; + job->param_high = batch_size + value_offset_; + job->num_input_elements = batch_size + value_offset_; + + job->next_in_ptr = const_cast<uint8_t*>(buffer_ - 1); + job->available_in = max_bytes_ + 1; + + qpl_status status = qpl_execute_job(job); Review Comment: ```suggestion auto status = qpl_execute_job(job); ``` ########## cpp/src/arrow/util/qpl_job_pool.cc: ########## @@ -0,0 +1,122 @@ +// 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. + +#include "arrow/util/qpl_job_pool.h" +#include "arrow/status.h" + +#ifdef ARROW_WITH_QPL + +namespace arrow { +namespace util { +namespace internal { + +std::array<qpl_job*, QplJobHWPool::MAX_JOB_NUMBER> QplJobHWPool::hw_job_ptr_pool; +std::array<std::atomic_bool, QplJobHWPool::MAX_JOB_NUMBER> QplJobHWPool::job_ptr_locks; +bool QplJobHWPool::iaa_job_ready = false; +std::unique_ptr<uint8_t[]> QplJobHWPool::hw_jobs_buffer; + +QplJobHWPool& QplJobHWPool::GetInstance() { + static QplJobHWPool pool; + return pool; +} + +QplJobHWPool::QplJobHWPool() + : random_engine(std::random_device()()), distribution(0, MAX_JOB_NUMBER - 1) { + (void)AllocateQPLJob(); +} + +QplJobHWPool::~QplJobHWPool() { + for (uint32_t i = 0; i < MAX_JOB_NUMBER; ++i) { + if (hw_job_ptr_pool[i]) { + qpl_fini_job(hw_job_ptr_pool[i]); + hw_job_ptr_pool[i] = nullptr; + } + } + iaa_job_ready = false; +} + +arrow::Status QplJobHWPool::AllocateQPLJob() { + uint32_t job_size = 0; + + /// Get size required for saving a single qpl job object + qpl_get_job_size(qpl_path_hardware, &job_size); + /// Allocate entire buffer for storing all job objects + hw_jobs_buffer = std::make_unique<uint8_t[]>(job_size * MAX_JOB_NUMBER); + /// Initialize pool for storing all job object pointers + /// Reallocate buffer by shifting address offset for each job object. + for (uint32_t index = 0; index < MAX_JOB_NUMBER; ++index) { + qpl_job* qpl_job_ptr = + reinterpret_cast<qpl_job*>(hw_jobs_buffer.get() + index * job_size); + if (qpl_init_job(qpl_path_hardware, qpl_job_ptr) != QPL_STS_OK) { + iaa_job_ready = false; + return arrow::Status::Invalid( + "Initialization of hardware IAA failed." + " Please check if Intel In-Memory Analytics Accelerator (IAA) " + "is properly set up!"); + } + hw_job_ptr_pool[index] = qpl_job_ptr; + job_ptr_locks[index].store(false); + } + + iaa_job_ready = true; + return arrow::Status::OK(); +} + +qpl_job* QplJobHWPool::AcquireJob(uint32_t& job_id) { + if (!job_ready()) { + return nullptr; + } + uint32_t retry = 0; + auto index = distribution(random_engine); + while (!tryLockJob(index)) { + index = distribution(random_engine); + retry++; + if (retry > MAX_JOB_NUMBER) { + return nullptr; + } + } + job_id = MAX_JOB_NUMBER - index; + if (index >= MAX_JOB_NUMBER) { + return nullptr; + } + return hw_job_ptr_pool[index]; +} + +void QplJobHWPool::ReleaseJob(uint32_t job_id) { + if (job_ready()) { + job_ptr_locks[MAX_JOB_NUMBER - job_id].store(false); + } +} + +bool QplJobHWPool::tryLockJob(uint32_t index) { Review Comment: ```suggestion bool QplJobHWPool::TryLockJob(uint32_t index) { ``` ########## cpp/src/arrow/util/qpl_job_pool.cc: ########## @@ -0,0 +1,122 @@ +// 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. + +#include "arrow/util/qpl_job_pool.h" +#include "arrow/status.h" + +#ifdef ARROW_WITH_QPL + +namespace arrow { +namespace util { +namespace internal { + +std::array<qpl_job*, QplJobHWPool::MAX_JOB_NUMBER> QplJobHWPool::hw_job_ptr_pool; +std::array<std::atomic_bool, QplJobHWPool::MAX_JOB_NUMBER> QplJobHWPool::job_ptr_locks; +bool QplJobHWPool::iaa_job_ready = false; +std::unique_ptr<uint8_t[]> QplJobHWPool::hw_jobs_buffer; + +QplJobHWPool& QplJobHWPool::GetInstance() { + static QplJobHWPool pool; + return pool; +} + +QplJobHWPool::QplJobHWPool() + : random_engine(std::random_device()()), distribution(0, MAX_JOB_NUMBER - 1) { + (void)AllocateQPLJob(); +} + +QplJobHWPool::~QplJobHWPool() { + for (uint32_t i = 0; i < MAX_JOB_NUMBER; ++i) { + if (hw_job_ptr_pool[i]) { + qpl_fini_job(hw_job_ptr_pool[i]); + hw_job_ptr_pool[i] = nullptr; + } + } + iaa_job_ready = false; +} + +arrow::Status QplJobHWPool::AllocateQPLJob() { + uint32_t job_size = 0; + + /// Get size required for saving a single qpl job object + qpl_get_job_size(qpl_path_hardware, &job_size); + /// Allocate entire buffer for storing all job objects + hw_jobs_buffer = std::make_unique<uint8_t[]>(job_size * MAX_JOB_NUMBER); + /// Initialize pool for storing all job object pointers + /// Reallocate buffer by shifting address offset for each job object. + for (uint32_t index = 0; index < MAX_JOB_NUMBER; ++index) { + qpl_job* qpl_job_ptr = Review Comment: ```suggestion auto qpl_job_ptr = ``` ########## cpp/thirdparty/versions.txt: ########## @@ -76,6 +76,8 @@ ARROW_PROTOBUF_BUILD_SHA256_CHECKSUM=2f723218f6cb709ae4cdc4fb5ed56a5951fc5d466f0 # warnings. ARROW_RAPIDJSON_BUILD_VERSION=232389d4f1012dddec4ef84861face2d2ba85709 ARROW_RAPIDJSON_BUILD_SHA256_CHECKSUM=b9290a9a6d444c8e049bd589ab804e0ccf2b05dc5984a19ed5ae75d090064806 +ARROW_QPL_BUILD_VERSION=v0.2.1 Review Comment: It seem that 0.3.0 is the latest release: https://github.com/intel/qpl/releases/tag/v0.3.0 ########## cpp/src/arrow/util/bit_stream_utils.h: ########## @@ -398,6 +412,27 @@ inline int BitReader::GetBatch(int num_bits, T* v, int batch_size) { return batch_size; } +#ifdef ARROW_WITH_QPL +inline bool BitReader::GetBatchWithQpl(int batch_size, qpl_job* job) { + if (!job) { + return false; + } + job->param_low = value_offset_; + job->param_high = batch_size + value_offset_; + job->num_input_elements = batch_size + value_offset_; Review Comment: Why do we need to introduce new `value_offset_`? Can we use existing `bit_offset_` and `byte_offset_` instead? ########## cpp/src/arrow/util/rle_encoding.h: ########## @@ -598,6 +605,73 @@ inline int RleDecoder::GetBatchWithDict(const T* dictionary, int32_t dictionary_ return values_read; } +#ifdef ARROW_WITH_QPL +template <typename T, typename V> +inline void CopyValues(const T* dictionary, const std::vector<uint8_t>& destination, + T* values, int batch_size) { + auto* out = values; + auto* indices = reinterpret_cast<const V*>(destination.data()); + for (int j = 0; j < batch_size; j++) { + auto idx = indices[j]; + T val = dictionary[idx]; + std::fill(out, out + 1, val); + out++; + } + return; +} + +template <typename T> +inline int RleDecoder::GetBatchWithDictIAA(const T* dictionary, int32_t dictionary_length, + T* values, int batch_size) { + if (batch_size <= 0) { + return batch_size; + } + if (!::arrow::util::internal::QplJobHWPool::GetInstance().job_ready() || + bit_width_ <= 1) { + return GetBatchWithDict(dictionary, dictionary_length, values, batch_size); + } + uint32_t job_id = 0; + auto* job = ::arrow::util::internal::QplJobHWPool::GetInstance().AcquireJob(job_id); + if (!job) { + return -1; + } + + std::vector<uint8_t> destination; + if (dictionary_length < 0xFF) { + job->out_bit_width = qpl_ow_8; + destination.resize(batch_size, 0); + } else if (dictionary_length < 0xFFFF) { + job->out_bit_width = qpl_ow_16; + destination.resize(batch_size * 2, 0); + } else { + job->out_bit_width = qpl_ow_32; + destination.resize(batch_size * 4, 0); + } + + job->op = qpl_op_extract; + job->src1_bit_width = bit_width_; + job->parser = qpl_p_parquet_rle; + job->next_out_ptr = destination.data(); + job->available_out = static_cast<uint32_t>(destination.size()); + + if (!bit_reader_.GetBatchWithQpl(batch_size, job)) { + return -1; Review Comment: Should we call `qpl_fini_job()` and `ReleaseJob()` here too? Can we use RAII to ensure releasing job like `std::lock()`? ########## cpp/cmake_modules/ThirdpartyToolchain.cmake: ########## @@ -2203,6 +2214,51 @@ if(ARROW_WITH_RAPIDJSON) endif() endif() +macro(build_qpl) + message(STATUS "Building QPL from source") + set(QPL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/qpl_ep/src/qpl_ep-install") + set(QPL_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}qpl${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(QPL_STATIC_LIB "${QPL_PREFIX}/lib/${QPL_STATIC_LIB_NAME}") + set(QPL_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} -DCMAKE_INSTALL_LIBDIR=lib + "-DCMAKE_INSTALL_PREFIX=${QPL_PREFIX}") + set(QPL_PATCH_COMMAND) + find_package(Patch) + if(Patch_FOUND) + # This patch is for Qpl <= v0.2.0 + set(QPL_PATCH_COMMAND + ${Patch_EXECUTABLE} + "${CMAKE_CURRENT_BINARY_DIR}/qpl_ep-prefix/src/qpl_ep/tools/CMakeLists.txt" + "${CMAKE_SOURCE_DIR}/build-support/qpl-tools-cmakefile.patch") + endif() + + externalproject_add(qpl_ep + ${EP_LOG_OPTIONS} + URL ${QPL_SOURCE_URL} + URL_HASH "SHA256=${ARROW_QPL_BUILD_SHA256_CHECKSUM}" + PATCH_COMMAND ${QPL_PATCH_COMMAND} + BUILD_BYPRODUCTS "${QPL_STATIC_LIB}" + CMAKE_ARGS ${QPL_CMAKE_ARGS}) + + file(MAKE_DIRECTORY "${QPL_PREFIX}/include") + + add_library(Qpl::qpl STATIC IMPORTED) + set(QPL_LIBRARIES ${QPL_STATIC_LIB}) + set(QPL_INCLUDE_DIRS "${QPL_PREFIX}/include") + set_target_properties(Qpl::qpl + PROPERTIES IMPORTED_LOCATION ${QPL_LIBRARIES} + INTERFACE_INCLUDE_DIRECTORIES ${QPL_INCLUDE_DIRS}) Review Comment: We can remove needless variables here: ```suggestion set_target_properties(Qpl::qpl PROPERTIES IMPORTED_LOCATION ${QPL_STATIC_LIB} INTERFACE_INCLUDE_DIRECTORIES ${QPL_PREFIX}/include) ``` ########## cpp/src/parquet/encoding.cc: ########## @@ -1494,8 +1494,13 @@ class DictDecoderImpl : public DecoderImpl, virtual public DictDecoder<Type> { int Decode(T* buffer, int num_values) override { num_values = std::min(num_values, num_values_); int decoded_values = +#ifdef ARROW_WITH_QPL + idx_decoder_.GetBatchWithDictIAA(reinterpret_cast<const T*>(dictionary_->data()), + dictionary_length_, buffer, num_values); Review Comment: Can we dispatch in `GetBatchWithDict()` not here? ########## cpp/cmake_modules/ThirdpartyToolchain.cmake: ########## @@ -2203,6 +2214,51 @@ if(ARROW_WITH_RAPIDJSON) endif() endif() +macro(build_qpl) + message(STATUS "Building QPL from source") + set(QPL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/qpl_ep/src/qpl_ep-install") + set(QPL_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}qpl${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(QPL_STATIC_LIB "${QPL_PREFIX}/lib/${QPL_STATIC_LIB_NAME}") + set(QPL_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} -DCMAKE_INSTALL_LIBDIR=lib + "-DCMAKE_INSTALL_PREFIX=${QPL_PREFIX}") + set(QPL_PATCH_COMMAND) + find_package(Patch) + if(Patch_FOUND) + # This patch is for Qpl <= v0.2.0 Review Comment: Did you upstream this patch? Please add pull request URL as comment. -- 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]
