Repository navigation
Conversation
pitrou
left a comment
There was a problem hiding this comment.
I must think a bit more about the EncodingOptions API but otherwise this is looking rather good.
| // The encoder emits strictly increasing positions. Use the vectorized | ||
| // fast path for that common case. |
There was a problem hiding this comment.
Was the "vectorized fast path" measured to bring substantial benefits? After all, there should not be many exceptions...
There was a problem hiding this comment.
#48345 (comment) mentioned testing unroll factors of 2, 4 and 8, but provided no measurements specific to exception patching.
When I made this change, I have verified that the code path has been vectorized by gcc on godbolt. But I didn't verify its performance gain because I used Clang locally which failed to do this :/
There was a problem hiding this comment.
https://godbolt.org/z/xY51czqfq
Seem this would vectorize only with avx512f? x86 SSE4.2/AVX2 doesn't has vscatter, and unroll might only affect little performance, unroll 4 with 50% exception with only have 5% performance enhancement in my machine. And with 1-10% exception, the optimization <= 1.2% in my machine.
|
@pitrou Could you help take a look again? |
| } | ||
| vector_offsets.push_back(static_cast<AlpFormatConstants::OffsetType>(current_offset)); | ||
| current_offset += per_vector_metadata_size + vec.GetDataStoredSize(); | ||
| if (stored_size > static_cast<int64_t>(body.size()) - current_offset) { |
There was a problem hiding this comment.
Would it be useful to marking it as [[unlikely]]?
|
@wgtmac Can you rebase now that we have supplementary ALP benchmarks in git main? |
|
A bit weird about |
|
Good point @mapleFU , perhaps |
|
I applied this PR on top of Hoisting the multipliers in
|
|
|
||
| WriterProperties::Builder* WriterProperties::Builder::encoding_options( | ||
| const EncodingOptions& options) { | ||
| default_column_properties_.set_encoding_options(options); |
There was a problem hiding this comment.
why do we set default options here, bf doesn't have default options in this scenerio, I'm not sure about what's the pro of it.
| } | ||
|
|
||
| if (!col_props.encoding_options().options.empty()) { | ||
| this->encoding_options(col_path, col_props.encoding_options()); |
There was a problem hiding this comment.
Here didn't copying from default? Or should we just not keeping the default?
| // The encoder emits strictly increasing positions. Use the vectorized | ||
| // fast path for that common case. |
| "and FIXED_LEN_BYTE_ARRAY"); | ||
| } | ||
| } else if (encoding == Encoding::ALP) { | ||
| const auto& alp_options = options.Get<AlpOptions>(encoding); |
There was a problem hiding this comment.
Should we validate it here since it's a public API ( just DCHECK might also ok for me, I don't know)
Rationale for this change
This PR addresses follow-up items from #48345 to improve ALP performance, format compatibility, and writer configuration.
What changes are included in this PR?
EncodingOptionsandAlpOptionsto configure the ALP vector size globally or per column.PutSpaced().Are these changes tested?
Yes. I ran the ALP and Parquet tests and the new benchmarks from #55714.
Are there any user-facing changes?
Yes. Writers can set
AlpOptions::vector_sizethroughWriterProperties::Builder::encoding_options(). The default is 1,024 values. Supported sizes are powers of two from 8 through 32,768.The exported
MakeEncodersignature and writer property layouts change, so C++ consumers need to rebuild.Was AI used for this PR?
AI assisted with implementation, review, test execution, and benchmarking.
PR code and description written by:
Reviewed before submission by: