Skip to content

perf(nimble): Add bulk-scan path to legacy fixed-width reads (#18612) - #18612

Open
MatzeB wants to merge 2 commits into
facebookincubator:mainfrom
MatzeB:export-D116602815
Open

perf(nimble): Add bulk-scan path to legacy fixed-width reads (#18612)#18612
MatzeB wants to merge 2 commits into
facebookincubator:mainfrom
MatzeB:export-D116602815

Conversation

@MatzeB

@MatzeB MatzeB commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary:

This diff is created by PerfAICT to optimize facebook::nimble::legacy::callReadWithVisitor in "fbcode/velox/dwio/nimble/encodings/legacy/EncodingUtils.h", by reducing CPU cycles spent in this function.

Optimization Details

The inclusive cost of legacy::callReadWithVisitor was dominated by FixedBitWidthEncoding<T>::readWithVisitor, which always decoded values one at a time via the scalar per-value slow path (fixedBitArray_.get(row_++) + baseline_ followed by per-value ColumnVisitor::process). This change adds a bulk-scan fast path — mirroring the already-landed canonical implementation in the non-legacy encodings/FixedBitWidthEncoding.h — that handles the dominant dense, no-null, no-filter/hook, 4/8-byte integral ExtractToReader case with a single bulkGetWithBaseline decode plus processFixedWidthRun, falling back to the unchanged slow path for all other cases. All supporting helpers (readWithVisitorFast, useFastPath, processFixedWidthRun, FixedBitArray) are shared, not duplicated, so behavior is preserved.

Differential Revision: D116602815

@netlify

netlify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit bc07b0b
🔍 Latest deploy log https://app.netlify.com/projects/meta-velox/deploys/6a87848a41f98a00080be69e

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 20, 2026
@meta-codesync

meta-codesync Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

@MatzeB has exported this pull request. If you are a Meta employee, you can view the originating Diff in D116602815.

@MatzeB MatzeB changed the title Add SIMD bulk-scan fast path to legacy FixedBitWidthEncoding readWithVisitor perf(nimble): Add bulk-scan path to legacy fixed-width reads Aug 20, 2026
MatzeB added 2 commits August 20, 2026 15:49
Summary: Bugfix: Dense nullable reads using an `AlwaysTrue` visitor could return an all-valid vector even when the input contained nulls. The bulk path now copies the read-range null bitmap when the reader cannot return that buffer directly, then marks the result as nullable.

Differential Revision: D116851691
…kincubator#18612)

Summary:

This diff is created by PerfAICT to optimize `facebook::nimble::legacy::callReadWithVisitor` in "fbcode/velox/dwio/nimble/encodings/legacy/EncodingUtils.h", by reducing CPU cycles spent in this function.

### Optimization Details

The inclusive cost of `legacy::callReadWithVisitor` was dominated by `FixedBitWidthEncoding<T>::readWithVisitor`, which always decoded values one at a time via the scalar per-value slow path (`fixedBitArray_.get(row_++) + baseline_` followed by per-value `ColumnVisitor::process`). This change adds a bulk-scan fast path — mirroring the already-landed canonical implementation in the non-legacy `encodings/FixedBitWidthEncoding.h` — that handles the dominant dense, no-null, no-filter/hook, 4/8-byte integral ExtractToReader case with a single `bulkGetWithBaseline` decode plus `processFixedWidthRun`, falling back to the unchanged slow path for all other cases. All supporting helpers (`readWithVisitorFast`, `useFastPath`, `processFixedWidthRun`, `FixedBitArray`) are shared, not duplicated, so behavior is preserved.

Differential Revision: D116602815
@meta-codesync meta-codesync Bot changed the title perf(nimble): Add bulk-scan path to legacy fixed-width reads perf(nimble): Add bulk-scan path to legacy fixed-width reads (#18612) Aug 20, 2026
@MatzeB
MatzeB force-pushed the export-D116602815 branch from 8721396 to bc07b0b Compare August 20, 2026 22:49
@MatzeB

MatzeB commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

I don't understand why "[Meta Internal-Only Changes Check]" CI complains... Maybe we need to land D116851691 aka #18611 first because we cannot express parent/child stack here on github...

@github-actions

Copy link
Copy Markdown

Selective Build Plan

Linux release with adapters is running a full build (no build targets matched the changed files). See the CI workflows README for what this means.


Fast path • Graph from main@c3413b270eb5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant