Skip to content

perf(gfql): small-frame eager gate for projected filters (fix-forward on r4) - #1857

Merged
lmeyerov merged 4 commits into
masterfrom
perf/gfql-proj-smallframe-gate
Aug 7, 2026
Merged

perf(gfql): small-frame eager gate for projected filters (fix-forward on r4)#1857
lmeyerov merged 4 commits into
masterfrom
perf/gfql-proj-smallframe-gate

Conversation

@lmeyerov

@lmeyerov lmeyerov commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

The #172-pattern floors gate did its job on the fresh r4 board lanes: q8@20k tripped its locked floor (1.88 → 2.51ms vs max 2.35) while q8@100k improved (13.50 → 13.11ms, q5 back to WIN 1.46x, board 8W/0T/1L). Root cause: the polars lazy filter+select carries a fixed per-call plan cost the monotonicity analysis missed — negligible at 13ms cells, decisive at 1.9ms ones.

Fix: frames under 1M rows filter eagerly and cut columns via a buffer-share select (identical output contract, zero added overhead — the pre-r4 cost shape); large frames keep the lazy narrow gather that won at 100k. All projection pins (width, decoy, error parity, all engines) unchanged and green.

The quarantined 20k lane stays unpublished per the landing tool's refusal; a re-lane on master+this validates the fix and restores the q8@20k floor before this merges (per the lock-in discipline).

For owner review; lock lane queued behind the current dgx chain.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi

… on r4)

The floors gate caught it: the polars lazy filter+select's fixed
per-call plan cost regressed q8@20k past its locked floor while the
same projection improved q8@100k. Frames under 1M rows now filter
eagerly and cut columns via a buffer-share select -- identical output
contract, no added overhead; large frames keep the lazy narrow gather.
Width/decoy/error pins unchanged and green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi
lmeyerov and others added 3 commits August 6, 2026 19:05
…teration)

Even eager filter+select re-tripped the q8@20k floor (2.40 vs 2.35):
every extra polars op carries fixed overhead a small frame cannot
amortize. Below the row threshold the filter now returns full width --
byte-identical to the pre-projection path -- and the contract becomes
AT LEAST the projected columns (exactly them once the frame is large
enough to pay; pandas/cudf mask+loc stays narrow at every size).
Mechanism pins force the threshold to keep asserting narrow shapes on
small fixtures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi
The gate lives inside _filter_project, so the newly-projected grouped-aggregate
filters inherit it: on polars, frames under the threshold now skip narrowing.
That is the declared contract (AT LEAST the projected columns, exactly them only
when large), but #1856's width pin asserted exact narrowing unconditionally and
tripped on its tiny fixtures.

Both sides of that boundary are now pinned per engine: the width pin forces the
large-frame arm (_force_narrowing), and a new small-frame twin asserts polars
keeps the decoy columns while pandas/cudf still narrow -- and that neither
changes the answer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi
@lmeyerov
lmeyerov merged commit 2c38a48 into master Aug 7, 2026
69 checks passed
lmeyerov added a commit that referenced this pull request Aug 7, 2026
CHANGELOG keeps all entries; code and test files auto-merged. Verified locally:
only the 3 cudf cases that fail identically on origin/master here (libnvrtc
absent) fail; zero non-cudf failures across the lowering and grouped-aggregate
suites.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant