perf(gfql): dense two-hop count round 3 — elide second bincount via gather-sum identity - #1851
Merged
Conversation
…gather-sum identity sum_b indeg(b)*outdeg(b) = sum_e indeg(src(e)): the out-degree bincount and aligned product-sum collapse into one gather-sum of in-degrees at each edge's source. One O(E) bincount remains on every backend (cupy also drops a kernel launch). No new guards, no new state. Spy pins moved to the one-bincount shape; new degree-product oracle pin covers raw and shifted lanes on duplicate-heavy random graphs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi
lmeyerov
force-pushed
the
perf/gfql-q8-dense-r3
branch
from
August 5, 2026 21:36
54ae25b to
3b01773
Compare
Same owner rule as #1846: claims live in pins (one-bincount spy shapes, degree-product oracle, budget-boundary both-sides), not comment prose. Comment/docstring-only change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi
lmeyerov
marked this pull request as ready for review
August 5, 2026 23:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1847 (round 2). ONE algebraic change to the proof-gated dense-domain kernel, values identical by construction:
Elision of the second degree table:
sum_b indeg(b)*outdeg(b) = sum_e indeg(src(e))— each middle node contributes its in-degree once per out-edge — so the out-degree bincount and the aligned product-sum collapse into a single gather-sum of in-degrees at each edge's source. Exactly one O(E) bincount remains, on every backend (on cupy this also drops a kernel launch). No new guards, no new state, no concurrency.The host-threading variant measured alongside this was split out to draft #1852 pending the owner's call on library-owned thread pools; this PR is the thread-free core.
Testing: T6 mechanism-spy pins moved to the one-bincount shape (shift-elision, scratch-buffer, mixed-dtype, both budget-boundary sides); new degree-product oracle pin on duplicate-heavy random graphs covering both the raw and shifted lanes. mypy clean; no new casts.
Measured effects and verdicts live with the receipted lanes in pyg-bench (r3 candidate lanes in progress) and the docs board.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi