Skip to content

perf(fts): accelerate wide and queries with bulk intersection - #9030

Open
BubbleCal wants to merge 1 commit into
yang/fts-stack-certified-andfrom
yang/fts-underfilled-and-lazy-decode
Open

perf(fts): accelerate wide and queries with bulk intersection#9030
BubbleCal wants to merge 1 commit into
yang/fts-stack-certified-andfrom
yang/fts-underfilled-and-lazy-decode

Conversation

@BubbleCal

@BubbleCal BubbleCal commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Wide root Match AND queries still spend substantial time in per-document iterator advancement. This PR enables the existing bulk scoring route for four or more modern block-256, non-grouped clauses, and adds bounded pairwise SIMD/scalar DocID intersection before the competitive floor becomes positive. Posting offsets are recovered only for final survivors; positive-floor scoring retains the existing bulk implementation.

Ordinary root Match AND queries directly use Wand.search. Compound WandCursor continues to use the classic path covered by #9033. The separate Boolean MUST-child floor-propagation change in #9015 is not included.

Measurements

The comparison is incremental, from 85ec700bb4aacbc4e87f826f93fe7bc78fe53e41 to measured candidate 02c5f5a73fb29a47a0ff33293936e38c8f90c470. The current stacked tip, 0181df1136be876a04b327f24a0f1a4709263b58, has identical production code; subsequent changes only deduplicate tests and exclude benchmark files. The parent stack layer likewise retains the measured baseline's production code. These measurements establish the final bulk-routing/intersection increment, not the combined stack's speedup versus main.

Scenario / metric Baseline This PR Benefit
4 terms, 0 matches / latency 1.237869 ms 0.335107 ms 3.694x speedup
5 terms, 5 matches / latency 1.552503 ms 0.448852 ms 3.459x speedup
8 terms, 0 matches / latency 3.984348 ms 0.841667 ms 4.734x speedup
16 terms, 5 matches / latency 8.309449 ms 1.882632 ms 4.414x speedup
4 terms, contiguous 32,768 matches / latency 2.627815 ms 1.309050 ms 2.007x speedup
16 terms, contiguous 32,768 matches / latency 13.304164 ms 3.344204 ms 3.978x speedup
16 terms, sparse correlated 32,768 matches / latency 13.401886 ms 3.383210 ms 3.961x speedup

Lower latency is better; benefit is baseline/current. Same AWS c7i.8xlarge, Xeon Platinum 8488C, Ubuntu 24.04, Rust 1.97.0/clang 18, repository release-with-debug with thin LTO and configured Haswell/AVX2 target. Both versions use Auto mode, CPU 2, one query in flight, LANCE_CPU_THREADS=1, and RAYON_NUM_THREADS=1.

The complete comparison contains 42 frozen cases: 65,536-document scaling/additional-distribution corpora and a 131,072-document control corpus. All use k=10, V3/block256, no positions/filter, and fully resident prewarm. High-hit scaling holds the intersection and each term's DF at 32,768 across term counts. Four independent processes per version/case run in ABBAABBA order, each with 2 s warmup, 5 s measurement, and 30 samples. Values are the median of four run medians. Independent scoring oracles and exact row/score-bit signatures passed.

Eight of 15 short-query controls show observed median regressions of approximately 0.6–2.2%. Some baseline runs have wider between-process spread; these are descriptive repeated measurements, not significance claims. Results cover warm index-query CPU work, not a 2.86B-row production or end-to-end dataset workload. Combined performance versus main remains unverified. Benchmark drivers and raw evidence are archived separately; no benchmark files are included in this stack.

Validation

  • The equivalent combined implementation passed 762 inverted-index tests on ARM and x86.
  • Six dataset integration cases passed: N4/N16 × 0/5/high matches, two fragments, V3/block256, independent BM25 row/score-bit oracle, verified MatchQuery plans, and a strict 10th/11th score gap.
  • Thirteen existing WAND/certificate/tie tests passed, including bounded completion and exact overflow replay.
  • Per-layer inverted-index suite: 762 passed; required all-workspace Clippy and formatting passed.
  • Dataset integration rerun: 6 root Match AND cases and 13 WAND/certificate/tie cases passed. CI: pending.

Stack, 4/4: #9031#9032#9033this PR. Base: #9033.

Merge in stack order; retarget/restack the remaining PRs after their parent merges.

@github-actions github-actions Bot added A-index Vector index, linalg, tokenizer performance labels Sep 7, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Sep 7, 2026
Enable full bulk AND for modern wider conjunctions and intersect zero-floor
windows using bounded pairwise SIMD/scalar kernels. Recover offsets only
for surviving DocIDs while preserving scoring and compatibility paths.

Add exact-result coverage across block boundaries and dataset fragments.
@BubbleCal
BubbleCal force-pushed the yang/fts-underfilled-and-lazy-decode branch from 5400136 to 0181df1 Compare September 7, 2026 05:11
@BubbleCal BubbleCal changed the title perf(fts): accelerate underfilled and wide conjunction searches perf(fts): accelerate wide and queries with bulk intersection Sep 7, 2026
@BubbleCal
BubbleCal changed the base branch from main to yang/fts-stack-certified-and September 7, 2026 05:12
@lance-gatekeeper lance-gatekeeper Bot removed K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Sep 7, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Gate recommendation: approve with a non-blocking risk.

After the restack, this PR is correctly scoped to wide modern conjunction routing and pairwise block intersection while preserving exact membership, phrase and visibility handling, score bits, and dataset-level behavior. The remaining risk is performance reproducibility: the reported incremental baseline is production-equivalent to the current base, but the benchmark driver and raw evidence are absent from this tree, and 8 of 15 short-query controls show roughly 0.6–2.2% median regressions. LANCE_FTS_BULK_AND=off provides a runtime rollback if production latency buckets regress. No further change is requested for this pull request.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-index Vector index, linalg, tokenizer K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant