Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
a7ac1ae
Add PFOR core algorithm and tests
sfc-gh-pgaur Apr 20, 2026
c8501f5
Integrate PFOR encoding into parquet encoder/decoder
sfc-gh-pgaur Apr 21, 2026
8ac3f28
Add PFOR encoding benchmark
sfc-gh-pgaur Apr 21, 2026
ff837d9
Use signed integer types consistently per Arrow style guide
sfc-gh-pgaur Jun 3, 2026
f8c70e8
Use arrow::util::span for buffer parameters in Store/Load/Decode/Seri…
sfc-gh-pgaur Jun 3, 2026
65b29f1
Return Result<T>/Status on decode paths instead of ARROW_DCHECK
sfc-gh-pgaur Jun 3, 2026
7c5e6e4
Add static_assert(ARROW_LITTLE_ENDIAN) and replace reinterpret_cast w…
sfc-gh-pgaur Jun 3, 2026
0c5ef3e
Use single-call unpack() instead of manual batch loop + BitReader rem…
sfc-gh-pgaur Jun 3, 2026
a99dee8
Add pragma GCC unroll/ivdep to decode loops for better vectorization
sfc-gh-pgaur Jun 3, 2026
c1a8eb5
Add PforEncodedVectorView for zero-copy decode path
sfc-gh-pgaur Jun 3, 2026
49ef1ce
Make vector_size configurable on encode path with default kPforVector…
sfc-gh-pgaur Jun 3, 2026
6f3a5bf
Fix pfor_test.cc: unwrap Result<> from PforVectorInfo::Load()
sfc-gh-pgaur Jun 3, 2026
cd2ed56
Convert PforWrapper::LoadHeader to return Result<PforHeader>
sfc-gh-pgaur Jun 14, 2026
b6aae63
Use SafeLoadAs/SafeStore for header and offset array in PforWrapper
sfc-gh-pgaur Jun 14, 2026
374eae6
Validate header fields in PforWrapper::LoadHeader
sfc-gh-pgaur Jun 14, 2026
87564b8
Use int64_t and global ::arrow:: prefix at PFOR encoder/decoder call …
sfc-gh-pgaur Jun 15, 2026
4f305b9
Use uint8_t* consistently in PforWrapper API instead of char*
sfc-gh-pgaur Jun 15, 2026
9d5e82c
Convert PforVectorInfo to class with SafeLoadAs/SafeStore and bit_wid…
sfc-gh-pgaur Jun 15, 2026
5583424
Convert PforEncodedVector and PforEncodedVectorView to classes
sfc-gh-pgaur Jun 15, 2026
d801fe4
Tighten PforVectorInfo encapsulation: validate num_exceptions in Load…
sfc-gh-pgaur Jun 15, 2026
9fabb7e
make
sfc-gh-pgaur Jun 25, 2026
384e89f
Use bit_util::IsPowerOf2/CeilDiv and add incremental encode/decode TO…
sfc-gh-pgaur Jun 26, 2026
9d5470c
Drop Snowflake attribution from PFOR header comments
sfc-gh-pgaur Jun 26, 2026
9bef47b
Fix IsPowerOf2(int32_t) ambiguity in pfor_wrapper.cc
sfc-gh-pgaur Jun 28, 2026
6ae3c9b
Add FastLanes auto-vectorized bit-packing library
sfc-gh-pgaur Jun 28, 2026
822f91b
Add FastLanes-FOR to parquet-pfor-comparison-benchmark
sfc-gh-pgaur Jun 28, 2026
ef3e746
FastLanes-FOR: add DecodeFlat (flat output) and benchmark it
sfc-gh-pgaur Jun 28, 2026
4037bb2
FastLanes: add toTransposed32; correct fromTransposed32 docstring
sfc-gh-pgaur Jun 28, 2026
26ea3c4
PFOR: add PackingMode (BitPack | FastLanes) per-vector flag
sfc-gh-pgaur Jun 28, 2026
51f2568
PFOR: add OutputOrder { Flat, Transposed } decode option
sfc-gh-pgaur Jun 28, 2026
d9ef31b
Local: keep -O3 from CMake Release defaults (drop -O2 downgrade)
sfc-gh-pgaur Jun 28, 2026
6468d91
PFOR: cover bit_width 0 and 32 paths in transposed-output tests
sfc-gh-pgaur Jul 20, 2026
3a66cb1
PFOR: adapt to updated Arrow util APIs
sfc-gh-pgaur Jul 20, 2026
a106ed5
PFOR: migrate to std::span
sfc-gh-pgaur Jul 20, 2026
20b90fb
PFOR: add FastLanesOrdered packing mode (interleave without FL_ORDER)
sfc-gh-pgaur Jul 20, 2026
98bdbf2
PFOR: decode BitPack into stack scratch (avoid per-vector heap alloc)
sfc-gh-pgaur Jul 24, 2026
c52b0ff
PFOR: vectorize the frame-of-reference add in BitPack decode
sfc-gh-pgaur Jul 24, 2026
be09337
PFOR: speed up encode (cost-model histogram + stack deltas)
sfc-gh-pgaur Jul 24, 2026
aa4e37b
Skip FOR-add pass in PFOR decode when frame-of-reference is 0
sfc-gh-pgaur Jul 24, 2026
4e8d557
Add TPC-H, more TPC-DS, and NYC-taxi numeric columns to PFOR benchmark
sfc-gh-pgaur Jul 24, 2026
11825c5
Remove FastLanes packing modes from PFOR (BitPack only)
sfc-gh-pgaur Jul 24, 2026
8b5453c
Add int64 (BIGINT) columns to the PFOR comparison benchmark
sfc-gh-pgaur Jul 25, 2026
db68831
Note the frame-of-reference bias fold as a TODO on the decode path
sfc-gh-pgaur Aug 21, 2026
5f12e15
Add a bias parameter to arrow::internal::unpack
sfc-gh-pgaur Aug 21, 2026
152e1d6
Keep unpack_full at memcpy speed when it carries a bias
sfc-gh-pgaur Aug 21, 2026
8cae5e6
Reflow an unpack call site to clang-format 18
sfc-gh-pgaur Aug 21, 2026
50fcf20
Store the PFOR bit width in 7 bits, not 6
sfc-gh-pgaur Aug 21, 2026
b0978e8
Fold the frame-of-reference add into the PFOR unpacker
sfc-gh-pgaur Aug 21, 2026
ba66ee7
Spell the restrict qualifier portably in unpack_full
sfc-gh-pgaur Aug 23, 2026
d995235
Fix two errors PFOR raises at the checkin warning level
sfc-gh-pgaur Aug 25, 2026
1d36687
List PFOR in SupportedEncodings for INT32 and INT64
sfc-gh-pgaur Aug 25, 2026
6a285b4
Use std::bit_width instead of __builtin_clz in PFOR
sfc-gh-pgaur Aug 25, 2026
aeffcb4
Apply clang-format 18 to the PFOR sources
sfc-gh-pgaur Aug 25, 2026
1a77108
Reject a PFOR page header that disagrees with its buffer
sfc-gh-pgaur Aug 25, 2026
db4f45f
Count PFOR exceptions in an unsigned field
sfc-gh-pgaur Aug 25, 2026
f54ffdf
Put the output buffer last in PforWrapper::Decode
sfc-gh-pgaur Aug 25, 2026
9d302f6
Return Status from PforWrapper::Encode
sfc-gh-pgaur Aug 25, 2026
f3e40a8
Decode PFOR pages with null slots through the Arrow path
sfc-gh-pgaur Aug 25, 2026
1c304ed
Note that incremental PFOR encode and decode come later
sfc-gh-pgaur Aug 25, 2026
1f3fe88
Correct the bit_width mask comments in PforVectorInfo
sfc-gh-pgaur Aug 26, 2026
6e82a32
Validate PFOR exception positions and counts before patching
sfc-gh-pgaur Aug 26, 2026
06df37f
Drop the cached PFOR page when the decoder is given a new one
sfc-gh-pgaur Aug 26, 2026
8412366
Validate PFOR wire metadata and enforce the output buffer size
sfc-gh-pgaur Aug 26, 2026
3ffe18f
Build PFOR into libarrow instead of recompiling it per target
sfc-gh-pgaur Aug 27, 2026
3deff2f
Stop PforDecoder from shadowing its base class page state
sfc-gh-pgaur Aug 27, 2026
6fd8480
Derive PFOR layout sizes from the fields they describe
sfc-gh-pgaur Aug 27, 2026
87aa140
Drop the unused PFOR vector view; harden SerializeVector
sfc-gh-pgaur Aug 27, 2026
ccd88a8
Note the missing PLAIN fallback in PforEncoder
sfc-gh-pgaur Aug 27, 2026
544af58
Type-parameterize the PFOR tests over int32 and int64
sfc-gh-pgaur Aug 27, 2026
7dd4a9c
Take the PFOR value count from the page's own header
sfc-gh-pgaur Sep 3, 2026
16be70a
Validate the PFOR element count and offset chain before decoding
sfc-gh-pgaur Sep 3, 2026
f150979
Encode an all-null PFOR page as a bare header
sfc-gh-pgaur Sep 3, 2026
239898f
Serialize PFOR little-endian instead of refusing to build
sfc-gh-pgaur Sep 3, 2026
9d57072
Build the PFOR sources under meson too
sfc-gh-pgaur Sep 3, 2026
3570bf1
Record what a batched PFOR read costs today
sfc-gh-pgaur Sep 3, 2026
87fdc1d
Add end-to-end PFOR tests through the Arrow reader and writer
sfc-gh-pgaur Sep 3, 2026
b5c850f
Name the PFOR headers _internal.h
sfc-gh-pgaur Sep 3, 2026
96c7a11
Give PFOR a delta mode and a frame it can search
sfc-gh-pgaur Sep 1, 2026
1d97580
Cut the frame search's cost, and lower its frame onto a real value
sfc-gh-pgaur Sep 1, 2026
56e2003
Add the delta-mode column shapes to the codec comparison benchmark
sfc-gh-pgaur Sep 1, 2026
10bd2d7
Decline the PFOR delta mode from a sampled estimate
sfc-gh-pgaur Sep 3, 2026
06cd8cb
Gate PFOR and its delta mode behind writer properties
sfc-gh-pgaur Sep 3, 2026
55cb7ee
Harden the PFOR delta flag against a corrupt page
sfc-gh-pgaur Sep 3, 2026
f2e3609
Note that the delta prefix sum could fold into the unpack kernel
sfc-gh-pgaur Sep 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,6 @@ rat.txt

# for ODBC DLL
*.rc

# Local out-of-tree benchmark build dir
cpp/build-bench/
15 changes: 3 additions & 12 deletions cpp/cmake_modules/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -633,21 +633,12 @@ endif()

if(NOT MSVC)
set(C_RELEASE_FLAGS "")
if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3")
string(APPEND C_RELEASE_FLAGS " -O2")
endif()
# Local override: keep -O3 from CMake's default Release flags for the
# pfor benchmark — the bench is sensitive to inlining/unrolling that
# -O3 enables. Upstream Arrow downgrades to -O2 here; we skip that.
set(CXX_RELEASE_FLAGS "")
if(CMAKE_CXX_FLAGS_RELEASE MATCHES "-O3")
string(APPEND CXX_RELEASE_FLAGS " -O2")
endif()
set(C_RELWITHDEBINFO_FLAGS "")
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "-O3")
string(APPEND C_RELWITHDEBINFO_FLAGS " -O2")
endif()
set(CXX_RELWITHDEBINFO_FLAGS "")
if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "-O3")
string(APPEND CXX_RELWITHDEBINFO_FLAGS " -O2")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
string(APPEND C_RELEASE_FLAGS " -ftree-vectorize")
string(APPEND CXX_RELEASE_FLAGS " -ftree-vectorize")
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,8 @@ set(ARROW_UTIL_SRCS
util/math_internal.cc
util/memory.cc
util/mutex.cc
util/pfor/pfor.cc
util/pfor/pfor_wrapper.cc
util/ree_util.cc
util/secure_string.cc
util/string.cc
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/arrow/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ arrow_util_srcs = [
'util/math_internal.cc',
'util/memory.cc',
'util/mutex.cc',
'util/pfor/pfor.cc',
'util/pfor/pfor_wrapper.cc',
'util/ree_util.cc',
'util/secure_string.cc',
'util/string.cc',
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/arrow/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ add_arrow_test(threading-utility-test
test_common.cc
thread_pool_test.cc)

add_arrow_test(pfor-test SOURCES pfor/pfor_test.cc)

add_arrow_benchmark(pfor/pfor_benchmark)

add_arrow_benchmark(bit_block_counter_benchmark)
add_arrow_benchmark(bit_util_benchmark)
add_arrow_benchmark(bitmap_reader_benchmark)
Expand Down
32 changes: 32 additions & 0 deletions cpp/src/arrow/util/bpacking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ struct UnpackDynamicFunction {
}
};

template <typename Uint>
struct UnpackBiasDynamicFunction {
using FunctionType = decltype(&bpacking::unpack_bias_scalar<Uint>);

static constexpr auto targets() {
return std::array{
ARROW_DISPATCH_TARGET_NONE(&bpacking::unpack_bias_scalar<Uint>) //
ARROW_DISPATCH_TARGET_NEON(&bpacking::unpack_bias_neon<Uint>) //
ARROW_DISPATCH_TARGET_SVE128(&bpacking::unpack_bias_sve128<Uint>) //
ARROW_DISPATCH_TARGET_SVE256(&bpacking::unpack_bias_sve256<Uint>) //
ARROW_DISPATCH_TARGET_SSE4_2(&bpacking::unpack_bias_sse4_2<Uint>) //
ARROW_DISPATCH_TARGET_AVX2(&bpacking::unpack_bias_avx2<Uint>) //
ARROW_DISPATCH_TARGET_AVX512(&bpacking::unpack_bias_avx512<Uint>) //
};
}
};

} // namespace

template <typename Uint>
Expand All @@ -57,4 +74,19 @@ template void unpack<uint16_t>(const uint8_t*, uint16_t*, const UnpackOptions&);
template void unpack<uint32_t>(const uint8_t*, uint32_t*, const UnpackOptions&);
template void unpack<uint64_t>(const uint8_t*, uint64_t*, const UnpackOptions&);

template <typename Uint>
void unpack_bias(const uint8_t* in, Uint* out, const UnpackOptions& opts, Uint bias) {
static const DynamicDispatch<UnpackBiasDynamicFunction<Uint>> dispatch;
return dispatch(in, out, opts, bias);
}

template void unpack_bias<uint8_t>(const uint8_t*, uint8_t*, const UnpackOptions&,
uint8_t);
template void unpack_bias<uint16_t>(const uint8_t*, uint16_t*, const UnpackOptions&,
uint16_t);
template void unpack_bias<uint32_t>(const uint8_t*, uint32_t*, const UnpackOptions&,
uint32_t);
template void unpack_bias<uint64_t>(const uint8_t*, uint64_t*, const UnpackOptions&,
uint64_t);

} // namespace arrow::internal
Loading
Loading